3 # This shell script handles all host based configuration for libffi.
6 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
7 # Most of the time we can define all the variables all at once...
9 aarch64*-*-cygwin* | aarch64*-*-mingw* | aarch64*-*-win* )
10 TARGET=ARM_WIN64; TARGETDIR=aarch64
11 if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then
17 TARGET=AARCH64; TARGETDIR=aarch64
18 SOURCES="ffi.c sysv.S"
22 TARGET=ALPHA; TARGETDIR=alpha;
23 # Support 128-bit long double, changeable via command-line switch.
24 HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)'
29 TARGET=ARC; TARGETDIR=arc
30 SOURCES="ffi.c arcompact.S"
33 arm*-*-cygwin* | arm*-*-mingw* | arm*-*-win* )
34 TARGET=ARM_WIN32; TARGETDIR=arm
35 if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then
41 TARGET=ARM; TARGETDIR=arm
42 SOURCES="ffi.c sysv.S"
46 TARGET=AVR32; TARGETDIR=avr32
47 SOURCES="ffi.c sysv.S"
51 TARGET=BFIN; TARGETDIR=bfin
52 SOURCES="ffi.c sysv.S"
56 TARGET=LIBFFI_CRIS; TARGETDIR=cris
57 SOURCES="ffi.c sysv.S"
61 TARGET=CSKY; TARGETDIR=csky
62 SOURCES="ffi.c sysv.S"
66 TARGET=FRV; TARGETDIR=frv
67 SOURCES="ffi.c eabi.S"
70 hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*)
71 TARGET=PA_LINUX; TARGETDIR=pa
72 SOURCES="ffi.c linux.S"
75 TARGET=PA64_HPUX; TARGETDIR=pa
78 TARGET=PA_HPUX; TARGETDIR=pa
79 SOURCES="ffi.c hpux32.S"
82 i?86-*-freebsd* | i?86-*-openbsd*)
83 TARGET=X86_FREEBSD; TARGETDIR=x86
86 i?86-*-cygwin* | i?86-*-mingw* | i?86-*-win* | i?86-*-os2* | i?86-*-interix* \
87 | x86_64-*-cygwin* | x86_64-*-mingw* | x86_64-*-win* )
89 if test $ac_cv_sizeof_size_t = 4; then
94 if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then
97 # All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
98 # We must also check with_cross_host to decide if this is a native
99 # or cross-build and select where to install dlls appropriately.
100 if test -n "$with_cross_host" &&
101 test x"$with_cross_host" != x"no"; then
102 AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"';
104 AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"';
108 i?86-*-darwin* | x86_64-*-darwin* | i?86-*-ios | x86_64-*-ios)
110 if test $ac_cv_sizeof_size_t = 4; then
117 i?86-*-* | x86_64-*-* | amd64-*)
119 if test $ac_cv_sizeof_size_t = 4; then
120 echo 'int foo (void) { return __x86_64__; }' > conftest.c
121 if $CC $CFLAGS -Werror -S conftest.c -o conftest.s > /dev/null 2>&1; then
134 TARGET=IA64; TARGETDIR=ia64
135 SOURCES="ffi.c unix.S"
139 TARGET=KVX; TARGETDIR=kvx
140 SOURCES="ffi.c sysv.S"
144 TARGET=LOONGARCH64; TARGETDIR=loongarch64
145 SOURCES="ffi.c sysv.S"
149 TARGET=M32R; TARGETDIR=m32r
150 SOURCES="ffi.c sysv.S"
154 TARGET=M68K; TARGETDIR=m68k
155 SOURCES="ffi.c sysv.S"
159 TARGET=M88K; TARGETDIR=m88k
160 SOURCES="ffi.c obsd.S"
164 TARGET=MICROBLAZE; TARGETDIR=microblaze
165 SOURCES="ffi.c sysv.S"
169 TARGET=MOXIE; TARGETDIR=moxie
170 SOURCES="ffi.c eabi.S"
174 TARGET=METAG; TARGETDIR=metag
175 SOURCES="ffi.c sysv.S"
178 mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
179 TARGET=MIPS; TARGETDIR=mips
181 mips*-*linux* | mips*-*-openbsd* | mips*-*-freebsd*)
182 # Support 128-bit long double for NewABI.
183 HAVE_LONG_DOUBLE='defined(__mips64)'
184 TARGET=MIPS; TARGETDIR=mips
188 TARGET=NIOS2; TARGETDIR=nios2
189 SOURCES="ffi.c sysv.S"
193 TARGET=OR1K; TARGETDIR=or1k
194 SOURCES="ffi.c sysv.S"
197 powerpc*-*-linux* | powerpc-*-sysv*)
198 TARGET=POWERPC; TARGETDIR=powerpc
199 HAVE_LONG_DOUBLE_VARIANT=1
202 TARGET=POWERPC; TARGETDIR=powerpc
205 TARGET=POWERPC; TARGETDIR=powerpc
208 TARGET=POWERPC; TARGETDIR=powerpc
210 powerpc-*-darwin* | powerpc64-*-darwin*)
211 TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
213 powerpc-*-aix* | rs6000-*-aix*)
214 TARGET=POWERPC_AIX; TARGETDIR=powerpc
216 powerpc-*-freebsd* | powerpc-*-openbsd* | powerpc-*-netbsd*)
217 TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
218 HAVE_LONG_DOUBLE_VARIANT=1
220 powerpcspe-*-freebsd*)
221 TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
222 CFLAGS="$CFLAGS -D__NO_FPRS__"
224 powerpc64-*-freebsd* | powerpc64le-*-freebsd*)
225 TARGET=POWERPC; TARGETDIR=powerpc
228 TARGET=POWERPC; TARGETDIR=powerpc
232 TARGET=RISCV; TARGETDIR=riscv
233 SOURCES="ffi.c sysv.S"
236 s390-*-* | s390x-*-*)
237 TARGET=S390; TARGETDIR=s390
238 SOURCES="ffi.c sysv.S"
241 sh-*-* | sh[34]*-*-*)
242 TARGET=SH; TARGETDIR=sh
243 SOURCES="ffi.c sysv.S"
246 TARGET=SH64; TARGETDIR=sh64
247 SOURCES="ffi.c sysv.S"
251 TARGET=SPARC; TARGETDIR=sparc
252 SOURCES="ffi.c ffi64.c v8.S v9.S"
256 TARGET=TILE; TARGETDIR=tile
257 SOURCES="ffi.c tile.S"
261 TARGET=VAX; TARGETDIR=vax
262 SOURCES="ffi.c elfbsd.S"
266 TARGET=XTENSA; TARGETDIR=xtensa
267 SOURCES="ffi.c sysv.S"
271 # ... but some of the cases above share configury.
274 if test "$MSVC" = 1; then
275 SOURCES="ffi.c sysv_msvc_arm32.S"
277 SOURCES="ffi.c sysv.S"
281 if test "$MSVC" = 1; then
282 SOURCES="ffi.c win64_armasm.S"
284 SOURCES="ffi.c sysv.S"
288 SOURCES="ffi.c o32.S n32.S"
291 SOURCES="ffi.c ffi_sysv.c ffi_linux64.c sysv.S ppc_closure.S"
292 SOURCES="${SOURCES} linux64.S linux64_closure.S"
295 SOURCES="ffi_darwin.c aix.S aix_closure.S"
298 SOURCES="ffi_darwin.c darwin.S darwin_closure.S"
301 SOURCES="ffi.c ffi_sysv.c sysv.S ppc_closure.S"
303 X86 | X86_DARWIN | X86_FREEBSD | X86_WIN32)
304 if test "$MSVC" = 1; then
305 SOURCES="ffi.c sysv_intel.S"
307 SOURCES="ffi.c sysv.S"
311 if test x"$TARGET_X32" = xyes; then
312 SOURCES="ffi64.c unix64.S"
314 SOURCES="ffi64.c unix64.S ffiw64.c win64.S"
318 if test "$MSVC" = 1; then
319 SOURCES="ffiw64.c win64_intel.S"
321 SOURCES="ffiw64.c win64.S"
326 # If we failed to configure SOURCES, we can't do anything.
327 if test -z "${SOURCES}"; then