ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.50
Committed: 2005-06-30T10:20:18Z (19 years, 4 months ago) by gbeauche
Branch: MAIN
Changes since 1.49: +1 -0 lines
Log Message:
Add system-specific implementations of idle_{wait,resume} functions.

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