ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.24
Committed: 2003-11-21T14:16:02Z (21 years ago) by gbeauche
Branch: MAIN
CVS Tags: nigel-build-16, nigel-build-15
Changes since 1.23: +3 -3 lines
Log Message:
fix loff_t & caddr_t type checks

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