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 mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
30 AC_SUBST(SIM_SUBTARGET)
35 # Select the byte order of the target
41 mips*tx19*) default_endian=BIG_ENDIAN ;;
43 # start-sanitize-r5900
44 mips64r59*-*-*) mips_endian=LITTLE_ENDIAN ;;
46 mips64el*-*-*) mips_endian=LITTLE_ENDIAN ;;
47 mips64*-*-*) default_endian=BIG_ENDIAN ;;
48 mips16*-*-*) default_endian=BIG_ENDIAN ;;
49 mips*-*-*) default_endian=BIG_ENDIAN ;;
50 *) default_endian=BIG_ENDIAN ;;
52 SIM_AC_OPTION_ENDIAN($mips_endian,$default_endian)
57 # Select the bitsize of the target
62 mips*tx19*) mips_bitsize=32 ; mips_msb=31 ;;
64 # start-sanitize-r5900
65 mips64r59*-*-*) mips_bitsize=64 ; mips_msb=63 ; mips_addr_bitsize=32;;
68 mips64*-sky*-*) mips_bitsize=64 ; mips_msb=63 ; mips_addr_bitsize=32;;
70 mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
71 mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
72 mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
73 *) mips_bitsize=64 ; mips_msb=63 ;;
75 SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
80 # Select the floating hardware support of the target
82 mips_fpu=HARDWARE_FLOATING_POINT
86 mips*tx19*) mips_fpu=SOFT_FLOATING_POINT ;;
88 mips*tx39*) mips_fpu=HARD_FLOATING_POINT
91 # start-sanitize-vr4xxx
92 mips64vr4xxx-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
94 # start-sanitize-r5900
95 mips64r59*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
98 mips64*-sky*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
100 mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
101 mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
102 mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
103 *) mips_fpu=HARD_FLOATING_POINT ;;
105 SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
110 # Select the level of SMP support
113 # start-sanitize-r5900
114 mips64r59*-*-*) mips_smp=1 ;;
118 SIM_AC_OPTION_SMP($mips_smp)
123 # Select the IGEN architecture
126 sim_igen_machine="-M mipsIV"
127 sim_m16_machine="-M mips16"
128 sim_igen_filter="32,64,f"
131 # start-sanitize-tx19
132 mips*tx19*) sim_gen=M16
133 sim_igen_machine="-M tx19"
134 sim_m16_machine="-M tx19"
139 mips*tx39*) sim_gen=IGEN
140 sim_igen_filter="32,f"
141 sim_igen_machine="-M r3900"
143 # start-sanitize-r5900
144 mips64r59*-*-*) sim_gen=IGEN
145 sim_igen_machine="-M r5900"
148 # start-sanitize-vr4320
149 mips64vr4320-*-*) sim_gen=IGEN
150 sim_igen_machine="-M mipsIV,vr4320 -G gen-multi-sim=vr4320"
152 # end-sanitize-vr4320
153 mips64vr43*-*-*) sim_gen=IGEN
154 sim_igen_machine="-M mipsIV"
155 # start-sanitize-vr4320
156 sim_igen_machine="-M mipsIV,vr4320 -G gen-multi-sim=mipsIV"
157 # end-sanitize-vr4320
159 # start-sanitize-cygnus
160 mips64vr54*-*-*) sim_gen=IGEN
161 sim_igen_machine="-M vr5000,vr5400 -G gen-multi-sim=vr5400"
163 # end-sanitize-cygnus
164 mips64vr5*-*-*) sim_gen=IGEN
165 sim_igen_machine="-M vr5000"
166 # start-sanitize-cygnus
167 sim_igen_machine="-M vr5000,vr5400 -G gen-multi-sim=vr5000"
169 # end-sanitize-cygnus
170 # start-sanitize-vr4xxx
171 mips64vr4xxx-*-*) sim_gen=IGEN
172 sim_igen_machine="-M mipsIV,vr4100 -G gen-multi-sim=mipsIV"
174 # end-sanitize-vr4xxx
175 mips64vr41*) sim_gen=M16
176 sim_igen_machine="-M vr4100"
177 sim_m16_machine="-M vr4100"
178 sim_igen_filter="32,64,f"
181 mips64*-*-*) sim_igen_filter="32,64,f"
184 mips16*-*-*) sim_gen=M16
185 sim_igen_filter="32,64,f"
188 mips*lsi*) sim_gen=M16
189 sim_igen_machine="-M mipsIII,mips16"
190 sim_m16_machine="-M mips16,mipsIII"
191 sim_igen_filter="32,f"
194 mips*-*-*) sim_gen=IGEN
195 sim_igen_filter="32,f"
198 sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
199 sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
200 AC_SUBST(sim_igen_flags)
201 AC_SUBST(sim_m16_flags)
206 # Add simulated hardware devices
210 # start-sanitize-tx3904
213 hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
214 mips_extra_objs="dv-sockser.o"
215 SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_TX3904=1"
217 # end-sanitize-tx3904
220 mips_extra_objs='$(SIM_SKY_OBJS)'
221 SIM_SUBTARGET="-DTARGET_SKY -DWITH_DEVICES=1 -DDEVICE_INIT=1"
224 mips_extra_objs='$(SIM_SKY_OBJS)'
225 SIM_SUBTARGET="-DTARGET_SKY -DTARGET_SKY_B -DWITH_DEVICES=1 -DDEVICE_INIT=1"
232 SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
233 AC_SUBST(mips_extra_objs)
236 # Choose simulator engine
246 *) mips_igen_engine="engine.o"
249 AC_SUBST(mips_igen_engine)
255 # Enable GPU2 library
256 AC_ARG_WITH(sim-gpu2,
257 [ --with-sim-gpu2=path Use GPU2 library under given directory],
258 [if test -d "${withval}"
260 SIM_SUBTARGET="${SIM_SUBTARGET} -DSKY_GPU2 -I${withval}/include"
261 mips_extra_libs="-L${withval}/lib -lgpu2 -L${x_libraries} -lX11 -lXext"
262 WITH_GPU2="yes" ; export WITH_GPU2
264 # complex X/etc. detection; stolen shamelessly from tcl/tk/gdb configury. --angela
266 #--------------------------------------------------------------------
267 # Locate the X11 header files and the X11 library archive. Try
268 # the ac_path_x macro first, but if it doesn't find the X stuff
269 # (e.g. because there's no xmkmf program) then check through
270 # a list of possible directories. Under some conditions the
271 # autoconf macro will return an include directory that contains
272 # no include files, so double-check its result just to be safe.
273 #--------------------------------------------------------------------
277 if test "$no_x" = ""; then
278 if test "$x_includes" = ""; then
279 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
281 if test ! -r $x_includes/X11/Intrinsic.h; then
282 not_really_there="yes"
286 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
287 AC_MSG_CHECKING(for X11 header files)
288 XINCLUDES="# no special path needed"
289 AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
290 if test "$XINCLUDES" = nope; then
291 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"
293 if test -r $i/X11/Intrinsic.h; then
301 if test "$x_includes" != ""; then
302 XINCLUDES=-I$x_includes
304 XINCLUDES="# no special path needed"
307 if test "$XINCLUDES" = nope; then
308 AC_MSG_RESULT(couldn't find any!)
309 XINCLUDES="# no include files found"
312 if test "$no_x" = yes; then
313 AC_MSG_CHECKING(for X11 libraries)
315 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"
317 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
325 if test "$x_libraries" = ""; then
328 XLIBSW="-L$x_libraries -lX11"
331 if test "$XLIBSW" = nope ; then
332 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
334 if test "$XLIBSW" = nope ; then
335 AC_MSG_RESULT(couldn't find any! Using -lX11.)
339 #--------------------------------------------------------------------
340 # Various manipulations on the search path used at runtime to
341 # find shared libraries:
342 # 1. If the X library binaries are in a non-standard directory,
343 # add the X library location into that search path.
344 # 2. On systems such as AIX and Ultrix that use "-L" as the
345 # search path option, colons cannot be used to separate
346 # directories from each other. Change colons to " -L".
347 # 3. Create two sets of search flags, one for use in cc lines
348 # and the other for when the linker is invoked directly. In
349 # the second case, '-Wl,' must be stripped off and commas must
350 # be replaced by spaces.
351 #--------------------------------------------------------------------
354 # CYGNUS LOCAL: statically link on Solaris, HPUX & SunOS so that
355 # we don't have problems with people not having libraries
356 # installed or not having LD_LIBRARY_PATH set.
361 # gdb linked statically w/ Solaris iff GCC and GNU ld are used,
366 if test "x$GCC" = "xyes" ; then
367 # This is probably the simplest way to test for GNU ld.
368 # It only works with relatively recent versions of GNU
370 gld_text=`$CC -Wl,--version 2>&1 | sed 1q`
373 # Why do we link against libX11 twice? Because the
374 # Openwin X11 and Xext libraries are seriously broken.
375 sol_xlibsw="-Wl,-Bstatic $XLIBSW -lXext -lX11 -Wl,-Bdynamic"
379 if test -z "$sol_xlibsw"; then
380 if test "x$x_libraries" != "x"; then
381 XLIBSW="$XLIBSW -R$x_libraries"
385 suppress_enable_shared=yes
389 # gdb linked statically w/ SunOS or HPUX
391 m68k-hp-hpux*|hppa*-hp-hpux*|sparc-sun-sunos*)
392 if test "x$x_libraries" != "x" ;
394 XLIBSW="$x_libraries/libX11.a"
396 XLIBSW="/usr/lib/libX11.a"
398 suppress_enable_shared=yes
401 # default is to link dynamically
410 #--------------------------------------------------------------------
411 # Check for the existence of various libraries. The order here
412 # is important, so that then end up in the right order in the
413 # command line generated by make. The -lsocket and -lnsl libraries
414 # require a couple of special tricks:
415 # 1. Use "connect" and "accept" to check for -lsocket, and
416 # "gethostbyname" to check for -lnsl.
417 # 2. Use each function name only once: can't redo a check because
418 # autoconf caches the results of the last check and won't redo it.
419 # 3. Use -lnsl and -lsocket only if they supply procedures that
420 # aren't already present in the normal libraries. This is because
421 # IRIX 5.2 has libraries, but they aren't needed and they're
422 # bogus: they goof up name resolution if used.
423 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
424 # To get around this problem, check for both libraries together
425 # if -lsocket doesn't work by itself.
426 #--------------------------------------------------------------------
428 AC_CHECK_LIB(Xbsd, main, [SOCKLIBSW="$SOCKLIBSW -lXbsd"])
430 # CYGNUS LOCAL: Store any socket library(ies) in the cache, and don't
431 # mess up the cache values of the functions we check for.
432 AC_CACHE_CHECK([for socket libraries], sim_cv_lib_sockets,
435 unset ac_cv_func_connect
436 AC_CHECK_FUNC(connect, sim_checkSocket=0, sim_checkSocket=1)
437 if test "$sim_checkSocket" = 1; then
438 unset ac_cv_func_connect
439 AC_CHECK_LIB(socket, main, sim_cv_lib_sockets="-lsocket",
442 if test "$sim_checkBoth" = 1; then
443 sim_oldLibs=$SOCKLIBSW
444 SOCKLIBSW="$SOCKLIBSW -lsocket -lnsl"
445 unset ac_cv_func_accept
446 AC_CHECK_FUNC(accept,
448 sim_cv_lib_sockets="-lsocket -lnsl"])
449 unset ac_cv_func_accept
450 SOCKLIBSW=$sim_oldLibs
452 unset ac_cv_func_gethostbyname
453 sim_oldLibs=$SOCKLIBSW
454 SOCKLIBSW="$SOCKLIBSW $sim_cv_lib_sockets"
455 AC_CHECK_FUNC(gethostbyname, ,
456 [AC_CHECK_LIB(nsl, main,
457 [sim_cv_lib_sockets="$sim_cv_lib_sockets -lnsl"])])
458 unset ac_cv_func_gethostbyname
459 SOCKLIBSW=$sim_oldSOCKLIBSW
461 test -z "$sim_cv_lib_sockets" || SOCKLIBSW="$SOCKLIBSW $sim_cv_lib_sockets"
463 mips_extra_libs="-L${withval}/lib -lgpu2 -lm $XLIBSW $SOCKLIBSW"
464 cat > simConfig.sh << --EOF--
465 mips_extra_libs="$mips_extra_libs"
469 AC_MSG_ERROR("Directory ${withval} does not exist.");
473 # Enable target accurate FP library
474 AC_ARG_WITH(sim-funit,
475 [ --with-sim-funit=path Use target FP library under given directory],
476 [if test -d "${withval}"
478 SIM_SUBTARGET="${SIM_SUBTARGET} -DSKY_FUNIT -I${withval}/include"
479 mips_extra_libs="${mips_extra_libs} -L${withval}/lib -lfunit"
481 AC_MSG_ERROR("Directory ${withval} does not exist.");
484 AC_SUBST(mips_extra_libs)
486 AC_CHECK_HEADERS(string.h strings.h stdlib.h stdlib.h)
487 AC_CHECK_LIB(m, fabs)
488 AC_CHECK_FUNCS(aint anint sqrt)