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