ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.12
Committed: 2002-11-05T10:32:42Z (22 years ago) by gbeauche
Branch: MAIN
Changes since 1.11: +4 -6 lines
Log Message:
Get rid of CPU_* defines as nobody actually used them and are useless

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