]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/mips/configure.in
64231ed96124646ba19f8ba65229aa3953b0b162
[thirdparty/binutils-gdb.git] / sim / mips / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 sinclude(../common/aclocal.m4)
3 AC_PREREQ(2.5)dnl
4 AC_INIT(Makefile.in)
5
6 SIM_AC_COMMON
7
8 dnl Options available in this module
9 SIM_AC_OPTION_INLINE()
10 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
11 SIM_AC_OPTION_HOSTENDIAN
12 SIM_AC_OPTION_WARNINGS
13
14 # Ensure a reasonable default simulator is constructed: (DEPRECATED)
15 case "${target}" in
16 # start-sanitize-tx19
17 mips*tx19*) SIMCONF="-mips1 -mcpu=r1900 -mno-fp --warnings";;
18 # end-sanitize-tx19
19 # start-sanitize-tx49
20 mips*tx49*) SIMCONF="-mips3 --warnings -mcpu=r4900";;
21 # end-sanitize-tx49
22 # start-sanitize-r5900
23 mips64r59*-*-*) SIMCONF="-mips3 --warnings -mcpu=r5900";;
24 # end-sanitize-r5900
25 mips64vr4100-*-*) SIMCOMF="-mips0 -mcpu=r4100 -mgp64 --warnings" ;;
26 mips64*-*-*) SIMCONF="-mips0 --warnings";;
27 mips16*-*-*) SIMCONF="-mips0 --warnings";;
28 mips*-*-*) SIMCONF="-mips2 --warnings";;
29 *) SIMCONF="-mips0 --warnings";;
30 esac
31 AC_SUBST(SIMCONF)
32
33 # DEPRECATED
34 #
35 # Instead of defining a `subtarget' macro, code should be checking
36 # the value of {STATE,CPU}_ARCHITECTURE to identify the architecture
37 # in question.
38 #
39 case "${target}" in
40 # start-sanitize-tx19
41 mips*tx19*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
42 # end-sanitize-tx19
43 mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
44 *) SIM_SUBTARGET="";;
45 esac
46 AC_SUBST(SIM_SUBTARGET)
47
48
49
50 #
51 # Select the byte order of the target
52 #
53 mips_endian=
54 default_endian=
55 case "${target}" in
56 # start-sanitize-tx19
57 mips*tx19*) default_endian=BIG_ENDIAN ;;
58 # end-sanitize-tx19
59 # start-sanitize-r5900
60 mips64r59*-*-*) mips_endian=LITTLE_ENDIAN ;;
61 # end-sanitize-r5900
62 mips64el*-*-*) mips_endian=LITTLE_ENDIAN ;;
63 mips64*-*-*) default_endian=BIG_ENDIAN ;;
64 mips16*-*-*) default_endian=BIG_ENDIAN ;;
65 mips*-*-*) default_endian=BIG_ENDIAN ;;
66 *) default_endian=BIG_ENDIAN ;;
67 esac
68 SIM_AC_OPTION_ENDIAN($mips_endian,$default_endian)
69
70
71
72 #
73 # Select the bitsize of the target
74 #
75 mips_addr_bitsize=
76 case "${target}" in
77 # start-sanitize-tx19
78 mips*tx19*) mips_bitsize=32 ; mips_msb=31 ;;
79 # end-sanitize-tx19
80 # start-sanitize-r5900
81 mips64r59*-*-*) mips_bitsize=64 ; mips_msb=63 ; mips_addr_bitsize=32;;
82 # end-sanitize-r5900
83 # start-sanitize-sky
84 mips64*-sky*-*) mips_bitsize=64 ; mips_msb=63 ; mips_addr_bitsize=32;;
85 # end-sanitize-sky
86 mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
87 mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
88 mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
89 *) mips_bitsize=64 ; mips_msb=63 ;;
90 esac
91 SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
92
93
94
95 #
96 # Select the floating hardware support of the target
97 #
98 mips_fpu=HARDWARE_FLOATING_POINT
99 mips_fpu_bitsize=
100 case "${target}" in
101 # start-sanitize-tx19
102 mips*tx19*) mips_fpu=SOFT_FLOATING_POINT ;;
103 # end-sanitize-tx19
104 mips*tx39*) mips_fpu=HARD_FLOATING_POINT
105 mips_fpu_bitsize=32
106 ;;
107 # start-sanitize-r5900
108 mips64r59*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
109 # end-sanitize-r5900
110 # start-sanitize-sky
111 mips64*-sky*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
112 # end-sanitize-sky
113 mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
114 mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
115 mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
116 *) mips_fpu=HARD_FLOATING_POINT ;;
117 esac
118 SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
119
120
121
122 #
123 # Select the level of SMP support
124 #
125 case "${target}" in
126 # start-sanitize-r5900
127 mips64r59*-*-*) mips_smp=1 ;;
128 # end-sanitize-r5900
129 *) mips_smp=0 ;;
130 esac
131 SIM_AC_OPTION_SMP($mips_smp)
132
133
134
135 #
136 # Select the IGEN architecture
137 #
138 sim_use_gen=IGEN
139 sim_igen_machine="-M mipsIV"
140 sim_m16_machine="-M mips16"
141 sim_igen_filter="32,64,f"
142 sim_m16_filter="16"
143 case "${target}" in
144 # start-sanitize-tx19
145 mips*tx19*) sim_default_gen=M16
146 sim_use_gen=M16
147 sim_igen_machine="-M tx19"
148 sim_m16_machine="-M tx19"
149 sim_igen_filter="32"
150 sim_m16_filter="16"
151 ;;
152 # end-sanitize-tx19
153 mips*tx39*) sim_default_gen=IGEN
154 sim_use_gen=IGEN
155 sim_igen_filter="32,f"
156 sim_igen_machine="-M r3900"
157 ;;
158 # start-sanitize-r5900
159 mips64r59*-*-*) sim_default_gen=IGEN
160 sim_use_gen=IGEN
161 sim_igen_machine="-M r5900"
162 ;;
163 # end-sanitize-r5900
164 # start-sanitize-vr4320
165 mips64vr4320-*-*) sim_default_gen=IGEN
166 sim_use_gen=IGEN
167 sim_igen_machine="-M mipsIV,vr4320 -G gen-multi-sim=vr4320"
168 ;;
169 # end-sanitize-vr4320
170 mips64vr43*-*-*) sim_default_gen=IGEN
171 sim_use_gen=IGEN
172 sim_igen_machine="-M mipsIV"
173 # start-sanitize-vr4320
174 sim_igen_machine="-M mipsIV,vr4320 -G gen-multi-sim=mipsIV"
175 # end-sanitize-vr4320
176 ;;
177 # start-sanitize-cygnus
178 mips64vr54*-*-*) sim_default_gen=IGEN
179 sim_use_gen=IGEN
180 sim_igen_machine="-M vr5000,vr5400 -G gen-multi-sim=vr5400"
181 ;;
182 # end-sanitize-cygnus
183 mips64vr5*-*-*) sim_default_gen=IGEN
184 sim_use_gen=IGEN
185 sim_igen_machine="-M vr5000"
186 # start-sanitize-cygnus
187 sim_igen_machine="-M vr5000,vr5400 -G gen-multi-sim=vr5000"
188 # end-sanitize-cygnus
189 ;;
190 mips64vr4100-*-*) echo "NOTE: mips64vr4100 still uses gencode"
191 sim_use_gen=NO
192 ;;
193 mips64*-*-*) sim_default_gen=IGEN
194 sim_igen_filter="32,64,f"
195 sim_use_gen=IGEN
196 ;;
197 mips16*-*-*) sim_default_gen=M16
198 sim_igen_filter="32,64,f"
199 sim_m16_filter="16"
200 sim_use_gen=NO
201 ;;
202 mips*lsi*) sim_default_gen=M16
203 sim_use_gen=M16
204 sim_igen_machine="-M mipsIII,mips16"
205 sim_m16_machine="-M mips16,mipsIII"
206 sim_igen_filter="32,f"
207 sim_m16_filter="16"
208 ;;
209
210 mips*-*-*) sim_default_gen=IGEN
211 sim_igen_filter="32,f"
212 sim_use_gen=IGEN
213 ;;
214 esac
215 sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
216 sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
217 AC_SUBST(sim_igen_flags)
218 AC_SUBST(sim_m16_flags)
219
220
221
222 #
223 # Enable igen
224 #
225 AC_ARG_ENABLE(sim-igen,
226 [ --enable-sim-igen=opts Enable IGEN simulator],
227 [case "${enableval}" in
228 yes) sim_gen="${sim_default_gen}";;
229 no) sim_gen=NO;;
230 16) sim_gen=M16;;
231 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-igen"); sim_gen="";;
232 esac
233 if test x"$silent" != x"yes" && test x"$sim_gen" != x""; then
234 echo "Setting sim_gen = $sim_gen" 6>&1
235 fi],[sim_gen="${sim_use_gen}"])dnl
236 AC_SUBST(sim_gen)
237
238
239 #
240 # Add simulated hardware devices
241 #
242 hw_enabled=no
243 case "${target}" in
244 # start-sanitize-tx3904
245 mips*tx39*)
246 hw_enabled=yes
247 hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
248 mips_extra_objs="dv-sockser.o"
249 SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_TX3904=1"
250 ;;
251 # end-sanitize-tx3904
252 # start-sanitize-sky
253 mips64r59*-sky-*)
254 mips_extra_objs='$(SIM_SKY_OBJS)'
255 SIM_SUBTARGET="-DTARGET_SKY -DWITH_DEVICES=1 -DDEVICE_INIT=1"
256 ;;
257 mips64*-skyb-*)
258 mips_extra_objs='$(SIM_SKY_OBJS)'
259 SIM_SUBTARGET="-DTARGET_SKY -DTARGET_SKY_B -DWITH_DEVICES=1 -DDEVICE_INIT=1"
260 ;;
261 # end-sanitize-sky
262 *)
263 mips_extra_objs=""
264 ;;
265 esac
266 SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
267 AC_SUBST(mips_extra_objs)
268
269
270 # Choose simulator engine
271 case "${target}" in
272 # start-sanitize-sky
273 mips64r59*-sky-*)
274 mips_igen_engine=""
275 ;;
276 mips64*-skyb-*)
277 mips_igen_engine=""
278 ;;
279 # end-sanitize-sky
280 *) mips_igen_engine="engine.o"
281 ;;
282 esac
283 AC_SUBST(mips_igen_engine)
284
285
286 AC_PATH_X
287 mips_extra_libs=""
288 # start-sanitize-sky
289 # Enable GPU2 library
290 AC_ARG_WITH(sim-gpu2,
291 [ --with-sim-gpu2=path Use GPU2 library under given directory],
292 [if test -d "${withval}"
293 then
294 SIM_SUBTARGET="${SIM_SUBTARGET} -DSKY_GPU2 -I${withval}/include"
295 mips_extra_libs="-L${withval}/lib -lgpu2 -L${x_libraries} -lX11 -lXext"
296 WITH_GPU2="yes" ; export WITH_GPU2
297
298 # complex X/etc. detection; stolen shamelessly from tcl/tk/gdb configury. --angela
299
300 #--------------------------------------------------------------------
301 # Locate the X11 header files and the X11 library archive. Try
302 # the ac_path_x macro first, but if it doesn't find the X stuff
303 # (e.g. because there's no xmkmf program) then check through
304 # a list of possible directories. Under some conditions the
305 # autoconf macro will return an include directory that contains
306 # no include files, so double-check its result just to be safe.
307 #--------------------------------------------------------------------
308
309 AC_PATH_X
310 not_really_there=""
311 if test "$no_x" = ""; then
312 if test "$x_includes" = ""; then
313 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
314 else
315 if test ! -r $x_includes/X11/Intrinsic.h; then
316 not_really_there="yes"
317 fi
318 fi
319 fi
320 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
321 AC_MSG_CHECKING(for X11 header files)
322 XINCLUDES="# no special path needed"
323 AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
324 if test "$XINCLUDES" = nope; then
325 dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
326 for i in $dirs ; do
327 if test -r $i/X11/Intrinsic.h; then
328 AC_MSG_RESULT($i)
329 XINCLUDES=" -I$i"
330 break
331 fi
332 done
333 fi
334 else
335 if test "$x_includes" != ""; then
336 XINCLUDES=-I$x_includes
337 else
338 XINCLUDES="# no special path needed"
339 fi
340 fi
341 if test "$XINCLUDES" = nope; then
342 AC_MSG_RESULT(couldn't find any!)
343 XINCLUDES="# no include files found"
344 fi
345
346 if test "$no_x" = yes; then
347 AC_MSG_CHECKING(for X11 libraries)
348 XLIBSW=nope
349 dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
350 for i in $dirs ; do
351 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
352 AC_MSG_RESULT($i)
353 XLIBSW="-L$i -lX11"
354 x_libraries="$i"
355 break
356 fi
357 done
358 else
359 if test "$x_libraries" = ""; then
360 XLIBSW=-lX11
361 else
362 XLIBSW="-L$x_libraries -lX11"
363 fi
364 fi
365 if test "$XLIBSW" = nope ; then
366 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
367 fi
368 if test "$XLIBSW" = nope ; then
369 AC_MSG_RESULT(couldn't find any! Using -lX11.)
370 XLIBSW=-lX11
371 fi
372
373 #--------------------------------------------------------------------
374 # Various manipulations on the search path used at runtime to
375 # find shared libraries:
376 # 1. If the X library binaries are in a non-standard directory,
377 # add the X library location into that search path.
378 # 2. On systems such as AIX and Ultrix that use "-L" as the
379 # search path option, colons cannot be used to separate
380 # directories from each other. Change colons to " -L".
381 # 3. Create two sets of search flags, one for use in cc lines
382 # and the other for when the linker is invoked directly. In
383 # the second case, '-Wl,' must be stripped off and commas must
384 # be replaced by spaces.
385 #--------------------------------------------------------------------
386
387 #
388 # CYGNUS LOCAL: statically link on Solaris, HPUX & SunOS so that
389 # we don't have problems with people not having libraries
390 # installed or not having LD_LIBRARY_PATH set.
391 #
392
393 case "$host" in
394 #
395 # gdb linked statically w/ Solaris iff GCC and GNU ld are used,
396 # otherwise dynamic
397 #
398 sparc-sun-solaris2*)
399 sol_xlibsw=
400 if test "x$GCC" = "xyes" ; then
401 # This is probably the simplest way to test for GNU ld.
402 # It only works with relatively recent versions of GNU
403 # ld.
404 gld_text=`$CC -Wl,--version 2>&1 | sed 1q`
405 case "$gld_text" in
406 GNU* | *BFD*)
407 # Why do we link against libX11 twice? Because the
408 # Openwin X11 and Xext libraries are seriously broken.
409 sol_xlibsw="-Wl,-Bstatic $XLIBSW -lXext -lX11 -Wl,-Bdynamic"
410 ;;
411 esac
412 fi
413 if test -z "$sol_xlibsw"; then
414 if test "x$x_libraries" != "x"; then
415 XLIBSW="$XLIBSW -R$x_libraries"
416 fi
417 else
418 XLIBSW=$sol_xlibsw
419 suppress_enable_shared=yes
420 fi
421 ;;
422 #
423 # gdb linked statically w/ SunOS or HPUX
424 #
425 m68k-hp-hpux*|hppa*-hp-hpux*|sparc-sun-sunos*)
426 if test "x$x_libraries" != "x" ;
427 then
428 XLIBSW="$x_libraries/libX11.a"
429 else
430 XLIBSW="/usr/lib/libX11.a"
431 fi
432 suppress_enable_shared=yes
433 ;;
434 #
435 # default is to link dynamically
436 #
437 *)
438 ;;
439 esac
440 #
441 # END CYGNUS LOCAL
442
443
444 #--------------------------------------------------------------------
445 # Check for the existence of various libraries. The order here
446 # is important, so that then end up in the right order in the
447 # command line generated by make. The -lsocket and -lnsl libraries
448 # require a couple of special tricks:
449 # 1. Use "connect" and "accept" to check for -lsocket, and
450 # "gethostbyname" to check for -lnsl.
451 # 2. Use each function name only once: can't redo a check because
452 # autoconf caches the results of the last check and won't redo it.
453 # 3. Use -lnsl and -lsocket only if they supply procedures that
454 # aren't already present in the normal libraries. This is because
455 # IRIX 5.2 has libraries, but they aren't needed and they're
456 # bogus: they goof up name resolution if used.
457 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
458 # To get around this problem, check for both libraries together
459 # if -lsocket doesn't work by itself.
460 #--------------------------------------------------------------------
461
462 AC_CHECK_LIB(Xbsd, main, [SOCKLIBSW="$SOCKLIBSW -lXbsd"])
463
464 # CYGNUS LOCAL: Store any socket library(ies) in the cache, and don't
465 # mess up the cache values of the functions we check for.
466 AC_CACHE_CHECK([for socket libraries], sim_cv_lib_sockets,
467 [sim_cv_lib_sockets=
468 sim_checkBoth=0
469 unset ac_cv_func_connect
470 AC_CHECK_FUNC(connect, sim_checkSocket=0, sim_checkSocket=1)
471 if test "$sim_checkSocket" = 1; then
472 unset ac_cv_func_connect
473 AC_CHECK_LIB(socket, main, sim_cv_lib_sockets="-lsocket",
474 sim_checkBoth=1)
475 fi
476 if test "$sim_checkBoth" = 1; then
477 sim_oldLibs=$SOCKLIBSW
478 SOCKLIBSW="$SOCKLIBSW -lsocket -lnsl"
479 unset ac_cv_func_accept
480 AC_CHECK_FUNC(accept,
481 [sim_checkNsl=0
482 sim_cv_lib_sockets="-lsocket -lnsl"])
483 unset ac_cv_func_accept
484 SOCKLIBSW=$sim_oldLibs
485 fi
486 unset ac_cv_func_gethostbyname
487 sim_oldLibs=$SOCKLIBSW
488 SOCKLIBSW="$SOCKLIBSW $sim_cv_lib_sockets"
489 AC_CHECK_FUNC(gethostbyname, ,
490 [AC_CHECK_LIB(nsl, main,
491 [sim_cv_lib_sockets="$sim_cv_lib_sockets -lnsl"])])
492 unset ac_cv_func_gethostbyname
493 SOCKLIBSW=$sim_oldSOCKLIBSW
494 ])
495 test -z "$sim_cv_lib_sockets" || SOCKLIBSW="$SOCKLIBSW $sim_cv_lib_sockets"
496
497 mips_extra_libs="-L${withval}/lib -lgpu2 -lm $XLIBSW $SOCKLIBSW"
498 cat > simConfig.sh << --EOF--
499 mips_extra_libs="$mips_extra_libs"
500 --EOF--
501
502 else
503 AC_MSG_ERROR("Directory ${withval} does not exist.");
504 fi])dnl
505
506
507 # Enable target accurate FP library
508 AC_ARG_WITH(sim-funit,
509 [ --with-sim-funit=path Use target FP library under given directory],
510 [if test -d "${withval}"
511 then
512 SIM_SUBTARGET="${SIM_SUBTARGET} -DSKY_FUNIT -I${withval}/include"
513 mips_extra_libs="${mips_extra_libs} -L${withval}/lib -lfunit"
514 else
515 AC_MSG_ERROR("Directory ${withval} does not exist.");
516 fi])dnl
517 # end-sanitize-sky
518 AC_SUBST(mips_extra_libs)
519
520 AC_CHECK_HEADERS(string.h strings.h stdlib.h stdlib.h)
521 AC_CHECK_LIB(m, fabs)
522 AC_CHECK_FUNCS(aint anint sqrt)
523
524 SIM_AC_OUTPUT