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