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