ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.48
Committed: 2005-06-12T23:36:34Z (19 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.47: +3 -1 lines
Log Message:
Check for CoreFoundation framework (Darwin 8.0.1). Likewise for
IOKit/storage/IOBlockStorageDevice.h which is not available there on x86

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