Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 1 | # 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 Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 7 | # Most of the time we can define all the variables all at once... |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 8 | case "${host}" in |
Paul Monson | c2a6859 | 2019-08-07 11:57:45 -0700 | [diff] [blame] | 9 | aarch64*-*-cygwin* | aarch64*-*-mingw* | aarch64*-*-win* ) |
| 10 | TARGET=ARM_WIN64; TARGETDIR=aarch64 |
| 11 | MSVC=1 |
| 12 | ;; |
| 13 | |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 14 | aarch64*-*-*) |
| 15 | TARGET=AARCH64; TARGETDIR=aarch64 |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 16 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 17 | ;; |
| 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 Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 23 | SOURCES="ffi.c osf.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 24 | ;; |
| 25 | |
| 26 | arc*-*-*) |
| 27 | TARGET=ARC; TARGETDIR=arc |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 28 | SOURCES="ffi.c arcompact.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 29 | ;; |
| 30 | |
Paul Monson | db5706f | 2019-04-26 04:58:58 -0700 | [diff] [blame] | 31 | arm*-*-cygwin* | arm*-*-mingw* | arm*-*-win* ) |
| 32 | TARGET=ARM_WIN32; TARGETDIR=arm |
| 33 | MSVC=1 |
| 34 | ;; |
| 35 | |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 36 | arm*-*-*) |
| 37 | TARGET=ARM; TARGETDIR=arm |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 38 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 39 | ;; |
| 40 | |
| 41 | avr32*-*-*) |
| 42 | TARGET=AVR32; TARGETDIR=avr32 |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 43 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 44 | ;; |
| 45 | |
| 46 | bfin*) |
| 47 | TARGET=BFIN; TARGETDIR=bfin |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 48 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 49 | ;; |
| 50 | |
| 51 | cris-*-*) |
| 52 | TARGET=LIBFFI_CRIS; TARGETDIR=cris |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 53 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 54 | ;; |
| 55 | |
| 56 | frv-*-*) |
| 57 | TARGET=FRV; TARGETDIR=frv |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 58 | SOURCES="ffi.c eabi.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 59 | ;; |
| 60 | |
| 61 | hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*) |
| 62 | TARGET=PA_LINUX; TARGETDIR=pa |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 63 | SOURCES="ffi.c linux.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 64 | ;; |
| 65 | hppa*64-*-hpux*) |
| 66 | TARGET=PA64_HPUX; TARGETDIR=pa |
| 67 | ;; |
| 68 | hppa*-*-hpux*) |
| 69 | TARGET=PA_HPUX; TARGETDIR=pa |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 70 | SOURCES="ffi.c hpux32.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 71 | ;; |
| 72 | |
| 73 | i?86-*-freebsd* | i?86-*-openbsd*) |
| 74 | TARGET=X86_FREEBSD; TARGETDIR=x86 |
| 75 | ;; |
| 76 | |
Michael Haubenwallner | 247a5e7 | 2019-11-22 20:17:58 +0100 | [diff] [blame] | 77 | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-win* | i?86-*-os2* | i?86-*-interix* \ |
Anthony Green | 69963d3 | 2017-03-19 07:33:39 -0400 | [diff] [blame] | 78 | | x86_64-*-cygwin* | x86_64-*-mingw* | x86_64-*-win* ) |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 79 | 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ández | 1e0d107 | 2017-01-08 20:12:59 +0100 | [diff] [blame] | 85 | if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then |
Anthony Green | 69963d3 | 2017-03-19 07:33:39 -0400 | [diff] [blame] | 86 | MSVC=1 |
Ramón García Fernández | 1e0d107 | 2017-01-08 20:12:59 +0100 | [diff] [blame] | 87 | fi |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 88 | # 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 Angermann | 50e408c | 2017-05-21 20:44:10 +0800 | [diff] [blame] | 99 | i?86-*-darwin* | x86_64-*-darwin* | i?86-*-ios | x86_64-*-ios) |
Richard Henderson | 9f11261 | 2014-11-22 20:02:43 +0100 | [diff] [blame] | 100 | 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 Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 106 | ;; |
| 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 Skala | 41185b5 | 2017-03-15 12:50:41 +0100 | [diff] [blame] | 112 | x86_64-*x32|x86_64-x32-*) |
H.J. Lu | b2a343f | 2017-10-25 04:36:49 -0700 | [diff] [blame] | 113 | TARGET_X32=yes |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 114 | TARGET=X86_64 |
| 115 | ;; |
| 116 | *) |
H.J. Lu | b2a343f | 2017-10-25 04:36:49 -0700 | [diff] [blame] | 117 | 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 Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 125 | ;; |
| 126 | esac |
| 127 | else |
| 128 | TARGET=X86_64; |
| 129 | fi |
| 130 | ;; |
| 131 | |
| 132 | ia64*-*-*) |
| 133 | TARGET=IA64; TARGETDIR=ia64 |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 134 | SOURCES="ffi.c unix.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 135 | ;; |
| 136 | |
| 137 | m32r*-*-*) |
| 138 | TARGET=M32R; TARGETDIR=m32r |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 139 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 140 | ;; |
| 141 | |
| 142 | m68k-*-*) |
| 143 | TARGET=M68K; TARGETDIR=m68k |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 144 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 145 | ;; |
| 146 | |
| 147 | m88k-*-*) |
| 148 | TARGET=M88K; TARGETDIR=m88k |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 149 | SOURCES="ffi.c obsd.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 150 | ;; |
| 151 | |
| 152 | microblaze*-*-*) |
| 153 | TARGET=MICROBLAZE; TARGETDIR=microblaze |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 154 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 155 | ;; |
| 156 | |
| 157 | moxie-*-*) |
| 158 | TARGET=MOXIE; TARGETDIR=moxie |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 159 | SOURCES="ffi.c eabi.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 160 | ;; |
| 161 | |
| 162 | metag-*-*) |
| 163 | TARGET=METAG; TARGETDIR=metag |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 164 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 165 | ;; |
| 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 Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 178 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 179 | ;; |
| 180 | |
Anthony Green | bbea639 | 2019-11-18 13:06:26 -0500 | [diff] [blame] | 181 | or1k*-*-*) |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 182 | TARGET=OR1K; TARGETDIR=or1k |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 183 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 184 | ;; |
| 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 Klausner | 6c53577 | 2015-01-29 12:32:28 +0100 | [diff] [blame] | 202 | powerpc-*-freebsd* | powerpc-*-openbsd* | powerpc-*-netbsd*) |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 203 | 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'Rear | 3840d49 | 2018-03-11 05:55:15 -0700 | [diff] [blame] | 213 | riscv*-*) |
| 214 | TARGET=RISCV; TARGETDIR=riscv |
| 215 | SOURCES="ffi.c sysv.S" |
| 216 | ;; |
| 217 | |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 218 | s390-*-* | s390x-*-*) |
| 219 | TARGET=S390; TARGETDIR=s390 |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 220 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 221 | ;; |
| 222 | |
Richard Henderson | e46842b | 2015-01-13 07:23:48 -0800 | [diff] [blame] | 223 | sh-*-* | sh[34]*-*-*) |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 224 | TARGET=SH; TARGETDIR=sh |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 225 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 226 | ;; |
| 227 | sh64-*-* | sh5*-*-*) |
| 228 | TARGET=SH64; TARGETDIR=sh64 |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 229 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 230 | ;; |
| 231 | |
| 232 | sparc*-*-*) |
| 233 | TARGET=SPARC; TARGETDIR=sparc |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 234 | SOURCES="ffi.c ffi64.c v8.S v9.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 235 | ;; |
| 236 | |
| 237 | tile*-*) |
| 238 | TARGET=TILE; TARGETDIR=tile |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 239 | SOURCES="ffi.c tile.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 240 | ;; |
| 241 | |
| 242 | vax-*-*) |
| 243 | TARGET=VAX; TARGETDIR=vax |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 244 | SOURCES="ffi.c elfbsd.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 245 | ;; |
| 246 | |
| 247 | xtensa*-*) |
| 248 | TARGET=XTENSA; TARGETDIR=xtensa |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 249 | SOURCES="ffi.c sysv.S" |
Richard Henderson | 57f5248 | 2014-11-13 12:42:54 +0100 | [diff] [blame] | 250 | ;; |
| 251 | esac |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 252 | |
| 253 | # ... but some of the cases above share configury. |
| 254 | case "${TARGET}" in |
Paul Monson | db5706f | 2019-04-26 04:58:58 -0700 | [diff] [blame] | 255 | ARM_WIN32) |
| 256 | SOURCES="ffi.c sysv_msvc_arm32.S" |
| 257 | ;; |
Paul Monson | c2a6859 | 2019-08-07 11:57:45 -0700 | [diff] [blame] | 258 | ARM_WIN64) |
| 259 | SOURCES="ffi.c win64_armasm.S" |
| 260 | ;; |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 261 | 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 Henderson | 9f11261 | 2014-11-22 20:02:43 +0100 | [diff] [blame] | 277 | X86 | X86_DARWIN | X86_FREEBSD | X86_WIN32) |
Paul Monson | e1118af | 2019-02-19 03:58:25 -0800 | [diff] [blame] | 278 | if test "$MSVC" = 1; then |
| 279 | SOURCES="ffi.c sysv_intel.S" |
| 280 | else |
| 281 | SOURCES="ffi.c sysv.S" |
| 282 | fi |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 283 | ;; |
| 284 | X86_64) |
H.J. Lu | b2a343f | 2017-10-25 04:36:49 -0700 | [diff] [blame] | 285 | 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 Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 290 | ;; |
| 291 | X86_WIN64) |
Ramón García Fernández | 1e0d107 | 2017-01-08 20:12:59 +0100 | [diff] [blame] | 292 | if test "$MSVC" = 1; then |
| 293 | SOURCES="ffiw64.c win64_intel.S" |
| 294 | else |
| 295 | SOURCES="ffiw64.c win64.S" |
| 296 | fi |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 297 | ;; |
Richard Henderson | 5d69d57 | 2014-11-13 13:50:39 +0100 | [diff] [blame] | 298 | esac |
| 299 | |
| 300 | # If we failed to configure SOURCES, we can't do anything. |
| 301 | if test -z "${SOURCES}"; then |
| 302 | UNSUPPORTED=1 |
| 303 | fi |