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