ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.57
Committed: 2006-01-15T11:38:41Z (18 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.56: +1 -1 lines
Log Message:
fix framework detection on OSX/intel (thanks toshi for the remote access ;-)

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