Enable generation of GNU stack notes on Linux
[official-gcc.git] / libffi / configure.host
blob9d73f18ee8cb0bfce30457e87661b675db48f6dd
1 # configure.host
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...
8 case "${host}" in
9   aarch64*-*-cygwin* | aarch64*-*-mingw* | aarch64*-*-win* )
10         TARGET=ARM_WIN64; TARGETDIR=aarch64
11         if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then
12           MSVC=1
13         fi
14         ;;
16   aarch64*-*-*)
17         TARGET=AARCH64; TARGETDIR=aarch64
18         SOURCES="ffi.c sysv.S"
19         ;;
21   alpha*-*-*)
22         TARGET=ALPHA; TARGETDIR=alpha;
23         # Support 128-bit long double, changeable via command-line switch.
24         HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)'
25         SOURCES="ffi.c osf.S"
26         ;;
28   arc*-*-*)
29         TARGET=ARC; TARGETDIR=arc
30         SOURCES="ffi.c arcompact.S"
31         ;;
33   arm*-*-cygwin* | arm*-*-mingw* | arm*-*-win* )
34         TARGET=ARM_WIN32; TARGETDIR=arm
35         if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then
36           MSVC=1
37         fi
38         ;;
40   arm*-*-*)
41         TARGET=ARM; TARGETDIR=arm
42         SOURCES="ffi.c sysv.S"
43         ;;
45   avr32*-*-*)
46         TARGET=AVR32; TARGETDIR=avr32
47         SOURCES="ffi.c sysv.S"
48         ;;
50   bfin*)
51         TARGET=BFIN; TARGETDIR=bfin
52         SOURCES="ffi.c sysv.S"
53         ;;
55   cris-*-*)
56         TARGET=LIBFFI_CRIS; TARGETDIR=cris
57         SOURCES="ffi.c sysv.S"
58         ;;
60   csky-*-*)
61         TARGET=CSKY; TARGETDIR=csky
62         SOURCES="ffi.c sysv.S"
63         ;;
65   frv-*-*)
66         TARGET=FRV; TARGETDIR=frv
67         SOURCES="ffi.c eabi.S"
68         ;;
70   hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*)
71         TARGET=PA_LINUX; TARGETDIR=pa
72         SOURCES="ffi.c linux.S"
73         ;;
74   hppa*64-*-hpux*)
75         TARGET=PA64_HPUX; TARGETDIR=pa
76         ;;
77   hppa*-*-hpux*)
78         TARGET=PA_HPUX; TARGETDIR=pa
79         SOURCES="ffi.c hpux32.S"
80         ;;
82   i?86-*-freebsd* | i?86-*-openbsd*)
83         TARGET=X86_FREEBSD; TARGETDIR=x86
84         ;;
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* )
88         TARGETDIR=x86
89         if test $ac_cv_sizeof_size_t = 4; then
90           TARGET=X86_WIN32
91         else
92           TARGET=X86_WIN64
93         fi
94         if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then
95           MSVC=1
96         fi
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)"';
103         else
104           AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"';
105         fi
106         ;;
108   i?86-*-darwin* | x86_64-*-darwin* | i?86-*-ios | x86_64-*-ios)
109         TARGETDIR=x86
110         if test $ac_cv_sizeof_size_t = 4; then
111           TARGET=X86_DARWIN
112         else
113           TARGET=X86_64
114         fi
115         ;;
117   i?86-*-* | x86_64-*-* | amd64-*)
118         TARGETDIR=x86
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
122             TARGET_X32=yes
123             TARGET=X86_64
124           else
125             TARGET=X86;
126           fi
127           rm -f conftest.*
128         else
129           TARGET=X86_64;
130         fi
131         ;;
133   ia64*-*-*)
134         TARGET=IA64; TARGETDIR=ia64
135         SOURCES="ffi.c unix.S"
136         ;;
138   kvx-*-*)
139         TARGET=KVX; TARGETDIR=kvx
140         SOURCES="ffi.c sysv.S"
141         ;;
143   loongarch64-*-*)
144         TARGET=LOONGARCH64; TARGETDIR=loongarch64
145         SOURCES="ffi.c sysv.S"
146         ;;
148   m32r*-*-*)
149         TARGET=M32R; TARGETDIR=m32r
150         SOURCES="ffi.c sysv.S"
151         ;;
153   m68k-*-*)
154         TARGET=M68K; TARGETDIR=m68k
155         SOURCES="ffi.c sysv.S"
156         ;;
158   m88k-*-*)
159         TARGET=M88K; TARGETDIR=m88k
160         SOURCES="ffi.c obsd.S"
161         ;;
163   microblaze*-*-*)
164         TARGET=MICROBLAZE; TARGETDIR=microblaze
165         SOURCES="ffi.c sysv.S"
166         ;;
168   moxie-*-*)
169         TARGET=MOXIE; TARGETDIR=moxie
170         SOURCES="ffi.c eabi.S"
171         ;;
173   metag-*-*)
174         TARGET=METAG; TARGETDIR=metag
175         SOURCES="ffi.c sysv.S"
176         ;;
178   mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
179         TARGET=MIPS; TARGETDIR=mips
180         ;;
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
185         ;;
187   nios2*-linux*)
188         TARGET=NIOS2; TARGETDIR=nios2
189         SOURCES="ffi.c sysv.S"
190         ;;
192   or1k*-*-*)
193         TARGET=OR1K; TARGETDIR=or1k
194         SOURCES="ffi.c sysv.S"
195         ;;
197   powerpc*-*-linux* | powerpc-*-sysv*)
198         TARGET=POWERPC; TARGETDIR=powerpc
199         HAVE_LONG_DOUBLE_VARIANT=1
200         ;;
201   powerpc-*-amigaos*)
202         TARGET=POWERPC; TARGETDIR=powerpc
203         ;;
204   powerpc-*-eabi*)
205         TARGET=POWERPC; TARGETDIR=powerpc
206         ;;
207   powerpc-*-beos*)
208         TARGET=POWERPC; TARGETDIR=powerpc
209         ;;
210   powerpc-*-darwin* | powerpc64-*-darwin*)
211         TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
212         ;;
213   powerpc-*-aix* | rs6000-*-aix*)
214         TARGET=POWERPC_AIX; TARGETDIR=powerpc
215         ;;
216   powerpc-*-freebsd* | powerpc-*-openbsd* | powerpc-*-netbsd*)
217         TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
218         HAVE_LONG_DOUBLE_VARIANT=1
219         ;;
220   powerpcspe-*-freebsd*)
221         TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
222         CFLAGS="$CFLAGS -D__NO_FPRS__"
223         ;;
224   powerpc64-*-freebsd* | powerpc64le-*-freebsd*)
225         TARGET=POWERPC; TARGETDIR=powerpc
226         ;;
227   powerpc*-*-rtems*)
228         TARGET=POWERPC; TARGETDIR=powerpc
229         ;;
231   riscv*-*)
232         TARGET=RISCV; TARGETDIR=riscv
233         SOURCES="ffi.c sysv.S"
234         ;;
236   s390-*-* | s390x-*-*)
237         TARGET=S390; TARGETDIR=s390
238         SOURCES="ffi.c sysv.S"
239         ;;
241   sh-*-* | sh[34]*-*-*)
242         TARGET=SH; TARGETDIR=sh
243         SOURCES="ffi.c sysv.S"
244         ;;
245   sh64-*-* | sh5*-*-*)
246         TARGET=SH64; TARGETDIR=sh64
247         SOURCES="ffi.c sysv.S"
248         ;;
250   sparc*-*-*)
251         TARGET=SPARC; TARGETDIR=sparc
252         SOURCES="ffi.c ffi64.c v8.S v9.S"
253         ;;
255   tile*-*)
256         TARGET=TILE; TARGETDIR=tile
257         SOURCES="ffi.c tile.S"
258         ;;
260   vax-*-*)
261         TARGET=VAX; TARGETDIR=vax
262         SOURCES="ffi.c elfbsd.S"
263         ;;
265   xtensa*-*)
266         TARGET=XTENSA; TARGETDIR=xtensa
267         SOURCES="ffi.c sysv.S"
268         ;;
269 esac
271 # ... but some of the cases above share configury.
272 case "${TARGET}" in
273   ARM_WIN32)
274         if test "$MSVC" = 1; then
275                 SOURCES="ffi.c sysv_msvc_arm32.S"
276         else
277                 SOURCES="ffi.c sysv.S"
278         fi
279         ;;
280   ARM_WIN64)
281         if test "$MSVC" = 1; then
282                 SOURCES="ffi.c win64_armasm.S"
283         else
284                 SOURCES="ffi.c sysv.S"
285         fi
286         ;;
287   MIPS)
288         SOURCES="ffi.c o32.S n32.S"
289         ;;
290   POWERPC)
291         SOURCES="ffi.c ffi_sysv.c ffi_linux64.c sysv.S ppc_closure.S"
292         SOURCES="${SOURCES} linux64.S linux64_closure.S"
293         ;;
294   POWERPC_AIX)
295         SOURCES="ffi_darwin.c aix.S aix_closure.S"
296         ;;
297   POWERPC_DARWIN)
298         SOURCES="ffi_darwin.c darwin.S darwin_closure.S"
299         ;;
300   POWERPC_FREEBSD)
301         SOURCES="ffi.c ffi_sysv.c sysv.S ppc_closure.S"
302         ;;
303   X86 | X86_DARWIN | X86_FREEBSD | X86_WIN32)
304         if test "$MSVC" = 1; then
305                 SOURCES="ffi.c sysv_intel.S"
306         else
307                 SOURCES="ffi.c sysv.S"
308         fi
309         ;;
310   X86_64)
311         if test x"$TARGET_X32" = xyes; then
312                 SOURCES="ffi64.c unix64.S"
313         else
314                 SOURCES="ffi64.c unix64.S ffiw64.c win64.S"
315         fi
316         ;;
317   X86_WIN64)
318         if test "$MSVC" = 1; then
319                 SOURCES="ffiw64.c win64_intel.S"
320         else
321                 SOURCES="ffiw64.c win64.S"
322         fi
323         ;;
324 esac
326 # If we failed to configure SOURCES, we can't do anything.
327 if test -z "${SOURCES}"; then
328   UNSUPPORTED=1