• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
7# Most of the time we can define all the variables all at once...
8case "${host}" in
9  aarch64*-*-cygwin* | aarch64*-*-mingw* | aarch64*-*-win* )
10	TARGET=ARM_WIN64; TARGETDIR=aarch64
11	MSVC=1
12	;;
13
14  aarch64*-*-*)
15	TARGET=AARCH64; TARGETDIR=aarch64
16	SOURCES="ffi.c sysv.S"
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__)'
23	SOURCES="ffi.c osf.S"
24	;;
25
26  arc*-*-*)
27	TARGET=ARC; TARGETDIR=arc
28	SOURCES="ffi.c arcompact.S"
29	;;
30
31  arm*-*-cygwin* | arm*-*-mingw* | arm*-*-win* )
32	TARGET=ARM_WIN32; TARGETDIR=arm
33	MSVC=1
34	;;
35
36  arm*-*-*)
37	TARGET=ARM; TARGETDIR=arm
38	SOURCES="ffi.c sysv.S"
39	;;
40
41  avr32*-*-*)
42	TARGET=AVR32; TARGETDIR=avr32
43	SOURCES="ffi.c sysv.S"
44	;;
45
46  bfin*)
47	TARGET=BFIN; TARGETDIR=bfin
48	SOURCES="ffi.c sysv.S"
49	;;
50
51  cris-*-*)
52	TARGET=LIBFFI_CRIS; TARGETDIR=cris
53	SOURCES="ffi.c sysv.S"
54	;;
55
56  frv-*-*)
57	TARGET=FRV; TARGETDIR=frv
58	SOURCES="ffi.c eabi.S"
59	;;
60
61  hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*)
62	TARGET=PA_LINUX; TARGETDIR=pa
63	SOURCES="ffi.c linux.S"
64	;;
65  hppa*64-*-hpux*)
66	TARGET=PA64_HPUX; TARGETDIR=pa
67	;;
68  hppa*-*-hpux*)
69	TARGET=PA_HPUX; TARGETDIR=pa
70	SOURCES="ffi.c hpux32.S"
71	;;
72
73  i?86-*-freebsd* | i?86-*-openbsd*)
74	TARGET=X86_FREEBSD; TARGETDIR=x86
75	;;
76
77  i?86-*-cygwin* | i?86-*-mingw* | i?86-*-win* | i?86-*-os2* | i?86-*-interix* \
78  | x86_64-*-cygwin* | x86_64-*-mingw* | x86_64-*-win* )
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
85	if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then
86	  MSVC=1
87	fi
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
99  i?86-*-darwin* | x86_64-*-darwin* | i?86-*-ios | x86_64-*-ios)
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
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
112	    x86_64-*x32|x86_64-x32-*)
113	      TARGET_X32=yes
114	      TARGET=X86_64
115	      ;;
116	    *)
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.*
125	      ;;
126          esac
127	else
128	  TARGET=X86_64;
129	fi
130	;;
131
132  ia64*-*-*)
133	TARGET=IA64; TARGETDIR=ia64
134	SOURCES="ffi.c unix.S"
135	;;
136
137  m32r*-*-*)
138	TARGET=M32R; TARGETDIR=m32r
139	SOURCES="ffi.c sysv.S"
140	;;
141
142  m68k-*-*)
143	TARGET=M68K; TARGETDIR=m68k
144	SOURCES="ffi.c sysv.S"
145	;;
146
147  m88k-*-*)
148	TARGET=M88K; TARGETDIR=m88k
149	SOURCES="ffi.c obsd.S"
150	;;
151
152  microblaze*-*-*)
153	TARGET=MICROBLAZE; TARGETDIR=microblaze
154	SOURCES="ffi.c sysv.S"
155	;;
156
157  moxie-*-*)
158	TARGET=MOXIE; TARGETDIR=moxie
159	SOURCES="ffi.c eabi.S"
160	;;
161
162  metag-*-*)
163	TARGET=METAG; TARGETDIR=metag
164	SOURCES="ffi.c sysv.S"
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
178	SOURCES="ffi.c sysv.S"
179	;;
180
181  or1k*-*-*)
182	TARGET=OR1K; TARGETDIR=or1k
183	SOURCES="ffi.c sysv.S"
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	;;
202  powerpc-*-freebsd* | powerpc-*-openbsd* | powerpc-*-netbsd*)
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
213  riscv*-*)
214	TARGET=RISCV; TARGETDIR=riscv
215	SOURCES="ffi.c sysv.S"
216	;;
217
218  s390-*-* | s390x-*-*)
219	TARGET=S390; TARGETDIR=s390
220	SOURCES="ffi.c sysv.S"
221	;;
222
223  sh-*-* | sh[34]*-*-*)
224	TARGET=SH; TARGETDIR=sh
225	SOURCES="ffi.c sysv.S"
226	;;
227  sh64-*-* | sh5*-*-*)
228	TARGET=SH64; TARGETDIR=sh64
229	SOURCES="ffi.c sysv.S"
230	;;
231
232  sparc*-*-*)
233	TARGET=SPARC; TARGETDIR=sparc
234	SOURCES="ffi.c ffi64.c v8.S v9.S"
235	;;
236
237  tile*-*)
238        TARGET=TILE; TARGETDIR=tile
239	SOURCES="ffi.c tile.S"
240        ;;
241
242  vax-*-*)
243	TARGET=VAX; TARGETDIR=vax
244	SOURCES="ffi.c elfbsd.S"
245	;;
246
247  xtensa*-*)
248	TARGET=XTENSA; TARGETDIR=xtensa
249	SOURCES="ffi.c sysv.S"
250	;;
251esac
252
253# ... but some of the cases above share configury.
254case "${TARGET}" in
255  ARM_WIN32)
256	SOURCES="ffi.c sysv_msvc_arm32.S"
257	;;
258  ARM_WIN64)
259	SOURCES="ffi.c win64_armasm.S"
260	;;
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	;;
277  X86 | X86_DARWIN | X86_FREEBSD | X86_WIN32)
278	if test "$MSVC" = 1; then
279		SOURCES="ffi.c sysv_intel.S"
280	else
281		SOURCES="ffi.c sysv.S"
282	fi
283	;;
284  X86_64)
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
290	;;
291  X86_WIN64)
292	if test "$MSVC" = 1; then
293		SOURCES="ffiw64.c win64_intel.S"
294	else
295		SOURCES="ffiw64.c win64.S"
296	fi
297	;;
298esac
299
300# If we failed to configure SOURCES, we can't do anything.
301if test -z "${SOURCES}"; then
302  UNSUPPORTED=1
303fi
304