]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/ppc/configure.ac
sim: unify -Werror build settings
[thirdparty/binutils-gdb.git] / sim / ppc / configure.ac
CommitLineData
c906108c 1dnl Process this file with autoconf to produce a configure script.
c906108c 2AC_INIT(Makefile.in)
760b3e8b 3AC_CONFIG_MACRO_DIRS([../.. ../../config])
c906108c
SS
4
5AC_PROG_INSTALL
6AC_PROG_CC
7
8# Put a plausible default for CC_FOR_BUILD in Makefile.
9if test "x$cross_compiling" = "xno"; then
10 CC_FOR_BUILD='$(CC)'
11else
12 CC_FOR_BUILD=gcc
13fi
4b164edf 14CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
c906108c
SS
15
16dnl We don't use gettext, but bfd does. So we do the appropriate checks
17dnl to see if there are intl libraries we should link against.
18ALL_LINGUAS=
29035cbe 19ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
c906108c
SS
20
21
c906108c
SS
22AC_ARG_ENABLE(sim-bitsize,
23[ --enable-sim-bitsize=n Specify target bitsize (32 or 64).],
24[case "${enableval}" in
25 32|64) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";;
26 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64"); sim_bitsize="";;
27esac
28if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
29 echo "Setting bitsize flags = $sim_bitsize" 6>&1
30fi],[sim_bitsize=""])dnl
31
32
c906108c
SS
33AC_ARG_ENABLE(sim-config,
34[ --enable-sim-config=file Override default config file],
35[case "${enableval}" in
36 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-config=file");;
37 *) if test -f "${srcdir}/${enableval}"; then
38 sim_config="${enableval}";
39 elif test -f "${srcdir}/${enableval}-config.h"; then
40 sim_config="${enableval}-config.h"
41 else
42 AC_MSG_ERROR("Config file $enableval was not found");
43 sim_config=std-config.h
44 fi;;
45esac
46if test x"$silent" != x"yes" && test x"$sim_config" != x""; then
47 echo "Setting config flags = $sim_config" 6>&1
48fi],[sim_config="std-config.h"
49if test x"$silent" != x"yes"; then
50 echo "Setting config flags = $sim_config" 6>&1
51fi])dnl
52
53
54AC_ARG_ENABLE(sim-decode-mechanism,
55[ --enable-sim-decode-mechanism=which Specify the instruction decode mechanism.],
56[case "${enableval}" in
57 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-decode-mechanism=file");;
58 array|switch|padded-switch|goto-switch) sim_decode_mechanism="-T ${enableval}";;
59 *) AC_MSG_ERROR("File $enableval is not an opcode rules file");
60 sim_decode_mechanism="switch";;
61esac
62if test x"$silent" != x"yes" && test x"$sim_decode_mechanism" != x""; then
63 echo "Setting decode mechanism flags = $sim_decode_mechanism" 6>&1
64fi],[sim_decode_mechanism=""
65if test x"$silent" != x"yes"; then
66 echo "Setting decode mechanism flags = $sim_decode_mechanism"
67fi])dnl
68
69
70AC_ARG_ENABLE(sim-default-model,
71[ --enable-sim-default-model=which Specify default PowerPC to model.],
72[case "${enableval}" in
73 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-default-model=model");;
74 *) sim_default_model="-DWITH_DEFAULT_MODEL=${enableval}";;
75esac
76if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
77 echo "Setting default-model flags = $sim_default_model" 6>&1
78fi],[sim_default_model=""])dnl
79
80
81AC_ARG_ENABLE(sim-duplicate,
82[ --enable-sim-duplicate Expand (duplicate) semantic functions.],
83[case "${enableval}" in
84 yes) sim_dup="-E";;
85 no) sim_dup="";;
86 *) AC_MSG_ERROR("--enable-sim-duplicate does not take a value"); sim_dup="";;
87esac
88if test x"$silent" != x"yes" && test x"$sim_dup" != x""; then
89 echo "Setting duplicate flags = $sim_dup" 6>&1
90fi],[sim_dup="-E"
91if test x"$silent" != x"yes"; then
92 echo "Setting duplicate flags = $sim_dup" 6>&1
93fi])dnl
94
95
c906108c
SS
96AC_ARG_ENABLE(sim-filter,
97[ --enable-sim-filter=rule Specify filter rules.],
98[case "${enableval}" in
99 yes) AC_MSG_ERROR("--enable-sim-filter must be specified with a rule to filter or no"); sim_filter="";;
100 no) sim_filter="";;
101 *) sim_filter="-F $enableval";;
102esac
103if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then
104 echo "Setting filter flags = $sim_filter" 6>&1
105fi],[sim_filter="-F 32,f,o"
106if test x"$silent" != x"yes"; then
107 echo "Setting filter flags = $sim_filter" 6>&1
108fi])dnl
109
110
111AC_ARG_ENABLE(sim-float,
345d88d9 112[ --enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point.],
c906108c
SS
113[case "${enableval}" in
114 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
115 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
345d88d9
AC
116 altivec) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
117 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
c906108c
SS
118 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
119esac
120if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
121 echo "Setting float flags = $sim_float" 6>&1
345d88d9
AC
122fi],[
123case "${target}" in
124 *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
125 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
126 *) sim_float=""
127esac
128])dnl
c906108c 129
00a0b122
JS
130AC_CACHE_CHECK([if union semun defined],
131 ac_cv_HAS_UNION_SEMUN,
132 [AC_TRY_COMPILE([
133#include <sys/types.h>
134#include <sys/ipc.h>
135#include <sys/sem.h>],
136[union semun arg ;],
137[ac_cv_has_union_semun="yes"],
138[ac_cv_has_union_semun="no"])
139AC_MSG_RESULT($ac_cv_has_union_semun)
140])
141
142
143if test "$ac_cv_has_union_semun" = "yes"; then
144 AC_CACHE_CHECK(whether System V semaphores are supported,
145 ac_cv_sysv_sem,
146 [
147 AC_TRY_RUN(
148 [
149 #include <sys/types.h>
150 #include <sys/ipc.h>
151 #include <sys/sem.h>
152 int main () {
153 union semun arg ;
154
155 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
156 if (id == -1)
157 exit(1);
158 arg.val = 0; /* avoid implicit type cast to union */
159 if (semctl(id, 0, IPC_RMID, arg) == -1)
160 exit(1);
161 exit(0);
162 }
163 ],
164 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
165 ])
166else # semun is not defined
167 AC_CACHE_CHECK(whether System V semaphores are supported,
168 ac_cv_sysv_sem,
169 [
170 AC_TRY_RUN(
171 [
172 #include <sys/types.h>
173 #include <sys/ipc.h>
174 #include <sys/sem.h>
175 union semun {
176 int val;
177 struct semid_ds *buf;
178 ushort *array;
179 };
180 int main () {
181 union semun arg ;
182
183 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
184 if (id == -1)
185 exit(1);
186 arg.val = 0; /* avoid implicit type cast to union */
187 if (semctl(id, 0, IPC_RMID, arg) == -1)
188 exit(1);
189 exit(0);
190 }
191 ],
192 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
193 ])
194fi
195
196AC_CACHE_CHECK(whether System V shared memory is supported,
197ac_cv_sysv_shm,
198[
199AC_TRY_RUN([
200#include <sys/types.h>
201#include <sys/ipc.h>
202#include <sys/shm.h>
203int main () {
204 int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
205 if (id == -1)
206 exit(1);
207 if (shmctl(id, IPC_RMID, 0) == -1)
208 exit(1);
209 exit(0);
210}
211],
212ac_cv_sysv_shm="yes", ac_cv_sysv_shm="no", :)
213])
214
215if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
216 sim_sysv_ipc_hw=",sem,shm";
217else
218 sim_sysv_ipc_hw="";
219fi
220
221if test x"$ac_cv_has_union_semun" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
bf0275b1
DE
222 AC_DEFINE(HAVE_UNION_SEMUN, 1,
223 [Define if union semun is defined in <sys/sem.h>])
00a0b122
JS
224fi
225
c906108c
SS
226
227AC_ARG_ENABLE(sim-hardware,
228[ --enable-sim-hardware=list Specify the hardware to be included in the build.],
00a0b122 229[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
c906108c
SS
230case "${enableval}" in
231 yes) ;;
232 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
233 ,*) hardware="${hardware}${enableval}";;
234 *,) hardware="${enableval}${hardware}";;
235 *) hardware="${enableval}"'';;
236esac
237sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
238sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
239if test x"$silent" != x"yes" && test x"$hardware" != x""; then
240 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
00a0b122 241fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
c906108c
SS
242sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
243sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
244if test x"$silent" != x"yes"; then
245 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
246fi])dnl
247
c906108c
SS
248AC_ARG_ENABLE(sim-hostbitsize,
249[ --enable-sim-hostbitsize=32|64 Specify host bitsize (32 or 64).],
250[case "${enableval}" in
251 32|64) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
252 *) AC_MSG_ERROR("--enable-sim-hostbitsize was given $enableval. Expected 32 or 64"); sim_hostbitsize="";;
253esac
254if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
255 echo "Setting hostbitsize flags = $sim_hostbitsize" 6>&1
256fi],[sim_hostbitsize=""])dnl
257
258
c906108c
SS
259AC_ARG_ENABLE(sim-icache,
260[ --enable-sim-icache=size Specify instruction-decode cache size and type.],
261[icache="-R"
262 case "${enableval}" in
263 yes) icache="1024"; sim_icache="-I $icache";;
264 no) sim_icache="-R";;
265 *) icache=1024
266 sim_icache="-"
267 for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do
268 case "$x" in
269 define) sim_icache="${sim_icache}R";;
270 semantic) sim_icache="${sim_icache}C";;
271 insn) sim_icache="${sim_icache}S";;
272 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;;
273 *) AC_MSG_ERROR("Unknown value $x for --enable-sim-icache"); sim_icache="";;
274 esac
275 done
276 sim_icache="${sim_icache}I $icache";;
277esac
278if test x"$silent" != x"yes" && test x"$icache" != x""; then
279 echo "Setting instruction cache size to $icache ($sim_icache)"
280fi],[sim_icache="-CSRI 1024"
281if test x"$silent" != x"yes"; then
282 echo "Setting instruction cache size to 1024 ($sim_icache)"
283fi])dnl
284
285
286AC_ARG_ENABLE(sim-inline,
287[ --enable-sim-inline=inlines Specify which functions should be inlined.],
288[sim_inline=""
289case "$enableval" in
290 no) sim_inline="-DDEFAULT_INLINE=0";;
291 0) sim_inline="-DDEFAULT_INLINE=0";;
292 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
d29d5195 293 1) sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS";;
c906108c
SS
294 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
295 new_flag=""
296 case "$x" in
297 *_INLINE=*) new_flag="-D$x";;
298 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
299 *_INLINE) new_flag="-D$x=ALL_INLINE";;
300 *) new_flag="-D$x""_INLINE=ALL_INLINE";;
301 esac
302 if test x"$sim_inline" = x""; then
303 sim_inline="$new_flag"
304 else
305 sim_inline="$sim_inline $new_flag"
306 fi
307 done;;
308esac
309if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
310 echo "Setting inline flags = $sim_inline" 6>&1
311fi],[if test x"$GCC" != ""; then
d29d5195 312 sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS"
c906108c
SS
313 if test x"$silent" != x"yes"; then
314 echo "Setting inline flags = $sim_inline" 6>&1
315 fi
316else
317 sim_inline=""
318fi])dnl
319
320
321AC_ARG_ENABLE(sim-jump,
322[ --enable-sim-jump Jump between semantic code (instead of call/return).],
323[case "${enableval}" in
324 yes) sim_jump="-J";;
325 no) sim_jump="";;
326 *) AC_MSG_ERROR("--enable-sim-jump does not take a value"); sim_jump="";;
327esac
328if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then
329 echo "Setting jump flag = $sim_jump" 6>&1
330fi],[sim_jump=""
331if test x"$silent" != x"yes"; then
332 echo "Setting jump flag = $sim_jump" 6>&1
333fi])dnl
334
335
336AC_ARG_ENABLE(sim-line-nr,
337[ --enable-sim-line-nr=opts Generate extra CPP code that references source rather than generated code],
338[case "${enableval}" in
339 yes) sim_line_nr="";;
340 no) sim_line_nr="-L";;
341 *) AC_MSG_ERROR("--enable-sim-line-nr does not take a value"); sim_line_nr="";;
342esac
343if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then
344 echo "Setting warning flags = $sim_line_nr" 6>&1
345fi],[sim_line_nr=""])dnl
346
347
348AC_ARG_ENABLE(sim-model,
349[ --enable-sim-model=which Specify PowerPC to model.],
350[case "${enableval}" in
351 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-model=model");;
352 *) sim_model="-DWITH_MODEL=${enableval}";;
353esac
354if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
355 echo "Setting model flags = $sim_model" 6>&1
356fi],[sim_model=""])dnl
357
358
359AC_ARG_ENABLE(sim-model-issue,
360[ --enable-sim-model-issue Specify whether to simulate model specific actions],
361[case "${enableval}" in
362 yes) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_PROCESS";;
363 no) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_IGNORE";;
364 *) AC_MSG_ERROR("--enable-sim-model-issue does not take a value"); sim_model_issue="";;
365esac
366if test x"$silent" != x"yes"; then
367 echo "Setting model-issue flags = $sim_model_issue" 6>&1
368fi],[sim_model_issue=""])dnl
369
370
371AC_ARG_ENABLE(sim-monitor,
372[ --enable-sim-monitor=mon Specify whether to enable monitoring events.],
373[case "${enableval}" in
374 yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";;
375 no) sim_monitor="-DWITH_MON=0";;
376 instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
377 memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
5629cf2b 378 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon");;
c906108c
SS
379esac
380if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
381 echo "Setting monitor flags = $sim_monitor" 6>&1
382fi],[sim_monitor=""])dnl
383
384
385AC_ARG_ENABLE(sim-opcode,
386[ --enable-sim-opcode=which Override default opcode lookup.],
387[case "${enableval}" in
388 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-opcode=file");;
389 *) if test -f "${srcdir}/${enableval}"; then
390 sim_opcode="${enableval}"
391 elif test -f "${srcdir}/dc-${enableval}"; then
392 sim_opcode="dc-${enableval}"
393 else
394 AC_MSG_ERROR("File $enableval is not an opcode rules file");
395 sim_opcode="dc-complex"
396 fi;;
397esac
398if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
399 echo "Setting opcode flags = $sim_opcode" 6>&1
400fi],[sim_opcode="dc-complex"
401if test x"$silent" != x"yes"; then
402 echo "Setting opcode flags = $sim_opcode"
403fi])dnl
404
405
406AC_ARG_ENABLE(sim-packages,
407[ --enable-sim-packages=list Specify the packages to be included in the build.],
408[packages=disklabel
409case "${enableval}" in
410 yes) ;;
411 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
412 ,*) packages="${packages}${enableval}";;
413 *,) packages="${enableval}${packages}";;
414 *) packages="${enableval}"'';;
415esac
416sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
417sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
418if test x"$silent" != x"yes" && test x"$packages" != x""; then
419 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
420fi],[packages=disklabel
421sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
422sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
423if test x"$silent" != x"yes"; then
424 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
425fi])dnl
426
427
c906108c
SS
428AC_ARG_ENABLE(sim-reserved-bits,
429[ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
430[case "${enableval}" in
431 yes) sim_reserved="-DWITH_RESERVED_BITS=1";;
432 no) sim_reserved="-DWITH_RESERVED_BITS=0";;
433 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved="";;
434esac
435if test x"$silent" != x"yes" && test x"$sim_reserved" != x""; then
436 echo "Setting reserved flags = $sim_reserved" 6>&1
437fi],[sim_reserved=""])dnl
438
439
440AC_ARG_ENABLE(sim-smp,
441[ --enable-sim-smp=n Specify number of processors to configure for.],
442[case "${enableval}" in
443 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
444 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
445 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
446esac
447if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
448 echo "Setting smp flags = $sim_smp" 6>&1
449fi],[sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5"
450if test x"$silent" != x"yes"; then
451 echo "Setting smp flags = $sim_smp" 6>&1
452fi])dnl
453
454
c906108c
SS
455AC_ARG_ENABLE(sim-switch,
456[ --enable-sim-switch Use a switch instead of a table for instruction call.],
457[case "${enableval}" in
458 yes) sim_switch="-s";;
459 no) sim_switch="";;
460 *) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";;
461esac
462if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
463 echo "Setting switch flags = $sim_switch" 6>&1
464fi],[sim_switch="";
465if test x"$silent" != x"yes"; then
466 echo "Setting switch flags = $sim_switch" 6>&1
467fi])dnl
468
469
470AC_ARG_ENABLE(sim-timebase,
471[ --enable-sim-timebase Specify whether the PPC timebase is supported.],
472[case "${enableval}" in
473 yes) sim_timebase="-DWITH_TIME_BASE=1";;
474 no) sim_timebase="-DWITH_TIME_BASE=0";;
475 *) AC_MSG_ERROR("--enable-sim-timebase does not take a value"); sim_timebase="";;
476esac
477if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
478 echo "Setting timebase flags = $sim_timebase" 6>&1
479fi],[sim_timebase=""])dnl
480
481
c906108c
SS
482AC_ARG_ENABLE(sim-warnings,
483[ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o],
484[case "${enableval}" in
485 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
486 no) sim_warnings="-w";;
487 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
488esac
489if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
490 echo "Setting warning flags = $sim_warnings" 6>&1
491fi],[sim_warnings=""])dnl
492
493
494AC_ARG_ENABLE(sim-xor-endian,
495[ --enable-sim-xor-endian=n Specify number bytes involved in PowerPC XOR bi-endian mode (default 8).],
496[case "${enableval}" in
497 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
498 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
499 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
500esac
501if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
502 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
503fi],[sim_xor_endian=""])dnl
504
505
c906108c
SS
506AC_CANONICAL_SYSTEM
507AC_ARG_PROGRAM
508
35689115
HPN
509# BFD conditionally uses zlib, so we must link it in if libbfd does, by
510# using the same condition.
5912fadd 511AM_ZLIB
35689115 512
2974be62
AM
513# BFD uses libdl when when plugins enabled.
514AC_PLUGINS
515
058ad269
MM
516case ${host} in
517 *mingw32*)
518 AC_DEFINE(USE_WIN32API, 1,
519 [Define if we should use the Windows API, instead of the
520 POSIX API. On Windows, we use the Windows API when
521 building for MinGW, but the POSIX API when building
522 for Cygwin.])
523 ;;
524esac
525
c906108c
SS
526AC_CONFIG_HEADER(config.h:config.in)
527
c906108c
SS
528
529dnl Figure out what type of termio/termios support there is
530sim_termio=""
531AC_MSG_CHECKING(for struct termios)
532AC_CACHE_VAL(ac_cv_termios_struct,
533[AC_TRY_COMPILE([#include <sys/types.h>
534#include <sys/termios.h>],
535[static struct termios x;
536 x.c_iflag = 0;
537 x.c_oflag = 0;
538 x.c_cflag = 0;
539 x.c_lflag = 0;
540 x.c_cc[NCCS] = 0;],
541ac_cv_termios_struct=yes, ac_cv_termios_struct=no)])
542AC_MSG_RESULT($ac_cv_termios_struct)
543if test $ac_cv_termios_struct = yes; then
544 sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE"
545fi
546
547if test "$ac_cv_termios_struct" = "yes"; then
548 AC_MSG_CHECKING(for c_line field in struct termios)
549 AC_CACHE_VAL(ac_cv_termios_cline,
550 [AC_TRY_COMPILE([#include <sys/types.h>
551#include <sys/termios.h>],
552[static struct termios x; x.c_line = 0;],
553 ac_cv_termios_cline=yes, ac_cv_termios_cline=no)])
554
555 AC_MSG_RESULT($ac_cv_termios_cline)
556 if test $ac_cv_termios_cline = yes; then
557 sim_termio="$sim_termio -DHAVE_TERMIOS_CLINE"
558 fi
559else
560 ac_cv_termios_cline=no
561fi
562
563if test "$ac_cv_termios_struct" != "yes"; then
564 AC_MSG_CHECKING(for struct termio)
565 AC_CACHE_VAL(ac_cv_termio_struct,
566 [AC_TRY_COMPILE([#include <sys/types.h>
567#include <sys/termio.h>],
568[static struct termio x;
569 x.c_iflag = 0;
570 x.c_oflag = 0;
571 x.c_cflag = 0;
572 x.c_lflag = 0;
573 x.c_cc[NCC] = 0;],
574ac_cv_termio_struct=yes, ac_cv_termio_struct=no)])
575 AC_MSG_RESULT($ac_cv_termio_struct)
576 if test $ac_cv_termio_struct = yes; then
577 sim_termio="$sim_termio -DHAVE_TERMIO_STRUCTURE"
578 fi
579else
580 ac_cv_termio_struct=no
581fi
582
583if test "$ac_cv_termio_struct" = "yes"; then
584 AC_MSG_CHECKING(for c_line field in struct termio)
585 AC_CACHE_VAL(ac_cv_termio_cline,
586 [AC_TRY_COMPILE([#include <sys/types.h>
587#include <sys/termio.h>],
588[static struct termio x; x.c_line = 0;],
589 ac_cv_termio_cline=yes, ac_cv_termio_cline=no)])
590
591 AC_MSG_RESULT($ac_cv_termio_cline)
592 if test $ac_cv_termio_cline = yes; then
593 sim_termio="$sim_termio -DHAVE_TERMIO_CLINE"
594 fi
595else
596 ac_cv_termio_cline=no
597fi
598
1f362c96
AC
599dnl Check for struct statfs
600AC_MSG_CHECKING(for struct statfs)
601AC_CACHE_VAL(ac_cv_struct_statfs,
602[AC_TRY_COMPILE([#include <sys/types.h>
603#ifdef HAVE_SYS_PARAM_H
604#include <sys/param.h>
605#endif
606#ifdef HAVE_SYS_MOUNT_H
607#include <sys/mount.h>
608#endif
609#ifdef HAVE_SYS_VFS_H
610#include <sys/vfs.h>
611#endif
612#ifdef HAVE_SYS_STATFS_H
613#include <sys/statfs.h>
614#endif],
615[static struct statfs s;],
616ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
617AC_MSG_RESULT($ac_cv_struct_statfs)
618if test $ac_cv_struct_statfs = yes; then
619 AC_DEFINE(HAVE_STRUCT_STATFS, 1,
620 [Define if struct statfs is defined in <sys/mount.h>])
621fi
622
30e66173
MI
623AC_CHECK_TYPES(long long)
624
c906108c
SS
625dnl Figure out if /dev/zero exists or not
626sim_devzero=""
627AC_MSG_CHECKING(for /dev/zero)
628AC_CACHE_VAL(ac_cv_devzero,
629[AC_TRY_RUN([#include <fcntl.h>
630main () {
631 char buf[2048];
632 int i;
633 int fd = open ("/dev/zero", O_RDONLY);
634 if (fd < 0)
635 return 1;
636 for (i = 0; i < sizeof (buf); i++)
637 buf[i] = 1;
638 if (read (fd, buf, sizeof (buf)) != sizeof (buf))
639 return 1;
640 for (i = 0; i < sizeof (buf); i++)
641 if (buf[i])
642 return 1;
643 return 0;
644}],[ac_cv_devzero=yes],[ac_cv_devzero=no],[ac_cv_devzero=no])])
645AC_MSG_RESULT($ac_cv_devzero)
646if test $ac_cv_devzero = yes; then
647 sim_devzero="-DHAVE_DEVZERO"
648else
649 sim_devzero=""
650fi
651
652dnl Figure out if we are in the new Cygnus tree with a common directory or not
653AC_MSG_CHECKING(for common simulator directory)
654if test -f "${srcdir}/../common/callback.c"; then
655 AC_MSG_RESULT(yes)
656 sim_callback="callback.o targ-map.o"
657 sim_targ_vals="targ-vals.h targ-map.c targ-vals.def"
658else
659 AC_MSG_RESULT(no)
660 sim_callback=""
661 sim_targ_vals=""
662fi
663
d29d5195
MG
664AC_MSG_CHECKING(for common simulator directory fpu implementation)
665if test -f "${srcdir}/../common/sim-fpu.c"; then
666 AC_MSG_RESULT(yes)
3e5e53f9 667 sim_fpu_cflags="-DHAVE_COMMON_FPU -I../common -I${srcdir}/../common"
3a11ea24 668 sim_fpu="sim-fpu.o"
d29d5195
MG
669else
670 AC_MSG_RESULT(no)
671 sim_fpu_cflags=
672 sim_fpu=
673fi
674
68a3e151
NF
675# Since we run commands on the build system, we have to create a
676# separate config header for the build system if build != host.
677if test x$host = x$build; then
678 AC_CONFIG_COMMANDS([build-config.h],[cp config.h build-config.h])
679else
680 tempdir=build.$$
681 rm -rf $tempdir
682 mkdir $tempdir
683 cd $tempdir
684 case ${srcdir} in
685 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
686 *) realsrcdir=../${srcdir};;
687 esac
688 saved_CFLAGS="${CFLAGS}"
689 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
690 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
691 ${realsrcdir}/configure \
692 --enable-languages=${enable_languages-all} \
693 --target=$target_alias --host=$build_alias --build=$build_alias
694 CFLAGS="${saved_CFLAGS}"
695 mv config.h ../build-config.h
696 cd ..
697 rm -rf $tempdir
698fi
699
c906108c 700AC_SUBST(CC_FOR_BUILD)
4b164edf 701AC_SUBST(CFLAGS_FOR_BUILD)
c906108c 702AC_SUBST(CFLAGS)
c906108c
SS
703AR=${AR-ar}
704AC_SUBST(AR)
705AC_PROG_RANLIB
c906108c
SS
706AC_SUBST(sim_warnings)
707AC_SUBST(sim_line_nr)
708AC_SUBST(sim_config)
709AC_SUBST(sim_opcode)
710AC_SUBST(sim_switch)
711AC_SUBST(sim_dup)
712AC_SUBST(sim_decode_mechanism)
713AC_SUBST(sim_jump)
714AC_SUBST(sim_filter)
715AC_SUBST(sim_icache)
716AC_SUBST(sim_hw_src)
717AC_SUBST(sim_hw_obj)
718AC_SUBST(sim_pk_src)
719AC_SUBST(sim_pk_obj)
720AC_SUBST(sim_inline)
c906108c 721AC_SUBST(sim_xor_endian)
c906108c
SS
722AC_SUBST(sim_smp)
723AC_SUBST(sim_igen_smp)
724AC_SUBST(sim_bitsize)
725AC_SUBST(sim_hostbitsize)
c906108c 726AC_SUBST(sim_timebase)
c906108c 727AC_SUBST(sim_float)
c906108c
SS
728AC_SUBST(sim_reserved)
729AC_SUBST(sim_monitor)
730AC_SUBST(sim_model)
731AC_SUBST(sim_default_model)
732AC_SUBST(sim_model_issue)
c906108c
SS
733AC_SUBST(sim_termio)
734AC_SUBST(sim_devzero)
735AC_SUBST(sim_callback)
736AC_SUBST(sim_targ_vals)
d29d5195
MG
737AC_SUBST(sim_fpu_cflags)
738AC_SUBST(sim_fpu)
c906108c
SS
739
740AC_OUTPUT(Makefile,
741[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])