OSDN Git Service

[automerger skipped] Merge "DO NOT MERGE" am: c5db7f8f22 -s ours
[android-x86/external-libffi.git] / configure.ac
1 dnl Process this with autoconf to create configure
2
3 AC_PREREQ(2.68)
4
5 AC_INIT([libffi], [3.2.1], [http://github.com/atgreen/libffi/issues])
6 AC_CONFIG_HEADERS([fficonfig.h])
7
8 AC_CANONICAL_SYSTEM
9 target_alias=${target_alias-$host_alias}
10
11 case "${host}" in
12   frv*-elf)
13     LDFLAGS=`echo $LDFLAGS | sed "s/\-B[^ ]*libgloss\/frv\///"`\ -B`pwd`/../libgloss/frv/
14     ;;
15 esac
16
17 AX_ENABLE_BUILDDIR
18
19 AM_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
28 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
29 m4_define([_AC_ARG_VAR_PRECIOUS],[])
30 save_CFLAGS=$CFLAGS
31 AC_PROG_CC
32 AC_PROG_CXX
33 CFLAGS=$save_CFLAGS
34 m4_undefine([_AC_ARG_VAR_PRECIOUS])
35 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
36
37 AC_SUBST(CFLAGS)
38
39 AM_PROG_AS
40 AM_PROG_CC_C_O
41 AC_PROG_LIBTOOL
42 AC_CONFIG_MACRO_DIR([m4])
43
44 # Test for 64-bit build.
45 AC_CHECK_SIZEOF([size_t])
46
47 AX_COMPILER_VENDOR
48 AX_CC_MAXOPT
49 # The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro
50 # compiler.
51 if test "$ax_cv_c_compiler_vendor" != "sun"; then
52   AX_CFLAGS_WARN_ALL
53 fi
54
55 if test "x$GCC" = "xyes"; then
56   CFLAGS="$CFLAGS -fexceptions"
57 fi
58
59 cat > local.exp <<EOF
60 set CC_FOR_TARGET "$CC"
61 set CXX_FOR_TARGET "$CXX"
62 EOF
63
64 AM_MAINTAINER_MODE
65
66 AC_CHECK_HEADERS(sys/mman.h)
67 AC_CHECK_FUNCS([mmap mkostemp])
68 AC_FUNC_MMAP_BLACKLIST
69
70 dnl The -no-testsuite modules omit the test subdir.
71 AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
72
73 TARGETDIR="unknown"
74 HAVE_LONG_DOUBLE_VARIANT=0
75 case "$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
291 esac
292
293 AC_SUBST(AM_RUNTESTFLAGS)
294 AC_SUBST(AM_LTLDFLAGS)
295
296 if test $TARGETDIR = unknown; then
297   AC_MSG_ERROR(["libffi has not been ported to $host."])
298 fi
299
300 AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
301 AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN)
302 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
303 AM_CONDITIONAL(X86, test x$TARGET = xX86)
304 AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD)
305 AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
306 AM_CONDITIONAL(X86_WIN64, test x$TARGET = xX86_WIN64)
307 AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN)
308 AM_CONDITIONAL(X86_DARWIN32, test x$TARGET = xX86_DARWIN && test $ac_cv_sizeof_size_t = 4)
309 AM_CONDITIONAL(X86_DARWIN64, test x$TARGET = xX86_DARWIN && test $ac_cv_sizeof_size_t = 8)
310 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
311 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
312 AM_CONDITIONAL(M32R, test x$TARGET = xM32R)
313 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
314 AM_CONDITIONAL(M88K, test x$TARGET = xM88K)
315 AM_CONDITIONAL(MICROBLAZE, test x$TARGET = xMICROBLAZE)
316 AM_CONDITIONAL(METAG, test x$TARGET = xMETAG)
317 AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE)
318 AM_CONDITIONAL(NIOS2, test x$TARGET = xNIOS2)
319 AM_CONDITIONAL(OR1K, test x$TARGET = xOR1K)
320 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
321 AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
322 AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
323 AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD)
324 AM_CONDITIONAL(AARCH64, test x$TARGET = xAARCH64)
325 AM_CONDITIONAL(ARC, test x$TARGET = xARC)
326 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
327 AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32)
328 AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS)
329 AM_CONDITIONAL(FRV, test x$TARGET = xFRV)
330 AM_CONDITIONAL(S390, test x$TARGET = xS390)
331 AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64)
332 AM_CONDITIONAL(SH, test x$TARGET = xSH)
333 AM_CONDITIONAL(SH64, test x$TARGET = xSH64)
334 AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX)
335 AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX)
336 AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX)
337 AM_CONDITIONAL(TILE, test x$TARGET = xTILE)
338 AM_CONDITIONAL(VAX, test x$TARGET = xVAX)
339 AM_CONDITIONAL(XTENSA, test x$TARGET = xXTENSA)
340
341 AC_HEADER_STDC
342 AC_CHECK_FUNCS(memcpy)
343 AC_FUNC_ALLOCA
344
345 AC_CHECK_SIZEOF(double)
346 AC_CHECK_SIZEOF(long double)
347
348 # Also AC_SUBST this variable for ffi.h.
349 if 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
362 fi
363 AC_SUBST(HAVE_LONG_DOUBLE)
364 AC_SUBST(HAVE_LONG_DOUBLE_VARIANT)
365
366 AC_C_BIGENDIAN
367
368 GCC_AS_CFI_PSEUDO_OP
369
370 if 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
399 fi
400
401 if 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
440 fi
441
442 # On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC.
443 AC_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
450 LT_SYS_SYMBOL_USCORE
451 if test "x$sys_symbol_underscore" = xyes; then
452     AC_DEFINE(SYMBOL_UNDERSCORE, 1, [Define if symbols are underscored.])
453 fi
454
455 FFI_EXEC_TRAMPOLINE_TABLE=0
456 case "$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      ;;
468 esac
469 AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1)
470 AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE)
471
472 if 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
478 foo:
479 jmp bar
480 .section .eh_frame,"a",@unwind
481 bar:
482 EOF
483
484         cat > conftest2.c  << EOF
485 extern void foo();
486 int main(){foo();}
487 EOF
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
501 fi
502
503 if 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
544 fi
545
546 AH_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
562 AC_SUBST(TARGET)
563 AC_SUBST(TARGETDIR)
564
565 AC_SUBST(SHELL)
566
567 AC_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)
572 AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes")
573
574 AC_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)
579 AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes")
580
581 AC_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
587 AC_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...
595 if 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)
610 else
611   toolexeclibdir="${libdir}"
612 fi
613 AC_SUBST(toolexeclibdir)
614
615 AC_CONFIG_COMMANDS(include, [test -d include || mkdir include])
616 AC_CONFIG_COMMANDS(src, [
617 test -d src || mkdir src
618 test -d src/$TARGETDIR || mkdir src/$TARGETDIR
619 ], [TARGETDIR="$TARGETDIR"])
620
621 AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
622
623 AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc)
624
625 AC_OUTPUT