]>
Commit | Line | Data |
---|---|---|
47c5fab6 | 1 | dnl Process this with autoconf to create configure |
b375837d | 2 | |
81a71e2b | 3 | AC_PREREQ(2.64) |
b375837d | 4 | |
a65f362a | 5 | AC_INIT([libffi], [3.0.11], [http://gcc.gnu.org/bugs.html]) |
b375837d | 6 | AC_CONFIG_HEADERS([fficonfig.h]) |
7 | ||
8 | AM_ENABLE_MULTILIB(, ..) | |
3b43a26e | 9 | |
3743c332 | 10 | AC_CANONICAL_SYSTEM |
11 | target_alias=${target_alias-$host_alias} | |
47c5fab6 | 12 | |
2e818f50 | 13 | . ${srcdir}/configure.host |
14 | ||
b375837d | 15 | AM_INIT_AUTOMAKE |
47c5fab6 | 16 | |
8cd092c9 | 17 | # See if makeinfo has been installed and is modern enough |
18 | # that we can use it. | |
19 | ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version], | |
20 | [GNU texinfo.* \([0-9][0-9.]*\)], | |
21 | [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*]) | |
22 | AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes") | |
23 | ||
24 | # We would like our source tree to be readonly. However when releases or | |
25 | # pre-releases are generated, the flex/bison generated files as well as the | |
26 | # various formats of manuals need to be included along with the rest of the | |
27 | # sources. Therefore we have --enable-generated-files-in-srcdir to do | |
28 | # just that. | |
29 | AC_MSG_CHECKING(generated-files-in-srcdir) | |
30 | AC_ARG_ENABLE(generated-files-in-srcdir, | |
31 | AS_HELP_STRING([--enable-generated-files-in-srcdir], | |
32 | [put copies of generated files in source dir intended for creating source tarballs for users without texinfo bison or flex]), | |
33 | [case "$enableval" in | |
34 | yes) enable_generated_files_in_srcdir=yes ;; | |
35 | no) enable_generated_files_in_srcdir=no ;; | |
36 | *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; | |
37 | esac], | |
38 | [enable_generated_files_in_srcdir=no]) | |
39 | AC_MSG_RESULT($enable_generated_files_in_srcdir) | |
40 | AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes) | |
41 | ||
b375837d | 42 | # The same as in boehm-gc and libstdc++. Have to borrow it from there. |
43 | # We must force CC to /not/ be precious variables; otherwise | |
44 | # the wrong, non-multilib-adjusted value will be used in multilibs. | |
45 | # As a side effect, we have to subst CFLAGS ourselves. | |
47c5fab6 | 46 | |
b375837d | 47 | m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) |
48 | m4_define([_AC_ARG_VAR_PRECIOUS],[]) | |
47c5fab6 | 49 | AC_PROG_CC |
9abe4a66 | 50 | m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) |
3743c332 | 51 | |
b375837d | 52 | AC_SUBST(CFLAGS) |
53 | ||
54 | AM_PROG_AS | |
55 | AM_PROG_CC_C_O | |
47c5fab6 | 56 | AC_PROG_LIBTOOL |
57 | ||
b375837d | 58 | AM_MAINTAINER_MODE |
59 | ||
2be99030 | 60 | AC_CHECK_HEADERS(sys/mman.h) |
61 | AC_CHECK_FUNCS(mmap) | |
e7f352cc | 62 | AC_FUNC_MMAP_BLACKLIST |
63 | ||
3743c332 | 64 | dnl The -no-testsuite modules omit the test subdir. |
65 | AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite) | |
66 | ||
47c5fab6 | 67 | TARGETDIR="unknown" |
68 | case "$host" in | |
a65f362a | 69 | aarch64*-*-*) |
70 | TARGET=AARCH64; TARGETDIR=aarch64 | |
71 | ;; | |
72 | ||
ea4d299a | 73 | alpha*-*-*) |
74 | TARGET=ALPHA; TARGETDIR=alpha; | |
3220fb87 | 75 | # Support 128-bit long double, changeable via command-line switch. |
ea4d299a | 76 | HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)' |
77 | ;; | |
78 | ||
79 | arm*-*-*) | |
80 | TARGET=ARM; TARGETDIR=arm | |
81 | ;; | |
82 | ||
f2ed5930 | 83 | amd64-*-freebsd* | amd64-*-openbsd*) |
a65f362a | 84 | TARGET=X86_64; TARGETDIR=x86 |
85 | ;; | |
86 | ||
87 | amd64-*-freebsd*) | |
55e813ce | 88 | TARGET=X86_64; TARGETDIR=x86 |
89 | ;; | |
90 | ||
2a06dfe6 | 91 | avr32*-*-*) |
92 | TARGET=AVR32; TARGETDIR=avr32 | |
93 | ;; | |
94 | ||
a65f362a | 95 | bfin*) |
96 | TARGET=BFIN; TARGETDIR=bfin | |
97 | ;; | |
98 | ||
ea4d299a | 99 | cris-*-*) |
100 | TARGET=LIBFFI_CRIS; TARGETDIR=cris | |
101 | ;; | |
102 | ||
103 | frv-*-*) | |
104 | TARGET=FRV; TARGETDIR=frv | |
105 | ;; | |
106 | ||
a65f362a | 107 | hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*) |
ea4d299a | 108 | TARGET=PA_LINUX; TARGETDIR=pa |
109 | ;; | |
110 | hppa*64-*-hpux*) | |
111 | TARGET=PA64_HPUX; TARGETDIR=pa | |
112 | ;; | |
113 | hppa*-*-hpux*) | |
114 | TARGET=PA_HPUX; TARGETDIR=pa | |
115 | ;; | |
116 | ||
cc6aa710 | 117 | i?86-*-freebsd* | i?86-*-openbsd*) |
1f429ea0 | 118 | TARGET=X86_FREEBSD; TARGETDIR=x86 |
119 | ;; | |
a65f362a | 120 | i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix*) |
ea4d299a | 121 | TARGET=X86_WIN32; TARGETDIR=x86 |
9dfad575 | 122 | # All mingw/cygwin/win32 builds require -no-undefined for sharedlib. |
123 | # We must also check with_cross_host to decide if this is a native | |
124 | # or cross-build and select where to install dlls appropriately. | |
125 | if test -n "$with_cross_host" && | |
126 | test x"$with_cross_host" != x"no"; then | |
127 | AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"'; | |
128 | else | |
129 | AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"'; | |
130 | fi | |
ea4d299a | 131 | ;; |
132 | i?86-*-darwin*) | |
133 | TARGET=X86_DARWIN; TARGETDIR=x86 | |
134 | ;; | |
f54a4242 | 135 | i?86-*-solaris2.1[[0-9]]*) |
136 | TARGET=X86_64; TARGETDIR=x86 | |
137 | ;; | |
ea4d299a | 138 | i?86-*-*) |
15ac1e63 | 139 | TARGET=X86_64; TARGETDIR=x86 |
ea4d299a | 140 | ;; |
141 | ||
142 | ia64*-*-*) | |
143 | TARGET=IA64; TARGETDIR=ia64 | |
144 | ;; | |
145 | ||
146 | m32r*-*-*) | |
147 | TARGET=M32R; TARGETDIR=m32r | |
148 | ;; | |
149 | ||
150 | m68k-*-*) | |
151 | TARGET=M68K; TARGETDIR=m68k | |
152 | ;; | |
153 | ||
126de59d | 154 | mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) |
7a659e46 | 155 | TARGET=MIPS; TARGETDIR=mips |
ea4d299a | 156 | ;; |
a65f362a | 157 | mips*-*-linux* | mips*-*-openbsd*) |
08fbebd8 | 158 | # Support 128-bit long double for NewABI. |
159 | HAVE_LONG_DOUBLE='defined(__mips64)' | |
7a659e46 | 160 | TARGET=MIPS; TARGETDIR=mips |
ea4d299a | 161 | ;; |
162 | ||
1f429ea0 | 163 | powerpc*-*-linux* | powerpc-*-sysv*) |
164 | TARGET=POWERPC; TARGETDIR=powerpc | |
165 | ;; | |
a65f362a | 166 | powerpc-*-amigaos*) |
167 | TARGET=POWERPC; TARGETDIR=powerpc | |
168 | ;; | |
1f429ea0 | 169 | powerpc-*-beos*) |
ea4d299a | 170 | TARGET=POWERPC; TARGETDIR=powerpc |
171 | ;; | |
a65f362a | 172 | powerpc-*-darwin* | powerpc64-*-darwin*) |
ea4d299a | 173 | TARGET=POWERPC_DARWIN; TARGETDIR=powerpc |
174 | ;; | |
175 | powerpc-*-aix* | rs6000-*-aix*) | |
176 | TARGET=POWERPC_AIX; TARGETDIR=powerpc | |
177 | ;; | |
a65f362a | 178 | powerpc-*-freebsd* | powerpc-*-openbsd*) |
ea4d299a | 179 | TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc |
180 | ;; | |
a65f362a | 181 | powerpc64-*-freebsd*) |
5280001e | 182 | TARGET=POWERPC; TARGETDIR=powerpc |
183 | ;; | |
ea4d299a | 184 | powerpc*-*-rtems*) |
185 | TARGET=POWERPC; TARGETDIR=powerpc | |
186 | ;; | |
187 | ||
188 | s390-*-* | s390x-*-*) | |
189 | TARGET=S390; TARGETDIR=s390 | |
190 | ;; | |
191 | ||
192 | sh-*-* | sh[[34]]*-*-*) | |
193 | TARGET=SH; TARGETDIR=sh | |
194 | ;; | |
195 | sh64-*-* | sh5*-*-*) | |
196 | TARGET=SH64; TARGETDIR=sh64 | |
197 | ;; | |
198 | ||
199 | sparc*-*-*) | |
200 | TARGET=SPARC; TARGETDIR=sparc | |
201 | ;; | |
202 | ||
a65f362a | 203 | tile*-*) |
204 | TARGET=TILE; TARGETDIR=tile | |
205 | ;; | |
206 | ||
ea4d299a | 207 | x86_64-*-darwin*) |
208 | TARGET=X86_DARWIN; TARGETDIR=x86 | |
209 | ;; | |
fffc53bb | 210 | |
ea4d299a | 211 | x86_64-*-cygwin* | x86_64-*-mingw*) |
00581c89 | 212 | TARGET=X86_WIN64; TARGETDIR=x86 |
bb52d0cb | 213 | # All mingw/cygwin/win32 builds require -no-undefined for sharedlib. |
214 | # We must also check with_cross_host to decide if this is a native | |
215 | # or cross-build and select where to install dlls appropriately. | |
216 | if test -n "$with_cross_host" && | |
217 | test x"$with_cross_host" != x"no"; then | |
218 | AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"'; | |
219 | else | |
220 | AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"'; | |
221 | fi | |
ea4d299a | 222 | ;; |
fffc53bb | 223 | |
ea4d299a | 224 | x86_64-*-*) |
225 | TARGET=X86_64; TARGETDIR=x86 | |
226 | ;; | |
47c5fab6 | 227 | esac |
228 | ||
3743c332 | 229 | AC_SUBST(AM_RUNTESTFLAGS) |
1a42df5d | 230 | AC_SUBST(AM_LTLDFLAGS) |
3743c332 | 231 | |
47c5fab6 | 232 | if test $TARGETDIR = unknown; then |
b375837d | 233 | AC_MSG_ERROR(["libffi has not been ported to $host."]) |
47c5fab6 | 234 | fi |
235 | ||
7a659e46 | 236 | AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) |
a65f362a | 237 | AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN) |
47c5fab6 | 238 | AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) |
239 | AM_CONDITIONAL(X86, test x$TARGET = xX86) | |
1f429ea0 | 240 | AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) |
a4cc90ca | 241 | AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32) |
00581c89 | 242 | AM_CONDITIONAL(X86_WIN64, test x$TARGET = xX86_WIN64) |
eb819ecd | 243 | AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN) |
47c5fab6 | 244 | AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA) |
28c07da5 | 245 | AM_CONDITIONAL(IA64, test x$TARGET = xIA64) |
7e74b6d4 | 246 | AM_CONDITIONAL(M32R, test x$TARGET = xM32R) |
47c5fab6 | 247 | AM_CONDITIONAL(M68K, test x$TARGET = xM68K) |
248 | AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC) | |
faae36ce | 249 | AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX) |
b81d6fe1 | 250 | AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN) |
569238e2 | 251 | AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD) |
a65f362a | 252 | AM_CONDITIONAL(AARCH64, test x$TARGET = xAARCH64) |
47c5fab6 | 253 | AM_CONDITIONAL(ARM, test x$TARGET = xARM) |
2a06dfe6 | 254 | AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32) |
7e5823cf | 255 | AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS) |
2e818f50 | 256 | AM_CONDITIONAL(FRV, test x$TARGET = xFRV) |
ea1f83c5 | 257 | AM_CONDITIONAL(S390, test x$TARGET = xS390) |
42c71854 | 258 | AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64) |
b1e5d71d | 259 | AM_CONDITIONAL(SH, test x$TARGET = xSH) |
81f536a3 | 260 | AM_CONDITIONAL(SH64, test x$TARGET = xSH64) |
1a82d6f6 | 261 | AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX) |
262 | AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX) | |
263 | AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX) | |
a65f362a | 264 | AM_CONDITIONAL(TILE, test x$TARGET = xTILE) |
47c5fab6 | 265 | |
266 | AC_HEADER_STDC | |
267 | AC_CHECK_FUNCS(memcpy) | |
268 | AC_FUNC_ALLOCA | |
269 | ||
69738b31 | 270 | AC_CHECK_SIZEOF(double) |
271 | AC_CHECK_SIZEOF(long double) | |
ed35b400 | 272 | |
3d37e05c | 273 | # Also AC_SUBST this variable for ffi.h. |
ea4d299a | 274 | if test -z "$HAVE_LONG_DOUBLE"; then |
275 | HAVE_LONG_DOUBLE=0 | |
276 | if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then | |
277 | if test $ac_cv_sizeof_long_double != 0; then | |
278 | HAVE_LONG_DOUBLE=1 | |
279 | AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double]) | |
280 | fi | |
3d37e05c | 281 | fi |
282 | fi | |
283 | AC_SUBST(HAVE_LONG_DOUBLE) | |
284 | ||
69738b31 | 285 | AC_C_BIGENDIAN |
47c5fab6 | 286 | |
022a1701 | 287 | GCC_AS_CFI_PSEUDO_OP |
a53add80 | 288 | |
b19313f4 | 289 | if test x$TARGET = xSPARC; then |
b40c762b | 290 | AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs], |
291 | libffi_cv_as_sparc_ua_pcrel, [ | |
292 | save_CFLAGS="$CFLAGS" | |
293 | save_LDFLAGS="$LDFLAGS" | |
294 | CFLAGS="$CFLAGS -fpic" | |
295 | LDFLAGS="$LDFLAGS -shared" | |
296 | AC_TRY_LINK([asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");],, | |
297 | [libffi_cv_as_sparc_ua_pcrel=yes], | |
298 | [libffi_cv_as_sparc_ua_pcrel=no]) | |
299 | CFLAGS="$save_CFLAGS" | |
300 | LDFLAGS="$save_LDFLAGS"]) | |
301 | if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then | |
302 | AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1, | |
303 | [Define if your assembler and linker support unaligned PC relative relocs.]) | |
304 | fi | |
f3bd7a2c | 305 | |
306 | AC_CACHE_CHECK([assembler .register pseudo-op support], | |
307 | libffi_cv_as_register_pseudo_op, [ | |
308 | libffi_cv_as_register_pseudo_op=unknown | |
309 | # Check if we have .register | |
310 | AC_TRY_COMPILE([asm (".register %g2, #scratch");],, | |
b375837d | 311 | [libffi_cv_as_register_pseudo_op=yes], |
312 | [libffi_cv_as_register_pseudo_op=no]) | |
f3bd7a2c | 313 | ]) |
314 | if test "x$libffi_cv_as_register_pseudo_op" = xyes; then | |
315 | AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1, | |
b375837d | 316 | [Define if your assembler supports .register.]) |
f3bd7a2c | 317 | fi |
b40c762b | 318 | fi |
319 | ||
1cde303d | 320 | if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then |
95ff4d7d | 321 | AC_CACHE_CHECK([assembler supports pc related relocs], |
322 | libffi_cv_as_x86_pcrel, [ | |
323 | libffi_cv_as_x86_pcrel=yes | |
324 | echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s | |
40ae1f19 | 325 | if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then |
95ff4d7d | 326 | libffi_cv_as_x86_pcrel=no |
327 | fi | |
328 | ]) | |
329 | if test "x$libffi_cv_as_x86_pcrel" = xyes; then | |
330 | AC_DEFINE(HAVE_AS_X86_PCREL, 1, | |
331 | [Define if your assembler supports PC relative relocs.]) | |
332 | fi | |
40ae1f19 | 333 | |
334 | AC_CACHE_CHECK([assembler .ascii pseudo-op support], | |
335 | libffi_cv_as_ascii_pseudo_op, [ | |
336 | libffi_cv_as_ascii_pseudo_op=unknown | |
337 | # Check if we have .ascii | |
c29b28e7 | 338 | AC_TRY_COMPILE([asm (".ascii \\"string\\"");],, |
40ae1f19 | 339 | [libffi_cv_as_ascii_pseudo_op=yes], |
340 | [libffi_cv_as_ascii_pseudo_op=no]) | |
341 | ]) | |
342 | if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then | |
343 | AC_DEFINE(HAVE_AS_ASCII_PSEUDO_OP, 1, | |
344 | [Define if your assembler supports .ascii.]) | |
345 | fi | |
346 | ||
347 | AC_CACHE_CHECK([assembler .string pseudo-op support], | |
348 | libffi_cv_as_string_pseudo_op, [ | |
349 | libffi_cv_as_string_pseudo_op=unknown | |
350 | # Check if we have .string | |
c29b28e7 | 351 | AC_TRY_COMPILE([asm (".string \\"string\\"");],, |
40ae1f19 | 352 | [libffi_cv_as_string_pseudo_op=yes], |
353 | [libffi_cv_as_string_pseudo_op=no]) | |
354 | ]) | |
355 | if test "x$libffi_cv_as_string_pseudo_op" = xyes; then | |
356 | AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1, | |
357 | [Define if your assembler supports .string.]) | |
358 | fi | |
95ff4d7d | 359 | fi |
360 | ||
a65f362a | 361 | # On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. |
362 | AC_ARG_ENABLE(pax_emutramp, | |
363 | [ --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC], | |
364 | if test "$enable_pax_emutramp" = "yes"; then | |
365 | AC_DEFINE(FFI_MMAP_EXEC_EMUTRAMP_PAX, 1, | |
366 | [Define this if you want to enable pax emulated trampolines]) | |
367 | fi) | |
368 | ||
369 | FFI_EXEC_TRAMPOLINE_TABLE=0 | |
3531d81f | 370 | case "$target" in |
a65f362a | 371 | *arm*-apple-darwin*) |
372 | FFI_EXEC_TRAMPOLINE_TABLE=1 | |
373 | AC_DEFINE(FFI_EXEC_TRAMPOLINE_TABLE, 1, | |
374 | [Cannot use PROT_EXEC on this target, so, we revert to | |
375 | alternative means]) | |
376 | ;; | |
377 | *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) | |
3531d81f | 378 | AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, |
379 | [Cannot use malloc on this target, so, we revert to | |
380 | alternative means]) | |
381 | ;; | |
382 | esac | |
a65f362a | 383 | AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1) |
384 | AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE) | |
3531d81f | 385 | |
5ed988d2 | 386 | if test x$TARGET = xX86_64; then |
387 | AC_CACHE_CHECK([assembler supports unwind section type], | |
388 | libffi_cv_as_x86_64_unwind_section_type, [ | |
389 | libffi_cv_as_x86_64_unwind_section_type=yes | |
390 | echo '.section .eh_frame,"a",@unwind' > conftest.s | |
391 | if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then | |
392 | libffi_cv_as_x86_64_unwind_section_type=no | |
393 | fi | |
394 | ]) | |
395 | if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then | |
396 | AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1, | |
397 | [Define if your assembler supports unwind section type.]) | |
398 | fi | |
399 | fi | |
400 | ||
a65f362a | 401 | if test "x$GCC" = "xyes"; then |
402 | AC_CACHE_CHECK([whether .eh_frame section should be read-only], | |
403 | libffi_cv_ro_eh_frame, [ | |
404 | libffi_cv_ro_eh_frame=no | |
405 | echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c | |
406 | if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then | |
407 | if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then | |
408 | libffi_cv_ro_eh_frame=yes | |
409 | elif grep '.section.*eh_frame.*#alloc' conftest.c \ | |
410 | | grep -v '#write' > /dev/null; then | |
411 | libffi_cv_ro_eh_frame=yes | |
412 | fi | |
413 | fi | |
414 | rm -f conftest.* | |
415 | ]) | |
416 | if test "x$libffi_cv_ro_eh_frame" = xyes; then | |
417 | AC_DEFINE(HAVE_RO_EH_FRAME, 1, | |
418 | [Define if .eh_frame sections should be read-only.]) | |
419 | AC_DEFINE(EH_FRAME_FLAGS, "a", | |
420 | [Define to the flags needed for the .section .eh_frame directive. ]) | |
421 | else | |
422 | AC_DEFINE(EH_FRAME_FLAGS, "aw", | |
423 | [Define to the flags needed for the .section .eh_frame directive. ]) | |
424 | fi | |
1da888ec | 425 | |
a65f362a | 426 | AC_CACHE_CHECK([for __attribute__((visibility("hidden")))], |
427 | libffi_cv_hidden_visibility_attribute, [ | |
428 | echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c | |
429 | libffi_cv_hidden_visibility_attribute=no | |
430 | if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then | |
431 | if grep '\.hidden.*foo' conftest.s >/dev/null; then | |
432 | libffi_cv_hidden_visibility_attribute=yes | |
433 | fi | |
434 | fi | |
435 | rm -f conftest.* | |
436 | ]) | |
437 | if test $libffi_cv_hidden_visibility_attribute = yes; then | |
438 | AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1, | |
439 | [Define if __attribute__((visibility("hidden"))) is supported.]) | |
440 | fi | |
33b4ca90 | 441 | fi |
442 | ||
443 | AH_BOTTOM([ | |
444 | #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE | |
445 | #ifdef LIBFFI_ASM | |
446 | #define FFI_HIDDEN(name) .hidden name | |
447 | #else | |
448 | #define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) | |
449 | #endif | |
450 | #else | |
451 | #ifdef LIBFFI_ASM | |
452 | #define FFI_HIDDEN(name) | |
453 | #else | |
454 | #define FFI_HIDDEN | |
455 | #endif | |
456 | #endif | |
457 | ]) | |
458 | ||
47c5fab6 | 459 | AC_SUBST(TARGET) |
460 | AC_SUBST(TARGETDIR) | |
461 | ||
462 | AC_SUBST(SHELL) | |
463 | ||
070883fe | 464 | AC_ARG_ENABLE(debug, |
465 | [ --enable-debug debugging mode], | |
466 | if test "$enable_debug" = "yes"; then | |
3d37e05c | 467 | AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.]) |
070883fe | 468 | fi) |
a65f362a | 469 | AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes") |
070883fe | 470 | |
471 | AC_ARG_ENABLE(structs, | |
472 | [ --disable-structs omit code for struct support], | |
473 | if test "$enable_structs" = "no"; then | |
3d37e05c | 474 | AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this is you do not want support for aggregate types.]) |
070883fe | 475 | fi) |
476 | ||
477 | AC_ARG_ENABLE(raw-api, | |
478 | [ --disable-raw-api make the raw api unavailable], | |
479 | if test "$enable_raw_api" = "no"; then | |
3d37e05c | 480 | AC_DEFINE(FFI_NO_RAW_API, 1, [Define this is you do not want support for the raw API.]) |
070883fe | 481 | fi) |
47c5fab6 | 482 | |
483 | AC_ARG_ENABLE(purify-safety, | |
070883fe | 484 | [ --enable-purify-safety purify-safe mode], |
485 | if test "$enable_purify_safety" = "yes"; then | |
3d37e05c | 486 | AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.]) |
070883fe | 487 | fi) |
9573c665 | 488 | |
c8d4fa8c | 489 | if test -n "$with_cross_host" && |
490 | test x"$with_cross_host" != x"no"; then | |
491 | toolexecdir='$(exec_prefix)/$(target_alias)' | |
492 | toolexeclibdir='$(toolexecdir)/lib' | |
493 | else | |
494 | toolexecdir='$(libdir)/gcc-lib/$(target_alias)' | |
495 | toolexeclibdir='$(libdir)' | |
496 | fi | |
777bb3dc | 497 | multi_os_directory=`$CC -print-multi-os-directory` |
498 | case $multi_os_directory in | |
499 | .) ;; # Avoid trailing /. | |
500 | *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; | |
501 | esac | |
c8d4fa8c | 502 | AC_SUBST(toolexecdir) |
503 | AC_SUBST(toolexeclibdir) | |
47c5fab6 | 504 | |
3b43a26e | 505 | if test "${multilib}" = "yes"; then |
506 | multilib_arg="--enable-multilib" | |
507 | else | |
508 | multilib_arg= | |
509 | fi | |
510 | ||
b375837d | 511 | AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) |
512 | AC_CONFIG_COMMANDS(src, [ | |
9461b350 | 513 | test -d src || mkdir src |
b375837d | 514 | test -d src/$TARGETDIR || mkdir src/$TARGETDIR |
515 | ], [TARGETDIR="$TARGETDIR"]) | |
516 | ||
517 | AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h) | |
518 | ||
1f429ea0 | 519 | AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile) |
3d37e05c | 520 | |
b375837d | 521 | AC_OUTPUT |