ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.17
Committed: 2003-07-25T13:45:25Z (21 years, 3 months ago) by cebix
Branch: MAIN
Changes since 1.16: +4 -4 lines
Log Message:
fixed the test for GCC [Brian J. Johnson]

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