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