]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/ppc/configure.ac
8635d8f6bf39f6f917fa3b861f7cd3597ae32177
[thirdparty/binutils-gdb.git] / sim / ppc / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)dnl
3 AC_INIT(Makefile.in)
4 sinclude(../common/acinclude.m4)
5
6 AC_PROG_INSTALL
7 AC_PROG_CC
8
9 # Put a plausible default for CC_FOR_BUILD in Makefile.
10 if test "x$cross_compiling" = "xno"; then
11 CC_FOR_BUILD='$(CC)'
12 else
13 CC_FOR_BUILD=gcc
14 fi
15 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
16
17 dnl We don't use gettext, but bfd does. So we do the appropriate checks
18 dnl to see if there are intl libraries we should link against.
19 ALL_LINGUAS=
20 ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
21
22
23 AC_ARG_ENABLE(sim-alignment,
24 [ --enable-sim-alignment=align Specify strict or nonstrict alignment.],
25 [case "${enableval}" in
26 yes | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
27 no | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
28 0 | default | DEFAULT) sim_alignment="-DWITH_ALIGNMENT=0";;
29 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
30 esac
31 if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
32 echo "Setting alignment flags = $sim_alignment" 6>&1
33 fi],[sim_alignment=""])dnl
34
35
36 AC_MSG_CHECKING([whether to enable sim asserts])
37 sim_assert="1"
38 AC_ARG_ENABLE(sim-assert,
39 [ --enable-sim-assert Specify whether to perform random assertions.],
40 [case "${enableval}" in
41 yes) sim_assert="1";;
42 no) sim_assert="0";;
43 *) AC_MSG_ERROR([--enable-sim-assert does not take a value]);;
44 esac])dnl
45 AC_DEFINE_UNQUOTED([WITH_ASSERT], [$sim_assert], [Sim assert settings])
46 AC_MSG_RESULT($sim_assert)
47
48
49 AC_ARG_ENABLE(sim-bitsize,
50 [ --enable-sim-bitsize=n Specify target bitsize (32 or 64).],
51 [case "${enableval}" in
52 32|64) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";;
53 *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64"); sim_bitsize="";;
54 esac
55 if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
56 echo "Setting bitsize flags = $sim_bitsize" 6>&1
57 fi],[sim_bitsize=""])dnl
58
59
60 AC_ARG_ENABLE(sim-config,
61 [ --enable-sim-config=file Override default config file],
62 [case "${enableval}" in
63 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-config=file");;
64 *) if test -f "${srcdir}/${enableval}"; then
65 sim_config="${enableval}";
66 elif test -f "${srcdir}/${enableval}-config.h"; then
67 sim_config="${enableval}-config.h"
68 else
69 AC_MSG_ERROR("Config file $enableval was not found");
70 sim_config=std-config.h
71 fi;;
72 esac
73 if test x"$silent" != x"yes" && test x"$sim_config" != x""; then
74 echo "Setting config flags = $sim_config" 6>&1
75 fi],[sim_config="std-config.h"
76 if test x"$silent" != x"yes"; then
77 echo "Setting config flags = $sim_config" 6>&1
78 fi])dnl
79
80
81 AC_ARG_ENABLE(sim-decode-mechanism,
82 [ --enable-sim-decode-mechanism=which Specify the instruction decode mechanism.],
83 [case "${enableval}" in
84 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-decode-mechanism=file");;
85 array|switch|padded-switch|goto-switch) sim_decode_mechanism="-T ${enableval}";;
86 *) AC_MSG_ERROR("File $enableval is not an opcode rules file");
87 sim_decode_mechanism="switch";;
88 esac
89 if test x"$silent" != x"yes" && test x"$sim_decode_mechanism" != x""; then
90 echo "Setting decode mechanism flags = $sim_decode_mechanism" 6>&1
91 fi],[sim_decode_mechanism=""
92 if test x"$silent" != x"yes"; then
93 echo "Setting decode mechanism flags = $sim_decode_mechanism"
94 fi])dnl
95
96
97 AC_ARG_ENABLE(sim-default-model,
98 [ --enable-sim-default-model=which Specify default PowerPC to model.],
99 [case "${enableval}" in
100 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-default-model=model");;
101 *) sim_default_model="-DWITH_DEFAULT_MODEL=${enableval}";;
102 esac
103 if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
104 echo "Setting default-model flags = $sim_default_model" 6>&1
105 fi],[sim_default_model=""])dnl
106
107
108 AC_ARG_ENABLE(sim-duplicate,
109 [ --enable-sim-duplicate Expand (duplicate) semantic functions.],
110 [case "${enableval}" in
111 yes) sim_dup="-E";;
112 no) sim_dup="";;
113 *) AC_MSG_ERROR("--enable-sim-duplicate does not take a value"); sim_dup="";;
114 esac
115 if test x"$silent" != x"yes" && test x"$sim_dup" != x""; then
116 echo "Setting duplicate flags = $sim_dup" 6>&1
117 fi],[sim_dup="-E"
118 if test x"$silent" != x"yes"; then
119 echo "Setting duplicate flags = $sim_dup" 6>&1
120 fi])dnl
121
122
123 AC_ARG_ENABLE(sim-endian,
124 [ --enable-sim-endian=endian Specify target byte endian orientation.],
125 [case "${enableval}" in
126 yes) case "$target" in
127 *powerpc-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
128 *powerpcle-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
129 *) echo "Unknown target $target" 1>&6; sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
130 esac;;
131 no) sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
132 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
133 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
134 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
135 esac
136 if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
137 echo "Setting endian flags = $sim_endian" 6>&1
138 fi],[sim_endian=""])dnl
139
140
141 AC_MSG_CHECKING([default sim environment setting])
142 sim_env="0"
143 AC_ARG_ENABLE(sim-env,
144 [ --enable-sim-env=env Specify target environment (operating, virtual, user).],
145 [case "${enableval}" in
146 operating | os | oea) sim_env="OPERATING_ENVIRONMENT";;
147 virtual | vea) sim_env="VIRTUAL_ENVIRONMENT";;
148 user | uea) sim_env="USER_ENVIRONMENT";;
149 no) sim_env="0";;
150 *) AC_MSG_ERROR([Unknown value $enableval passed to --enable-sim-env]);;
151 esac])dnl
152 AC_DEFINE_UNQUOTED([WITH_ENVIRONMENT], [$sim_env], [Sim default environment])
153 AC_MSG_RESULT($sim_env)
154
155
156 AC_ARG_ENABLE(sim-filter,
157 [ --enable-sim-filter=rule Specify filter rules.],
158 [case "${enableval}" in
159 yes) AC_MSG_ERROR("--enable-sim-filter must be specified with a rule to filter or no"); sim_filter="";;
160 no) sim_filter="";;
161 *) sim_filter="-F $enableval";;
162 esac
163 if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then
164 echo "Setting filter flags = $sim_filter" 6>&1
165 fi],[sim_filter="-F 32,f,o"
166 if test x"$silent" != x"yes"; then
167 echo "Setting filter flags = $sim_filter" 6>&1
168 fi])dnl
169
170
171 AC_ARG_ENABLE(sim-float,
172 [ --enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point.],
173 [case "${enableval}" in
174 yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
175 no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
176 altivec) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
177 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
178 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
179 esac
180 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
181 echo "Setting float flags = $sim_float" 6>&1
182 fi],[
183 case "${target}" in
184 *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
185 *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
186 *) sim_float=""
187 esac
188 ])dnl
189
190 AC_CACHE_CHECK([if union semun defined],
191 ac_cv_HAS_UNION_SEMUN,
192 [AC_TRY_COMPILE([
193 #include <sys/types.h>
194 #include <sys/ipc.h>
195 #include <sys/sem.h>],
196 [union semun arg ;],
197 [ac_cv_has_union_semun="yes"],
198 [ac_cv_has_union_semun="no"])
199 AC_MSG_RESULT($ac_cv_has_union_semun)
200 ])
201
202
203 if test "$ac_cv_has_union_semun" = "yes"; then
204 AC_CACHE_CHECK(whether System V semaphores are supported,
205 ac_cv_sysv_sem,
206 [
207 AC_TRY_RUN(
208 [
209 #include <sys/types.h>
210 #include <sys/ipc.h>
211 #include <sys/sem.h>
212 int main () {
213 union semun arg ;
214
215 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
216 if (id == -1)
217 exit(1);
218 arg.val = 0; /* avoid implicit type cast to union */
219 if (semctl(id, 0, IPC_RMID, arg) == -1)
220 exit(1);
221 exit(0);
222 }
223 ],
224 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
225 ])
226 else # semun is not defined
227 AC_CACHE_CHECK(whether System V semaphores are supported,
228 ac_cv_sysv_sem,
229 [
230 AC_TRY_RUN(
231 [
232 #include <sys/types.h>
233 #include <sys/ipc.h>
234 #include <sys/sem.h>
235 union semun {
236 int val;
237 struct semid_ds *buf;
238 ushort *array;
239 };
240 int main () {
241 union semun arg ;
242
243 int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
244 if (id == -1)
245 exit(1);
246 arg.val = 0; /* avoid implicit type cast to union */
247 if (semctl(id, 0, IPC_RMID, arg) == -1)
248 exit(1);
249 exit(0);
250 }
251 ],
252 ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
253 ])
254 fi
255
256 AC_CACHE_CHECK(whether System V shared memory is supported,
257 ac_cv_sysv_shm,
258 [
259 AC_TRY_RUN([
260 #include <sys/types.h>
261 #include <sys/ipc.h>
262 #include <sys/shm.h>
263 int main () {
264 int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
265 if (id == -1)
266 exit(1);
267 if (shmctl(id, IPC_RMID, 0) == -1)
268 exit(1);
269 exit(0);
270 }
271 ],
272 ac_cv_sysv_shm="yes", ac_cv_sysv_shm="no", :)
273 ])
274
275 if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
276 sim_sysv_ipc_hw=",sem,shm";
277 else
278 sim_sysv_ipc_hw="";
279 fi
280
281 if test x"$ac_cv_has_union_semun" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
282 AC_DEFINE(HAVE_UNION_SEMUN, 1,
283 [Define if union semun is defined in <sys/sem.h>])
284 fi
285
286
287 AC_ARG_ENABLE(sim-hardware,
288 [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
289 [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
290 case "${enableval}" in
291 yes) ;;
292 no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
293 ,*) hardware="${hardware}${enableval}";;
294 *,) hardware="${enableval}${hardware}";;
295 *) hardware="${enableval}"'';;
296 esac
297 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
298 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
299 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
300 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
301 fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
302 sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
303 sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
304 if test x"$silent" != x"yes"; then
305 echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
306 fi])dnl
307
308 AC_ARG_ENABLE(sim-hostbitsize,
309 [ --enable-sim-hostbitsize=32|64 Specify host bitsize (32 or 64).],
310 [case "${enableval}" in
311 32|64) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
312 *) AC_MSG_ERROR("--enable-sim-hostbitsize was given $enableval. Expected 32 or 64"); sim_hostbitsize="";;
313 esac
314 if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
315 echo "Setting hostbitsize flags = $sim_hostbitsize" 6>&1
316 fi],[sim_hostbitsize=""])dnl
317
318
319 AC_ARG_ENABLE(sim-hostendian,
320 [ --enable-sim-hostendian=end Specify host byte endian orientation.],
321 [case "${enableval}" in
322 no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
323 b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
324 l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
325 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
326 esac
327 if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
328 echo "Setting hostendian flags = $sim_hostendian" 6>&1
329 fi],[
330 if test "x$cross_compiling" = "xno"; then
331 AC_C_BIGENDIAN
332 if test $ac_cv_c_bigendian = yes; then
333 sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
334 else
335 sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
336 fi
337 else
338 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
339 fi])dnl
340
341
342 AC_ARG_ENABLE(sim-icache,
343 [ --enable-sim-icache=size Specify instruction-decode cache size and type.],
344 [icache="-R"
345 case "${enableval}" in
346 yes) icache="1024"; sim_icache="-I $icache";;
347 no) sim_icache="-R";;
348 *) icache=1024
349 sim_icache="-"
350 for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do
351 case "$x" in
352 define) sim_icache="${sim_icache}R";;
353 semantic) sim_icache="${sim_icache}C";;
354 insn) sim_icache="${sim_icache}S";;
355 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;;
356 *) AC_MSG_ERROR("Unknown value $x for --enable-sim-icache"); sim_icache="";;
357 esac
358 done
359 sim_icache="${sim_icache}I $icache";;
360 esac
361 if test x"$silent" != x"yes" && test x"$icache" != x""; then
362 echo "Setting instruction cache size to $icache ($sim_icache)"
363 fi],[sim_icache="-CSRI 1024"
364 if test x"$silent" != x"yes"; then
365 echo "Setting instruction cache size to 1024 ($sim_icache)"
366 fi])dnl
367
368
369 AC_ARG_ENABLE(sim-inline,
370 [ --enable-sim-inline=inlines Specify which functions should be inlined.],
371 [sim_inline=""
372 case "$enableval" in
373 no) sim_inline="-DDEFAULT_INLINE=0";;
374 0) sim_inline="-DDEFAULT_INLINE=0";;
375 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
376 1) sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS";;
377 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
378 new_flag=""
379 case "$x" in
380 *_INLINE=*) new_flag="-D$x";;
381 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
382 *_INLINE) new_flag="-D$x=ALL_INLINE";;
383 *) new_flag="-D$x""_INLINE=ALL_INLINE";;
384 esac
385 if test x"$sim_inline" = x""; then
386 sim_inline="$new_flag"
387 else
388 sim_inline="$sim_inline $new_flag"
389 fi
390 done;;
391 esac
392 if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
393 echo "Setting inline flags = $sim_inline" 6>&1
394 fi],[if test x"$GCC" != ""; then
395 sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS"
396 if test x"$silent" != x"yes"; then
397 echo "Setting inline flags = $sim_inline" 6>&1
398 fi
399 else
400 sim_inline=""
401 fi])dnl
402
403
404 AC_ARG_ENABLE(sim-jump,
405 [ --enable-sim-jump Jump between semantic code (instead of call/return).],
406 [case "${enableval}" in
407 yes) sim_jump="-J";;
408 no) sim_jump="";;
409 *) AC_MSG_ERROR("--enable-sim-jump does not take a value"); sim_jump="";;
410 esac
411 if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then
412 echo "Setting jump flag = $sim_jump" 6>&1
413 fi],[sim_jump=""
414 if test x"$silent" != x"yes"; then
415 echo "Setting jump flag = $sim_jump" 6>&1
416 fi])dnl
417
418
419 AC_ARG_ENABLE(sim-line-nr,
420 [ --enable-sim-line-nr=opts Generate extra CPP code that references source rather than generated code],
421 [case "${enableval}" in
422 yes) sim_line_nr="";;
423 no) sim_line_nr="-L";;
424 *) AC_MSG_ERROR("--enable-sim-line-nr does not take a value"); sim_line_nr="";;
425 esac
426 if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then
427 echo "Setting warning flags = $sim_line_nr" 6>&1
428 fi],[sim_line_nr=""])dnl
429
430
431 AC_ARG_ENABLE(sim-model,
432 [ --enable-sim-model=which Specify PowerPC to model.],
433 [case "${enableval}" in
434 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-model=model");;
435 *) sim_model="-DWITH_MODEL=${enableval}";;
436 esac
437 if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
438 echo "Setting model flags = $sim_model" 6>&1
439 fi],[sim_model=""])dnl
440
441
442 AC_ARG_ENABLE(sim-model-issue,
443 [ --enable-sim-model-issue Specify whether to simulate model specific actions],
444 [case "${enableval}" in
445 yes) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_PROCESS";;
446 no) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_IGNORE";;
447 *) AC_MSG_ERROR("--enable-sim-model-issue does not take a value"); sim_model_issue="";;
448 esac
449 if test x"$silent" != x"yes"; then
450 echo "Setting model-issue flags = $sim_model_issue" 6>&1
451 fi],[sim_model_issue=""])dnl
452
453
454 AC_ARG_ENABLE(sim-monitor,
455 [ --enable-sim-monitor=mon Specify whether to enable monitoring events.],
456 [case "${enableval}" in
457 yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";;
458 no) sim_monitor="-DWITH_MON=0";;
459 instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
460 memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
461 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon"); sim_env="";;
462 esac
463 if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
464 echo "Setting monitor flags = $sim_monitor" 6>&1
465 fi],[sim_monitor=""])dnl
466
467
468 AC_ARG_ENABLE(sim-opcode,
469 [ --enable-sim-opcode=which Override default opcode lookup.],
470 [case "${enableval}" in
471 yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-opcode=file");;
472 *) if test -f "${srcdir}/${enableval}"; then
473 sim_opcode="${enableval}"
474 elif test -f "${srcdir}/dc-${enableval}"; then
475 sim_opcode="dc-${enableval}"
476 else
477 AC_MSG_ERROR("File $enableval is not an opcode rules file");
478 sim_opcode="dc-complex"
479 fi;;
480 esac
481 if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
482 echo "Setting opcode flags = $sim_opcode" 6>&1
483 fi],[sim_opcode="dc-complex"
484 if test x"$silent" != x"yes"; then
485 echo "Setting opcode flags = $sim_opcode"
486 fi])dnl
487
488
489 AC_ARG_ENABLE(sim-packages,
490 [ --enable-sim-packages=list Specify the packages to be included in the build.],
491 [packages=disklabel
492 case "${enableval}" in
493 yes) ;;
494 no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
495 ,*) packages="${packages}${enableval}";;
496 *,) packages="${enableval}${packages}";;
497 *) packages="${enableval}"'';;
498 esac
499 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
500 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
501 if test x"$silent" != x"yes" && test x"$packages" != x""; then
502 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
503 fi],[packages=disklabel
504 sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
505 sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
506 if test x"$silent" != x"yes"; then
507 echo "Setting packages to $sim_pk_src, $sim_pk_obj"
508 fi])dnl
509
510
511 AC_ARG_ENABLE(sim-reserved-bits,
512 [ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
513 [case "${enableval}" in
514 yes) sim_reserved="-DWITH_RESERVED_BITS=1";;
515 no) sim_reserved="-DWITH_RESERVED_BITS=0";;
516 *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved="";;
517 esac
518 if test x"$silent" != x"yes" && test x"$sim_reserved" != x""; then
519 echo "Setting reserved flags = $sim_reserved" 6>&1
520 fi],[sim_reserved=""])dnl
521
522
523 AC_ARG_ENABLE(sim-smp,
524 [ --enable-sim-smp=n Specify number of processors to configure for.],
525 [case "${enableval}" in
526 yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
527 no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
528 *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
529 esac
530 if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
531 echo "Setting smp flags = $sim_smp" 6>&1
532 fi],[sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5"
533 if test x"$silent" != x"yes"; then
534 echo "Setting smp flags = $sim_smp" 6>&1
535 fi])dnl
536
537
538 AC_MSG_CHECKING([for sim stdio debug behavior])
539 sim_stdio=0
540 AC_ARG_ENABLE(sim-stdio,
541 [ --enable-sim-stdio Specify whether to use stdio for console input/output.],
542 [case "${enableval}" in
543 yes) sim_stdio="DO_USE_STDIO";;
544 no) sim_stdio="DONT_USE_STDIO";;
545 *) AC_MSG_ERROR([Unknown value $enableval passed to --enable-sim-stdio]);;
546 esac])dnl
547 AC_DEFINE_UNQUOTED([WITH_STDIO], [$sim_stdio], [How to route I/O])
548 AC_MSG_RESULT($sim_stdio)
549
550
551 AC_ARG_ENABLE(sim-switch,
552 [ --enable-sim-switch Use a switch instead of a table for instruction call.],
553 [case "${enableval}" in
554 yes) sim_switch="-s";;
555 no) sim_switch="";;
556 *) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";;
557 esac
558 if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
559 echo "Setting switch flags = $sim_switch" 6>&1
560 fi],[sim_switch="";
561 if test x"$silent" != x"yes"; then
562 echo "Setting switch flags = $sim_switch" 6>&1
563 fi])dnl
564
565
566 AC_ARG_ENABLE(sim-timebase,
567 [ --enable-sim-timebase Specify whether the PPC timebase is supported.],
568 [case "${enableval}" in
569 yes) sim_timebase="-DWITH_TIME_BASE=1";;
570 no) sim_timebase="-DWITH_TIME_BASE=0";;
571 *) AC_MSG_ERROR("--enable-sim-timebase does not take a value"); sim_timebase="";;
572 esac
573 if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
574 echo "Setting timebase flags = $sim_timebase" 6>&1
575 fi],[sim_timebase=""])dnl
576
577
578 AC_MSG_CHECKING([for sim trace settings])
579 sim_trace="1"
580 AC_ARG_ENABLE(sim-trace,
581 [ --enable-sim-trace Specify whether tracing is supported.],
582 [case "${enableval}" in
583 yes) sim_trace="1";;
584 no) sim_trace="0";;
585 *) AC_MSG_ERROR([--enable-sim-trace does not take a value]);;
586 esac])dnl
587 AC_DEFINE_UNQUOTED([WITH_TRACE], [$sim_trace], [Sim trace settings])
588 AC_MSG_RESULT($sim_trace)
589
590
591 AC_ARG_ENABLE(sim-warnings,
592 [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o],
593 [case "${enableval}" in
594 yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
595 no) sim_warnings="-w";;
596 *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
597 esac
598 if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
599 echo "Setting warning flags = $sim_warnings" 6>&1
600 fi],[sim_warnings=""])dnl
601
602
603 AC_ARG_ENABLE(sim-xor-endian,
604 [ --enable-sim-xor-endian=n Specify number bytes involved in PowerPC XOR bi-endian mode (default 8).],
605 [case "${enableval}" in
606 yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
607 no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
608 *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
609 esac
610 if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
611 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
612 fi],[sim_xor_endian=""])dnl
613
614
615 ACX_PKGVERSION([GDB])
616 ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
617 AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
618 AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
619
620 AC_CANONICAL_SYSTEM
621 AC_ARG_PROGRAM
622
623 # BFD conditionally uses zlib, so we must link it in if libbfd does, by
624 # using the same condition.
625 AM_ZLIB
626
627 # BFD uses libdl when when plugins enabled.
628 AC_PLUGINS
629
630 . ${srcdir}/../../bfd/configure.host
631
632 case ${host} in
633 *mingw32*)
634 AC_DEFINE(USE_WIN32API, 1,
635 [Define if we should use the Windows API, instead of the
636 POSIX API. On Windows, we use the Windows API when
637 building for MinGW, but the POSIX API when building
638 for Cygwin.])
639 ;;
640 esac
641
642 AC_CONFIG_HEADER(config.h:config.in)
643
644 AC_STRUCT_ST_BLKSIZE
645 AC_STRUCT_ST_BLOCKS
646 AC_STRUCT_ST_RDEV
647 AC_STRUCT_TIMEZONE
648
649 AC_TYPE_GETGROUPS
650 AC_TYPE_MODE_T
651 AC_TYPE_OFF_T
652 AC_TYPE_PID_T
653 AC_TYPE_SIGNAL
654 AC_TYPE_SIZE_T
655 AC_TYPE_UID_T
656
657 AC_CHECK_FUNCS(access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink)
658
659 AC_CHECK_HEADERS(fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h sys/vfs.h sys/statfs.h)
660 AC_HEADER_DIRENT
661
662 dnl Figure out what type of termio/termios support there is
663 sim_termio=""
664 AC_MSG_CHECKING(for struct termios)
665 AC_CACHE_VAL(ac_cv_termios_struct,
666 [AC_TRY_COMPILE([#include <sys/types.h>
667 #include <sys/termios.h>],
668 [static struct termios x;
669 x.c_iflag = 0;
670 x.c_oflag = 0;
671 x.c_cflag = 0;
672 x.c_lflag = 0;
673 x.c_cc[NCCS] = 0;],
674 ac_cv_termios_struct=yes, ac_cv_termios_struct=no)])
675 AC_MSG_RESULT($ac_cv_termios_struct)
676 if test $ac_cv_termios_struct = yes; then
677 sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE"
678 fi
679
680 if test "$ac_cv_termios_struct" = "yes"; then
681 AC_MSG_CHECKING(for c_line field in struct termios)
682 AC_CACHE_VAL(ac_cv_termios_cline,
683 [AC_TRY_COMPILE([#include <sys/types.h>
684 #include <sys/termios.h>],
685 [static struct termios x; x.c_line = 0;],
686 ac_cv_termios_cline=yes, ac_cv_termios_cline=no)])
687
688 AC_MSG_RESULT($ac_cv_termios_cline)
689 if test $ac_cv_termios_cline = yes; then
690 sim_termio="$sim_termio -DHAVE_TERMIOS_CLINE"
691 fi
692 else
693 ac_cv_termios_cline=no
694 fi
695
696 if test "$ac_cv_termios_struct" != "yes"; then
697 AC_MSG_CHECKING(for struct termio)
698 AC_CACHE_VAL(ac_cv_termio_struct,
699 [AC_TRY_COMPILE([#include <sys/types.h>
700 #include <sys/termio.h>],
701 [static struct termio x;
702 x.c_iflag = 0;
703 x.c_oflag = 0;
704 x.c_cflag = 0;
705 x.c_lflag = 0;
706 x.c_cc[NCC] = 0;],
707 ac_cv_termio_struct=yes, ac_cv_termio_struct=no)])
708 AC_MSG_RESULT($ac_cv_termio_struct)
709 if test $ac_cv_termio_struct = yes; then
710 sim_termio="$sim_termio -DHAVE_TERMIO_STRUCTURE"
711 fi
712 else
713 ac_cv_termio_struct=no
714 fi
715
716 if test "$ac_cv_termio_struct" = "yes"; then
717 AC_MSG_CHECKING(for c_line field in struct termio)
718 AC_CACHE_VAL(ac_cv_termio_cline,
719 [AC_TRY_COMPILE([#include <sys/types.h>
720 #include <sys/termio.h>],
721 [static struct termio x; x.c_line = 0;],
722 ac_cv_termio_cline=yes, ac_cv_termio_cline=no)])
723
724 AC_MSG_RESULT($ac_cv_termio_cline)
725 if test $ac_cv_termio_cline = yes; then
726 sim_termio="$sim_termio -DHAVE_TERMIO_CLINE"
727 fi
728 else
729 ac_cv_termio_cline=no
730 fi
731
732 dnl Check for struct statfs
733 AC_MSG_CHECKING(for struct statfs)
734 AC_CACHE_VAL(ac_cv_struct_statfs,
735 [AC_TRY_COMPILE([#include <sys/types.h>
736 #ifdef HAVE_SYS_PARAM_H
737 #include <sys/param.h>
738 #endif
739 #ifdef HAVE_SYS_MOUNT_H
740 #include <sys/mount.h>
741 #endif
742 #ifdef HAVE_SYS_VFS_H
743 #include <sys/vfs.h>
744 #endif
745 #ifdef HAVE_SYS_STATFS_H
746 #include <sys/statfs.h>
747 #endif],
748 [static struct statfs s;],
749 ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
750 AC_MSG_RESULT($ac_cv_struct_statfs)
751 if test $ac_cv_struct_statfs = yes; then
752 AC_DEFINE(HAVE_STRUCT_STATFS, 1,
753 [Define if struct statfs is defined in <sys/mount.h>])
754 fi
755
756 AC_CHECK_TYPES(long long)
757
758 dnl Figure out if /dev/zero exists or not
759 sim_devzero=""
760 AC_MSG_CHECKING(for /dev/zero)
761 AC_CACHE_VAL(ac_cv_devzero,
762 [AC_TRY_RUN([#include <fcntl.h>
763 main () {
764 char buf[2048];
765 int i;
766 int fd = open ("/dev/zero", O_RDONLY);
767 if (fd < 0)
768 return 1;
769 for (i = 0; i < sizeof (buf); i++)
770 buf[i] = 1;
771 if (read (fd, buf, sizeof (buf)) != sizeof (buf))
772 return 1;
773 for (i = 0; i < sizeof (buf); i++)
774 if (buf[i])
775 return 1;
776 return 0;
777 }],[ac_cv_devzero=yes],[ac_cv_devzero=no],[ac_cv_devzero=no])])
778 AC_MSG_RESULT($ac_cv_devzero)
779 if test $ac_cv_devzero = yes; then
780 sim_devzero="-DHAVE_DEVZERO"
781 else
782 sim_devzero=""
783 fi
784
785 dnl Figure out if we are in the new Cygnus tree with a common directory or not
786 AC_MSG_CHECKING(for common simulator directory)
787 if test -f "${srcdir}/../common/callback.c"; then
788 AC_MSG_RESULT(yes)
789 sim_callback="callback.o targ-map.o"
790 sim_targ_vals="targ-vals.h targ-map.c targ-vals.def"
791 else
792 AC_MSG_RESULT(no)
793 sim_callback=""
794 sim_targ_vals=""
795 fi
796
797 AC_MSG_CHECKING(for common simulator directory fpu implementation)
798 if test -f "${srcdir}/../common/sim-fpu.c"; then
799 AC_MSG_RESULT(yes)
800 sim_fpu_cflags="-DHAVE_COMMON_FPU -I../common -I${srcdir}/../common"
801 sim_fpu="sim-fpu.o"
802 else
803 AC_MSG_RESULT(no)
804 sim_fpu_cflags=
805 sim_fpu=
806 fi
807
808 # Since we run commands on the build system, we have to create a
809 # separate config header for the build system if build != host.
810 if test x$host = x$build; then
811 AC_CONFIG_COMMANDS([build-config.h],[cp config.h build-config.h])
812 else
813 tempdir=build.$$
814 rm -rf $tempdir
815 mkdir $tempdir
816 cd $tempdir
817 case ${srcdir} in
818 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
819 *) realsrcdir=../${srcdir};;
820 esac
821 saved_CFLAGS="${CFLAGS}"
822 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
823 LDFLAGS="${LDFLAGS_FOR_BUILD}" \
824 ${realsrcdir}/configure \
825 --enable-languages=${enable_languages-all} \
826 --target=$target_alias --host=$build_alias --build=$build_alias
827 CFLAGS="${saved_CFLAGS}"
828 mv config.h ../build-config.h
829 cd ..
830 rm -rf $tempdir
831 fi
832
833 dnl Check for exe extension
834 AC_EXEEXT
835
836 AC_SUBST(CC_FOR_BUILD)
837 AC_SUBST(CFLAGS_FOR_BUILD)
838 AC_SUBST(CFLAGS)
839 AC_SUBST(HDEFINES)
840 AR=${AR-ar}
841 AC_SUBST(AR)
842 AC_PROG_RANLIB
843 AC_SUBST(sim_warnings)
844 AC_SUBST(sim_line_nr)
845 AC_SUBST(sim_config)
846 AC_SUBST(sim_opcode)
847 AC_SUBST(sim_switch)
848 AC_SUBST(sim_dup)
849 AC_SUBST(sim_decode_mechanism)
850 AC_SUBST(sim_jump)
851 AC_SUBST(sim_filter)
852 AC_SUBST(sim_icache)
853 AC_SUBST(sim_hw_src)
854 AC_SUBST(sim_hw_obj)
855 AC_SUBST(sim_pk_src)
856 AC_SUBST(sim_pk_obj)
857 AC_SUBST(sim_inline)
858 AC_SUBST(sim_endian)
859 AC_SUBST(sim_xor_endian)
860 AC_SUBST(sim_hostendian)
861 AC_SUBST(sim_smp)
862 AC_SUBST(sim_igen_smp)
863 AC_SUBST(sim_bitsize)
864 AC_SUBST(sim_hostbitsize)
865 AC_SUBST(sim_timebase)
866 AC_SUBST(sim_alignment)
867 AC_SUBST(sim_float)
868 AC_SUBST(sim_reserved)
869 AC_SUBST(sim_monitor)
870 AC_SUBST(sim_model)
871 AC_SUBST(sim_default_model)
872 AC_SUBST(sim_model_issue)
873 AC_SUBST(sim_termio)
874 AC_SUBST(sim_devzero)
875 AC_SUBST(sim_callback)
876 AC_SUBST(sim_targ_vals)
877 AC_SUBST(sim_fpu_cflags)
878 AC_SUBST(sim_fpu)
879
880 AC_OUTPUT(Makefile,
881 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])