1 dnl Process this file with autoconf to produce a configure script.
2 sinclude(../common/aclocal.m4)
8 dnl Options available in this module
10 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
11 SIM_AC_OPTION_HOSTENDIAN
12 SIM_AC_OPTION_WARNINGS
16 # Instead of defining a `subtarget' macro, code should be checking
17 # the value of {STATE,CPU}_ARCHITECTURE to identify the architecture
21 # start-sanitize-vr4xxx
22 mips64vr4xxx*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;;
25 mips*tx19*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
27 mips64vr5xxx*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;;
28 mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
31 AC_SUBST(SIM_SUBTARGET)
36 # Select the byte order of the target
42 mips*tx19*) default_endian=BIG_ENDIAN ;;
44 # start-sanitize-r5900
45 mips64r59*-*-*) mips_endian=LITTLE_ENDIAN ;;
47 mips64el*-*-*) mips_endian=LITTLE_ENDIAN ;;
48 mips64*-*-*) default_endian=BIG_ENDIAN ;;
49 mips16*-*-*) default_endian=BIG_ENDIAN ;;
50 mips*-*-*) default_endian=BIG_ENDIAN ;;
51 *) default_endian=BIG_ENDIAN ;;
53 SIM_AC_OPTION_ENDIAN($mips_endian,$default_endian)
58 # Select the bitsize of the target
63 mips*tx19*) mips_bitsize=32 ; mips_msb=31 ;;
65 # start-sanitize-r5900
66 mips64r59*-*-*) mips_bitsize=64 ; mips_msb=63 ; mips_addr_bitsize=32;;
69 mips64*-sky*-*) mips_bitsize=64 ; mips_msb=63 ; mips_addr_bitsize=32;;
71 mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
72 mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
73 mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
74 *) mips_bitsize=64 ; mips_msb=63 ;;
76 SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
81 # Select the floating hardware support of the target
83 mips_fpu=HARDWARE_FLOATING_POINT
87 mips*tx19*) mips_fpu=SOFT_FLOATING_POINT ;;
89 mips*tx39*) mips_fpu=HARD_FLOATING_POINT
92 # start-sanitize-vr4xxx
93 mips64vr4xxx*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
95 # start-sanitize-r5900
96 mips64r59*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
99 mips64*-sky*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
101 mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
102 mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
103 mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
104 *) mips_fpu=HARD_FLOATING_POINT ;;
106 SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
111 # Select the level of SMP support
114 # start-sanitize-r5900
115 mips64r59*-*-*) mips_smp=1 ;;
119 SIM_AC_OPTION_SMP($mips_smp)
124 # Select the IGEN architecture
127 sim_igen_machine="-M mipsIV"
128 sim_m16_machine="-M mips16"
129 sim_igen_filter="32,64,f"
132 # start-sanitize-tx19
133 mips*tx19*) sim_gen=M16
134 sim_igen_machine="-M tx19"
135 sim_m16_machine="-M tx19"
140 mips*tx39*) sim_gen=IGEN
141 sim_igen_filter="32,f"
142 sim_igen_machine="-M r3900"
144 # start-sanitize-r5900
145 mips64r59*-*-*) sim_gen=IGEN
146 sim_igen_machine="-M r5900"
149 # start-sanitize-vr4320
150 mips64vr4320-*-*) sim_gen=IGEN
151 sim_igen_machine="-M mipsIV,vr4320 -G gen-multi-sim=vr4320"
153 # end-sanitize-vr4320
154 mips64vr43*-*-*) sim_gen=IGEN
155 sim_igen_machine="-M mipsIV"
156 # start-sanitize-vr4320
157 sim_igen_machine="-M mipsIV,vr4320 -G gen-multi-sim=mipsIV"
158 # end-sanitize-vr4320
160 # start-sanitize-cygnus
161 mips64vr54*-*-*) sim_gen=IGEN
162 sim_igen_machine="-M vr5000,vr5400 -G gen-multi-sim=vr5400"
164 # end-sanitize-cygnus
165 mips64vr5*-*-*) sim_gen=IGEN
166 sim_igen_machine="-M vr5000"
167 # start-sanitize-cygnus
168 sim_igen_machine="-M vr5000,vr5400 -G gen-multi-sim=vr5000"
169 # end-sanitize-cygnus
171 # start-sanitize-vr4xxx
172 mips64vr4xxx*-*-*) sim_gen=HACK
173 sim_igen_filter="32,64,f"
175 # mips64vr4xxx*-*-*) sim_gen=IGEN
176 # sim_igen_machine="-M mipsIV,vr4100,vr4121 -G gen-multi-sim=mipsIV"
178 # mips64vr4xxx*-*-*) sim_gen=M16
179 # sim_igen_machine="-M mipsIV,vr4100 -G gen-multi-sim=mipsV"
180 # sim_m16_machine="-M vr4100"
181 # sim_igen_filter="32,64,f"
182 # sim_m16_filter="16"
184 # end-sanitize-vr4xxx
185 mips64vr41*) sim_gen=M16
186 sim_igen_machine="-M vr4100"
187 sim_m16_machine="-M vr4100"
188 sim_igen_filter="32,64,f"
191 mips64*-*-*) sim_igen_filter="32,64,f"
194 mips16*-*-*) sim_gen=M16
195 sim_igen_filter="32,64,f"
198 mips*lsi*) sim_gen=M16
199 sim_igen_machine="-M mipsIII,mips16"
200 sim_m16_machine="-M mips16,mipsIII"
201 sim_igen_filter="32,f"
204 mips*-*-*) sim_gen=IGEN
205 sim_igen_filter="32,f"
208 sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
209 sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
210 AC_SUBST(sim_igen_flags)
211 AC_SUBST(sim_m16_flags)
216 # Add simulated hardware devices
222 hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
223 mips_extra_objs="dv-sockser.o"
224 SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_TX3904=1"
228 mips_extra_objs='$(SIM_SKY_OBJS)'
229 SIM_SUBTARGET="-DTARGET_SKY -DWITH_DEVICES=1 -DDEVICE_INIT=1"
232 mips_extra_objs='$(SIM_SKY_OBJS)'
233 SIM_SUBTARGET="-DTARGET_SKY -DTARGET_SKY_B -DWITH_DEVICES=1 -DDEVICE_INIT=1"
240 SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
241 AC_SUBST(mips_extra_objs)
244 # Choose simulator engine
254 *) mips_igen_engine="engine.o"
257 AC_SUBST(mips_igen_engine)
263 # Enable GPU2 library
264 AC_ARG_WITH(sim-gpu2,
265 [ --with-sim-gpu2=path Use GPU2 library under given directory],
266 [if test -d "${withval}"
268 SIM_SUBTARGET="${SIM_SUBTARGET} -DSKY_GPU2 -I${withval}/include"
269 mips_extra_libs="-L${withval}/lib -lgpu2 -L${x_libraries} -lX11 -lXext"
270 WITH_GPU2="yes" ; export WITH_GPU2
272 # complex X/etc. detection; stolen shamelessly from tcl/tk/gdb configury. --angela
274 #--------------------------------------------------------------------
275 # Locate the X11 header files and the X11 library archive. Try
276 # the ac_path_x macro first, but if it doesn't find the X stuff
277 # (e.g. because there's no xmkmf program) then check through
278 # a list of possible directories. Under some conditions the
279 # autoconf macro will return an include directory that contains
280 # no include files, so double-check its result just to be safe.
281 #--------------------------------------------------------------------
285 if test "$no_x" = ""; then
286 if test "$x_includes" = ""; then
287 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
289 if test ! -r $x_includes/X11/Intrinsic.h; then
290 not_really_there="yes"
294 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
295 AC_MSG_CHECKING(for X11 header files)
296 XINCLUDES="# no special path needed"
297 AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
298 if test "$XINCLUDES" = nope; then
299 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"
301 if test -r $i/X11/Intrinsic.h; then
309 if test "$x_includes" != ""; then
310 XINCLUDES=-I$x_includes
312 XINCLUDES="# no special path needed"
315 if test "$XINCLUDES" = nope; then
316 AC_MSG_RESULT(couldn't find any!)
317 XINCLUDES="# no include files found"
320 if test "$no_x" = yes; then
321 AC_MSG_CHECKING(for X11 libraries)
323 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"
325 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
333 if test "$x_libraries" = ""; then
336 XLIBSW="-L$x_libraries -lX11"
339 if test "$XLIBSW" = nope ; then
340 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
342 if test "$XLIBSW" = nope ; then
343 AC_MSG_RESULT(couldn't find any! Using -lX11.)
347 #--------------------------------------------------------------------
348 # Various manipulations on the search path used at runtime to
349 # find shared libraries:
350 # 1. If the X library binaries are in a non-standard directory,
351 # add the X library location into that search path.
352 # 2. On systems such as AIX and Ultrix that use "-L" as the
353 # search path option, colons cannot be used to separate
354 # directories from each other. Change colons to " -L".
355 # 3. Create two sets of search flags, one for use in cc lines
356 # and the other for when the linker is invoked directly. In
357 # the second case, '-Wl,' must be stripped off and commas must
358 # be replaced by spaces.
359 #--------------------------------------------------------------------
362 # CYGNUS LOCAL: statically link on Solaris, HPUX & SunOS so that
363 # we don't have problems with people not having libraries
364 # installed or not having LD_LIBRARY_PATH set.
369 # gdb linked statically w/ Solaris iff GCC and GNU ld are used,
374 if test "x$GCC" = "xyes" ; then
375 # This is probably the simplest way to test for GNU ld.
376 # It only works with relatively recent versions of GNU
378 gld_text=`$CC -Wl,--version 2>&1 | sed 1q`
381 # Why do we link against libX11 twice? Because the
382 # Openwin X11 and Xext libraries are seriously broken.
383 sol_xlibsw="-Wl,-Bstatic $XLIBSW -lXext -lX11 -Wl,-Bdynamic"
387 if test -z "$sol_xlibsw"; then
388 if test "x$x_libraries" != "x"; then
389 XLIBSW="$XLIBSW -R$x_libraries"
393 suppress_enable_shared=yes
397 # gdb linked statically w/ SunOS or HPUX
399 m68k-hp-hpux*|hppa*-hp-hpux*|sparc-sun-sunos*)
400 if test "x$x_libraries" != "x" ;
402 XLIBSW="$x_libraries/libX11.a"
404 XLIBSW="/usr/lib/libX11.a"
406 suppress_enable_shared=yes
409 # default is to link dynamically
418 #--------------------------------------------------------------------
419 # Check for the existence of various libraries. The order here
420 # is important, so that then end up in the right order in the
421 # command line generated by make. The -lsocket and -lnsl libraries
422 # require a couple of special tricks:
423 # 1. Use "connect" and "accept" to check for -lsocket, and
424 # "gethostbyname" to check for -lnsl.
425 # 2. Use each function name only once: can't redo a check because
426 # autoconf caches the results of the last check and won't redo it.
427 # 3. Use -lnsl and -lsocket only if they supply procedures that
428 # aren't already present in the normal libraries. This is because
429 # IRIX 5.2 has libraries, but they aren't needed and they're
430 # bogus: they goof up name resolution if used.
431 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
432 # To get around this problem, check for both libraries together
433 # if -lsocket doesn't work by itself.
434 #--------------------------------------------------------------------
436 AC_CHECK_LIB(Xbsd, main, [SOCKLIBSW="$SOCKLIBSW -lXbsd"])
438 # CYGNUS LOCAL: Store any socket library(ies) in the cache, and don't
439 # mess up the cache values of the functions we check for.
440 AC_CACHE_CHECK([for socket libraries], sim_cv_lib_sockets,
443 unset ac_cv_func_connect
444 AC_CHECK_FUNC(connect, sim_checkSocket=0, sim_checkSocket=1)
445 if test "$sim_checkSocket" = 1; then
446 unset ac_cv_func_connect
447 AC_CHECK_LIB(socket, main, sim_cv_lib_sockets="-lsocket",
450 if test "$sim_checkBoth" = 1; then
451 sim_oldLibs=$SOCKLIBSW
452 SOCKLIBSW="$SOCKLIBSW -lsocket -lnsl"
453 unset ac_cv_func_accept
454 AC_CHECK_FUNC(accept,
456 sim_cv_lib_sockets="-lsocket -lnsl"])
457 unset ac_cv_func_accept
458 SOCKLIBSW=$sim_oldLibs
460 unset ac_cv_func_gethostbyname
461 sim_oldLibs=$SOCKLIBSW
462 SOCKLIBSW="$SOCKLIBSW $sim_cv_lib_sockets"
463 AC_CHECK_FUNC(gethostbyname, ,
464 [AC_CHECK_LIB(nsl, main,
465 [sim_cv_lib_sockets="$sim_cv_lib_sockets -lnsl"])])
466 unset ac_cv_func_gethostbyname
467 SOCKLIBSW=$sim_oldSOCKLIBSW
469 test -z "$sim_cv_lib_sockets" || SOCKLIBSW="$SOCKLIBSW $sim_cv_lib_sockets"
471 mips_extra_libs="-L${withval}/lib -lgpu2 -lm $XLIBSW $SOCKLIBSW"
472 cat > simConfig.sh << --EOF--
473 mips_extra_libs="$mips_extra_libs"
477 AC_MSG_ERROR("Directory ${withval} does not exist.");
481 # Enable target accurate FP library
482 AC_ARG_WITH(sim-funit,
483 [ --with-sim-funit=path Use target FP library under given directory],
484 [if test -d "${withval}"
486 SIM_SUBTARGET="${SIM_SUBTARGET} -DSKY_FUNIT -I${withval}/include"
487 mips_extra_libs="${mips_extra_libs} -L${withval}/lib -lfunit"
489 AC_MSG_ERROR("Directory ${withval} does not exist.");
492 AC_SUBST(mips_extra_libs)
494 AC_CHECK_HEADERS(string.h strings.h stdlib.h stdlib.h)
495 AC_CHECK_LIB(m, fabs)
496 AC_CHECK_FUNCS(aint anint sqrt)