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