ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.11
Committed: 2002-10-01T09:58:08Z (22 years, 2 months ago) by gbeauche
Branch: MAIN
Changes since 1.10: +2 -2 lines
Log Message:
- CAN_JIT=yes has to be moved into the actual block containing JITSRCS.
- Optimistically reenable gas/x86 assembly optimizations and JIT for FreeBSD
  as it used to work in the past there. If not, beat me.

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.11 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
824 gbeauche 1.1 dnl i386 CPU
825 gbeauche 1.7 DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\""
826 gbeauche 1.1 if [[ "x$HAVE_GAS" = "xyes" ]]; then
827     ASM_OPTIMIZATIONS=i386
828 gbeauche 1.7 DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE"
829 gbeauche 1.10 JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS"
830 gbeauche 1.11 CAN_JIT=yes
831 gbeauche 1.1 fi
832     elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
833     dnl SPARC CPU
834     case "$target_os" in
835     solaris*)
836     AC_MSG_CHECKING(SPARC CPU architecture)
837     SPARC_TYPE=`Solaris/which_sparc`
838     AC_MSG_RESULT($SPARC_TYPE)
839     case "$SPARC_TYPE" in
840     SPARC_V8)
841     ASM_OPTIMIZATIONS="SPARC V8 architecture"
842     DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
843     CFLAGS="$CFLAGS -Wa,-Av8"
844     CXXFLAGS="$CXXFLAGS -Wa,-Av8"
845     ;;
846     SPARC_V9)
847     ASM_OPTIMIZATIONS="SPARC V9 architecture"
848     DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
849     CFLAGS="$CFLAGS -Wa,-Av9"
850     CXXFLAGS="$CXXFLAGS -Wa,-Av9"
851     ;;
852     esac
853     ;;
854     esac
855     elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
856     dnl Native m68k, no emulation
857     CPUINCLUDES="-I../native_cpu"
858     CPUSRCS="asm_support.s"
859     fi
860    
861 gbeauche 1.5 dnl Enable JIT compiler, if possible.
862     if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
863     JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
864     DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU"
865    
866     if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then
867     if [[ "x$WANT_MON" = "xyes" ]]; then
868     DEFINES="$DEFINES -DJIT_DEBUG=1"
869     else
870     AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug])
871     WANT_JIT_DEBUG=no
872     fi
873     fi
874 gbeauche 1.8
875     dnl IEEE core is the only FPU emulator to use with the JIT compiler
876     case $FPE_CORE_TEST_ORDER in
877     ieee*) ;;
878     *) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;;
879     esac
880     FPE_CORE_TEST_ORDER="ieee"
881 gbeauche 1.5 else
882     WANT_JIT=no
883     WANT_JIT_DEBUG=no
884     JITSRCS=""
885     fi
886    
887 gbeauche 1.1 dnl Utility macro used by next two tests.
888     dnl AC_EXAMINE_OBJECT(C source code,
889     dnl commands examining object file,
890     dnl [commands to run if compile failed]):
891     dnl
892     dnl Compile the source code to an object file; then convert it into a
893     dnl printable representation. All unprintable characters and
894     dnl asterisks (*) are replaced by dots (.). All white space is
895     dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
896     dnl output, but runs of newlines are compressed to a single newline.
897     dnl Finally, line breaks are forcibly inserted so that no line is
898     dnl longer than 80 columns and the file ends with a newline. The
899     dnl result of all this processing is in the file conftest.dmp, which
900     dnl may be examined by the commands in the second argument.
901     dnl
902     AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
903     [AC_LANG_SAVE
904     AC_LANG_C
905     dnl Next bit cribbed from AC_TRY_COMPILE.
906     cat > conftest.$ac_ext <<EOF
907     [#line __oline__ "configure"
908     #include "confdefs.h"
909     $1
910     ]EOF
911     if AC_TRY_EVAL(ac_compile); then
912     od -c conftest.o |
913     sed ['s/^[0-7]*[ ]*/ /
914     s/\*/./g
915     s/ \\n/*/g
916     s/ [0-9][0-9][0-9]/./g
917     s/ \\[^ ]/./g'] |
918     tr -d '
919     ' | tr -s '*' '
920     ' | fold | sed '$a\
921     ' > conftest.dmp
922     $2
923     ifelse($3, , , else
924     $3
925     )dnl
926     fi
927     rm -rf conftest*
928     AC_LANG_RESTORE])
929    
930     dnl Floating point format probe.
931     dnl The basic concept is the same as the above: grep the object
932     dnl file for an interesting string. We have to watch out for
933     dnl rounding changing the values in the object, however; this is
934     dnl handled by ignoring the least significant byte of the float.
935     dnl
936     dnl Does not know about VAX G-float or C4x idiosyncratic format.
937     dnl It does know about PDP-10 idiosyncratic format, but this is
938     dnl not presently supported by GCC. S/390 "binary floating point"
939     dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
940     dnl as ASCII?)
941     dnl
942     AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
943     [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
944     [gcc_AC_EXAMINE_OBJECT(
945     [/* This will not work unless sizeof(double) == 8. */
946     extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
947    
948     /* This structure must have no internal padding. */
949     struct possibility {
950     char prefix[8];
951     double candidate;
952     char postfix[8];
953     };
954    
955     #define C(cand) { "\nformat:", cand, ":tamrof\n" }
956     struct possibility table [] =
957     {
958     C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
959     C( 3.53802595280598432000e+18), /* D__float - VAX */
960     C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
961     C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
962     C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
963     };],
964     [if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
965     ac_cv_c_float_format='IEEE (big-endian)'
966     elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
967     ac_cv_c_float_format='IEEE (big-endian)'
968     elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
969     ac_cv_c_float_format='IEEE (little-endian)'
970     elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
971     ac_cv_c_float_format='IEEE (little-endian)'
972     elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
973     ac_cv_c_float_format='VAX D-float'
974     elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
975     ac_cv_c_float_format='PDP-10'
976     elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
977     ac_cv_c_float_format='IBM 370 hex'
978     else
979     AC_MSG_ERROR(Unknown floating point format)
980     fi],
981     [AC_MSG_ERROR(compile failed)])
982     ])
983     # IEEE is the default format. If the float endianness isn't the same
984     # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
985     # (which is a tristate: yes, no, default). This is only an issue with
986     # IEEE; the other formats are only supported by a few machines each,
987     # all with the same endianness.
988     format=IEEE_FLOAT_FORMAT
989     fbigend=
990     case $ac_cv_c_float_format in
991     'IEEE (big-endian)' )
992     if test $ac_cv_c_bigendian = no; then
993     fbigend=1
994     fi
995     ;;
996     'IEEE (little-endian)' )
997     if test $ac_cv_c_bigendian = yes; then
998     fbigend=0
999     fi
1000     ;;
1001     'VAX D-float' )
1002     format=VAX_FLOAT_FORMAT
1003     ;;
1004     'PDP-10' )
1005     format=PDP10_FLOAT_FORMAT
1006     ;;
1007     'IBM 370 hex' )
1008     format=IBM_FLOAT_FORMAT
1009     ;;
1010     esac
1011     AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1012     [Define to the floating point format of the host machine.])
1013     if test -n "$fbigend"; then
1014     AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1015     [Define to 1 if the host machine stores floating point numbers in
1016     memory with the word containing the sign bit at the lowest address,
1017     or to 0 if it does it the other way around.
1018    
1019     This macro should not be defined if the ordering is the same as for
1020     multi-word integers.])
1021     fi
1022     ])
1023    
1024     dnl Select appropriate FPU source.
1025     gcc_AC_C_FLOAT_FORMAT
1026     AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h)
1027    
1028     for fpe in $FPE_CORE_TEST_ORDER; do
1029     case $fpe in
1030     ieee)
1031 gbeauche 1.2 case $ac_cv_c_float_format in
1032     IEEE*)
1033 gbeauche 1.1 FPE_CORE="IEEE fpu core"
1034     DEFINES="$DEFINES -DFPU_IEEE"
1035     FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
1036 gbeauche 1.4 dnl Math functions not mandated by C99 standard
1037     AC_CHECK_FUNCS(isnanl isinfl)
1038     dnl Math functions required by C99 standard, but probably not
1039     dnl implemented everywhere. In that case, we fall back to the
1040     dnl regular variant for doubles.
1041     AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl)
1042     AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl)
1043     AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl)
1044     AC_CHECK_FUNCS(floorl ceill)
1045 gbeauche 1.1 break
1046 gbeauche 1.2 ;;
1047     esac
1048 gbeauche 1.1 ;;
1049     x86)
1050     if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then
1051     FPE_CORE="i387 fpu core"
1052     DEFINES="$DEFINES -DFPU_X86"
1053     FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
1054     break
1055     fi
1056     ;;
1057     uae)
1058     FPE_CORE="uae fpu core"
1059     DEFINES="$DEFINES -DFPU_UAE"
1060     FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
1061     break
1062     ;;
1063     *)
1064     AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core])
1065     ;;
1066     esac
1067     done
1068     if [[ "x$FPE_CORE" = "x" ]]; then
1069     AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER])
1070     fi
1071    
1072     dnl Check for certain math functions
1073     AC_CHECK_FUNCS(atanh)
1074 gbeauche 1.4 AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
1075 gbeauche 1.1
1076     dnl UAE CPU sources for all non-m68k-native architectures.
1077     if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
1078     CPUINCLUDES="-I../uae_cpu"
1079 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"
1080 gbeauche 1.1 fi
1081    
1082     dnl Remove the "-g" option if set for GCC.
1083     if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1084     CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
1085     CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1086     fi
1087    
1088     dnl Or if we have -Ofast
1089     if [[ "x$HAVE_OFAST" = "xyes" ]]; then
1090     CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
1091     CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
1092     CXXFLAGS="-LANG:std $CXXFLAGS"
1093     LDFLAGS="$LDFLAGS -ipa"
1094     fi
1095    
1096     dnl Generate Makefile.
1097     AC_SUBST(DEFINES)
1098     AC_SUBST(SYSSRCS)
1099     AC_SUBST(CPUINCLUDES)
1100     AC_SUBST(CPUSRCS)
1101     AC_OUTPUT(Makefile)
1102    
1103     dnl Print summary.
1104     echo
1105     echo Basilisk II configuration summary:
1106     echo
1107     echo XFree86 DGA support .................... : $WANT_XF86_DGA
1108     echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
1109     echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
1110     echo Enable video on SEGV signals ........... : $WANT_VOSF
1111     echo ESD sound support ...................... : $WANT_ESD
1112     echo GTK user interface ..................... : $WANT_GTK
1113     echo mon debugger support ................... : $WANT_MON
1114     echo Running m68k code natively ............. : $WANT_NATIVE_M68K
1115 gbeauche 1.5 echo Use JIT compiler ....................... : $WANT_JIT
1116     echo JIT debug mode ......................... : $WANT_JIT_DEBUG
1117 gbeauche 1.1 echo Floating-Point emulation core .......... : $FPE_CORE
1118     echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
1119     echo Addressing mode ........................ : $ADDRESSING_MODE
1120     echo
1121     echo "Configuration done. Now type \"make\" (or \"gmake\")."