upgrade to 3.1 version and disable info files
[platform/upstream/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.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)
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   powerpc*-*-linux* | powerpc-*-sysv*)
234         TARGET=POWERPC; TARGETDIR=powerpc
235         HAVE_LONG_DOUBLE_VARIANT=1
236         ;;
237   powerpc-*-amigaos*)
238         TARGET=POWERPC; TARGETDIR=powerpc
239         ;;
240   powerpc-*-beos*)
241         TARGET=POWERPC; TARGETDIR=powerpc
242         ;;
243   powerpc-*-darwin* | powerpc64-*-darwin*)
244         TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
245         ;;
246   powerpc-*-aix* | rs6000-*-aix*)
247         TARGET=POWERPC_AIX; TARGETDIR=powerpc
248         ;;
249   powerpc-*-freebsd* | powerpc-*-openbsd*)
250         TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
251         HAVE_LONG_DOUBLE_VARIANT=1
252         ;;
253   powerpc64-*-freebsd*)
254         TARGET=POWERPC; TARGETDIR=powerpc
255         ;;
256   powerpc*-*-rtems*)
257         TARGET=POWERPC; TARGETDIR=powerpc
258         ;;
259
260   s390-*-* | s390x-*-*)
261         TARGET=S390; TARGETDIR=s390
262         ;;
263
264   sh-*-* | sh[[34]]*-*-*)
265         TARGET=SH; TARGETDIR=sh
266         ;;
267   sh64-*-* | sh5*-*-*)
268         TARGET=SH64; TARGETDIR=sh64
269         ;;
270
271   sparc*-*-*)
272         TARGET=SPARC; TARGETDIR=sparc
273         ;;
274
275   tile*-*)
276         TARGET=TILE; TARGETDIR=tile
277         ;;
278
279   vax-*-*)
280         TARGET=VAX; TARGETDIR=vax
281         ;;
282
283   xtensa*-*)
284         TARGET=XTENSA; TARGETDIR=xtensa
285         ;;
286
287 esac
288
289 AC_SUBST(AM_RUNTESTFLAGS)
290 AC_SUBST(AM_LTLDFLAGS)
291
292 if test $TARGETDIR = unknown; then
293   AC_MSG_ERROR(["libffi has not been ported to $host."])
294 fi
295
296 AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
297 AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN)
298 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
299 AM_CONDITIONAL(X86, test x$TARGET = xX86)
300 AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD)
301 AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
302 AM_CONDITIONAL(X86_WIN64, test x$TARGET = xX86_WIN64)
303 AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN)
304 AM_CONDITIONAL(X86_DARWIN32, test x$TARGET = xX86_DARWIN && test $ac_cv_sizeof_size_t = 4)
305 AM_CONDITIONAL(X86_DARWIN64, test x$TARGET = xX86_DARWIN && test $ac_cv_sizeof_size_t = 8)
306 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
307 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
308 AM_CONDITIONAL(M32R, test x$TARGET = xM32R)
309 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
310 AM_CONDITIONAL(M88K, test x$TARGET = xM88K)
311 AM_CONDITIONAL(MICROBLAZE, test x$TARGET = xMICROBLAZE)
312 AM_CONDITIONAL(METAG, test x$TARGET = xMETAG)
313 AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE)
314 AM_CONDITIONAL(NIOS2, test x$TARGET = xNIOS2)
315 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
316 AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
317 AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
318 AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD)
319 AM_CONDITIONAL(AARCH64, test x$TARGET = xAARCH64)
320 AM_CONDITIONAL(ARC, test x$TARGET = xARC)
321 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
322 AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32)
323 AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS)
324 AM_CONDITIONAL(FRV, test x$TARGET = xFRV)
325 AM_CONDITIONAL(S390, test x$TARGET = xS390)
326 AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64)
327 AM_CONDITIONAL(SH, test x$TARGET = xSH)
328 AM_CONDITIONAL(SH64, test x$TARGET = xSH64)
329 AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX)
330 AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX)
331 AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX)
332 AM_CONDITIONAL(TILE, test x$TARGET = xTILE)
333 AM_CONDITIONAL(VAX, test x$TARGET = xVAX)
334 AM_CONDITIONAL(XTENSA, test x$TARGET = xXTENSA)
335
336 AC_HEADER_STDC
337 AC_CHECK_FUNCS(memcpy)
338 AC_FUNC_ALLOCA
339
340 AC_CHECK_SIZEOF(double)
341 AC_CHECK_SIZEOF(long double)
342
343 # Also AC_SUBST this variable for ffi.h.
344 if test -z "$HAVE_LONG_DOUBLE"; then
345   HAVE_LONG_DOUBLE=0
346   if test $ac_cv_sizeof_long_double != 0; then
347     if test $HAVE_LONG_DOUBLE_VARIANT != 0; then
348       AC_DEFINE(HAVE_LONG_DOUBLE_VARIANT, 1, [Define if you support more than one size of the long double type])
349       HAVE_LONG_DOUBLE=1
350     else
351       if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then
352         HAVE_LONG_DOUBLE=1
353         AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double])
354       fi
355     fi
356   fi
357 fi
358 AC_SUBST(HAVE_LONG_DOUBLE)
359 AC_SUBST(HAVE_LONG_DOUBLE_VARIANT)
360
361 AC_C_BIGENDIAN
362
363 GCC_AS_CFI_PSEUDO_OP
364
365 if test x$TARGET = xSPARC; then
366     AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs],
367         libffi_cv_as_sparc_ua_pcrel, [
368         save_CFLAGS="$CFLAGS"
369         save_LDFLAGS="$LDFLAGS"
370         CFLAGS="$CFLAGS -fpic"
371         LDFLAGS="$LDFLAGS -shared"
372         AC_TRY_LINK([asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");],,
373                     [libffi_cv_as_sparc_ua_pcrel=yes],
374                     [libffi_cv_as_sparc_ua_pcrel=no])
375         CFLAGS="$save_CFLAGS"
376         LDFLAGS="$save_LDFLAGS"])
377     if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then
378         AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
379                   [Define if your assembler and linker support unaligned PC relative relocs.])
380     fi
381
382     AC_CACHE_CHECK([assembler .register pseudo-op support],
383        libffi_cv_as_register_pseudo_op, [
384        libffi_cv_as_register_pseudo_op=unknown
385        # Check if we have .register
386        AC_TRY_COMPILE(,[asm (".register %g2, #scratch");],
387                        [libffi_cv_as_register_pseudo_op=yes],
388                        [libffi_cv_as_register_pseudo_op=no])
389     ])
390     if test "x$libffi_cv_as_register_pseudo_op" = xyes; then
391        AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
392                [Define if your assembler supports .register.])
393     fi
394 fi
395
396 if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then
397     AC_CACHE_CHECK([assembler supports pc related relocs],
398         libffi_cv_as_x86_pcrel, [
399         libffi_cv_as_x86_pcrel=no
400         echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
401         if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then
402             libffi_cv_as_x86_pcrel=yes
403         fi
404         ])
405     if test "x$libffi_cv_as_x86_pcrel" = xyes; then
406         AC_DEFINE(HAVE_AS_X86_PCREL, 1,
407                   [Define if your assembler supports PC relative relocs.])
408     fi
409
410     AC_CACHE_CHECK([assembler .ascii pseudo-op support],
411        libffi_cv_as_ascii_pseudo_op, [
412        libffi_cv_as_ascii_pseudo_op=unknown
413        # Check if we have .ascii
414        AC_TRY_COMPILE(,[asm (".ascii \\"string\\"");],
415                        [libffi_cv_as_ascii_pseudo_op=yes],
416                        [libffi_cv_as_ascii_pseudo_op=no])
417     ])
418     if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then
419        AC_DEFINE(HAVE_AS_ASCII_PSEUDO_OP, 1,
420                [Define if your assembler supports .ascii.])
421     fi
422
423     AC_CACHE_CHECK([assembler .string pseudo-op support],
424        libffi_cv_as_string_pseudo_op, [
425        libffi_cv_as_string_pseudo_op=unknown
426        # Check if we have .string
427        AC_TRY_COMPILE(,[asm (".string \\"string\\"");],
428                        [libffi_cv_as_string_pseudo_op=yes],
429                        [libffi_cv_as_string_pseudo_op=no])
430     ])
431     if test "x$libffi_cv_as_string_pseudo_op" = xyes; then
432        AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1,
433                [Define if your assembler supports .string.])
434     fi
435 fi
436
437 # On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC.
438 AC_ARG_ENABLE(pax_emutramp,
439   [  --enable-pax_emutramp       enable pax emulated trampolines, for we can't use PROT_EXEC],
440   if test "$enable_pax_emutramp" = "yes"; then
441     AC_DEFINE(FFI_MMAP_EXEC_EMUTRAMP_PAX, 1,
442       [Define this if you want to enable pax emulated trampolines])
443   fi)
444
445 LT_SYS_SYMBOL_USCORE
446 if test "x$sys_symbol_underscore" = xyes; then
447     AC_DEFINE(SYMBOL_UNDERSCORE, 1, [Define if symbols are underscored.])
448 fi
449
450 FFI_EXEC_TRAMPOLINE_TABLE=0
451 case "$target" in
452      *arm*-apple-darwin*)
453        FFI_EXEC_TRAMPOLINE_TABLE=1
454        AC_DEFINE(FFI_EXEC_TRAMPOLINE_TABLE, 1,
455                  [Cannot use PROT_EXEC on this target, so, we revert to
456                    alternative means])
457      ;;
458      *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*)
459        AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1,
460                  [Cannot use malloc on this target, so, we revert to
461                    alternative means])
462      ;;
463 esac
464 AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1)
465 AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE)
466
467 if test x$TARGET = xX86_64; then
468     AC_CACHE_CHECK([toolchain supports unwind section type],
469         libffi_cv_as_x86_64_unwind_section_type, [
470         cat  > conftest1.s << EOF
471 .text
472 .globl foo
473 foo:
474 jmp bar
475 .section .eh_frame,"a",@unwind
476 bar:
477 EOF
478
479         cat > conftest2.c  << EOF
480 extern void foo();
481 int main(){foo();}
482 EOF
483
484         libffi_cv_as_x86_64_unwind_section_type=no
485         # we ensure that we can compile _and_ link an assembly file containing an @unwind section
486         # since the compiler can support it and not the linker (ie old binutils)
487         if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \
488            $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then
489             libffi_cv_as_x86_64_unwind_section_type=yes
490         fi
491         ])
492     if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then
493         AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1,
494                   [Define if your assembler supports unwind section type.])
495     fi
496 fi
497
498 if test "x$GCC" = "xyes"; then
499   AC_CACHE_CHECK([whether .eh_frame section should be read-only],
500       libffi_cv_ro_eh_frame, [
501         libffi_cv_ro_eh_frame=no
502         echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
503         if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then
504             objdump -h conftest.o > conftest.dump 2>&1
505             libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1`
506             libffi_test_line=`expr $libffi_eh_frame_line + 1`p
507             sed -n $libffi_test_line conftest.dump > conftest.line
508             if grep READONLY conftest.line > /dev/null; then
509                 libffi_cv_ro_eh_frame=yes
510             fi
511         fi
512         rm -f conftest.*
513       ])
514   if test "x$libffi_cv_ro_eh_frame" = xyes; then
515       AC_DEFINE(HAVE_RO_EH_FRAME, 1,
516               [Define if .eh_frame sections should be read-only.])
517       AC_DEFINE(EH_FRAME_FLAGS, "a",
518               [Define to the flags needed for the .section .eh_frame directive.  ])
519   else
520       AC_DEFINE(EH_FRAME_FLAGS, "aw",
521               [Define to the flags needed for the .section .eh_frame directive.  ])
522   fi
523
524   AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
525       libffi_cv_hidden_visibility_attribute, [
526         echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1  ; }' > conftest.c
527         libffi_cv_hidden_visibility_attribute=no
528         if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
529             if grep '\.hidden.*foo' conftest.s >/dev/null; then
530                 libffi_cv_hidden_visibility_attribute=yes
531             fi
532         fi
533         rm -f conftest.*
534       ])
535   if test $libffi_cv_hidden_visibility_attribute = yes; then
536       AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1,
537               [Define if __attribute__((visibility("hidden"))) is supported.])
538   fi
539 fi
540
541 AH_BOTTOM([
542 #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
543 #ifdef LIBFFI_ASM
544 #define FFI_HIDDEN(name) .hidden name
545 #else
546 #define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
547 #endif
548 #else
549 #ifdef LIBFFI_ASM
550 #define FFI_HIDDEN(name)
551 #else
552 #define FFI_HIDDEN
553 #endif
554 #endif
555 ])
556
557 AC_SUBST(TARGET)
558 AC_SUBST(TARGETDIR)
559
560 AC_SUBST(SHELL)
561
562 AC_ARG_ENABLE(debug,
563 [  --enable-debug          debugging mode],
564   if test "$enable_debug" = "yes"; then
565     AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.])
566   fi)
567 AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes")
568
569 AC_ARG_ENABLE(structs,
570 [  --disable-structs       omit code for struct support],
571   if test "$enable_structs" = "no"; then
572     AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this if you do not want support for aggregate types.])
573   fi)
574 AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes")
575
576 AC_ARG_ENABLE(raw-api,
577 [  --disable-raw-api       make the raw api unavailable],
578   if test "$enable_raw_api" = "no"; then
579     AC_DEFINE(FFI_NO_RAW_API, 1, [Define this if you do not want support for the raw API.])
580   fi)
581
582 AC_ARG_ENABLE(purify-safety,
583 [  --enable-purify-safety  purify-safe mode],
584   if test "$enable_purify_safety" = "yes"; then
585     AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.])
586   fi)
587
588 # These variables are only ever used when we cross-build to X86_WIN32.
589 # And we only support this with GCC, so...
590 if test "x$GCC" = "xyes"; then
591   if test -n "$with_cross_host" &&
592      test x"$with_cross_host" != x"no"; then
593     toolexecdir='$(exec_prefix)/$(target_alias)'
594     toolexeclibdir='$(toolexecdir)/lib'
595   else
596     toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
597     toolexeclibdir='$(libdir)'
598   fi
599   multi_os_directory=`$CC $CFLAGS -print-multi-os-directory`
600   case $multi_os_directory in
601     .) ;; # Avoid trailing /.
602     ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
603   esac
604   AC_SUBST(toolexecdir)
605 else
606   toolexeclibdir='$(libdir)'
607 fi
608 AC_SUBST(toolexeclibdir)
609
610 AC_CONFIG_COMMANDS(include, [test -d include || mkdir include])
611 AC_CONFIG_COMMANDS(src, [
612 test -d src || mkdir src
613 test -d src/$TARGETDIR || mkdir src/$TARGETDIR
614 ], [TARGETDIR="$TARGETDIR"])
615
616 AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
617
618 AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc)
619
620 AC_OUTPUT