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