blob: 9a72cda87e9c1ebd4de7b5cb59bec132d9af1808 [file] [log] [blame]
Richard Henderson57f52482014-11-13 12:42:54 +01001# configure.host
2#
3# This shell script handles all host based configuration for libffi.
4#
5
6# THIS TABLE IS SORTED. KEEP IT THAT WAY.
Richard Henderson5d69d572014-11-13 13:50:39 +01007# Most of the time we can define all the variables all at once...
Richard Henderson57f52482014-11-13 12:42:54 +01008case "${host}" in
Paul Monsonc2a68592019-08-07 11:57:45 -07009 aarch64*-*-cygwin* | aarch64*-*-mingw* | aarch64*-*-win* )
10 TARGET=ARM_WIN64; TARGETDIR=aarch64
11 MSVC=1
12 ;;
13
Richard Henderson57f52482014-11-13 12:42:54 +010014 aarch64*-*-*)
15 TARGET=AARCH64; TARGETDIR=aarch64
Richard Henderson5d69d572014-11-13 13:50:39 +010016 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +010017 ;;
18
19 alpha*-*-*)
20 TARGET=ALPHA; TARGETDIR=alpha;
21 # Support 128-bit long double, changeable via command-line switch.
22 HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)'
Richard Henderson5d69d572014-11-13 13:50:39 +010023 SOURCES="ffi.c osf.S"
Richard Henderson57f52482014-11-13 12:42:54 +010024 ;;
25
26 arc*-*-*)
27 TARGET=ARC; TARGETDIR=arc
Richard Henderson5d69d572014-11-13 13:50:39 +010028 SOURCES="ffi.c arcompact.S"
Richard Henderson57f52482014-11-13 12:42:54 +010029 ;;
30
Paul Monsondb5706f2019-04-26 04:58:58 -070031 arm*-*-cygwin* | arm*-*-mingw* | arm*-*-win* )
32 TARGET=ARM_WIN32; TARGETDIR=arm
33 MSVC=1
34 ;;
35
Richard Henderson57f52482014-11-13 12:42:54 +010036 arm*-*-*)
37 TARGET=ARM; TARGETDIR=arm
Richard Henderson5d69d572014-11-13 13:50:39 +010038 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +010039 ;;
40
41 avr32*-*-*)
42 TARGET=AVR32; TARGETDIR=avr32
Richard Henderson5d69d572014-11-13 13:50:39 +010043 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +010044 ;;
45
46 bfin*)
47 TARGET=BFIN; TARGETDIR=bfin
Richard Henderson5d69d572014-11-13 13:50:39 +010048 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +010049 ;;
50
51 cris-*-*)
52 TARGET=LIBFFI_CRIS; TARGETDIR=cris
Richard Henderson5d69d572014-11-13 13:50:39 +010053 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +010054 ;;
55
56 frv-*-*)
57 TARGET=FRV; TARGETDIR=frv
Richard Henderson5d69d572014-11-13 13:50:39 +010058 SOURCES="ffi.c eabi.S"
Richard Henderson57f52482014-11-13 12:42:54 +010059 ;;
60
61 hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*)
62 TARGET=PA_LINUX; TARGETDIR=pa
Richard Henderson5d69d572014-11-13 13:50:39 +010063 SOURCES="ffi.c linux.S"
Richard Henderson57f52482014-11-13 12:42:54 +010064 ;;
65 hppa*64-*-hpux*)
66 TARGET=PA64_HPUX; TARGETDIR=pa
67 ;;
68 hppa*-*-hpux*)
69 TARGET=PA_HPUX; TARGETDIR=pa
Richard Henderson5d69d572014-11-13 13:50:39 +010070 SOURCES="ffi.c hpux32.S"
Richard Henderson57f52482014-11-13 12:42:54 +010071 ;;
72
73 i?86-*-freebsd* | i?86-*-openbsd*)
74 TARGET=X86_FREEBSD; TARGETDIR=x86
75 ;;
76
Michael Haubenwallner247a5e72019-11-22 20:17:58 +010077 i?86-*-cygwin* | i?86-*-mingw* | i?86-*-win* | i?86-*-os2* | i?86-*-interix* \
Anthony Green69963d32017-03-19 07:33:39 -040078 | x86_64-*-cygwin* | x86_64-*-mingw* | x86_64-*-win* )
Richard Henderson57f52482014-11-13 12:42:54 +010079 TARGETDIR=x86
80 if test $ac_cv_sizeof_size_t = 4; then
81 TARGET=X86_WIN32
82 else
83 TARGET=X86_WIN64
84 fi
Ramón García Fernández1e0d1072017-01-08 20:12:59 +010085 if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then
Anthony Green69963d32017-03-19 07:33:39 -040086 MSVC=1
Ramón García Fernández1e0d1072017-01-08 20:12:59 +010087 fi
Richard Henderson57f52482014-11-13 12:42:54 +010088 # All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
89 # We must also check with_cross_host to decide if this is a native
90 # or cross-build and select where to install dlls appropriately.
91 if test -n "$with_cross_host" &&
92 test x"$with_cross_host" != x"no"; then
93 AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"';
94 else
95 AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"';
96 fi
97 ;;
98
Moritz Angermann50e408c2017-05-21 20:44:10 +080099 i?86-*-darwin* | x86_64-*-darwin* | i?86-*-ios | x86_64-*-ios)
Richard Henderson9f112612014-11-22 20:02:43 +0100100 TARGETDIR=x86
101 if test $ac_cv_sizeof_size_t = 4; then
102 TARGET=X86_DARWIN
103 else
104 TARGET=X86_64
105 fi
Richard Henderson57f52482014-11-13 12:42:54 +0100106 ;;
107
108 i?86-*-* | x86_64-*-* | amd64-*)
109 TARGETDIR=x86
110 if test $ac_cv_sizeof_size_t = 4; then
111 case "$host" in
Matija Skala41185b52017-03-15 12:50:41 +0100112 x86_64-*x32|x86_64-x32-*)
H.J. Lub2a343f2017-10-25 04:36:49 -0700113 TARGET_X32=yes
Richard Henderson57f52482014-11-13 12:42:54 +0100114 TARGET=X86_64
115 ;;
116 *)
H.J. Lub2a343f2017-10-25 04:36:49 -0700117 echo 'int foo (void) { return __x86_64__; }' > conftest.c
118 if $CC $CFLAGS -Werror -S conftest.c -o conftest.s > /dev/null 2>&1; then
119 TARGET_X32=yes
120 TARGET=X86_64
121 else
122 TARGET=X86;
123 fi
124 rm -f conftest.*
Richard Henderson57f52482014-11-13 12:42:54 +0100125 ;;
126 esac
127 else
128 TARGET=X86_64;
129 fi
130 ;;
131
132 ia64*-*-*)
133 TARGET=IA64; TARGETDIR=ia64
Richard Henderson5d69d572014-11-13 13:50:39 +0100134 SOURCES="ffi.c unix.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100135 ;;
136
137 m32r*-*-*)
138 TARGET=M32R; TARGETDIR=m32r
Richard Henderson5d69d572014-11-13 13:50:39 +0100139 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100140 ;;
141
142 m68k-*-*)
143 TARGET=M68K; TARGETDIR=m68k
Richard Henderson5d69d572014-11-13 13:50:39 +0100144 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100145 ;;
146
147 m88k-*-*)
148 TARGET=M88K; TARGETDIR=m88k
Richard Henderson5d69d572014-11-13 13:50:39 +0100149 SOURCES="ffi.c obsd.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100150 ;;
151
152 microblaze*-*-*)
153 TARGET=MICROBLAZE; TARGETDIR=microblaze
Richard Henderson5d69d572014-11-13 13:50:39 +0100154 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100155 ;;
156
157 moxie-*-*)
158 TARGET=MOXIE; TARGETDIR=moxie
Richard Henderson5d69d572014-11-13 13:50:39 +0100159 SOURCES="ffi.c eabi.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100160 ;;
161
162 metag-*-*)
163 TARGET=METAG; TARGETDIR=metag
Richard Henderson5d69d572014-11-13 13:50:39 +0100164 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100165 ;;
166
167 mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
168 TARGET=MIPS; TARGETDIR=mips
169 ;;
170 mips*-*linux* | mips*-*-openbsd*)
171 # Support 128-bit long double for NewABI.
172 HAVE_LONG_DOUBLE='defined(__mips64)'
173 TARGET=MIPS; TARGETDIR=mips
174 ;;
175
176 nios2*-linux*)
177 TARGET=NIOS2; TARGETDIR=nios2
Richard Henderson5d69d572014-11-13 13:50:39 +0100178 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100179 ;;
180
Anthony Greenbbea6392019-11-18 13:06:26 -0500181 or1k*-*-*)
Richard Henderson57f52482014-11-13 12:42:54 +0100182 TARGET=OR1K; TARGETDIR=or1k
Richard Henderson5d69d572014-11-13 13:50:39 +0100183 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100184 ;;
185
186 powerpc*-*-linux* | powerpc-*-sysv*)
187 TARGET=POWERPC; TARGETDIR=powerpc
188 HAVE_LONG_DOUBLE_VARIANT=1
189 ;;
190 powerpc-*-amigaos*)
191 TARGET=POWERPC; TARGETDIR=powerpc
192 ;;
193 powerpc-*-beos*)
194 TARGET=POWERPC; TARGETDIR=powerpc
195 ;;
196 powerpc-*-darwin* | powerpc64-*-darwin*)
197 TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
198 ;;
199 powerpc-*-aix* | rs6000-*-aix*)
200 TARGET=POWERPC_AIX; TARGETDIR=powerpc
201 ;;
Thomas Klausner6c535772015-01-29 12:32:28 +0100202 powerpc-*-freebsd* | powerpc-*-openbsd* | powerpc-*-netbsd*)
Richard Henderson57f52482014-11-13 12:42:54 +0100203 TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
204 HAVE_LONG_DOUBLE_VARIANT=1
205 ;;
206 powerpc64-*-freebsd*)
207 TARGET=POWERPC; TARGETDIR=powerpc
208 ;;
209 powerpc*-*-rtems*)
210 TARGET=POWERPC; TARGETDIR=powerpc
211 ;;
212
Stef O'Rear3840d492018-03-11 05:55:15 -0700213 riscv*-*)
214 TARGET=RISCV; TARGETDIR=riscv
215 SOURCES="ffi.c sysv.S"
216 ;;
217
Richard Henderson57f52482014-11-13 12:42:54 +0100218 s390-*-* | s390x-*-*)
219 TARGET=S390; TARGETDIR=s390
Richard Henderson5d69d572014-11-13 13:50:39 +0100220 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100221 ;;
222
Richard Hendersone46842b2015-01-13 07:23:48 -0800223 sh-*-* | sh[34]*-*-*)
Richard Henderson57f52482014-11-13 12:42:54 +0100224 TARGET=SH; TARGETDIR=sh
Richard Henderson5d69d572014-11-13 13:50:39 +0100225 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100226 ;;
227 sh64-*-* | sh5*-*-*)
228 TARGET=SH64; TARGETDIR=sh64
Richard Henderson5d69d572014-11-13 13:50:39 +0100229 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100230 ;;
231
232 sparc*-*-*)
233 TARGET=SPARC; TARGETDIR=sparc
Richard Henderson5d69d572014-11-13 13:50:39 +0100234 SOURCES="ffi.c ffi64.c v8.S v9.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100235 ;;
236
237 tile*-*)
238 TARGET=TILE; TARGETDIR=tile
Richard Henderson5d69d572014-11-13 13:50:39 +0100239 SOURCES="ffi.c tile.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100240 ;;
241
242 vax-*-*)
243 TARGET=VAX; TARGETDIR=vax
Richard Henderson5d69d572014-11-13 13:50:39 +0100244 SOURCES="ffi.c elfbsd.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100245 ;;
246
247 xtensa*-*)
248 TARGET=XTENSA; TARGETDIR=xtensa
Richard Henderson5d69d572014-11-13 13:50:39 +0100249 SOURCES="ffi.c sysv.S"
Richard Henderson57f52482014-11-13 12:42:54 +0100250 ;;
251esac
Richard Henderson5d69d572014-11-13 13:50:39 +0100252
253# ... but some of the cases above share configury.
254case "${TARGET}" in
Paul Monsondb5706f2019-04-26 04:58:58 -0700255 ARM_WIN32)
256 SOURCES="ffi.c sysv_msvc_arm32.S"
257 ;;
Paul Monsonc2a68592019-08-07 11:57:45 -0700258 ARM_WIN64)
259 SOURCES="ffi.c win64_armasm.S"
260 ;;
Richard Henderson5d69d572014-11-13 13:50:39 +0100261 MIPS)
262 SOURCES="ffi.c o32.S n32.S"
263 ;;
264 POWERPC)
265 SOURCES="ffi.c ffi_sysv.c ffi_linux64.c sysv.S ppc_closure.S"
266 SOURCES="${SOURCES} linux64.S linux64_closure.S"
267 ;;
268 POWERPC_AIX)
269 SOURCES="ffi_darwin.c aix.S aix_closure.S"
270 ;;
271 POWERPC_DARWIN)
272 SOURCES="ffi_darwin.c darwin.S darwin_closure.S"
273 ;;
274 POWERPC_FREEBSD)
275 SOURCES="ffi.c ffi_sysv.c sysv.S ppc_closure.S"
276 ;;
Richard Henderson9f112612014-11-22 20:02:43 +0100277 X86 | X86_DARWIN | X86_FREEBSD | X86_WIN32)
Paul Monsone1118af2019-02-19 03:58:25 -0800278 if test "$MSVC" = 1; then
279 SOURCES="ffi.c sysv_intel.S"
280 else
281 SOURCES="ffi.c sysv.S"
282 fi
Richard Henderson5d69d572014-11-13 13:50:39 +0100283 ;;
284 X86_64)
H.J. Lub2a343f2017-10-25 04:36:49 -0700285 if test x"$TARGET_X32" = xyes; then
286 SOURCES="ffi64.c unix64.S"
287 else
288 SOURCES="ffi64.c unix64.S ffiw64.c win64.S"
289 fi
Richard Henderson5d69d572014-11-13 13:50:39 +0100290 ;;
291 X86_WIN64)
Ramón García Fernández1e0d1072017-01-08 20:12:59 +0100292 if test "$MSVC" = 1; then
293 SOURCES="ffiw64.c win64_intel.S"
294 else
295 SOURCES="ffiw64.c win64.S"
296 fi
Richard Henderson5d69d572014-11-13 13:50:39 +0100297 ;;
Richard Henderson5d69d572014-11-13 13:50:39 +0100298esac
299
300# If we failed to configure SOURCES, we can't do anything.
301if test -z "${SOURCES}"; then
302 UNSUPPORTED=1
303fi