ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.6
Committed: 2002-09-18T10:25:05Z (22 years, 1 month ago) by gbeauche
Branch: MAIN
Changes since 1.5: +2 -2 lines
Log Message:
Define SAHF_SETO_PROFITABLE on x86, aka restore full performance of the
JIT compiler. ;-) BTW, also fixes some valgrind warnings.

File Contents

# User Rev Content
1 gbeauche 1.1 dnl Process this file with autoconf to produce a configure script.
2     dnl Written in 2002 by Christian Bauer et al.
3    
4     AC_INIT(main_unix.cpp)
5     AC_PREREQ(2.52)
6     AC_CONFIG_HEADER(config.h)
7    
8 gbeauche 1.5 dnl Video options.
9 gbeauche 1.1 AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
10     AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
11     AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
12     AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
13    
14 gbeauche 1.5 dnl JIT compiler options.
15     AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
16     AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
17    
18 gbeauche 1.1 dnl FPU emulation core.
19     AC_ARG_ENABLE(fpe,
20     [ --enable-fpe=FPE specify which fpu emulator to use [default=auto]],
21     [ case "$enableval" in
22     dnl default is always ieee, if architecture has this fp format
23     auto) FPE_CORE_TEST_ORDER="ieee uae";;
24     ieee) FPE_CORE_TEST_ORDER="ieee";;
25     uae) FPE_CORE_TEST_ORDER="uae";;
26     x86) FPE_CORE_TEST_ORDER="x86";;
27     *) AC_MSG_ERROR([--enable-fpe takes only one of the following values: auto, x86, ieee, uae]);;
28     esac
29     ],
30     [ FPE_CORE_TEST_ORDER="ieee uae"
31     ])
32    
33     dnl Addressing modes.
34     AC_ARG_ENABLE(addressing,
35     [ --enable-addressing=AM specify the addressing mode to use [default=fastest]],
36     [ case "$enableval" in
37     real) ADDRESSING_TEST_ORDER="real";;
38     direct) ADDRESSING_TEST_ORDER="direct";;
39     banks) ADDRESSING_TEST_ORDER="banks";;
40     fastest)ADDRESSING_TEST_ORDER="direct banks";;
41     *) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
42     esac
43     ],
44     [ ADDRESSING_TEST_ORDER="direct banks"
45     ])
46    
47     dnl External packages.
48     AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
49     AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
50     AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
51    
52     dnl Canonical system information.
53     AC_CANONICAL_HOST
54     AC_CANONICAL_TARGET
55    
56     dnl Target OS type (target is host if not cross-compiling).
57     case "$target_os" in
58     linux*) OS_TYPE=linux;;
59     netbsd*) OS_TYPE=netbsd;;
60     freebsd*) OS_TYPE=freebsd;;
61     solaris*) OS_TYPE=solaris;;
62     darwin*) OS_TYPE=darwin;;
63     *) OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;;
64     esac
65     DEFINES="$DEFINES -DOS_$OS_TYPE"
66    
67     dnl Target CPU type.
68     HAVE_I386=no
69     HAVE_M68K=no
70     HAVE_SPARC=no
71     HAVE_POWERPC=no
72     case "$target_cpu" in
73     i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;;
74     m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;;
75     sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;;
76     powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;;
77     *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;;
78     esac
79     DEFINES="$DEFINES -DCPU_$CPU_TYPE"
80    
81     dnl Checks for programs.
82     AC_PROG_CC
83     AC_PROG_CC_C_O
84     AC_PROG_CPP
85     AC_PROG_CXX
86     AC_PROG_MAKE_SET
87     AC_PROG_INSTALL
88    
89     dnl We use mon if possible.
90     MONSRCS=
91     if [[ "x$WANT_MON" = "xyes" ]]; then
92     AC_MSG_CHECKING(for mon)
93     mon_srcdir=../../../mon/src
94     if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
95     AC_MSG_RESULT(yes)
96     AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".])
97     MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c"
98     CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
99     AC_CHECK_LIB(ncurses, tgetent, ,
100     AC_CHECK_LIB(termcap, tgetent, ,
101     AC_CHECK_LIB(termlib, tgetent, ,
102     AC_CHECK_LIB(terminfo, tgetent, ,
103     AC_CHECK_LIB(Hcurses, tgetent, ,
104     AC_CHECK_LIB(curses, tgetent))))))
105     AC_CHECK_LIB(readline, readline)
106     AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
107     else
108     AC_MSG_RESULT(no)
109     AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
110     WANT_MON=no
111     fi
112     fi
113    
114     dnl Checks for libraries.
115     AC_CHECK_LIB(posix4, sem_init)
116     AC_CHECK_LIB(rt, timer_create)
117    
118     dnl We need X11.
119     AC_PATH_XTRA
120     if [[ "x$no_x" = "xyes" ]]; then
121     AC_MSG_ERROR([You need X11 to run Basilisk II.])
122     fi
123     CFLAGS="$CFLAGS $X_CFLAGS"
124     CXXFLAGS="$CXXFLAGS $X_CFLAGS"
125     LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
126    
127     dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
128     HAVE_PTHREADS=yes
129     AC_CHECK_LIB(pthread, pthread_create, , [
130     AC_CHECK_LIB(c_r, pthread_create, , [
131     AC_CHECK_LIB(PTL, pthread_create, , [
132     HAVE_PTHREADS=no
133     ])
134     ])
135     ])
136     if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
137     AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
138     fi
139     AC_CHECK_FUNCS(pthread_cancel)
140     AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
141     AC_CHECK_FUNCS(pthread_mutexattr_settype)
142 gbeauche 1.3 AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
143 gbeauche 1.1
144     dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
145     SEMSRC=
146     AC_CHECK_FUNCS(sem_init, , [
147     if test "x$HAVE_PTHREADS" = "xyes"; then
148     SEMSRC=posix_sem.cpp
149     fi
150     ])
151    
152     dnl We use DGA (XFree86 or fbdev) if possible.
153     if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
154     AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [
155     AC_DEFINE(ENABLE_XF86_DGA, 1, [Define if using XFree86 DGA extension.])
156     LIBS="$LIBS -lXxf86dga"
157     if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
158     AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.])
159     WANT_FBDEV_DGA=no
160     fi
161     ], [
162     AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
163     WANT_XF86_DGA=no
164     ])
165     fi
166     if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
167     AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using DGA with framebuffer device.])
168     fi
169    
170     dnl We use XFree86 VidMode if possible.
171     if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then
172     AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [
173     AC_DEFINE(ENABLE_XF86_VIDMODE, 1, [Define if using XFree86 DGA extension.])
174     LIBS="$LIBS -lXxf86vm"
175     ], [
176     AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.])
177     WANT_XF86_VIDMODE=no
178     ])
179     fi
180    
181     dnl We use GTK+ if possible.
182     UISRCS=../dummy/prefs_editor_dummy.cpp
183     if [[ "x$WANT_GTK" = "xyes" ]]; then
184     AM_PATH_GTK(1.2.0, [
185     AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
186     CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
187     LIBS="$LIBS $GTK_LIBS"
188     UISRCS=prefs_editor_gtk.cpp
189     B2_PATH_GNOMEUI([
190     AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.])
191     CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS"
192     LIBS="$LIBS $GNOMEUI_LIBS"
193     ], [])
194     ], [
195     AC_MSG_WARN([Could not find GTK+, disabling user interface.])
196     WANT_GTK=no
197     ])
198     fi
199    
200     dnl We use ESD if possible.
201     if [[ "x$WANT_ESD" = "xyes" ]]; then
202     AM_PATH_ESD(0.2.8, [
203     AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.])
204     CFLAGS="$CFLAGS $ESD_CFLAGS"
205     CXXFLAGS="$CXXFLAGS $ESD_CFLAGS"
206     LIBS="$LIBS $ESD_LIBS"
207     ], [
208     AC_MSG_WARN([Could not find ESD, disabling ESD support.])
209     WANT_ESD=no
210     ])
211     fi
212    
213     dnl We use 64-bit file size support if possible.
214     AC_SYS_LARGEFILE
215    
216     dnl Checks for header files.
217     AC_HEADER_STDC
218     AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
219    
220     dnl Checks for typedefs, structures, and compiler characteristics.
221     AC_C_BIGENDIAN
222     AC_C_CONST
223     AC_C_INLINE
224     AC_CHECK_SIZEOF(short, 2)
225     AC_CHECK_SIZEOF(int, 4)
226     AC_CHECK_SIZEOF(long, 4)
227     AC_CHECK_SIZEOF(long long, 8)
228     AC_CHECK_SIZEOF(float, 4)
229     AC_CHECK_SIZEOF(double, 8)
230     AC_CHECK_SIZEOF(long double, 12)
231     AC_CHECK_SIZEOF(void *, 4)
232     AC_TYPE_OFF_T
233     AC_CHECK_TYPE(loff_t, off_t)
234     AC_CHECK_TYPE(caddr_t, [char *])
235     AC_TYPE_SIZE_T
236     AC_TYPE_SIGNAL
237     AC_HEADER_TIME
238     AC_STRUCT_TM
239    
240     dnl Check whether sys/socket.h defines type socklen_t.
241     dnl (extracted from ac-archive/Miscellaneous)
242     AC_CACHE_CHECK([for socklen_t],
243     ac_cv_type_socklen_t, [
244     AC_TRY_COMPILE([
245     #include <sys/types.h>
246     #include <sys/socket.h>
247     ], [socklen_t len = 42; return 0;],
248     ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
249     dnl When cross-compiling, do not assume anything.
250     ac_cv_type_socklen_t="guessing no"
251     )
252     ])
253     if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
254     AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.])
255     fi
256    
257     dnl Checks for library functions.
258     AC_CHECK_FUNCS(strdup cfmakeraw)
259     AC_CHECK_FUNCS(clock_gettime timer_create)
260     AC_CHECK_FUNCS(sigaction signal)
261     AC_CHECK_FUNCS(mmap mprotect munmap)
262     AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
263    
264     dnl Darwin seems to define mach_task_self() instead of task_self().
265     AC_CHECK_FUNCS(mach_task_self task_self)
266    
267     dnl Check for headers and functions related to pty support (sshpty.c)
268     dnl From openssh-3.2.2p1 configure.ac
269    
270     AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
271     AC_CHECK_FUNCS(_getpty vhangup strlcpy)
272    
273     case "$host" in
274     *-*-hpux10.26)
275     disable_ptmx_check=yes
276     ;;
277     *-*-linux*)
278     no_dev_ptmx=1
279     ;;
280     mips-sony-bsd|mips-sony-newsos4)
281     AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).])
282     ;;
283     *-*-sco3.2v4*)
284     no_dev_ptmx=1
285     ;;
286     *-*-sco3.2v5*)
287     no_dev_ptmx=1
288     ;;
289     esac
290    
291     if test -z "$no_dev_ptmx" ; then
292     if test "x$disable_ptmx_check" != "xyes" ; then
293     AC_CHECK_FILE([/dev/ptmx],
294     [
295     AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.])
296     have_dev_ptmx=1
297     ]
298     )
299     fi
300     fi
301     AC_CHECK_FILE([/dev/ptc],
302     [
303     AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.])
304     have_dev_ptc=1
305     ]
306     )
307    
308     dnl (end of code from openssh-3.2.2p1 configure.ac)
309    
310    
311     dnl Select system-dependant source files.
312     SERIALSRC=serial_unix.cpp
313     ETHERSRC=../dummy/ether_dummy.cpp
314     SCSISRC=../dummy/scsi_dummy.cpp
315     AUDIOSRC=../dummy/audio_dummy.cpp
316     EXTRASYSSRCS=
317     CAN_NATIVE_M68K=no
318     case "$target_os" in
319     linux*)
320     ETHERSRC=ether_unix.cpp
321     AUDIOSRC=audio_oss_esd.cpp
322     SCSISRC=Linux/scsi_linux.cpp
323     ;;
324     freebsd*)
325     ETHERSRC=ether_unix.cpp
326     AUDIOSRC=audio_oss_esd.cpp
327     DEFINES="$DEFINES -DBSD_COMP"
328     CXXFLAGS="$CXXFLAGS -fpermissive"
329     dnl Check for the CAM library
330     AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
331     if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
332     AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
333     else
334     dnl Check for the sys kernel includes
335     AC_CHECK_HEADER(camlib.h)
336     if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
337     dnl In this case I should fix this thing including a "patch"
338     dnl to access directly to the functions in the kernel :) --Orlando
339     AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.])
340     else
341     SCSISRC=FreeBSD/scsi_freebsd.cpp
342     LIBS="$LIBS -lcam"
343     DEFINES="$DEFINES -DCAM"
344     fi
345     fi
346     ;;
347     netbsd*)
348     CAN_NATIVE_M68K=yes
349     ;;
350     solaris*)
351     AUDIOSRC=Solaris/audio_solaris.cpp
352     DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
353     ;;
354     irix*)
355     ETHERSRC=ether_unix.cpp
356     AUDIOSRC=Irix/audio_irix.cpp
357     EXTRASYSSRCS=Irix/unaligned.c
358     dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
359     DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
360     LIBS="$LIBS -laudio"
361     WANT_ESD=no
362    
363     dnl Check if our compiler supports -Ofast (MIPSPro)
364     HAVE_OFAST=no
365     ocflags="$CFLAGS"
366     CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'`
367     AC_MSG_CHECKING(if "-Ofast" works)
368     dnl Do a test compile of an empty function
369     AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no))
370     CFLAGS="$ocflags"
371    
372     ;;
373     esac
374    
375     dnl Use 68k CPU natively?
376     WANT_NATIVE_M68K=no
377     if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
378     AC_DEFINE(ENABLE_NATIVE_M68K, 1, [Define if using native 68k mode.])
379     WANT_NATIVE_M68K=yes
380     fi
381    
382     if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
383     dnl Serial, ethernet and audio support needs pthreads
384     AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
385     SERIALSRC=../dummy/serial_dummy.cpp
386     ETHERSRC=../dummy/ether_dummy.cpp
387     AUDIOSRC=../dummy/audio_dummy.cpp
388     fi
389     SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
390    
391     dnl Define a macro that translates a yesno-variable into a C macro definition
392     dnl to be put into the config.h file
393     dnl $1 -- the macro to define
394     dnl $2 -- the value to translate
395     dnl $3 -- template name
396     AC_DEFUN(AC_TRANSLATE_DEFINE, [
397     if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
398     AC_DEFINE($1, 1, $3)
399     fi
400     ])
401    
402     dnl Various checks if the system supports vm_allocate() and the like functions.
403     have_mach_vm=no
404     if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
405     "x$ac_cv_func_vm_protect" = "xyes" ]]; then
406     have_mach_vm=yes
407     fi
408     AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
409     [Define if your system has a working vm_allocate()-based memory allocator.])
410    
411     dnl Check that vm_allocate(), vm_protect() work
412     if [[ "x$have_mach_vm" = "xyes" ]]; then
413    
414     AC_CACHE_CHECK([whether vm_protect works],
415     ac_cv_vm_protect_works, [
416     AC_LANG_SAVE
417     AC_LANG_CPLUSPLUS
418     ac_cv_vm_protect_works=yes
419     dnl First the tests that should segfault
420     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
421     AC_TRY_RUN([
422     #define CONFIGURE_TEST_VM_MAP
423     #define TEST_VM_PROT_$test_def
424     #include "vm_alloc.cpp"
425     ], ac_cv_vm_protect_works=no, rm -f core,
426     dnl When cross-compiling, do not assume anything
427     ac_cv_vm_protect_works="guessing no"
428     )
429     done
430     AC_TRY_RUN([
431     #define CONFIGURE_TEST_VM_MAP
432     #define TEST_VM_PROT_RDWR_WRITE
433     #include "vm_alloc.cpp"
434     ], , ac_cv_vm_protect_works=no,
435     dnl When cross-compiling, do not assume anything
436     ac_cv_vm_protect_works="guessing no"
437     )
438     AC_LANG_RESTORE
439     ]
440     )
441    
442     dnl Remove support for vm_allocate() if vm_protect() does not work
443     if [[ "x$have_mach_vm" = "xyes" ]]; then
444     case $ac_cv_vm_protect_works in
445     *yes) have_mach_vm=yes;;
446     *no) have_mach_vm=no;;
447     esac
448     fi
449     AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
450     [Define if your system has a working vm_allocate()-based memory allocator.])
451    
452     fi dnl HAVE_MACH_VM
453    
454     dnl Various checks if the system supports mmap() and the like functions.
455     dnl ... and Mach memory allocators are not supported
456     have_mmap_vm=no
457     if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
458     "x$ac_cv_func_mprotect" = "xyes" ]]; then
459     if [[ "x$have_mach_vm" = "xno" ]]; then
460     have_mmap_vm=yes
461     fi
462     fi
463     AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
464     [Define if your system has a working mmap()-based memory allocator.])
465    
466     dnl Check that mmap() and associated functions work.
467     if [[ "x$have_mmap_vm" = "xyes" ]]; then
468    
469     dnl Check if we have a working anonymous mmap()
470     AC_CACHE_CHECK([whether mmap supports MAP_ANON],
471     ac_cv_mmap_anon, [
472     AC_LANG_SAVE
473     AC_LANG_CPLUSPLUS
474     AC_TRY_RUN([
475     #define HAVE_MMAP_ANON
476     #define CONFIGURE_TEST_VM_MAP
477     #define TEST_VM_MMAP_ANON
478     #include "vm_alloc.cpp"
479     ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
480     dnl When cross-compiling, do not assume anything.
481     ac_cv_mmap_anon="guessing no"
482     )
483     AC_LANG_RESTORE
484     ]
485     )
486     AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon",
487     [Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.])
488    
489     AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS],
490     ac_cv_mmap_anonymous, [
491     AC_LANG_SAVE
492     AC_LANG_CPLUSPLUS
493     AC_TRY_RUN([
494     #define HAVE_MMAP_ANONYMOUS
495     #define CONFIGURE_TEST_VM_MAP
496     #define TEST_VM_MMAP_ANON
497     #include "vm_alloc.cpp"
498     ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
499     dnl When cross-compiling, do not assume anything.
500     ac_cv_mmap_anonymous="guessing no"
501     )
502     AC_LANG_RESTORE
503     ]
504     )
505     AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous",
506     [Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.])
507    
508     AC_CACHE_CHECK([whether mprotect works],
509     ac_cv_mprotect_works, [
510     AC_LANG_SAVE
511     AC_LANG_CPLUSPLUS
512     ac_cv_mprotect_works=yes
513     dnl First the tests that should segfault
514     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
515     AC_TRY_RUN([
516     #define CONFIGURE_TEST_VM_MAP
517     #define TEST_VM_PROT_$test_def
518     #include "vm_alloc.cpp"
519     ], ac_cv_mprotect_works=no, rm -f core,
520     dnl When cross-compiling, do not assume anything
521     ac_cv_mprotect_works="guessing no"
522     )
523     done
524     AC_TRY_RUN([
525     #define CONFIGURE_TEST_VM_MAP
526     #define TEST_VM_PROT_RDWR_WRITE
527     #include "vm_alloc.cpp"
528     ], , ac_cv_mprotect_works=no,
529     dnl When cross-compiling, do not assume anything
530     ac_cv_mprotect_works="guessing no"
531     )
532     AC_LANG_RESTORE
533     ]
534     )
535    
536     dnl Remove support for mmap() if mprotect() does not work
537     if [[ "x$have_mmap_vm" = "xyes" ]]; then
538     case $ac_cv_mprotect_works in
539     *yes) have_mmap_vm=yes;;
540     *no) have_mmap_vm=no;;
541     esac
542     fi
543     AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm,
544     [Define if your system has a working mmap()-based memory allocator.])
545    
546     fi dnl HAVE_MMAP_VM
547    
548     dnl Check if we can mmap 0x2000 bytes from 0x0000
549     AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
550     ac_cv_can_map_lm, [
551     AC_LANG_SAVE
552     AC_LANG_CPLUSPLUS
553     AC_TRY_RUN([
554     #include "vm_alloc.cpp"
555     int main(void) { /* returns 0 if we could map the lowmem globals */
556     volatile char * lm;
557     if (vm_init() < 0) exit(1);
558     if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1);
559     lm[0] = 'z';
560     if (vm_release((char *)lm, 0x2000) < 0) exit(1);
561     vm_exit(); exit(0);
562     }
563     ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
564     dnl When cross-compiling, do not assume anything.
565     ac_cv_can_map_lm="guessing no"
566     )
567     AC_LANG_RESTORE
568     ]
569     )
570    
571     dnl Check signal handlers need to be reinstalled
572     AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
573     ac_cv_signal_need_reinstall, [
574     AC_LANG_SAVE
575     AC_LANG_CPLUSPLUS
576     AC_TRY_RUN([
577     #include <stdlib.h>
578     #ifdef HAVE_UNISTD_H
579     #include <unistd.h>
580     #endif
581     #include <signal.h>
582     static int handled_signal = 0;
583     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
584     int main(void) { /* returns 0 if signals need not to be reinstalled */
585     signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
586     exit(handled_signal == 2);
587     }
588     ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
589     dnl When cross-compiling, do not assume anything.
590     ac_cv_signal_need_reinstall="guessing yes"
591     )
592     AC_LANG_RESTORE
593     ]
594     )
595     AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall",
596     [Define if your system requires signals to be reinstalled.])
597    
598     dnl Check if sigaction handlers need to be reinstalled
599     AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
600     ac_cv_sigaction_need_reinstall, [
601     AC_LANG_SAVE
602     AC_LANG_CPLUSPLUS
603     AC_TRY_RUN([
604     #include <stdlib.h>
605     #ifdef HAVE_UNISTD_H
606     #include <unistd.h>
607     #endif
608     #include <signal.h>
609     static int handled_signal = 0;
610     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
611     typedef RETSIGTYPE (*signal_handler)(int);
612     static signal_handler mysignal(int sig, signal_handler handler) {
613     struct sigaction old_sa;
614     struct sigaction new_sa;
615     new_sa.sa_handler = handler;
616     return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
617     }
618     int main(void) { /* returns 0 if signals need not to be reinstalled */
619     mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
620     exit(handled_signal == 2);
621     }
622     ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
623     dnl When cross-compiling, do not assume anything.
624     ac_cv_sigaction_need_reinstall="guessing yes"
625     )
626     AC_LANG_RESTORE
627     ]
628     )
629     AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
630     [Define if your system requires sigactions to be reinstalled.])
631    
632     dnl Check if extended signals are supported.
633     AC_CACHE_CHECK([whether your system supports extended signal handlers],
634     ac_cv_have_extended_signals, [
635     AC_LANG_SAVE
636     AC_LANG_CPLUSPLUS
637     AC_TRY_RUN([
638     #define HAVE_SIGINFO_T 1
639     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
640     #include "vm_alloc.cpp"
641     #include "sigsegv.cpp"
642     ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
643     dnl When cross-compiling, do not assume anything.
644     ac_cv_have_extended_signals=no
645     )
646     AC_LANG_RESTORE
647     ]
648     )
649     AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
650     [Define if your system support extended signals.])
651    
652     dnl Otherwise, check for subterfuges.
653     if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
654     AC_CACHE_CHECK([whether we then have a subterfuge for your system],
655     ac_cv_have_sigcontext_hack, [
656     AC_LANG_SAVE
657     AC_LANG_CPLUSPLUS
658     AC_TRY_RUN([
659     #define HAVE_SIGCONTEXT_SUBTERFUGE 1
660     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
661     #include "vm_alloc.cpp"
662     #include "sigsegv.cpp"
663     ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
664     dnl When cross-compiling, do not assume anything.
665     ac_cv_have_sigcontext_hack=no
666     )
667     AC_LANG_RESTORE
668     ])
669     AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
670     [Define if we know a hack to replace siginfo_t->si_addr member.])
671     fi
672    
673     dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
674     AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
675     ac_cv_have_skip_instruction, [
676     AC_LANG_SAVE
677     AC_LANG_CPLUSPLUS
678     AC_TRY_RUN([
679     #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
680     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
681     #include "vm_alloc.cpp"
682     #include "sigsegv.cpp"
683     ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
684     dnl When cross-compiling, do not assume anything.
685     ac_cv_have_skip_instruction=no
686     )
687     AC_LANG_RESTORE
688     ]
689     )
690     AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
691     [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
692    
693     dnl Can we do Video on SEGV Signals ?
694     CAN_VOSF=no
695     if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
696     CAN_VOSF=yes
697     fi
698    
699     dnl Determine the addressing mode to use
700     if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
701     ADDRESSING_MODE="real"
702     else
703     ADDRESSING_MODE=""
704     AC_MSG_CHECKING([for the addressing mode to use])
705     for am in $ADDRESSING_TEST_ORDER; do
706     case $am in
707     real)
708     dnl Requires ability to mmap() Low Memory globals
709     if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
710     continue
711     fi
712     dnl Requires VOSF screen updates
713     if [[ "x$CAN_VOSF" = "xno" ]]; then
714     continue
715     fi
716     dnl Real addressing will probably work.
717     ADDRESSING_MODE="real"
718     WANT_VOSF=yes dnl we can use VOSF and we need it actually
719     DEFINES="$DEFINES -DREAL_ADDRESSING"
720     break
721     ;;
722     direct)
723     dnl Requires VOSF screen updates
724     if [[ "x$CAN_VOSF" = "xyes" ]]; then
725     ADDRESSING_MODE="direct"
726     WANT_VOSF=yes dnl we can use VOSF and we need it actually
727     DEFINES="$DEFINES -DDIRECT_ADDRESSING"
728     break
729     fi
730     ;;
731     banks)
732     dnl Default addressing mode
733     ADDRESSING_MODE="memory banks"
734     break
735     ;;
736     *)
737     AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
738     esac
739     done
740     AC_MSG_RESULT($ADDRESSING_MODE)
741     if [[ "x$ADDRESSING_MODE" = "x" ]]; then
742     AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
743     ADDRESSING_MODE="memory banks"
744     fi
745     fi
746    
747 gbeauche 1.5 dnl Banked Memory Addressing mode is not supported by the JIT compiler
748     if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then
749     AC_MSG_ERROR([Sorry, the JIT Compiler requires Direct Addressing, at least])
750     fi
751    
752 gbeauche 1.1 dnl Enable VOSF screen updates with this feature is requested and feasible
753     if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
754     AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
755     else
756     WANT_VOSF=no
757     fi
758    
759     dnl Check for GAS.
760     HAVE_GAS=no
761     AC_MSG_CHECKING(for GAS .p2align feature)
762     cat >conftest.S << EOF
763     .text
764     .p2align 5
765     EOF
766     if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi
767     AC_MSG_RESULT($HAVE_GAS)
768    
769     dnl Check for GCC 2.7 or higher.
770     HAVE_GCC27=no
771     AC_MSG_CHECKING(for GCC 2.7 or higher)
772     AC_EGREP_CPP(yes,
773     [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
774     yes
775     #endif
776     ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
777    
778     dnl Check for GCC 3.0 or higher.
779     HAVE_GCC30=no
780     AC_MSG_CHECKING(for GCC 3.0 or higher)
781     AC_EGREP_CPP(yes,
782     [#if __GNUC__ >= 3
783     yes
784     #endif
785     ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
786    
787     dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
788     dnl Also set "-fno-exceptions" for C++ because exception handling requires
789     dnl the frame pointer.
790     if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
791     CFLAGS="$CFLAGS -fomit-frame-pointer"
792     CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions"
793     fi
794    
795     dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp.
796     dnl As of 2001/08/02, this affects the following compilers:
797     dnl Official: probably gcc-3.1 (mainline CVS)
798     dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
799     dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
800     if [[ "x$HAVE_GCC27" = "xyes" ]]; then
801     SAVED_CXXFLAGS="$CXXFLAGS"
802     CXXFLAGS="$CXXFLAGS -fno-merge-constants"
803     AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
804     AC_LANG_SAVE
805     AC_LANG_CPLUSPLUS
806     AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no])
807     AC_LANG_RESTORE
808     ])
809     if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then
810     CXXFLAGS="$SAVED_CXXFLAGS"
811     fi
812     fi
813    
814     dnl Select appropriate CPU source and REGPARAM define.
815     ASM_OPTIMIZATIONS=none
816     CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
817 gbeauche 1.5
818     dnl (gb) JITSRCS will be emptied later if the JIT is not available
819     dnl Other platforms should define their own set of noflags file variants
820     CAN_JIT=no
821     JITSRCS="compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp"
822    
823 gbeauche 1.1 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then
824     dnl i386 CPU
825 gbeauche 1.6 DEFINES="$DEFINES -DSAHF_SETO_PROFITABLE -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\""
826 gbeauche 1.1 if [[ "x$HAVE_GAS" = "xyes" ]]; then
827     ASM_OPTIMIZATIONS=i386
828 gbeauche 1.6 DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS"
829 gbeauche 1.1 CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
830 gbeauche 1.5 JITSRCS="cpufast1_nf.s cpufast2_nf.s cpufast3_nf.s cpufast4_nf.s cpufast5_nf.s cpufast6_nf.s cpufast7_nf.s cpufast8_nf.s $JITSRCS"
831 gbeauche 1.1 fi
832 gbeauche 1.5 CAN_JIT=yes
833 gbeauche 1.1 elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
834     dnl SPARC CPU
835     case "$target_os" in
836     solaris*)
837     AC_MSG_CHECKING(SPARC CPU architecture)
838     SPARC_TYPE=`Solaris/which_sparc`
839     AC_MSG_RESULT($SPARC_TYPE)
840     case "$SPARC_TYPE" in
841     SPARC_V8)
842     ASM_OPTIMIZATIONS="SPARC V8 architecture"
843     DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
844     CFLAGS="$CFLAGS -Wa,-Av8"
845     CXXFLAGS="$CXXFLAGS -Wa,-Av8"
846     ;;
847     SPARC_V9)
848     ASM_OPTIMIZATIONS="SPARC V9 architecture"
849     DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
850     CFLAGS="$CFLAGS -Wa,-Av9"
851     CXXFLAGS="$CXXFLAGS -Wa,-Av9"
852     ;;
853     esac
854     ;;
855     esac
856     elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
857     dnl Native m68k, no emulation
858     CPUINCLUDES="-I../native_cpu"
859     CPUSRCS="asm_support.s"
860     fi
861    
862 gbeauche 1.5 dnl Enable JIT compiler, if possible.
863     if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
864     JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
865     DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU"
866    
867     if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then
868     if [[ "x$WANT_MON" = "xyes" ]]; then
869     DEFINES="$DEFINES -DJIT_DEBUG=1"
870     else
871     AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug])
872     WANT_JIT_DEBUG=no
873     fi
874     fi
875     else
876     WANT_JIT=no
877     WANT_JIT_DEBUG=no
878     JITSRCS=""
879     fi
880    
881 gbeauche 1.1 dnl Utility macro used by next two tests.
882     dnl AC_EXAMINE_OBJECT(C source code,
883     dnl commands examining object file,
884     dnl [commands to run if compile failed]):
885     dnl
886     dnl Compile the source code to an object file; then convert it into a
887     dnl printable representation. All unprintable characters and
888     dnl asterisks (*) are replaced by dots (.). All white space is
889     dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
890     dnl output, but runs of newlines are compressed to a single newline.
891     dnl Finally, line breaks are forcibly inserted so that no line is
892     dnl longer than 80 columns and the file ends with a newline. The
893     dnl result of all this processing is in the file conftest.dmp, which
894     dnl may be examined by the commands in the second argument.
895     dnl
896     AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
897     [AC_LANG_SAVE
898     AC_LANG_C
899     dnl Next bit cribbed from AC_TRY_COMPILE.
900     cat > conftest.$ac_ext <<EOF
901     [#line __oline__ "configure"
902     #include "confdefs.h"
903     $1
904     ]EOF
905     if AC_TRY_EVAL(ac_compile); then
906     od -c conftest.o |
907     sed ['s/^[0-7]*[ ]*/ /
908     s/\*/./g
909     s/ \\n/*/g
910     s/ [0-9][0-9][0-9]/./g
911     s/ \\[^ ]/./g'] |
912     tr -d '
913     ' | tr -s '*' '
914     ' | fold | sed '$a\
915     ' > conftest.dmp
916     $2
917     ifelse($3, , , else
918     $3
919     )dnl
920     fi
921     rm -rf conftest*
922     AC_LANG_RESTORE])
923    
924     dnl Floating point format probe.
925     dnl The basic concept is the same as the above: grep the object
926     dnl file for an interesting string. We have to watch out for
927     dnl rounding changing the values in the object, however; this is
928     dnl handled by ignoring the least significant byte of the float.
929     dnl
930     dnl Does not know about VAX G-float or C4x idiosyncratic format.
931     dnl It does know about PDP-10 idiosyncratic format, but this is
932     dnl not presently supported by GCC. S/390 "binary floating point"
933     dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
934     dnl as ASCII?)
935     dnl
936     AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
937     [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
938     [gcc_AC_EXAMINE_OBJECT(
939     [/* This will not work unless sizeof(double) == 8. */
940     extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
941    
942     /* This structure must have no internal padding. */
943     struct possibility {
944     char prefix[8];
945     double candidate;
946     char postfix[8];
947     };
948    
949     #define C(cand) { "\nformat:", cand, ":tamrof\n" }
950     struct possibility table [] =
951     {
952     C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
953     C( 3.53802595280598432000e+18), /* D__float - VAX */
954     C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
955     C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
956     C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
957     };],
958     [if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
959     ac_cv_c_float_format='IEEE (big-endian)'
960     elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
961     ac_cv_c_float_format='IEEE (big-endian)'
962     elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
963     ac_cv_c_float_format='IEEE (little-endian)'
964     elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
965     ac_cv_c_float_format='IEEE (little-endian)'
966     elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
967     ac_cv_c_float_format='VAX D-float'
968     elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
969     ac_cv_c_float_format='PDP-10'
970     elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
971     ac_cv_c_float_format='IBM 370 hex'
972     else
973     AC_MSG_ERROR(Unknown floating point format)
974     fi],
975     [AC_MSG_ERROR(compile failed)])
976     ])
977     # IEEE is the default format. If the float endianness isn't the same
978     # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
979     # (which is a tristate: yes, no, default). This is only an issue with
980     # IEEE; the other formats are only supported by a few machines each,
981     # all with the same endianness.
982     format=IEEE_FLOAT_FORMAT
983     fbigend=
984     case $ac_cv_c_float_format in
985     'IEEE (big-endian)' )
986     if test $ac_cv_c_bigendian = no; then
987     fbigend=1
988     fi
989     ;;
990     'IEEE (little-endian)' )
991     if test $ac_cv_c_bigendian = yes; then
992     fbigend=0
993     fi
994     ;;
995     'VAX D-float' )
996     format=VAX_FLOAT_FORMAT
997     ;;
998     'PDP-10' )
999     format=PDP10_FLOAT_FORMAT
1000     ;;
1001     'IBM 370 hex' )
1002     format=IBM_FLOAT_FORMAT
1003     ;;
1004     esac
1005     AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1006     [Define to the floating point format of the host machine.])
1007     if test -n "$fbigend"; then
1008     AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1009     [Define to 1 if the host machine stores floating point numbers in
1010     memory with the word containing the sign bit at the lowest address,
1011     or to 0 if it does it the other way around.
1012    
1013     This macro should not be defined if the ordering is the same as for
1014     multi-word integers.])
1015     fi
1016     ])
1017    
1018     dnl Select appropriate FPU source.
1019     gcc_AC_C_FLOAT_FORMAT
1020     AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h)
1021    
1022     for fpe in $FPE_CORE_TEST_ORDER; do
1023     case $fpe in
1024     ieee)
1025 gbeauche 1.2 case $ac_cv_c_float_format in
1026     IEEE*)
1027 gbeauche 1.1 FPE_CORE="IEEE fpu core"
1028     DEFINES="$DEFINES -DFPU_IEEE"
1029     FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
1030 gbeauche 1.4 dnl Math functions not mandated by C99 standard
1031     AC_CHECK_FUNCS(isnanl isinfl)
1032     dnl Math functions required by C99 standard, but probably not
1033     dnl implemented everywhere. In that case, we fall back to the
1034     dnl regular variant for doubles.
1035     AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl)
1036     AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl)
1037     AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl)
1038     AC_CHECK_FUNCS(floorl ceill)
1039 gbeauche 1.1 break
1040 gbeauche 1.2 ;;
1041     esac
1042 gbeauche 1.1 ;;
1043     x86)
1044     if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then
1045     FPE_CORE="i387 fpu core"
1046     DEFINES="$DEFINES -DFPU_X86"
1047     FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
1048     break
1049     fi
1050     ;;
1051     uae)
1052     FPE_CORE="uae fpu core"
1053     DEFINES="$DEFINES -DFPU_UAE"
1054     FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
1055     break
1056     ;;
1057     *)
1058     AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core])
1059     ;;
1060     esac
1061     done
1062     if [[ "x$FPE_CORE" = "x" ]]; then
1063     AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER])
1064     fi
1065    
1066     dnl Check for certain math functions
1067     AC_CHECK_FUNCS(atanh)
1068 gbeauche 1.4 AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
1069 gbeauche 1.1
1070     dnl UAE CPU sources for all non-m68k-native architectures.
1071     if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
1072     CPUINCLUDES="-I../uae_cpu"
1073 gbeauche 1.5 CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
1074 gbeauche 1.1 fi
1075    
1076     dnl Remove the "-g" option if set for GCC.
1077     if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1078     CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
1079     CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1080     fi
1081    
1082     dnl Or if we have -Ofast
1083     if [[ "x$HAVE_OFAST" = "xyes" ]]; then
1084     CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
1085     CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
1086     CXXFLAGS="-LANG:std $CXXFLAGS"
1087     LDFLAGS="$LDFLAGS -ipa"
1088     fi
1089    
1090     dnl Generate Makefile.
1091     AC_SUBST(DEFINES)
1092     AC_SUBST(SYSSRCS)
1093     AC_SUBST(CPUINCLUDES)
1094     AC_SUBST(CPUSRCS)
1095     AC_OUTPUT(Makefile)
1096    
1097     dnl Print summary.
1098     echo
1099     echo Basilisk II configuration summary:
1100     echo
1101     echo XFree86 DGA support .................... : $WANT_XF86_DGA
1102     echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
1103     echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
1104     echo Enable video on SEGV signals ........... : $WANT_VOSF
1105     echo ESD sound support ...................... : $WANT_ESD
1106     echo GTK user interface ..................... : $WANT_GTK
1107     echo mon debugger support ................... : $WANT_MON
1108     echo Running m68k code natively ............. : $WANT_NATIVE_M68K
1109 gbeauche 1.5 echo Use JIT compiler ....................... : $WANT_JIT
1110     echo JIT debug mode ......................... : $WANT_JIT_DEBUG
1111 gbeauche 1.1 echo Floating-Point emulation core .......... : $FPE_CORE
1112     echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
1113     echo Addressing mode ........................ : $ADDRESSING_MODE
1114     echo
1115     echo "Configuration done. Now type \"make\" (or \"gmake\")."