blob: a7bf5eefae0632bae68b74b2f0d09358b45e69af [file] [log] [blame]
Lloyd Pique457ba792015-10-27 14:32:21 -07001dnl Process this with autoconf to create configure
2
3AC_PREREQ(2.68)
4
5AC_INIT([libffi], [3.2.1], [http://github.com/atgreen/libffi/issues])
6AC_CONFIG_HEADERS([fficonfig.h])
7
8AC_CANONICAL_SYSTEM
9target_alias=${target_alias-$host_alias}
10
11case "${host}" in
12 frv*-elf)
13 LDFLAGS=`echo $LDFLAGS | sed "s/\-B[^ ]*libgloss\/frv\///"`\ -B`pwd`/../libgloss/frv/
14 ;;
15esac
16
17AX_ENABLE_BUILDDIR
18
19AM_INIT_AUTOMAKE
20
21# The same as in boehm-gc and libstdc++. Have to borrow it from there.
22# We must force CC to /not/ be precious variables; otherwise
23# the wrong, non-multilib-adjusted value will be used in multilibs.
24# As a side effect, we have to subst CFLAGS ourselves.
25# Also save and restore CFLAGS, since AC_PROG_CC will come up with
26# defaults of its own if none are provided.
27
28m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
29m4_define([_AC_ARG_VAR_PRECIOUS],[])
30save_CFLAGS=$CFLAGS
31AC_PROG_CC
32AC_PROG_CXX
33CFLAGS=$save_CFLAGS
34m4_undefine([_AC_ARG_VAR_PRECIOUS])
35m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
36
37AC_SUBST(CFLAGS)
38
39AM_PROG_AS
40AM_PROG_CC_C_O
41AC_PROG_LIBTOOL
42AC_CONFIG_MACRO_DIR([m4])
43
44# Test for 64-bit build.
45AC_CHECK_SIZEOF([size_t])
46
47AX_COMPILER_VENDOR
48AX_CC_MAXOPT
49# The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro
50# compiler.
51if test "$ax_cv_c_compiler_vendor" != "sun"; then
52 AX_CFLAGS_WARN_ALL
53fi
54
55if test "x$GCC" = "xyes"; then
56 CFLAGS="$CFLAGS -fexceptions"
57fi
58
59cat > local.exp <<EOF
60set CC_FOR_TARGET "$CC"
61set CXX_FOR_TARGET "$CXX"
62EOF
63
64AM_MAINTAINER_MODE
65
66AC_CHECK_HEADERS(sys/mman.h)
67AC_CHECK_FUNCS([mmap mkostemp])
68AC_FUNC_MMAP_BLACKLIST
69
70dnl The -no-testsuite modules omit the test subdir.
71AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
72
73TARGETDIR="unknown"
74HAVE_LONG_DOUBLE_VARIANT=0
75case "$host" in
76 aarch64*-*-*)
77 TARGET=AARCH64; TARGETDIR=aarch64
78 ;;
79
80 alpha*-*-*)
81 TARGET=ALPHA; TARGETDIR=alpha;
82 # Support 128-bit long double, changeable via command-line switch.
83 HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)'
84 ;;
85
86 arc*-*-*)
87 TARGET=ARC; TARGETDIR=arc
88 ;;
89
90 arm*-*-*)
91 TARGET=ARM; TARGETDIR=arm
92 ;;
93
94 amd64-*-freebsd* | amd64-*-openbsd*)
95 TARGET=X86_64; TARGETDIR=x86
96 ;;
97
98 amd64-*-freebsd*)
99 TARGET=X86_64; TARGETDIR=x86
100 ;;
101
102 amd64-*-freebsd*)
103 TARGET=X86_64; TARGETDIR=x86
104 ;;
105
106 avr32*-*-*)
107 TARGET=AVR32; TARGETDIR=avr32
108 ;;
109
110 bfin*)
111 TARGET=BFIN; TARGETDIR=bfin
112 ;;
113
114 cris-*-*)
115 TARGET=LIBFFI_CRIS; TARGETDIR=cris
116 ;;
117
118 frv-*-*)
119 TARGET=FRV; TARGETDIR=frv
120 ;;
121
122 hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*)
123 TARGET=PA_LINUX; TARGETDIR=pa
124 ;;
125 hppa*64-*-hpux*)
126 TARGET=PA64_HPUX; TARGETDIR=pa
127 ;;
128 hppa*-*-hpux*)
129 TARGET=PA_HPUX; TARGETDIR=pa
130 ;;
131
132 i?86-*-freebsd* | i?86-*-openbsd*)
133 TARGET=X86_FREEBSD; TARGETDIR=x86
134 ;;
135 i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix*)
136 TARGET=X86_WIN32; TARGETDIR=x86
137 # All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
138 # We must also check with_cross_host to decide if this is a native
139 # or cross-build and select where to install dlls appropriately.
140 if test -n "$with_cross_host" &&
141 test x"$with_cross_host" != x"no"; then
142 AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"';
143 else
144 AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"';
145 fi
146 ;;
147 i?86-*-darwin*)
148 TARGET=X86_DARWIN; TARGETDIR=x86
149 ;;
150 i?86-*-solaris2.1[[0-9]]*)
151 TARGETDIR=x86
152 if test $ac_cv_sizeof_size_t = 4; then
153 TARGET=X86;
154 else
155 TARGET=X86_64;
156 fi
157 ;;
158
159 x86_64-*-darwin*)
160 TARGET=X86_DARWIN; TARGETDIR=x86
161 ;;
162
163 x86_64-*-cygwin* | x86_64-*-mingw*)
164 TARGET=X86_WIN64; TARGETDIR=x86
165 # All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
166 # We must also check with_cross_host to decide if this is a native
167 # or cross-build and select where to install dlls appropriately.
168 if test -n "$with_cross_host" &&
169 test x"$with_cross_host" != x"no"; then
170 AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"';
171 else
172 AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"';
173 fi
174 ;;
175
176 i?86-*-* | x86_64-*-*)
177 TARGETDIR=x86
178 if test $ac_cv_sizeof_size_t = 4; then
179 case "$host" in
180 *-gnux32)
181 TARGET=X86_64
182 ;;
183 *)
184 TARGET=X86
185 ;;
186 esac
187 else
188 TARGET=X86_64;
189 fi
190 ;;
191
192 ia64*-*-*)
193 TARGET=IA64; TARGETDIR=ia64
194 ;;
195
196 m32r*-*-*)
197 TARGET=M32R; TARGETDIR=m32r
198 ;;
199
200 m68k-*-*)
201 TARGET=M68K; TARGETDIR=m68k
202 ;;
203
204 m88k-*-*)
205 TARGET=M88K; TARGETDIR=m88k
206 ;;
207
208 microblaze*-*-*)
209 TARGET=MICROBLAZE; TARGETDIR=microblaze
210 ;;
211
212 moxie-*-*)
213 TARGET=MOXIE; TARGETDIR=moxie
214 ;;
215
216 metag-*-*)
217 TARGET=METAG; TARGETDIR=metag
218 ;;
219
220 mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
221 TARGET=MIPS; TARGETDIR=mips
222 ;;
223 mips*-*linux* | mips*-*-openbsd*)
224 # Support 128-bit long double for NewABI.
225 HAVE_LONG_DOUBLE='defined(__mips64)'
226 TARGET=MIPS; TARGETDIR=mips
227 ;;
228
229 nios2*-linux*)
230 TARGET=NIOS2; TARGETDIR=nios2
231 ;;
232
233 or1k*-linux*)
234 TARGET=OR1K; TARGETDIR=or1k
235 ;;
236
237 powerpc*-*-linux* | powerpc-*-sysv*)
238 TARGET=POWERPC; TARGETDIR=powerpc
239 HAVE_LONG_DOUBLE_VARIANT=1
240 ;;
241 powerpc-*-amigaos*)
242 TARGET=POWERPC; TARGETDIR=powerpc
243 ;;
244 powerpc-*-beos*)
245 TARGET=POWERPC; TARGETDIR=powerpc
246 ;;
247 powerpc-*-darwin* | powerpc64-*-darwin*)
248 TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
249 ;;
250 powerpc-*-aix* | rs6000-*-aix*)
251 TARGET=POWERPC_AIX; TARGETDIR=powerpc
252 ;;
253 powerpc-*-freebsd* | powerpc-*-openbsd*)
254 TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
255 HAVE_LONG_DOUBLE_VARIANT=1
256 ;;
257 powerpc64-*-freebsd*)
258 TARGET=POWERPC; TARGETDIR=powerpc
259 ;;
260 powerpc*-*-rtems*)
261 TARGET=POWERPC; TARGETDIR=powerpc
262 ;;
263
264 s390-*-* | s390x-*-*)
265 TARGET=S390; TARGETDIR=s390
266 ;;
267
268 sh-*-* | sh[[34]]*-*-*)
269 TARGET=SH; TARGETDIR=sh
270 ;;
271 sh64-*-* | sh5*-*-*)
272 TARGET=SH64; TARGETDIR=sh64
273 ;;
274
275 sparc*-*-*)
276 TARGET=SPARC; TARGETDIR=sparc
277 ;;
278
279 tile*-*)
280 TARGET=TILE; TARGETDIR=tile
281 ;;
282
283 vax-*-*)
284 TARGET=VAX; TARGETDIR=vax
285 ;;
286
287 xtensa*-*)
288 TARGET=XTENSA; TARGETDIR=xtensa
289 ;;
290
291esac
292
293AC_SUBST(AM_RUNTESTFLAGS)
294AC_SUBST(AM_LTLDFLAGS)
295
296if test $TARGETDIR = unknown; then
297 AC_MSG_ERROR(["libffi has not been ported to $host."])
298fi
299
300AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
301AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN)
302AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
303AM_CONDITIONAL(X86, test x$TARGET = xX86)
304AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD)
305AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
306AM_CONDITIONAL(X86_WIN64, test x$TARGET = xX86_WIN64)
307AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN)
308AM_CONDITIONAL(X86_DARWIN32, test x$TARGET = xX86_DARWIN && test $ac_cv_sizeof_size_t = 4)
309AM_CONDITIONAL(X86_DARWIN64, test x$TARGET = xX86_DARWIN && test $ac_cv_sizeof_size_t = 8)
310AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
311AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
312AM_CONDITIONAL(M32R, test x$TARGET = xM32R)
313AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
314AM_CONDITIONAL(M88K, test x$TARGET = xM88K)
315AM_CONDITIONAL(MICROBLAZE, test x$TARGET = xMICROBLAZE)
316AM_CONDITIONAL(METAG, test x$TARGET = xMETAG)
317AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE)
318AM_CONDITIONAL(NIOS2, test x$TARGET = xNIOS2)
319AM_CONDITIONAL(OR1K, test x$TARGET = xOR1K)
320AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
321AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
322AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
323AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD)
324AM_CONDITIONAL(AARCH64, test x$TARGET = xAARCH64)
325AM_CONDITIONAL(ARC, test x$TARGET = xARC)
326AM_CONDITIONAL(ARM, test x$TARGET = xARM)
327AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32)
328AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS)
329AM_CONDITIONAL(FRV, test x$TARGET = xFRV)
330AM_CONDITIONAL(S390, test x$TARGET = xS390)
331AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64)
332AM_CONDITIONAL(SH, test x$TARGET = xSH)
333AM_CONDITIONAL(SH64, test x$TARGET = xSH64)
334AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX)
335AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX)
336AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX)
337AM_CONDITIONAL(TILE, test x$TARGET = xTILE)
338AM_CONDITIONAL(VAX, test x$TARGET = xVAX)
339AM_CONDITIONAL(XTENSA, test x$TARGET = xXTENSA)
340
341AC_HEADER_STDC
342AC_CHECK_FUNCS(memcpy)
343AC_FUNC_ALLOCA
344
345AC_CHECK_SIZEOF(double)
346AC_CHECK_SIZEOF(long double)
347
348# Also AC_SUBST this variable for ffi.h.
349if test -z "$HAVE_LONG_DOUBLE"; then
350 HAVE_LONG_DOUBLE=0
351 if test $ac_cv_sizeof_long_double != 0; then
352 if test $HAVE_LONG_DOUBLE_VARIANT != 0; then
353 AC_DEFINE(HAVE_LONG_DOUBLE_VARIANT, 1, [Define if you support more than one size of the long double type])
354 HAVE_LONG_DOUBLE=1
355 else
356 if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then
357 HAVE_LONG_DOUBLE=1
358 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double])
359 fi
360 fi
361 fi
362fi
363AC_SUBST(HAVE_LONG_DOUBLE)
364AC_SUBST(HAVE_LONG_DOUBLE_VARIANT)
365
366AC_C_BIGENDIAN
367
368GCC_AS_CFI_PSEUDO_OP
369
370if test x$TARGET = xSPARC; then
371 AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs],
372 libffi_cv_as_sparc_ua_pcrel, [
373 save_CFLAGS="$CFLAGS"
374 save_LDFLAGS="$LDFLAGS"
375 CFLAGS="$CFLAGS -fpic"
376 LDFLAGS="$LDFLAGS -shared"
377 AC_TRY_LINK([asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");],,
378 [libffi_cv_as_sparc_ua_pcrel=yes],
379 [libffi_cv_as_sparc_ua_pcrel=no])
380 CFLAGS="$save_CFLAGS"
381 LDFLAGS="$save_LDFLAGS"])
382 if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then
383 AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
384 [Define if your assembler and linker support unaligned PC relative relocs.])
385 fi
386
387 AC_CACHE_CHECK([assembler .register pseudo-op support],
388 libffi_cv_as_register_pseudo_op, [
389 libffi_cv_as_register_pseudo_op=unknown
390 # Check if we have .register
391 AC_TRY_COMPILE(,[asm (".register %g2, #scratch");],
392 [libffi_cv_as_register_pseudo_op=yes],
393 [libffi_cv_as_register_pseudo_op=no])
394 ])
395 if test "x$libffi_cv_as_register_pseudo_op" = xyes; then
396 AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
397 [Define if your assembler supports .register.])
398 fi
399fi
400
401if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then
402 AC_CACHE_CHECK([assembler supports pc related relocs],
403 libffi_cv_as_x86_pcrel, [
404 libffi_cv_as_x86_pcrel=no
405 echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
406 if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then
407 libffi_cv_as_x86_pcrel=yes
408 fi
409 ])
410 if test "x$libffi_cv_as_x86_pcrel" = xyes; then
411 AC_DEFINE(HAVE_AS_X86_PCREL, 1,
412 [Define if your assembler supports PC relative relocs.])
413 fi
414
415 AC_CACHE_CHECK([assembler .ascii pseudo-op support],
416 libffi_cv_as_ascii_pseudo_op, [
417 libffi_cv_as_ascii_pseudo_op=unknown
418 # Check if we have .ascii
419 AC_TRY_COMPILE(,[asm (".ascii \\"string\\"");],
420 [libffi_cv_as_ascii_pseudo_op=yes],
421 [libffi_cv_as_ascii_pseudo_op=no])
422 ])
423 if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then
424 AC_DEFINE(HAVE_AS_ASCII_PSEUDO_OP, 1,
425 [Define if your assembler supports .ascii.])
426 fi
427
428 AC_CACHE_CHECK([assembler .string pseudo-op support],
429 libffi_cv_as_string_pseudo_op, [
430 libffi_cv_as_string_pseudo_op=unknown
431 # Check if we have .string
432 AC_TRY_COMPILE(,[asm (".string \\"string\\"");],
433 [libffi_cv_as_string_pseudo_op=yes],
434 [libffi_cv_as_string_pseudo_op=no])
435 ])
436 if test "x$libffi_cv_as_string_pseudo_op" = xyes; then
437 AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1,
438 [Define if your assembler supports .string.])
439 fi
440fi
441
442# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC.
443AC_ARG_ENABLE(pax_emutramp,
444 [ --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC],
445 if test "$enable_pax_emutramp" = "yes"; then
446 AC_DEFINE(FFI_MMAP_EXEC_EMUTRAMP_PAX, 1,
447 [Define this if you want to enable pax emulated trampolines])
448 fi)
449
450LT_SYS_SYMBOL_USCORE
451if test "x$sys_symbol_underscore" = xyes; then
452 AC_DEFINE(SYMBOL_UNDERSCORE, 1, [Define if symbols are underscored.])
453fi
454
455FFI_EXEC_TRAMPOLINE_TABLE=0
456case "$target" in
457 *arm*-apple-darwin*)
458 FFI_EXEC_TRAMPOLINE_TABLE=1
459 AC_DEFINE(FFI_EXEC_TRAMPOLINE_TABLE, 1,
460 [Cannot use PROT_EXEC on this target, so, we revert to
461 alternative means])
462 ;;
463 *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*)
464 AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1,
465 [Cannot use malloc on this target, so, we revert to
466 alternative means])
467 ;;
468esac
469AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1)
470AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE)
471
472if test x$TARGET = xX86_64; then
473 AC_CACHE_CHECK([toolchain supports unwind section type],
474 libffi_cv_as_x86_64_unwind_section_type, [
475 cat > conftest1.s << EOF
476.text
477.globl foo
478foo:
479jmp bar
480.section .eh_frame,"a",@unwind
481bar:
482EOF
483
484 cat > conftest2.c << EOF
485extern void foo();
486int main(){foo();}
487EOF
488
489 libffi_cv_as_x86_64_unwind_section_type=no
490 # we ensure that we can compile _and_ link an assembly file containing an @unwind section
491 # since the compiler can support it and not the linker (ie old binutils)
492 if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \
493 $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then
494 libffi_cv_as_x86_64_unwind_section_type=yes
495 fi
496 ])
497 if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then
498 AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1,
499 [Define if your assembler supports unwind section type.])
500 fi
501fi
502
503if test "x$GCC" = "xyes"; then
504 AC_CACHE_CHECK([whether .eh_frame section should be read-only],
505 libffi_cv_ro_eh_frame, [
506 libffi_cv_ro_eh_frame=no
507 echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
508 if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then
509 objdump -h conftest.o > conftest.dump 2>&1
510 libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1`
511 libffi_test_line=`expr $libffi_eh_frame_line + 1`p
512 sed -n $libffi_test_line conftest.dump > conftest.line
513 if grep READONLY conftest.line > /dev/null; then
514 libffi_cv_ro_eh_frame=yes
515 fi
516 fi
517 rm -f conftest.*
518 ])
519 if test "x$libffi_cv_ro_eh_frame" = xyes; then
520 AC_DEFINE(HAVE_RO_EH_FRAME, 1,
521 [Define if .eh_frame sections should be read-only.])
522 AC_DEFINE(EH_FRAME_FLAGS, "a",
523 [Define to the flags needed for the .section .eh_frame directive. ])
524 else
525 AC_DEFINE(EH_FRAME_FLAGS, "aw",
526 [Define to the flags needed for the .section .eh_frame directive. ])
527 fi
528
529 AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
530 libffi_cv_hidden_visibility_attribute, [
531 echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c
532 libffi_cv_hidden_visibility_attribute=no
533 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
534 if grep '\.hidden.*foo' conftest.s >/dev/null; then
535 libffi_cv_hidden_visibility_attribute=yes
536 fi
537 fi
538 rm -f conftest.*
539 ])
540 if test $libffi_cv_hidden_visibility_attribute = yes; then
541 AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1,
542 [Define if __attribute__((visibility("hidden"))) is supported.])
543 fi
544fi
545
546AH_BOTTOM([
547#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
548#ifdef LIBFFI_ASM
549#define FFI_HIDDEN(name) .hidden name
550#else
551#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
552#endif
553#else
554#ifdef LIBFFI_ASM
555#define FFI_HIDDEN(name)
556#else
557#define FFI_HIDDEN
558#endif
559#endif
560])
561
562AC_SUBST(TARGET)
563AC_SUBST(TARGETDIR)
564
565AC_SUBST(SHELL)
566
567AC_ARG_ENABLE(debug,
568[ --enable-debug debugging mode],
569 if test "$enable_debug" = "yes"; then
570 AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.])
571 fi)
572AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes")
573
574AC_ARG_ENABLE(structs,
575[ --disable-structs omit code for struct support],
576 if test "$enable_structs" = "no"; then
577 AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this if you do not want support for aggregate types.])
578 fi)
579AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes")
580
581AC_ARG_ENABLE(raw-api,
582[ --disable-raw-api make the raw api unavailable],
583 if test "$enable_raw_api" = "no"; then
584 AC_DEFINE(FFI_NO_RAW_API, 1, [Define this if you do not want support for the raw API.])
585 fi)
586
587AC_ARG_ENABLE(purify-safety,
588[ --enable-purify-safety purify-safe mode],
589 if test "$enable_purify_safety" = "yes"; then
590 AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.])
591 fi)
592
593# These variables are only ever used when we cross-build to X86_WIN32.
594# And we only support this with GCC, so...
595if test "x$GCC" = "xyes"; then
596 if test -n "$with_cross_host" &&
597 test x"$with_cross_host" != x"no"; then
598 toolexecdir="${exec_prefix}"/'$(target_alias)'
599 toolexeclibdir="${toolexecdir}"/lib
600 else
601 toolexecdir="${libdir}"/gcc-lib/'$(target_alias)'
602 toolexeclibdir="${libdir}"
603 fi
604 multi_os_directory=`$CC $CFLAGS -print-multi-os-directory`
605 case $multi_os_directory in
606 .) ;; # Avoid trailing /.
607 ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
608 esac
609 AC_SUBST(toolexecdir)
610else
611 toolexeclibdir="${libdir}"
612fi
613AC_SUBST(toolexeclibdir)
614
615AC_CONFIG_COMMANDS(include, [test -d include || mkdir include])
616AC_CONFIG_COMMANDS(src, [
617test -d src || mkdir src
618test -d src/$TARGETDIR || mkdir src/$TARGETDIR
619], [TARGETDIR="$TARGETDIR"])
620
621AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
622
623AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc)
624
625AC_OUTPUT