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