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