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