ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/configure.ac
Revision: 1.16
Committed: 2005-02-13T15:32:10Z (19 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.15: +5 -3 lines
Log Message:
Support NetBSD 2.0 for x86:
- implement trunc() function, isless() and isgreater() macros
- execute genexec.pl through a real perl executable
- disable generation of debug info from dyngen u-ops

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
3    
4     AC_INIT([SheepShaver], 2.2, [Christian.Bauer@uni-mainz.de], SheepShaver)
5     AC_CONFIG_SRCDIR(main_unix.cpp)
6     AC_PREREQ(2.52)
7     AC_CONFIG_HEADER(config.h)
8    
9     dnl Canonical system information.
10     AC_CANONICAL_HOST
11     AC_CANONICAL_TARGET
12    
13 gbeauche 1.2 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.1 dnl Options.
18     AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes])
19     AC_ARG_ENABLE(ppc-emulator, [ --enable-ppc-emulator use the selected PowerPC emulator [default=auto]], [WANT_EMULATED_PPC=$enableval], [WANT_EMULATED_PPC=auto])
20     AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
21     AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=no]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=no])
22     AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
23     AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
24     AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
25     AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
26     AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval])
27    
28 gbeauche 1.8 dnl Addressing mode
29     AC_ARG_ENABLE(addressing,
30     [ --enable-addressing=AM set the addressing mode to use [default=real]],
31     [case "$enableval" in
32     real) WANT_ADDRESSING_MODE="real";;
33     direct) WANT_ADDRESSING_MODE="direct";;
34 gbeauche 1.13 direct,0x*) WANT_ADDRESSING_MODE="direct"; NATMEM_OFFSET=`echo "$enableval" | sed -n '/direct,\(0[[xX]][[0-9A-Fa-f]]*\([[UuLl]]\{1,2\}\)\?\)$/s//\1/p'`;;
35 gbeauche 1.8 esac],
36     [WANT_ADDRESSING_MODE="real"]
37     )
38    
39 gbeauche 1.1 dnl SDL options.
40     AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no])
41     AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no])
42 gbeauche 1.7 AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no])
43 gbeauche 1.1
44     dnl Checks for programs.
45     AC_PROG_CC
46     AC_PROG_CPP
47     AC_PROG_CXX
48     AC_PROG_MAKE_SET
49     AC_PROG_INSTALL
50 gbeauche 1.3 AC_PROG_EGREP
51 gbeauche 1.16 AC_PATH_PROGS(FILE, [file false])
52     AC_PATH_PROG(PERL, [perl])
53 gbeauche 1.1
54     dnl Check for PowerPC target CPU.
55     HAVE_PPC=no
56     AC_MSG_CHECKING(for PowerPC target CPU)
57     AC_EGREP_CPP(yes,
58     [
59     #ifdef __powerpc__
60     yes
61     #endif
62     #ifdef __ppc__
63     yes
64     #endif
65     ], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no))
66    
67     dnl We use native CPU if possible.
68     EMULATED_PPC=yes
69     case $WANT_EMULATED_PPC in
70     auto) [[ "x$HAVE_PPC" = "xyes" ]] && EMULATED_PPC=no;;
71     no) EMULATED_PPC=no;;
72     esac
73     if [[ "x$EMULATED_PPC" = "xyes" ]]; then
74     AC_DEFINE(EMULATED_PPC, 1, [Define if using a PowerPC CPU emulator.])
75     fi
76    
77     dnl We use mon if possible.
78     MONSRCS=
79     case "x$WANT_MON" in
80     x/* | x.*)
81     mon_srcdir=$WANT_MON
82     WANT_MON=yes
83     ;;
84     xyes)
85     mon_srcdir=../../../mon/src
86     ;;
87     esac
88     if [[ "x$WANT_MON" = "xyes" ]]; then
89     AC_MSG_CHECKING(for mon)
90     if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
91     AC_MSG_RESULT(yes)
92     AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".])
93     MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c"
94     CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
95     AC_CHECK_LIB(ncurses, tgetent, ,
96     AC_CHECK_LIB(termcap, tgetent, ,
97     AC_CHECK_LIB(termlib, tgetent, ,
98     AC_CHECK_LIB(terminfo, tgetent, ,
99     AC_CHECK_LIB(Hcurses, tgetent, ,
100     AC_CHECK_LIB(curses, tgetent))))))
101     AC_CHECK_LIB(readline, readline)
102     AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
103     else
104     AC_MSG_RESULT(no)
105     AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
106     WANT_MON=no
107     fi
108     fi
109 gbeauche 1.11 AC_SUBST(MONSRCS)
110 gbeauche 1.1
111     dnl Checks for libraries.
112     AC_CHECK_LIB(posix4, sem_init)
113    
114     dnl Do we need SDL?
115     WANT_SDL=no
116     if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
117     WANT_SDL=yes
118     WANT_XF86_DGA=no
119     WANT_XF86_VIDMODE=no
120     WANT_FBDEV_DGA=no
121 gbeauche 1.7 SDL_SUPPORT="$SDL_SUPPORT video"
122     fi
123     if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
124     WANT_SDL=yes
125     SDL_SUPPORT="$SDL_SUPPORT audio"
126 gbeauche 1.1 fi
127     if [[ "x$WANT_SDL" = "xyes" ]]; then
128     AC_PATH_PROG(sdl_config, "sdl-config")
129     if [[ -n "$sdl_config" ]]; then
130 gbeauche 1.9 case $target_os in
131     # Special treatment for Cygwin so that we can still use the POSIX layer
132     *cygwin*)
133     sdl_cflags="-I`$sdl_config --prefix`/include/SDL"
134     sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL"
135     ;;
136     *)
137     sdl_cflags=`$sdl_config --cflags`
138     if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
139     sdl_libs=`$sdl_config --static-libs`
140     else
141     sdl_libs=`$sdl_config --libs`
142     fi
143     ;;
144     esac
145 gbeauche 1.1 CFLAGS="$CFLAGS $sdl_cflags"
146     CXXFLAGS="$CXXFLAGS $sdl_cflags"
147     LIBS="$LIBS $sdl_libs"
148     else
149     WANT_SDL=no
150 gbeauche 1.15 WANT_SDL_VIDEO=no
151     WANT_SDL_AUDIO=no
152 gbeauche 1.1 fi
153 gbeauche 1.7 SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
154     else
155     SDL_SUPPORT="none"
156 gbeauche 1.1 fi
157    
158     dnl We need X11, if not using SDL.
159 gbeauche 1.15 if [[ "x$WANT_SDL_VIDEO" != "xyes" ]]; then
160 gbeauche 1.1 AC_PATH_XTRA
161     if [[ "x$no_x" = "xyes" ]]; then
162     AC_MSG_ERROR([You need X11 to run SheepShaver.])
163     fi
164     CFLAGS="$CFLAGS $X_CFLAGS"
165     CXXFLAGS="$CXXFLAGS $X_CFLAGS"
166     LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
167     fi
168    
169     dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL.
170     HAVE_PTHREADS=yes
171     case $EMULATED_PPC:$target_os in
172     no:linux*)
173     dnl We do have our own pthread_cancel() implementation
174     AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.])
175     ;;
176     *:*)
177     AC_CHECK_LIB(pthread, pthread_create, , [
178     AC_CHECK_LIB(c_r, pthread_create, , [
179     AC_CHECK_LIB(PTL, pthread_create, , [
180     AC_MSG_ERROR([You need pthreads to run Basilisk II.])
181     ])
182     ])
183     ])
184     AC_CHECK_FUNCS(pthread_cancel)
185     AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
186     AC_CHECK_FUNCS(pthread_mutexattr_settype)
187     AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
188     if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
189     AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
190     fi
191     dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
192     SEMSRC=
193     AC_CHECK_FUNCS(sem_init, , [
194     if test "x$HAVE_PTHREADS" = "xyes"; then
195     SEMSRC=posix_sem.cpp
196     fi
197     ])
198     ;;
199     esac
200    
201     dnl We use XFree86 DGA if possible.
202     if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
203     AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [
204     AC_DEFINE(ENABLE_XF86_DGA, 1, [Define if using XFree86 DGA extension.])
205     LIBS="$LIBS -lXxf86dga"
206     ], [
207     AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
208     WANT_XF86_DGA=no
209     ])
210     fi
211    
212     dnl We use XFree86 VidMode if possible.
213     if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then
214     AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [
215     AC_DEFINE(ENABLE_XF86_VIDMODE, 1, [Define if using XFree86 DGA extension.])
216     LIBS="$LIBS -lXxf86vm"
217     ], [
218     AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.])
219     WANT_XF86_VIDMODE=no
220     ])
221     fi
222    
223     dnl We use GTK+ if possible.
224     UISRCS=../dummy/prefs_editor_dummy.cpp
225     if [[ "x$WANT_GTK" = "xyes" ]]; then
226     AM_PATH_GTK(1.2.0, [
227     AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
228     CFLAGS="$CFLAGS $GTK_CFLAGS"
229     CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
230     LIBS="$LIBS $GTK_LIBS"
231     UISRCS=prefs_editor_gtk.cpp
232     ], [
233     AC_MSG_WARN([Could not find GTK+, disabling user interface.])
234     WANT_GTK=no
235     ])
236     fi
237    
238     dnl We use ESD if possible.
239     if [[ "x$WANT_ESD" = "xyes" ]]; then
240     AM_PATH_ESD(0.2.8, [
241     AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.])
242     CFLAGS="$CFLAGS $ESD_CFLAGS"
243     CXXFLAGS="$CXXFLAGS $ESD_CFLAGS"
244     LIBS="$LIBS $ESD_LIBS"
245     ], [
246     AC_MSG_WARN([Could not find ESD, disabling ESD support.])
247     WANT_ESD=no
248     ])
249     fi
250    
251 gbeauche 1.2 dnl We use 64-bit file size support if possible.
252     AC_SYS_LARGEFILE
253    
254 gbeauche 1.1 dnl Checks for header files.
255     AC_HEADER_STDC
256     AC_HEADER_SYS_WAIT
257 gbeauche 1.9 AC_CHECK_HEADERS(malloc.h)
258 gbeauche 1.1 AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h)
259     AC_CHECK_HEADERS(sys/time.h sys/times.h sys/socket.h)
260 gbeauche 1.4 AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h)
261 gbeauche 1.1 AC_CHECK_HEADERS(linux/if.h, [], [], [
262     #if HAVE_SYS_SOCKET_H
263     # include <sys/socket.h>
264     #endif
265     ])
266     AC_CHECK_HEADERS(linux/if_tun.h net/if.h net/if_tun.h)
267 gbeauche 1.10 AC_CHECK_HEADERS(fenv.h)
268 gbeauche 1.1
269     dnl Checks for typedefs, structures, and compiler characteristics.
270     AC_C_BIGENDIAN
271     AC_C_CONST
272     AC_C_INLINE
273     AC_CHECK_SIZEOF(short, 2)
274     AC_CHECK_SIZEOF(int, 4)
275     AC_CHECK_SIZEOF(long, 4)
276     AC_CHECK_SIZEOF(long long, 8)
277     AC_CHECK_SIZEOF(float, 4)
278     AC_CHECK_SIZEOF(double, 8)
279     AC_CHECK_SIZEOF(void *, 4)
280     AC_TYPE_OFF_T
281     AC_CHECK_TYPE(loff_t, off_t)
282     AC_TYPE_SIZE_T
283     AC_TYPE_SIGNAL
284     AC_HEADER_TIME
285     AC_STRUCT_TM
286    
287     dnl Check whether struct sigaction has sa_restorer member.
288     AC_CACHE_CHECK([whether struct sigaction has sa_restorer],
289     ac_cv_signal_sa_restorer, [
290     AC_TRY_COMPILE([
291     #include <signal.h>
292     ], [struct sigaction sa; sa.sa_restorer = 0;],
293     ac_cv_signal_sa_restorer=yes, ac_cv_signal_sa_restorer=no,
294     dnl When cross-compiling, do not assume anything.
295     ac_cv_signal_sa_restorer=no
296     )
297     ])
298     if [[ "x$ac_cv_signal_sa_restorer" = "xyes" ]]; then
299     AC_DEFINE(HAVE_SIGNAL_SA_RESTORER, 1, [Define if sa_restorer is available in struct sigaction.])
300     fi
301    
302     dnl Checks for library functions.
303     AC_CHECK_FUNCS(strdup strlcpy cfmakeraw)
304     AC_CHECK_FUNCS(nanosleep)
305     AC_CHECK_FUNCS(sigaction signal)
306     AC_CHECK_FUNCS(mmap mprotect munmap)
307     AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
308     AC_CHECK_FUNCS(posix_memalign memalign valloc)
309 gbeauche 1.16 AC_CHECK_FUNCS(exp2f log2f exp2 log2 trunc)
310 gbeauche 1.1
311     dnl Darwin seems to define mach_task_self() instead of task_self().
312     AC_CHECK_FUNCS(mach_task_self task_self)
313    
314     dnl We need clock_gettime() for better performance but it may drag
315     dnl libpthread in, which we don't want for native ppc mode
316     case $EMULATED_PPC:$target_os in
317     no:linux*)
318     ;;
319     *:*)
320     AC_SEARCH_LIBS(clock_gettime, [rt posix4])
321     AC_CHECK_FUNCS(clock_gettime)
322     ;;
323     esac
324    
325 gbeauche 1.9 dnl Check for headers and functions related to pty support (sshpty.c)
326     dnl From openssh-3.2.2p1 configure.ac
327     AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
328     AC_CHECK_FUNCS(_getpty vhangup strlcpy)
329    
330     case "$host" in
331     *-*-hpux10.26)
332     disable_ptmx_check=yes
333     ;;
334     *-*-linux*)
335     no_dev_ptmx=1
336     ;;
337     mips-sony-bsd|mips-sony-newsos4)
338     AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).])
339     ;;
340     *-*-sco3.2v4*)
341     no_dev_ptmx=1
342     ;;
343     *-*-sco3.2v5*)
344     no_dev_ptmx=1
345     ;;
346     *-*-cygwin*)
347     no_dev_ptmx=1
348     ;;
349     esac
350    
351     if test -z "$no_dev_ptmx" ; then
352     if test "x$disable_ptmx_check" != "xyes" ; then
353     AC_CHECK_FILE([/dev/ptmx],
354     [
355     AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.])
356     have_dev_ptmx=1
357     ]
358     )
359     fi
360     fi
361     AC_CHECK_FILE([/dev/ptc],
362     [
363     AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.])
364     have_dev_ptc=1
365     ]
366     )
367     dnl (end of code from openssh-3.2.2p1 configure.ac)
368    
369 gbeauche 1.1 dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
370     AC_DEFUN(AC_CHECK_FRAMEWORK, [
371     AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
372     AC_CACHE_CHECK([whether compiler supports framework $1],
373     ac_Framework, [
374     saved_LIBS="$LIBS"
375     LIBS="$LIBS -framework $1"
376     AC_TRY_LINK(
377     [$2], [int main(void) { return 0; }],
378     [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
379     )
380     ])
381     AS_IF([test AS_VAR_GET(ac_Framework) = yes],
382     [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
383     )
384     AS_VAR_POPDEF([ac_Framework])dnl
385     ])
386    
387     dnl Check for some MacOS X frameworks
388     AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
389     AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
390    
391     dnl Select system-dependant sources.
392     SERIALSRC=serial_unix.cpp
393     ETHERSRC=../dummy/ether_dummy.cpp
394     SCSISRC=../dummy/scsi_dummy.cpp
395     AUDIOSRC=../dummy/audio_dummy.cpp
396 gbeauche 1.6 EXTFSSRC=extfs_unix.cpp
397 gbeauche 1.1 EXTRASYSSRCS=
398     case "$target_os" in
399     linux*)
400     ETHERSRC=Linux/ether_linux.cpp
401     AUDIOSRC=audio_oss_esd.cpp
402     SCSISRC=Linux/scsi_linux.cpp
403     if [[ "x$EMULATED_PPC" = "xno" ]]; then
404     EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S"
405     fi
406     ;;
407     darwin*)
408     if [[ "x$EMULATED_PPC" = "xno" ]]; then
409     EXTRASYSSRCS="Darwin/paranoia.cpp Linux/asm_linux.S"
410     fi
411     if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then
412     EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp"
413     fi
414 gbeauche 1.6 if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
415     EXTFSSRC=../MacOSX/extfs_macosx.mm
416     fi
417 gbeauche 1.1 ;;
418 gbeauche 1.9 cygwin*)
419     SERIALSRC="../dummy/serial_dummy.cpp"
420     ;;
421 gbeauche 1.1 esac
422    
423     dnl SDL overrides
424     if [[ "x$WANT_SDL" = "xyes" ]]; then
425     AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.])
426     fi
427     if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
428 gbeauche 1.7 AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support.])
429 gbeauche 1.1 VIDEOSRCS="../SDL/video_sdl.cpp"
430     KEYCODES="../SDL/keycodes"
431     if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
432     EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
433     else
434 gbeauche 1.9 case "$target_os" in
435     cygwin*)
436     EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
437     ;;
438     *)
439     EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
440     ;;
441     esac
442 gbeauche 1.1 fi
443     else
444     VIDEOSRCS="video_x.cpp"
445     KEYCODES="keycodes"
446     EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp"
447     fi
448 gbeauche 1.7 if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
449     AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
450     AUDIOSRC="../SDL/audio_sdl.cpp"
451     fi
452 gbeauche 1.1
453 gbeauche 1.11 SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $EXTRASYSSRCS"
454 gbeauche 1.1
455     dnl Define a macro that translates a yesno-variable into a C macro definition
456     dnl to be put into the config.h file
457     dnl $1 -- the macro to define
458     dnl $2 -- the value to translate
459     dnl $3 -- template name
460     AC_DEFUN(AC_TRANSLATE_DEFINE, [
461     if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
462     AC_DEFINE($1, 1, $3)
463     fi
464     ])
465    
466     dnl Check that the host supports TUN/TAP devices
467     AC_CACHE_CHECK([whether TUN/TAP is supported],
468     ac_cv_tun_tap_support, [
469     AC_TRY_COMPILE([
470     #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
471     #include <linux/if.h>
472     #include <linux/if_tun.h>
473     #endif
474     #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
475     #include <net/if.h>
476     #include <net/if_tun.h>
477     #endif
478     ], [
479     struct ifreq ifr;
480     memset(&ifr, 0, sizeof(ifr));
481     ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
482     ],
483     ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
484     )
485     ])
486     AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
487     [Define if your system supports TUN/TAP devices.])
488    
489     dnl Various checks if the system supports vm_allocate() and the like functions.
490     have_mach_vm=no
491     if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
492     "x$ac_cv_func_vm_protect" = "xyes" ]]; then
493     have_mach_vm=yes
494     fi
495     AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
496     [Define if your system has a working vm_allocate()-based memory allocator.])
497    
498     dnl Check that vm_allocate(), vm_protect() work
499     if [[ "x$have_mach_vm" = "xyes" ]]; then
500    
501     AC_CACHE_CHECK([whether vm_protect works],
502     ac_cv_vm_protect_works, [
503     AC_LANG_SAVE
504     AC_LANG_CPLUSPLUS
505     ac_cv_vm_protect_works=yes
506     dnl First the tests that should segfault
507     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
508     AC_TRY_RUN([
509     #define CONFIGURE_TEST_VM_MAP
510     #define TEST_VM_PROT_$test_def
511     #include "vm_alloc.cpp"
512     ], ac_cv_vm_protect_works=no, rm -f core,
513     dnl When cross-compiling, do not assume anything
514     ac_cv_vm_protect_works="guessing no"
515     )
516     done
517     AC_TRY_RUN([
518     #define CONFIGURE_TEST_VM_MAP
519     #define TEST_VM_PROT_RDWR_WRITE
520     #include "vm_alloc.cpp"
521     ], , ac_cv_vm_protect_works=no,
522     dnl When cross-compiling, do not assume anything
523     ac_cv_vm_protect_works="guessing no"
524     )
525     AC_LANG_RESTORE
526     ]
527     )
528    
529     dnl Remove support for vm_allocate() if vm_protect() does not work
530     if [[ "x$have_mach_vm" = "xyes" ]]; then
531     case $ac_cv_vm_protect_works in
532     *yes) have_mach_vm=yes;;
533     *no) have_mach_vm=no;;
534     esac
535     fi
536     AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
537     [Define if your system has a working vm_allocate()-based memory allocator.])
538    
539     fi dnl HAVE_MACH_VM
540    
541     dnl Various checks if the system supports mmap() and the like functions.
542     dnl ... and Mach memory allocators are not supported
543     have_mmap_vm=no
544     if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
545     "x$ac_cv_func_mprotect" = "xyes" ]]; then
546     if [[ "x$have_mach_vm" = "xno" ]]; then
547     have_mmap_vm=yes
548     fi
549     fi
550     AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
551     [Define if your system has a working mmap()-based memory allocator.])
552    
553     dnl Check that mmap() and associated functions work.
554     if [[ "x$have_mmap_vm" = "xyes" ]]; then
555    
556     dnl Check if we have a working anonymous mmap()
557     AC_CACHE_CHECK([whether mmap supports MAP_ANON],
558     ac_cv_mmap_anon, [
559     AC_LANG_SAVE
560     AC_LANG_CPLUSPLUS
561     AC_TRY_RUN([
562     #define HAVE_MMAP_ANON
563     #define CONFIGURE_TEST_VM_MAP
564     #define TEST_VM_MMAP_ANON
565     #include "vm_alloc.cpp"
566     ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
567     dnl When cross-compiling, do not assume anything.
568     ac_cv_mmap_anon="guessing no"
569     )
570     AC_LANG_RESTORE
571     ]
572     )
573     AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon",
574     [Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.])
575    
576     AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS],
577     ac_cv_mmap_anonymous, [
578     AC_LANG_SAVE
579     AC_LANG_CPLUSPLUS
580     AC_TRY_RUN([
581     #define HAVE_MMAP_ANONYMOUS
582     #define CONFIGURE_TEST_VM_MAP
583     #define TEST_VM_MMAP_ANON
584     #include "vm_alloc.cpp"
585     ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
586     dnl When cross-compiling, do not assume anything.
587     ac_cv_mmap_anonymous="guessing no"
588     )
589     AC_LANG_RESTORE
590     ]
591     )
592     AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous",
593     [Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.])
594    
595     AC_CACHE_CHECK([whether mprotect works],
596     ac_cv_mprotect_works, [
597     AC_LANG_SAVE
598     AC_LANG_CPLUSPLUS
599     ac_cv_mprotect_works=yes
600     dnl First the tests that should segfault
601     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
602     AC_TRY_RUN([
603     #define CONFIGURE_TEST_VM_MAP
604     #define TEST_VM_PROT_$test_def
605     #include "vm_alloc.cpp"
606     ], ac_cv_mprotect_works=no, rm -f core,
607     dnl When cross-compiling, do not assume anything
608     ac_cv_mprotect_works="guessing no"
609     )
610     done
611     AC_TRY_RUN([
612     #define CONFIGURE_TEST_VM_MAP
613     #define TEST_VM_PROT_RDWR_WRITE
614     #include "vm_alloc.cpp"
615     ], , ac_cv_mprotect_works=no,
616     dnl When cross-compiling, do not assume anything
617     ac_cv_mprotect_works="guessing no"
618     )
619     AC_LANG_RESTORE
620     ]
621     )
622    
623     dnl Remove support for mmap() if mprotect() does not work
624     if [[ "x$have_mmap_vm" = "xyes" ]]; then
625     case $ac_cv_mprotect_works in
626     *yes) have_mmap_vm=yes;;
627     *no) have_mmap_vm=no;;
628     esac
629     fi
630     AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm,
631     [Define if your system has a working mmap()-based memory allocator.])
632    
633     fi dnl HAVE_MMAP_VM
634    
635     dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
636     AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x3000],
637     ac_cv_pagezero_hack, [
638     ac_cv_pagezero_hack=no
639     if AC_TRY_COMMAND([Darwin/testlmem.sh 0x3000]); then
640     ac_cv_pagezero_hack=yes
641     dnl might as well skip the test for mmap-able low memory
642     ac_cv_can_map_lm=no
643     fi
644     ])
645     AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
646     [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
647    
648     dnl Check if we can mmap 0x3000 bytes from 0x0000
649     AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x3000],
650     ac_cv_can_map_lm, [
651     AC_LANG_SAVE
652     AC_LANG_CPLUSPLUS
653     AC_TRY_RUN([
654     #include "vm_alloc.cpp"
655     int main(void) { /* returns 0 if we could map the lowmem globals */
656     volatile char * lm = 0;
657     if (vm_init() < 0) exit(1);
658     if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
659     lm[0] = 'z';
660     if (vm_release((char *)lm, 0x2000) < 0) exit(1);
661     vm_exit(); exit(0);
662     }
663     ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
664     dnl When cross-compiling, do not assume anything.
665     ac_cv_can_map_lm="guessing no"
666     )
667     AC_LANG_RESTORE
668     ]
669     )
670    
671     dnl Check signal handlers need to be reinstalled
672     AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
673     ac_cv_signal_need_reinstall, [
674     AC_LANG_SAVE
675     AC_LANG_CPLUSPLUS
676     AC_TRY_RUN([
677     #include <stdlib.h>
678     #ifdef HAVE_UNISTD_H
679     #include <unistd.h>
680     #endif
681     #include <signal.h>
682     static int handled_signal = 0;
683     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
684     int main(void) { /* returns 0 if signals need not to be reinstalled */
685     signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
686     exit(handled_signal == 2);
687     }
688     ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
689     dnl When cross-compiling, do not assume anything.
690     ac_cv_signal_need_reinstall="guessing yes"
691     )
692     AC_LANG_RESTORE
693     ]
694     )
695     AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall",
696     [Define if your system requires signals to be reinstalled.])
697    
698     dnl Check if sigaction handlers need to be reinstalled
699     AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
700     ac_cv_sigaction_need_reinstall, [
701     AC_LANG_SAVE
702     AC_LANG_CPLUSPLUS
703     AC_TRY_RUN([
704     #include <stdlib.h>
705     #ifdef HAVE_UNISTD_H
706     #include <unistd.h>
707     #endif
708     #include <signal.h>
709     static int handled_signal = 0;
710     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
711     typedef RETSIGTYPE (*signal_handler)(int);
712     static signal_handler mysignal(int sig, signal_handler handler) {
713     struct sigaction old_sa;
714     struct sigaction new_sa;
715     new_sa.sa_handler = handler;
716     return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
717     }
718     int main(void) { /* returns 0 if signals need not to be reinstalled */
719     mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
720     exit(handled_signal == 2);
721     }
722     ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
723     dnl When cross-compiling, do not assume anything.
724     ac_cv_sigaction_need_reinstall="guessing yes"
725     )
726     AC_LANG_RESTORE
727     ]
728     )
729     AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
730     [Define if your system requires sigactions to be reinstalled.])
731    
732     dnl Check if Mach exceptions supported.
733     AC_CACHE_CHECK([whether your system supports Mach exceptions],
734     ac_cv_have_mach_exceptions, [
735     AC_LANG_SAVE
736     AC_LANG_CPLUSPLUS
737     AC_TRY_RUN([
738     #define HAVE_MACH_EXCEPTIONS 1
739     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
740     #include "vm_alloc.cpp"
741     #include "sigsegv.cpp"
742     ],
743     ac_cv_have_mach_exceptions=yes,
744     ac_cv_have_mach_exceptions=no,
745     dnl When cross-compiling, do not assume anything.
746     ac_cv_have_mach_exceptions=no
747     )
748     AC_LANG_RESTORE
749     ]
750     )
751     if [[ "$ac_cv_have_mach_exceptions" = "yes" ]]; then
752     sigsegv_recovery=mach
753     fi
754     AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
755     [Define if your system supports Mach exceptions.])
756    
757 gbeauche 1.9 dnl Check if Windows exceptions are supported.
758     AC_CACHE_CHECK([whether your system supports Windows exceptions],
759     ac_cv_have_win32_exceptions, [
760     AC_LANG_SAVE
761     AC_LANG_CPLUSPLUS
762     AC_TRY_RUN([
763     #define HAVE_WIN32_EXCEPTIONS 1
764     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
765     #include "vm_alloc.cpp"
766     #include "sigsegv.cpp"
767     ], [
768     sigsegv_recovery=win32
769     ac_cv_have_win32_exceptions=yes
770     ],
771     ac_cv_have_win32_exceptions=no,
772     dnl When cross-compiling, do not assume anything.
773     ac_cv_have_win32_exceptions=no
774     )
775     AC_LANG_RESTORE
776     ]
777     )
778     AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
779     [Define if your system supports Windows exceptions.])
780    
781 gbeauche 1.1 dnl Otherwise, check if extended signals are supported.
782     if [[ -z "$sigsegv_recovery" ]]; then
783     AC_CACHE_CHECK([whether your system supports extended signal handlers],
784     ac_cv_have_extended_signals, [
785     AC_LANG_SAVE
786     AC_LANG_CPLUSPLUS
787     AC_TRY_RUN([
788     #define HAVE_SIGINFO_T 1
789     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
790     #include "vm_alloc.cpp"
791     #include "sigsegv.cpp"
792     ],
793     ac_cv_have_extended_signals=yes,
794     ac_cv_have_extended_signals=no,
795     dnl When cross-compiling, do not assume anything.
796     ac_cv_have_extended_signals=no
797     )
798     AC_LANG_RESTORE
799     ]
800     )
801     if [[ "$ac_cv_have_extended_signals" = "yes" ]]; then
802     sigsegv_recovery=siginfo
803     fi
804     AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
805     [Define if your system support extended signals.])
806     fi
807    
808     dnl Otherwise, check for subterfuges.
809     if [[ -z "$sigsegv_recovery" ]]; then
810     AC_CACHE_CHECK([whether we then have a subterfuge for your system],
811     ac_cv_have_sigcontext_hack, [
812     AC_LANG_SAVE
813     AC_LANG_CPLUSPLUS
814     AC_TRY_RUN([
815     #define HAVE_SIGCONTEXT_SUBTERFUGE 1
816     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
817     #include "vm_alloc.cpp"
818     #include "sigsegv.cpp"
819     ],
820     ac_cv_have_sigcontext_hack=yes,
821     ac_cv_have_sigcontext_hack=no,
822     dnl When cross-compiling, do not assume anything.
823     ac_cv_have_sigcontext_hack=no
824     )
825     AC_LANG_RESTORE
826     ])
827     if [[ "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
828     sigsegv_recovery=sigcontext
829     fi
830     AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
831     [Define if we know a hack to replace siginfo_t->si_addr member.])
832     fi
833    
834     dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
835     AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
836     ac_cv_have_skip_instruction, [
837     AC_LANG_SAVE
838     AC_LANG_CPLUSPLUS
839     AC_TRY_RUN([
840     #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
841     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
842     #include "vm_alloc.cpp"
843     #include "sigsegv.cpp"
844     ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
845     dnl When cross-compiling, do not assume anything.
846     ac_cv_have_skip_instruction=no
847     )
848     AC_LANG_RESTORE
849     ]
850     )
851     AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
852     [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
853    
854     dnl Can we do Video on SEGV Signals ?
855     CAN_VOSF=no
856     if [[ -n "$sigsegv_recovery" ]]; then
857     CAN_VOSF=yes
858     fi
859    
860     dnl Enable VOSF screen updates with this feature is requested and feasible
861     if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
862     AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
863     else
864     WANT_VOSF=no
865     fi
866    
867 gbeauche 1.8 dnl Check addressing mode to use
868     AC_MSG_CHECKING([for addressing mode to use])
869 gbeauche 1.9 case "$os_target" in
870     cygwin*)
871     WANT_ADDRESSING_MODE="direct,cygwin-hack"
872     NATMEM_OFFSET=
873     ;;
874     esac
875 gbeauche 1.8 if [[ "$EMULATED_PPC" != "yes" ]]; then
876     if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then
877     AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.])
878     WANT_ADDRESSING_MODE="real"
879     fi
880     fi
881     if [[ "$WANT_ADDRESSING_MODE" = "direct" ]]; then
882     if [[ -n "$NATMEM_OFFSET" ]]; then
883     NATMEM_OFFSET_DEF="-DNATMEM_OFFSET=$NATMEM_OFFSET"
884     fi
885     AC_LANG_SAVE
886     AC_LANG_CPLUSPLUS
887     cat confdefs.h > conftest.$ac_ext
888     cat >> conftest.$ac_ext << EOF
889     #include <stdio.h>
890     #include <string.h>
891     #include "vm_alloc.cpp"
892    
893     int main(void)
894     {
895     if (vm_init() < 0)
896     return 1;
897    
898     static const struct {
899     unsigned long base;
900     unsigned int size;
901     } ranges[[]] = {
902     { 0x00000000, 0x0003000 },
903     { 0x10000000, 0x2000000 },
904     { 0x40800000, 0x0400000 },
905     { 0x68070000, 0x0010000 },
906     { 0x69000000, 0x0080000 },
907     { 0x68ffe000, 0x0002000 },
908     { 0x5fffe000, 0x0002000 },
909     { 0x60000000, 0x0040000 },
910     };
911     const int n_ranges = sizeof(ranges)/ sizeof(ranges[[0]]);
912    
913     #ifdef NATMEM_OFFSET
914     unsigned long ofs = NATMEM_OFFSET;
915     #else
916     for (unsigned long ofs = 0x10000000; ofs <= 0x90000000; ofs += 0x10000000)
917     #endif
918     for (int i = 0; i < n_ranges; i++) {
919     char *m = (char *)(ranges[[i]].base + ofs);
920     if (vm_acquire_fixed(m, ranges[[i]].size) != 0)
921     break;
922     memset(m, 0, ranges[[i]].size);
923     vm_release(m, ranges[[i]].size);
924     if (i == n_ranges - 1) {
925 gbeauche 1.13 if (sizeof(void *) == 8 && ofs > 0xffffffff)
926     printf("0x%lxul\n", ofs);
927     else
928     printf("0x%08x\n", ofs);
929 gbeauche 1.8 return 0;
930     }
931     }
932    
933     vm_exit();
934     return 1;
935     }
936     EOF
937     doit='$CXX conftest.$ac_ext -o conftest.$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS $NATMEM_OFFSET_DEF >& AS_MESSAGE_LOG_FD'
938     if AC_TRY_EVAL(doit); then
939     NATMEM_OFFSET=`./conftest.$ac_exeext`
940 gbeauche 1.9 else
941     NATMEM_OFFSET=
942 gbeauche 1.8 fi
943     rm -f conftest*
944     AC_LANG_RESTORE
945 gbeauche 1.9
946     if [[ -z "$NATMEM_OFFSET" ]]; then
947     AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value])
948     else
949     WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET"
950     AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET,
951     [Define constant offset for Mac address translation])
952     fi
953 gbeauche 1.8 fi
954     AC_MSG_RESULT($WANT_ADDRESSING_MODE)
955    
956 gbeauche 1.1 dnl Platform specific binary postprocessor
957     AC_PATH_PROG(BLESS, "true")
958     if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
959     BLESS=Darwin/lowmem
960     LDFLAGS="$LDFLAGS -pagezero_size 0x3000"
961     fi
962    
963     dnl Check for GCC 2.7 or higher.
964     HAVE_GCC27=no
965     AC_MSG_CHECKING(for GCC 2.7 or higher)
966     AC_EGREP_CPP(xyes,
967     [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
968     xyes
969     #endif
970     ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
971    
972     dnl Check for GCC 3.0 or higher.
973     HAVE_GCC30=no
974     AC_MSG_CHECKING(for GCC 3.0 or higher)
975     AC_EGREP_CPP(xyes,
976     [#if __GNUC__ >= 3
977     xyes
978     #endif
979     ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
980    
981     dnl Check for ICC.
982     AC_MSG_CHECKING(for ICC)
983     HAVE_ICC=no
984     if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
985     HAVE_ICC=yes
986     fi
987     AC_MSG_RESULT($HAVE_ICC)
988    
989 gbeauche 1.9 dnl Determine the generated object format
990 gbeauche 1.1 AC_CACHE_CHECK([whether the compiler can generate ELF objects],
991 gbeauche 1.9 ac_cv_object_format, [
992 gbeauche 1.1 echo 'int i;' > conftest.$ac_ext
993 gbeauche 1.9 ac_cv_object_format=no
994 gbeauche 1.1 if AC_TRY_EVAL(ac_compile); then
995     case `/usr/bin/file conftest.$ac_objext` in
996     *"ELF"*)
997 gbeauche 1.9 ac_cv_object_format=elf
998     ;;
999     *)
1000     ac_cv_object_format=unknown
1001 gbeauche 1.1 ;;
1002     esac
1003     fi
1004     rm -rf conftest*
1005     ])
1006    
1007     dnl CPU emulator sources
1008     if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1009     CPUSRCS="\
1010 gbeauche 1.9 ../kpx_cpu/src/mathlib/ieeefp.cpp \
1011 gbeauche 1.1 ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
1012     ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
1013     ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
1014     ../kpx_cpu/src/cpu/ppc/ppc-translate.cpp"
1015     CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src"
1016    
1017     dnl Enable JIT compiler, if possible
1018     if [[ "x$WANT_JIT" = "xyes" ]]; then
1019     AC_CACHE_CHECK([whether dyngen can be used],
1020     ac_cv_use_dyngen, [
1021 gbeauche 1.9 case $host_cpu:$ac_cv_object_format in
1022     powerpc:elf)
1023 gbeauche 1.1 ac_cv_use_dyngen=yes
1024     ;;
1025 gbeauche 1.9 x86_64:elf)
1026 gbeauche 1.1 ac_cv_use_dyngen=yes
1027     ;;
1028 gbeauche 1.9 i?86:elf)
1029 gbeauche 1.1 ac_cv_use_dyngen=yes
1030     ;;
1031     *:*)
1032     ac_cv_use_dyngen=no
1033     ;;
1034     esac
1035     dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2)
1036     if [[ -z "$DYNGEN_CC" ]]; then
1037     if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1038     DYNGEN_CC=$CXX
1039     else
1040     for p in /usr/bin /usr/local/bin; do
1041     gxx="$p/g++"
1042     if [[ -x "$gxx" ]]; then
1043     DYNGEN_CC="$gxx"
1044     fi
1045     done
1046     fi
1047     fi
1048     if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then
1049     ac_cv_use_dyngen=no
1050     fi
1051     ])
1052     if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
1053     case $host_cpu in
1054     i?86)
1055     DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2"
1056     if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1057     DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
1058     else
1059     DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
1060     fi
1061     saved_CPPFLAGS=$CPPFLAGS
1062     CPPFLAGS="$CPPFLAGS -mmmx"
1063     AC_CHECK_HEADERS(mmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -mmmx"])
1064     CPPFLAGS="$CPPFLAGS -msse"
1065     AC_CHECK_HEADERS(xmmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse"])
1066     CPPFLAGS="$CPPFLAGS -msse2"
1067     AC_CHECK_HEADERS(emmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse2"])
1068     CPPFLAGS=$saved_CPPFLAGS
1069     ;;
1070     x86_64)
1071     AC_CHECK_HEADERS(mmintrin.h xmmintrin.h emmintrin.h)
1072     ;;
1073     esac
1074 gbeauche 1.16 DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000 -g0"
1075 gbeauche 1.1 if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1076     DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
1077     fi
1078     else
1079     WANT_JIT=no
1080     fi
1081     AC_TRANSLATE_DEFINE(ENABLE_DYNGEN, $ac_cv_use_dyngen, [Define to enable dyngen engine])
1082     if [[ "x$WANT_JIT" = "xyes" ]]; then
1083     DYNGENSRCS="\
1084     ../kpx_cpu/src/cpu/jit/dyngen.c \
1085     ../kpx_cpu/src/cpu/jit/cxxdemangle.cpp"
1086     CPUSRCS="\
1087     ../kpx_cpu/src/cpu/jit/jit-cache.cpp \
1088     ../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \
1089     ../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp $CPUSRCS"
1090     fi
1091     fi
1092     CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp"
1093     else
1094     WANT_JIT=no
1095     fi
1096     if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
1097     AC_CACHE_CHECK([whether static data regions are executable],
1098     ac_cv_have_static_data_exec, [
1099     AC_TRY_RUN([int main(void) {
1100     #if defined(__powerpc__)
1101     static unsigned int p[8] = {0x4e800020,};
1102     asm volatile("dcbst 0,%0" : : "r" (p) : "memory");
1103     asm volatile("sync" : : : "memory");
1104     asm volatile("icbi 0,%0" : : "r" (p) : "memory");
1105     asm volatile("sync" : : : "memory");
1106     asm volatile("isync" : : : "memory");
1107     ((void (*)(void))p)();
1108     return 0;
1109     #endif
1110     return 1;
1111     }], ac_cv_have_static_data_exec=yes, ac_cv_have_static_data_exec=no,
1112     dnl When cross-compiling, do not assume anything.
1113     ac_cv_have_static_data_exec=no
1114     )
1115     ])
1116 gbeauche 1.14 else
1117     ac_cv_use_dyngen=no
1118 gbeauche 1.1 fi
1119     AC_TRANSLATE_DEFINE(HAVE_STATIC_DATA_EXEC, "$ac_cv_have_static_data_exec",
1120     [Define if your system marks static data pages as executable.])
1121    
1122     if [[ "x$WANT_JIT" = "xyes" ]]; then
1123     CPPFLAGS="$CPPFLAGS -DUSE_JIT"
1124     fi
1125    
1126     dnl Generate Makefile.
1127 gbeauche 1.16 AC_SUBST(PERL)
1128 gbeauche 1.14 AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen])
1129 gbeauche 1.1 AC_SUBST(DYNGENSRCS)
1130     AC_SUBST(DYNGEN_CC)
1131     AC_SUBST(DYNGEN_OP_FLAGS)
1132     AC_SUBST(SYSSRCS)
1133     AC_SUBST(CPUSRCS)
1134     AC_SUBST(BLESS)
1135     AC_SUBST(KEYCODES)
1136 gbeauche 1.5 AC_OUTPUT([
1137     Makefile
1138     ../MacOSX/Info.plist
1139     ])
1140 gbeauche 1.1
1141     dnl Print summary.
1142     echo
1143     echo SheepShaver configuration summary:
1144     echo
1145     echo SDL support ...................... : $SDL_SUPPORT
1146     echo XFree86 DGA support .............. : $WANT_XF86_DGA
1147     echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
1148     echo Using PowerPC emulator ........... : $EMULATED_PPC
1149     echo Enable JIT compiler .............. : $WANT_JIT
1150     echo Enable video on SEGV signals ..... : $WANT_VOSF
1151     echo ESD sound support ................ : $WANT_ESD
1152     echo GTK user interface ............... : $WANT_GTK
1153     echo mon debugger support ............. : $WANT_MON
1154 gbeauche 1.8 echo Addressing mode .................. : $WANT_ADDRESSING_MODE
1155 gbeauche 1.1 echo Bad memory access recovery type .. : $sigsegv_recovery
1156     echo
1157     echo "Configuration done. Now type \"make\"."