ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/configure.ac
Revision: 1.48
Committed: 2006-01-27T23:48:08Z (18 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.47: +37 -2 lines
Log Message:
Check whether compiler supports byte bit-fields. If so, we can enable slirp
emulation code since it pure C+sockets code.

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 gbeauche 1.40 AC_INIT([SheepShaver], 2.3, [Christian.Bauer@uni-mainz.de], SheepShaver)
5 gbeauche 1.1 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.33 dnl Invite Cygwin users to build within the Windows/ directory
18     case $target_os in
19     *cygwin* | *mingw32*)
20     AC_MSG_ERROR([You can only build the Windows version from its directory, Cygwin/X11 is not supported.])
21     ;;
22     esac
23    
24 gbeauche 1.1 dnl Options.
25     AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes])
26     AC_ARG_ENABLE(ppc-emulator, [ --enable-ppc-emulator use the selected PowerPC emulator [default=auto]], [WANT_EMULATED_PPC=$enableval], [WANT_EMULATED_PPC=auto])
27 gbeauche 1.21 AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb0 [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
28 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])
29 gbeauche 1.22 AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
30 gbeauche 1.1 AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
31     AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
32 gbeauche 1.20 AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]],
33     [case "$withval" in
34     gtk1) WANT_GTK="gtk";;
35     gtk|gtk2) WANT_GTK="$withval";;
36     yes) WANT_GTK="gtk2 gtk";;
37     *) WANT_GTK="no";;
38     esac],
39     [WANT_GTK="gtk2 gtk"])
40 gbeauche 1.1 AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
41     AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval])
42    
43 gbeauche 1.8 dnl Addressing mode
44     AC_ARG_ENABLE(addressing,
45     [ --enable-addressing=AM set the addressing mode to use [default=real]],
46     [case "$enableval" in
47     real) WANT_ADDRESSING_MODE="real";;
48     direct) WANT_ADDRESSING_MODE="direct";;
49 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'`;;
50 gbeauche 1.8 esac],
51     [WANT_ADDRESSING_MODE="real"]
52     )
53    
54 gbeauche 1.1 dnl SDL options.
55     AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no])
56     AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no])
57 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])
58 gbeauche 1.1
59     dnl Checks for programs.
60     AC_PROG_CC
61     AC_PROG_CPP
62     AC_PROG_CXX
63     AC_PROG_MAKE_SET
64     AC_PROG_INSTALL
65 gbeauche 1.3 AC_PROG_EGREP
66 gbeauche 1.16 AC_PATH_PROGS(FILE, [file false])
67     AC_PATH_PROG(PERL, [perl])
68 gbeauche 1.1
69     dnl Check for PowerPC target CPU.
70     HAVE_PPC=no
71     AC_MSG_CHECKING(for PowerPC target CPU)
72     AC_EGREP_CPP(yes,
73     [
74     #ifdef __powerpc__
75     yes
76     #endif
77     #ifdef __ppc__
78     yes
79     #endif
80     ], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no))
81    
82     dnl We use native CPU if possible.
83     EMULATED_PPC=yes
84     case $WANT_EMULATED_PPC in
85     auto) [[ "x$HAVE_PPC" = "xyes" ]] && EMULATED_PPC=no;;
86     no) EMULATED_PPC=no;;
87     esac
88     if [[ "x$EMULATED_PPC" = "xyes" ]]; then
89     AC_DEFINE(EMULATED_PPC, 1, [Define if using a PowerPC CPU emulator.])
90     fi
91    
92     dnl We use mon if possible.
93     MONSRCS=
94     case "x$WANT_MON" in
95     x/* | x.*)
96     mon_srcdir=$WANT_MON
97     WANT_MON=yes
98     ;;
99     xyes)
100     mon_srcdir=../../../mon/src
101     ;;
102     esac
103     if [[ "x$WANT_MON" = "xyes" ]]; then
104     AC_MSG_CHECKING(for mon)
105     if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
106     AC_MSG_RESULT(yes)
107     AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".])
108     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"
109     CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
110     AC_CHECK_LIB(ncurses, tgetent, ,
111     AC_CHECK_LIB(termcap, tgetent, ,
112     AC_CHECK_LIB(termlib, tgetent, ,
113     AC_CHECK_LIB(terminfo, tgetent, ,
114     AC_CHECK_LIB(Hcurses, tgetent, ,
115     AC_CHECK_LIB(curses, tgetent))))))
116     AC_CHECK_LIB(readline, readline)
117     AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
118     else
119     AC_MSG_RESULT(no)
120     AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
121     WANT_MON=no
122     fi
123     fi
124 gbeauche 1.11 AC_SUBST(MONSRCS)
125 gbeauche 1.1
126     dnl Checks for libraries.
127     AC_CHECK_LIB(posix4, sem_init)
128 gbeauche 1.42 AC_CHECK_LIB(m, cos)
129 gbeauche 1.1
130     dnl Do we need SDL?
131     WANT_SDL=no
132     if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
133     WANT_SDL=yes
134     WANT_XF86_DGA=no
135     WANT_XF86_VIDMODE=no
136     WANT_FBDEV_DGA=no
137 gbeauche 1.7 SDL_SUPPORT="$SDL_SUPPORT video"
138     fi
139     if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
140     WANT_SDL=yes
141     SDL_SUPPORT="$SDL_SUPPORT audio"
142 gbeauche 1.1 fi
143     if [[ "x$WANT_SDL" = "xyes" ]]; then
144     AC_PATH_PROG(sdl_config, "sdl-config")
145     if [[ -n "$sdl_config" ]]; then
146 gbeauche 1.33 sdl_cflags=`$sdl_config --cflags`
147     if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
148     sdl_libs=`$sdl_config --static-libs`
149     else
150     sdl_libs=`$sdl_config --libs`
151     fi
152 gbeauche 1.1 CFLAGS="$CFLAGS $sdl_cflags"
153     CXXFLAGS="$CXXFLAGS $sdl_cflags"
154     LIBS="$LIBS $sdl_libs"
155     else
156     WANT_SDL=no
157 gbeauche 1.15 WANT_SDL_VIDEO=no
158     WANT_SDL_AUDIO=no
159 gbeauche 1.1 fi
160 gbeauche 1.7 SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
161     else
162     SDL_SUPPORT="none"
163 gbeauche 1.1 fi
164    
165     dnl We need X11, if not using SDL.
166 gbeauche 1.15 if [[ "x$WANT_SDL_VIDEO" != "xyes" ]]; then
167 gbeauche 1.1 AC_PATH_XTRA
168     if [[ "x$no_x" = "xyes" ]]; then
169     AC_MSG_ERROR([You need X11 to run SheepShaver.])
170     fi
171     CFLAGS="$CFLAGS $X_CFLAGS"
172     CXXFLAGS="$CXXFLAGS $X_CFLAGS"
173     LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
174     fi
175    
176     dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL.
177     HAVE_PTHREADS=yes
178     case $EMULATED_PPC:$target_os in
179 gbeauche 1.17 no:linux*|no:netbsd*)
180 gbeauche 1.1 dnl We do have our own pthread_cancel() implementation
181     AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.])
182     ;;
183     *:*)
184     AC_CHECK_LIB(pthread, pthread_create, , [
185     AC_CHECK_LIB(c_r, pthread_create, , [
186     AC_CHECK_LIB(PTL, pthread_create, , [
187 gbeauche 1.29 dnl XXX remove when no pthreads case is merged
188     AC_MSG_ERROR([You need pthreads to run SheepShaver.])
189     HAVE_PTHREADS=no
190 gbeauche 1.1 ])
191     ])
192     ])
193     AC_CHECK_FUNCS(pthread_cancel)
194 gbeauche 1.34 AC_CHECK_FUNCS(pthread_cond_init pthread_testcancel)
195 gbeauche 1.1 AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
196     AC_CHECK_FUNCS(pthread_mutexattr_settype)
197     AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
198     dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
199     SEMSRC=
200     AC_CHECK_FUNCS(sem_init, , [
201     if test "x$HAVE_PTHREADS" = "xyes"; then
202     SEMSRC=posix_sem.cpp
203     fi
204     ])
205     ;;
206     esac
207 gbeauche 1.29 if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
208     AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
209     fi
210 gbeauche 1.1
211 gbeauche 1.21 dnl We use FBDev DGA if possible.
212     if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
213     AC_CHECK_HEADER(linux/fb.h, [
214     AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using Linux fbdev extension.])
215     ], [
216     AC_MSG_WARN([Could not find Linux FBDev extension, ignoring --enable-fbdev-dga.])
217     WANT_FBDEV_DGA=no
218     ])
219     fi
220    
221 gbeauche 1.1 dnl We use XFree86 DGA if possible.
222     if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
223     AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [
224     AC_DEFINE(ENABLE_XF86_DGA, 1, [Define if using XFree86 DGA extension.])
225     LIBS="$LIBS -lXxf86dga"
226     ], [
227     AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
228     WANT_XF86_DGA=no
229     ])
230     fi
231    
232     dnl We use XFree86 VidMode if possible.
233     if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then
234     AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [
235     AC_DEFINE(ENABLE_XF86_VIDMODE, 1, [Define if using XFree86 DGA extension.])
236     LIBS="$LIBS -lXxf86vm"
237     ], [
238     AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.])
239     WANT_XF86_VIDMODE=no
240     ])
241     fi
242    
243     dnl We use GTK+ if possible.
244     UISRCS=../dummy/prefs_editor_dummy.cpp
245 gbeauche 1.20 case "x$WANT_GTK" in
246     xgtk2*)
247     AM_PATH_GTK_2_0(1.3.15, [
248     AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
249     CFLAGS="$CFLAGS $GTK_CFLAGS"
250     CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
251     LIBS="$LIBS $GTK_LIBS"
252     UISRCS=prefs_editor_gtk.cpp
253     WANT_GTK=gtk2
254     ], [
255     case "x${WANT_GTK}x" in
256     *gtkx)
257     AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
258     WANT_GTK=gtk
259     ;;
260     *)
261     AC_MSG_WARN([Could not find GTK+, disabling user interface.])
262     WANT_GTK=no
263     ;;
264     esac
265     ])
266     ;;
267     esac
268     if [[ "x$WANT_GTK" = "xgtk" ]]; then
269 gbeauche 1.1 AM_PATH_GTK(1.2.0, [
270     AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
271     CFLAGS="$CFLAGS $GTK_CFLAGS"
272     CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
273     LIBS="$LIBS $GTK_LIBS"
274     UISRCS=prefs_editor_gtk.cpp
275     ], [
276     AC_MSG_WARN([Could not find GTK+, disabling user interface.])
277     WANT_GTK=no
278     ])
279     fi
280    
281     dnl We use ESD if possible.
282     if [[ "x$WANT_ESD" = "xyes" ]]; then
283     AM_PATH_ESD(0.2.8, [
284     AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.])
285     CFLAGS="$CFLAGS $ESD_CFLAGS"
286     CXXFLAGS="$CXXFLAGS $ESD_CFLAGS"
287     LIBS="$LIBS $ESD_LIBS"
288     ], [
289     AC_MSG_WARN([Could not find ESD, disabling ESD support.])
290     WANT_ESD=no
291     ])
292     fi
293    
294 gbeauche 1.2 dnl We use 64-bit file size support if possible.
295     AC_SYS_LARGEFILE
296    
297 gbeauche 1.1 dnl Checks for header files.
298     AC_HEADER_STDC
299     AC_HEADER_SYS_WAIT
300 gbeauche 1.31 AC_CHECK_HEADERS(malloc.h stdint.h)
301 gbeauche 1.1 AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h)
302 gbeauche 1.4 AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h)
303 gbeauche 1.32 AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
304     AC_CHECK_HEADERS(sys/time.h sys/poll.h sys/select.h arpa/inet.h)
305     AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
306     #ifdef HAVE_SYS_TYPES_H
307     #include <sys/types.h>
308     #endif
309     #ifdef HAVE_SYS_SOCKET_H
310     #include <sys/socket.h>
311 gbeauche 1.1 #endif
312     ])
313 gbeauche 1.32 AC_CHECK_HEADERS(AvailabilityMacros.h)
314     AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
315 gbeauche 1.10 AC_CHECK_HEADERS(fenv.h)
316 gbeauche 1.1
317     dnl Checks for typedefs, structures, and compiler characteristics.
318     AC_C_BIGENDIAN
319     AC_C_CONST
320     AC_C_INLINE
321     AC_CHECK_SIZEOF(short, 2)
322     AC_CHECK_SIZEOF(int, 4)
323     AC_CHECK_SIZEOF(long, 4)
324     AC_CHECK_SIZEOF(long long, 8)
325     AC_CHECK_SIZEOF(float, 4)
326     AC_CHECK_SIZEOF(double, 8)
327     AC_CHECK_SIZEOF(void *, 4)
328     AC_TYPE_OFF_T
329     AC_CHECK_TYPE(loff_t, off_t)
330     AC_TYPE_SIZE_T
331     AC_TYPE_SIGNAL
332     AC_HEADER_TIME
333     AC_STRUCT_TM
334    
335 gbeauche 1.34 dnl Check whether sys/socket.h defines type socklen_t.
336     dnl (extracted from ac-archive/Miscellaneous)
337     AC_CACHE_CHECK([for socklen_t],
338     ac_cv_type_socklen_t, [
339     AC_TRY_COMPILE([
340     #include <sys/types.h>
341     #include <sys/socket.h>
342     ], [socklen_t len = 42; return 0;],
343     ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
344     dnl When cross-compiling, do not assume anything.
345     ac_cv_type_socklen_t="guessing no"
346     )
347     ])
348     if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
349     AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.])
350     fi
351    
352 gbeauche 1.1 dnl Check whether struct sigaction has sa_restorer member.
353     AC_CACHE_CHECK([whether struct sigaction has sa_restorer],
354     ac_cv_signal_sa_restorer, [
355     AC_TRY_COMPILE([
356     #include <signal.h>
357     ], [struct sigaction sa; sa.sa_restorer = 0;],
358     ac_cv_signal_sa_restorer=yes, ac_cv_signal_sa_restorer=no,
359     dnl When cross-compiling, do not assume anything.
360     ac_cv_signal_sa_restorer=no
361     )
362     ])
363     if [[ "x$ac_cv_signal_sa_restorer" = "xyes" ]]; then
364     AC_DEFINE(HAVE_SIGNAL_SA_RESTORER, 1, [Define if sa_restorer is available in struct sigaction.])
365     fi
366    
367     dnl Checks for library functions.
368 gbeauche 1.32 AC_CHECK_FUNCS(strdup strerror strlcpy cfmakeraw)
369 gbeauche 1.1 AC_CHECK_FUNCS(nanosleep)
370     AC_CHECK_FUNCS(sigaction signal)
371     AC_CHECK_FUNCS(mmap mprotect munmap)
372     AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
373 gbeauche 1.26 AC_CHECK_FUNCS(exp2f log2f exp2 log2)
374     AC_CHECK_FUNCS(floorf roundf ceilf truncf floor round ceil trunc)
375 gbeauche 1.32 AC_CHECK_FUNCS(poll inet_aton)
376 gbeauche 1.1
377     dnl Darwin seems to define mach_task_self() instead of task_self().
378     AC_CHECK_FUNCS(mach_task_self task_self)
379    
380     dnl We need clock_gettime() for better performance but it may drag
381     dnl libpthread in, which we don't want for native ppc mode
382     case $EMULATED_PPC:$target_os in
383     no:linux*)
384     ;;
385     *:*)
386     AC_SEARCH_LIBS(clock_gettime, [rt posix4])
387 gbeauche 1.18 AC_CHECK_FUNCS(clock_gettime clock_nanosleep)
388 gbeauche 1.1 ;;
389     esac
390    
391 gbeauche 1.9 dnl Check for headers and functions related to pty support (sshpty.c)
392     dnl From openssh-3.2.2p1 configure.ac
393     AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
394     AC_CHECK_FUNCS(_getpty vhangup strlcpy)
395    
396     case "$host" in
397     *-*-hpux10.26)
398     disable_ptmx_check=yes
399     ;;
400     *-*-linux*)
401     no_dev_ptmx=1
402     ;;
403     mips-sony-bsd|mips-sony-newsos4)
404     AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).])
405     ;;
406     *-*-sco3.2v4*)
407     no_dev_ptmx=1
408     ;;
409     *-*-sco3.2v5*)
410     no_dev_ptmx=1
411     ;;
412     *-*-cygwin*)
413     no_dev_ptmx=1
414     ;;
415     esac
416    
417     if test -z "$no_dev_ptmx" ; then
418     if test "x$disable_ptmx_check" != "xyes" ; then
419     AC_CHECK_FILE([/dev/ptmx],
420     [
421     AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.])
422     have_dev_ptmx=1
423     ]
424     )
425     fi
426     fi
427     AC_CHECK_FILE([/dev/ptc],
428     [
429     AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.])
430     have_dev_ptc=1
431     ]
432     )
433     dnl (end of code from openssh-3.2.2p1 configure.ac)
434    
435 gbeauche 1.47 dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
436     dnl doesn't work or is unimplemented. On these systems (mostly older
437     dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
438     AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O],
439     ac_cv_nonblocking_io, [
440     case "$host" in
441     *-*-osf*)
442     ac_cv_nonblocking_io=FIONBIO
443     ;;
444     *-*-sunos4*)
445     ac_cv_nonblocking_io=FIONBIO
446     ;;
447     *-*-ultrix*)
448     ac_cv_nonblocking_io=FIONBIO
449     ;;
450     *)
451     ac_cv_nonblocking_io=O_NONBLOCK
452     ;;
453     esac
454     ])
455     if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then
456     AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used])
457     fi
458    
459 gbeauche 1.48 dnl Check whether compiler supports byte bit-fields
460     AC_CACHE_CHECK([whether compiler supports byte bit-fields],
461     ac_cv_have_byte_bitfields, [
462     AC_LANG_SAVE
463     AC_LANG_CPLUSPLUS
464     AC_TRY_RUN([
465     struct A {
466     unsigned char b1:4;
467     unsigned char b2:4;
468     unsigned char c;
469     unsigned short s;
470     unsigned char a[4];
471     };
472    
473     int main(void) {
474     A a;
475     return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1));
476     }],
477     [ac_cv_have_byte_bitfields=yes],
478     [ac_cv_have_byte_bitfields=no],
479     dnl When cross-compiling, assume only GCC supports this
480     [if [[ "$GCC" = "yes" ]]; then
481     ac_cv_have_byte_bitfields="guessing yes"
482     else
483     ac_cv_have_byte_bitfields="guessing no"
484     fi]
485     )
486     AC_LANG_RESTORE
487     ])
488    
489 gbeauche 1.1 dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
490     AC_DEFUN(AC_CHECK_FRAMEWORK, [
491     AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
492     AC_CACHE_CHECK([whether compiler supports framework $1],
493     ac_Framework, [
494     saved_LIBS="$LIBS"
495     LIBS="$LIBS -framework $1"
496     AC_TRY_LINK(
497 gbeauche 1.45 [$2], [],
498 gbeauche 1.1 [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
499     )
500     ])
501     AS_IF([test AS_VAR_GET(ac_Framework) = yes],
502     [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
503     )
504     AS_VAR_POPDEF([ac_Framework])dnl
505     ])
506    
507     dnl Check for some MacOS X frameworks
508     AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
509     AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
510 gbeauche 1.37 AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
511 gbeauche 1.1
512     dnl Select system-dependant sources.
513     SERIALSRC=serial_unix.cpp
514     ETHERSRC=../dummy/ether_dummy.cpp
515     SCSISRC=../dummy/scsi_dummy.cpp
516     AUDIOSRC=../dummy/audio_dummy.cpp
517 gbeauche 1.6 EXTFSSRC=extfs_unix.cpp
518 gbeauche 1.1 EXTRASYSSRCS=
519     case "$target_os" in
520     linux*)
521 gbeauche 1.32 ETHERSRC=ether_unix.cpp
522 gbeauche 1.1 AUDIOSRC=audio_oss_esd.cpp
523     SCSISRC=Linux/scsi_linux.cpp
524     if [[ "x$EMULATED_PPC" = "xno" ]]; then
525 gbeauche 1.35 EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S"
526 gbeauche 1.17 fi
527     ;;
528 gbeauche 1.32 freebsd*)
529     ETHERSRC=ether_unix.cpp
530     ;;
531 gbeauche 1.17 netbsd*)
532 gbeauche 1.32 ETHERSRC=ether_unix.cpp
533 gbeauche 1.17 if [[ "x$EMULATED_PPC" = "xno" ]]; then
534 gbeauche 1.35 EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S"
535 gbeauche 1.1 fi
536     ;;
537     darwin*)
538 gbeauche 1.32 ETHERSRC=ether_unix.cpp
539 gbeauche 1.1 if [[ "x$EMULATED_PPC" = "xno" ]]; then
540 gbeauche 1.35 EXTRASYSSRCS="paranoia.cpp ppc_asm.S"
541 gbeauche 1.1 fi
542 gbeauche 1.37 if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
543 gbeauche 1.1 EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp"
544     fi
545 gbeauche 1.6 if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
546     EXTFSSRC=../MacOSX/extfs_macosx.mm
547     fi
548 gbeauche 1.1 ;;
549 gbeauche 1.42 irix*)
550     AUDIOSRC=Irix/audio_irix.cpp
551     LIBS="$LIBS -laudio"
552     WANT_ESD=no
553 gbeauche 1.43
554     dnl Check if our compiler supports -IPA (MIPSPro)
555     HAVE_IPA=no
556     ocflags="$CFLAGS"
557     CFLAGS=`echo " $CFLAGS -IPA" | sed -e "s/ -g //g"`
558     AC_MSG_CHECKING(if "-IPA" works)
559     dnl Do a test compile of an empty function
560     AC_TRY_COMPILE([#if defined __GNUC__
561     # error GCC does not support IPA yet
562     #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
563     CFLAGS="$ocflags"
564 gbeauche 1.42 ;;
565 gbeauche 1.1 esac
566    
567 gbeauche 1.32 dnl Is the slirp library supported?
568 gbeauche 1.48 case "$ac_cv_have_byte_bitfields" in
569     yes|"guessing yes")
570     CAN_SLIRP=yes
571     ETHERSRC=ether_unix.cpp
572     ;;
573     esac
574     if [[ -n "$CAN_SLIRP" ]]; then
575 gbeauche 1.32 AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
576     SLIRP_SRCS="\
577     ../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \
578     ../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \
579     ../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \
580     ../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \
581     ../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \
582     ../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c"
583     fi
584     AC_SUBST(SLIRP_SRCS)
585    
586 gbeauche 1.1 dnl SDL overrides
587     if [[ "x$WANT_SDL" = "xyes" ]]; then
588     AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.])
589     fi
590     if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
591 gbeauche 1.7 AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support.])
592 gbeauche 1.1 VIDEOSRCS="../SDL/video_sdl.cpp"
593     KEYCODES="../SDL/keycodes"
594     if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
595     EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
596     else
597 gbeauche 1.33 EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
598 gbeauche 1.1 fi
599     else
600     VIDEOSRCS="video_x.cpp"
601     KEYCODES="keycodes"
602     EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp"
603     fi
604 gbeauche 1.7 if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
605     AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
606     AUDIOSRC="../SDL/audio_sdl.cpp"
607     fi
608 gbeauche 1.1
609 gbeauche 1.11 SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $EXTRASYSSRCS"
610 gbeauche 1.1
611     dnl Define a macro that translates a yesno-variable into a C macro definition
612     dnl to be put into the config.h file
613     dnl $1 -- the macro to define
614     dnl $2 -- the value to translate
615     dnl $3 -- template name
616     AC_DEFUN(AC_TRANSLATE_DEFINE, [
617     if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
618     AC_DEFINE($1, 1, $3)
619     fi
620     ])
621    
622     dnl Check that the host supports TUN/TAP devices
623     AC_CACHE_CHECK([whether TUN/TAP is supported],
624     ac_cv_tun_tap_support, [
625     AC_TRY_COMPILE([
626     #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
627     #include <linux/if.h>
628     #include <linux/if_tun.h>
629     #endif
630     #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
631     #include <net/if.h>
632     #include <net/if_tun.h>
633     #endif
634     ], [
635     struct ifreq ifr;
636     memset(&ifr, 0, sizeof(ifr));
637     ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
638     ],
639     ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
640     )
641     ])
642     AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
643     [Define if your system supports TUN/TAP devices.])
644    
645     dnl Various checks if the system supports vm_allocate() and the like functions.
646     have_mach_vm=no
647     if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
648     "x$ac_cv_func_vm_protect" = "xyes" ]]; then
649     have_mach_vm=yes
650     fi
651     AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
652     [Define if your system has a working vm_allocate()-based memory allocator.])
653    
654     dnl Check that vm_allocate(), vm_protect() work
655     if [[ "x$have_mach_vm" = "xyes" ]]; then
656    
657     AC_CACHE_CHECK([whether vm_protect works],
658     ac_cv_vm_protect_works, [
659     AC_LANG_SAVE
660     AC_LANG_CPLUSPLUS
661     ac_cv_vm_protect_works=yes
662     dnl First the tests that should segfault
663     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
664     AC_TRY_RUN([
665     #define CONFIGURE_TEST_VM_MAP
666     #define TEST_VM_PROT_$test_def
667     #include "vm_alloc.cpp"
668     ], ac_cv_vm_protect_works=no, rm -f core,
669     dnl When cross-compiling, do not assume anything
670     ac_cv_vm_protect_works="guessing no"
671     )
672     done
673     AC_TRY_RUN([
674     #define CONFIGURE_TEST_VM_MAP
675     #define TEST_VM_PROT_RDWR_WRITE
676     #include "vm_alloc.cpp"
677     ], , ac_cv_vm_protect_works=no,
678     dnl When cross-compiling, do not assume anything
679     ac_cv_vm_protect_works="guessing no"
680     )
681     AC_LANG_RESTORE
682     ]
683     )
684    
685     dnl Remove support for vm_allocate() if vm_protect() does not work
686     if [[ "x$have_mach_vm" = "xyes" ]]; then
687     case $ac_cv_vm_protect_works in
688     *yes) have_mach_vm=yes;;
689     *no) have_mach_vm=no;;
690     esac
691     fi
692     AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
693     [Define if your system has a working vm_allocate()-based memory allocator.])
694    
695     fi dnl HAVE_MACH_VM
696    
697     dnl Various checks if the system supports mmap() and the like functions.
698     dnl ... and Mach memory allocators are not supported
699     have_mmap_vm=no
700     if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
701     "x$ac_cv_func_mprotect" = "xyes" ]]; then
702     if [[ "x$have_mach_vm" = "xno" ]]; then
703     have_mmap_vm=yes
704     fi
705     fi
706     AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
707     [Define if your system has a working mmap()-based memory allocator.])
708    
709     dnl Check that mmap() and associated functions work.
710     if [[ "x$have_mmap_vm" = "xyes" ]]; then
711    
712     dnl Check if we have a working anonymous mmap()
713     AC_CACHE_CHECK([whether mmap supports MAP_ANON],
714     ac_cv_mmap_anon, [
715     AC_LANG_SAVE
716     AC_LANG_CPLUSPLUS
717     AC_TRY_RUN([
718     #define HAVE_MMAP_ANON
719     #define CONFIGURE_TEST_VM_MAP
720     #define TEST_VM_MMAP_ANON
721     #include "vm_alloc.cpp"
722     ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
723     dnl When cross-compiling, do not assume anything.
724     ac_cv_mmap_anon="guessing no"
725     )
726     AC_LANG_RESTORE
727     ]
728     )
729     AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon",
730     [Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.])
731    
732     AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS],
733     ac_cv_mmap_anonymous, [
734     AC_LANG_SAVE
735     AC_LANG_CPLUSPLUS
736     AC_TRY_RUN([
737     #define HAVE_MMAP_ANONYMOUS
738     #define CONFIGURE_TEST_VM_MAP
739     #define TEST_VM_MMAP_ANON
740     #include "vm_alloc.cpp"
741     ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
742     dnl When cross-compiling, do not assume anything.
743     ac_cv_mmap_anonymous="guessing no"
744     )
745     AC_LANG_RESTORE
746     ]
747     )
748     AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous",
749     [Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.])
750    
751     AC_CACHE_CHECK([whether mprotect works],
752     ac_cv_mprotect_works, [
753     AC_LANG_SAVE
754     AC_LANG_CPLUSPLUS
755     ac_cv_mprotect_works=yes
756     dnl First the tests that should segfault
757     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
758     AC_TRY_RUN([
759     #define CONFIGURE_TEST_VM_MAP
760     #define TEST_VM_PROT_$test_def
761     #include "vm_alloc.cpp"
762     ], ac_cv_mprotect_works=no, rm -f core,
763     dnl When cross-compiling, do not assume anything
764     ac_cv_mprotect_works="guessing no"
765     )
766     done
767     AC_TRY_RUN([
768     #define CONFIGURE_TEST_VM_MAP
769     #define TEST_VM_PROT_RDWR_WRITE
770     #include "vm_alloc.cpp"
771     ], , ac_cv_mprotect_works=no,
772     dnl When cross-compiling, do not assume anything
773     ac_cv_mprotect_works="guessing no"
774     )
775     AC_LANG_RESTORE
776     ]
777     )
778    
779     dnl Remove support for mmap() if mprotect() does not work
780     if [[ "x$have_mmap_vm" = "xyes" ]]; then
781     case $ac_cv_mprotect_works in
782     *yes) have_mmap_vm=yes;;
783     *no) have_mmap_vm=no;;
784     esac
785     fi
786     AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm,
787     [Define if your system has a working mmap()-based memory allocator.])
788    
789     fi dnl HAVE_MMAP_VM
790    
791     dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
792     AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x3000],
793     ac_cv_pagezero_hack, [
794     ac_cv_pagezero_hack=no
795     if AC_TRY_COMMAND([Darwin/testlmem.sh 0x3000]); then
796     ac_cv_pagezero_hack=yes
797     dnl might as well skip the test for mmap-able low memory
798     ac_cv_can_map_lm=no
799     fi
800     ])
801     AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
802     [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
803    
804     dnl Check if we can mmap 0x3000 bytes from 0x0000
805     AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x3000],
806     ac_cv_can_map_lm, [
807     AC_LANG_SAVE
808     AC_LANG_CPLUSPLUS
809     AC_TRY_RUN([
810     #include "vm_alloc.cpp"
811     int main(void) { /* returns 0 if we could map the lowmem globals */
812     volatile char * lm = 0;
813     if (vm_init() < 0) exit(1);
814     if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
815     lm[0] = 'z';
816     if (vm_release((char *)lm, 0x2000) < 0) exit(1);
817     vm_exit(); exit(0);
818     }
819     ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
820     dnl When cross-compiling, do not assume anything.
821     ac_cv_can_map_lm="guessing no"
822     )
823     AC_LANG_RESTORE
824     ]
825     )
826    
827     dnl Check signal handlers need to be reinstalled
828     AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
829     ac_cv_signal_need_reinstall, [
830     AC_LANG_SAVE
831     AC_LANG_CPLUSPLUS
832     AC_TRY_RUN([
833     #include <stdlib.h>
834     #ifdef HAVE_UNISTD_H
835     #include <unistd.h>
836     #endif
837     #include <signal.h>
838     static int handled_signal = 0;
839     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
840     int main(void) { /* returns 0 if signals need not to be reinstalled */
841     signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
842     exit(handled_signal == 2);
843     }
844     ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
845     dnl When cross-compiling, do not assume anything.
846     ac_cv_signal_need_reinstall="guessing yes"
847     )
848     AC_LANG_RESTORE
849     ]
850     )
851     AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall",
852     [Define if your system requires signals to be reinstalled.])
853    
854     dnl Check if sigaction handlers need to be reinstalled
855     AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
856     ac_cv_sigaction_need_reinstall, [
857     AC_LANG_SAVE
858     AC_LANG_CPLUSPLUS
859     AC_TRY_RUN([
860     #include <stdlib.h>
861     #ifdef HAVE_UNISTD_H
862     #include <unistd.h>
863     #endif
864     #include <signal.h>
865     static int handled_signal = 0;
866     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
867     typedef RETSIGTYPE (*signal_handler)(int);
868     static signal_handler mysignal(int sig, signal_handler handler) {
869     struct sigaction old_sa;
870     struct sigaction new_sa;
871     new_sa.sa_handler = handler;
872     return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
873     }
874     int main(void) { /* returns 0 if signals need not to be reinstalled */
875     mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
876     exit(handled_signal == 2);
877     }
878     ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
879     dnl When cross-compiling, do not assume anything.
880     ac_cv_sigaction_need_reinstall="guessing yes"
881     )
882     AC_LANG_RESTORE
883     ]
884     )
885     AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
886     [Define if your system requires sigactions to be reinstalled.])
887    
888     dnl Check if Mach exceptions supported.
889     AC_CACHE_CHECK([whether your system supports Mach exceptions],
890     ac_cv_have_mach_exceptions, [
891     AC_LANG_SAVE
892     AC_LANG_CPLUSPLUS
893     AC_TRY_RUN([
894     #define HAVE_MACH_EXCEPTIONS 1
895     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
896     #include "vm_alloc.cpp"
897     #include "sigsegv.cpp"
898     ],
899     ac_cv_have_mach_exceptions=yes,
900     ac_cv_have_mach_exceptions=no,
901     dnl When cross-compiling, do not assume anything.
902     ac_cv_have_mach_exceptions=no
903     )
904     AC_LANG_RESTORE
905     ]
906     )
907     if [[ "$ac_cv_have_mach_exceptions" = "yes" ]]; then
908     sigsegv_recovery=mach
909     fi
910     AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
911     [Define if your system supports Mach exceptions.])
912    
913 gbeauche 1.9 dnl Check if Windows exceptions are supported.
914     AC_CACHE_CHECK([whether your system supports Windows exceptions],
915     ac_cv_have_win32_exceptions, [
916     AC_LANG_SAVE
917     AC_LANG_CPLUSPLUS
918     AC_TRY_RUN([
919     #define HAVE_WIN32_EXCEPTIONS 1
920     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
921     #include "vm_alloc.cpp"
922     #include "sigsegv.cpp"
923     ], [
924     sigsegv_recovery=win32
925     ac_cv_have_win32_exceptions=yes
926     ],
927     ac_cv_have_win32_exceptions=no,
928     dnl When cross-compiling, do not assume anything.
929     ac_cv_have_win32_exceptions=no
930     )
931     AC_LANG_RESTORE
932     ]
933     )
934     AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
935     [Define if your system supports Windows exceptions.])
936    
937 gbeauche 1.1 dnl Otherwise, check if extended signals are supported.
938     if [[ -z "$sigsegv_recovery" ]]; then
939     AC_CACHE_CHECK([whether your system supports extended signal handlers],
940     ac_cv_have_extended_signals, [
941     AC_LANG_SAVE
942     AC_LANG_CPLUSPLUS
943     AC_TRY_RUN([
944     #define HAVE_SIGINFO_T 1
945     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
946     #include "vm_alloc.cpp"
947     #include "sigsegv.cpp"
948     ],
949     ac_cv_have_extended_signals=yes,
950     ac_cv_have_extended_signals=no,
951     dnl When cross-compiling, do not assume anything.
952     ac_cv_have_extended_signals=no
953     )
954     AC_LANG_RESTORE
955     ]
956     )
957     if [[ "$ac_cv_have_extended_signals" = "yes" ]]; then
958     sigsegv_recovery=siginfo
959     fi
960     AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
961     [Define if your system support extended signals.])
962     fi
963    
964     dnl Otherwise, check for subterfuges.
965     if [[ -z "$sigsegv_recovery" ]]; then
966     AC_CACHE_CHECK([whether we then have a subterfuge for your system],
967     ac_cv_have_sigcontext_hack, [
968     AC_LANG_SAVE
969     AC_LANG_CPLUSPLUS
970     AC_TRY_RUN([
971     #define HAVE_SIGCONTEXT_SUBTERFUGE 1
972     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
973     #include "vm_alloc.cpp"
974     #include "sigsegv.cpp"
975     ],
976     ac_cv_have_sigcontext_hack=yes,
977     ac_cv_have_sigcontext_hack=no,
978     dnl When cross-compiling, do not assume anything.
979     ac_cv_have_sigcontext_hack=no
980     )
981     AC_LANG_RESTORE
982     ])
983     if [[ "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
984     sigsegv_recovery=sigcontext
985     fi
986     AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
987     [Define if we know a hack to replace siginfo_t->si_addr member.])
988     fi
989    
990     dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
991     AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
992     ac_cv_have_skip_instruction, [
993     AC_LANG_SAVE
994     AC_LANG_CPLUSPLUS
995     AC_TRY_RUN([
996     #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
997     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
998     #include "vm_alloc.cpp"
999     #include "sigsegv.cpp"
1000     ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
1001     dnl When cross-compiling, do not assume anything.
1002     ac_cv_have_skip_instruction=no
1003     )
1004     AC_LANG_RESTORE
1005     ]
1006     )
1007     AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
1008     [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
1009    
1010     dnl Can we do Video on SEGV Signals ?
1011     CAN_VOSF=no
1012     if [[ -n "$sigsegv_recovery" ]]; then
1013     CAN_VOSF=yes
1014     fi
1015    
1016     dnl Enable VOSF screen updates with this feature is requested and feasible
1017     if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
1018     AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
1019     else
1020     WANT_VOSF=no
1021     fi
1022    
1023 gbeauche 1.8 dnl Check addressing mode to use
1024     AC_MSG_CHECKING([for addressing mode to use])
1025     if [[ "$EMULATED_PPC" != "yes" ]]; then
1026     if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then
1027     AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.])
1028     WANT_ADDRESSING_MODE="real"
1029     fi
1030     fi
1031     if [[ "$WANT_ADDRESSING_MODE" = "direct" ]]; then
1032     if [[ -n "$NATMEM_OFFSET" ]]; then
1033     NATMEM_OFFSET_DEF="-DNATMEM_OFFSET=$NATMEM_OFFSET"
1034     fi
1035     AC_LANG_SAVE
1036     AC_LANG_CPLUSPLUS
1037     cat confdefs.h > conftest.$ac_ext
1038     cat >> conftest.$ac_ext << EOF
1039     #include <stdio.h>
1040     #include <string.h>
1041     #include "vm_alloc.cpp"
1042    
1043     int main(void)
1044     {
1045     if (vm_init() < 0)
1046     return 1;
1047    
1048     static const struct {
1049     unsigned long base;
1050     unsigned int size;
1051     } ranges[[]] = {
1052     { 0x00000000, 0x0003000 },
1053     { 0x10000000, 0x2000000 },
1054     { 0x40800000, 0x0400000 },
1055     { 0x68070000, 0x0010000 },
1056     { 0x69000000, 0x0080000 },
1057     { 0x68ffe000, 0x0002000 },
1058     { 0x5fffe000, 0x0002000 },
1059     { 0x60000000, 0x0040000 },
1060     };
1061     const int n_ranges = sizeof(ranges)/ sizeof(ranges[[0]]);
1062    
1063     #ifdef NATMEM_OFFSET
1064     unsigned long ofs = NATMEM_OFFSET;
1065     #else
1066     for (unsigned long ofs = 0x10000000; ofs <= 0x90000000; ofs += 0x10000000)
1067     #endif
1068     for (int i = 0; i < n_ranges; i++) {
1069     char *m = (char *)(ranges[[i]].base + ofs);
1070     if (vm_acquire_fixed(m, ranges[[i]].size) != 0)
1071     break;
1072     memset(m, 0, ranges[[i]].size);
1073     vm_release(m, ranges[[i]].size);
1074     if (i == n_ranges - 1) {
1075 gbeauche 1.13 if (sizeof(void *) == 8 && ofs > 0xffffffff)
1076     printf("0x%lxul\n", ofs);
1077     else
1078     printf("0x%08x\n", ofs);
1079 gbeauche 1.8 return 0;
1080     }
1081     }
1082    
1083     vm_exit();
1084     return 1;
1085     }
1086     EOF
1087     doit='$CXX conftest.$ac_ext -o conftest.$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS $NATMEM_OFFSET_DEF >& AS_MESSAGE_LOG_FD'
1088     if AC_TRY_EVAL(doit); then
1089     NATMEM_OFFSET=`./conftest.$ac_exeext`
1090 gbeauche 1.9 else
1091     NATMEM_OFFSET=
1092 gbeauche 1.8 fi
1093     rm -f conftest*
1094     AC_LANG_RESTORE
1095 gbeauche 1.9
1096     if [[ -z "$NATMEM_OFFSET" ]]; then
1097     AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value])
1098     else
1099     WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET"
1100     AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET,
1101     [Define constant offset for Mac address translation])
1102     fi
1103 gbeauche 1.8 fi
1104     AC_MSG_RESULT($WANT_ADDRESSING_MODE)
1105    
1106 gbeauche 1.26 dnl Utility macro used by next two tests.
1107     dnl AC_EXAMINE_OBJECT(C source code,
1108     dnl commands examining object file,
1109     dnl [commands to run if compile failed]):
1110     dnl
1111     dnl Compile the source code to an object file; then convert it into a
1112     dnl printable representation. All unprintable characters and
1113     dnl asterisks (*) are replaced by dots (.). All white space is
1114     dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
1115     dnl output, but runs of newlines are compressed to a single newline.
1116     dnl Finally, line breaks are forcibly inserted so that no line is
1117     dnl longer than 80 columns and the file ends with a newline. The
1118     dnl result of all this processing is in the file conftest.dmp, which
1119     dnl may be examined by the commands in the second argument.
1120     dnl
1121     AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
1122     [AC_LANG_SAVE
1123     AC_LANG_C
1124     dnl Next bit cribbed from AC_TRY_COMPILE.
1125     cat > conftest.$ac_ext <<EOF
1126     [#line __oline__ "configure"
1127     #include "confdefs.h"
1128     $1
1129     ]EOF
1130     if AC_TRY_EVAL(ac_compile); then
1131     od -c conftest.o |
1132     sed ['s/^[0-7]*[ ]*/ /
1133     s/\*/./g
1134     s/ \\n/*/g
1135     s/ [0-9][0-9][0-9]/./g
1136     s/ \\[^ ]/./g'] |
1137     tr -d '
1138     ' | tr -s '*' '
1139     ' | fold | sed '$a\
1140     ' > conftest.dmp
1141     $2
1142     ifelse($3, , , else
1143     $3
1144     )dnl
1145     fi
1146     rm -rf conftest*
1147     AC_LANG_RESTORE])
1148    
1149     dnl Floating point format probe.
1150     dnl The basic concept is the same as the above: grep the object
1151     dnl file for an interesting string. We have to watch out for
1152     dnl rounding changing the values in the object, however; this is
1153     dnl handled by ignoring the least significant byte of the float.
1154     dnl
1155     dnl Does not know about VAX G-float or C4x idiosyncratic format.
1156     dnl It does know about PDP-10 idiosyncratic format, but this is
1157     dnl not presently supported by GCC. S/390 "binary floating point"
1158     dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
1159     dnl as ASCII?)
1160     dnl
1161     AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
1162     [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
1163     [gcc_AC_EXAMINE_OBJECT(
1164     [/* This will not work unless sizeof(double) == 8. */
1165     extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
1166    
1167     /* This structure must have no internal padding. */
1168     struct possibility {
1169     char prefix[8];
1170     double candidate;
1171     char postfix[8];
1172     };
1173    
1174     #define C(cand) { "\nformat:", cand, ":tamrof\n" }
1175     struct possibility table [] =
1176     {
1177     C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
1178     C( 3.53802595280598432000e+18), /* D__float - VAX */
1179     C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
1180     C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
1181     C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
1182     };],
1183     [if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1184     ac_cv_c_float_format='IEEE (big-endian)'
1185     elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
1186     ac_cv_c_float_format='IEEE (big-endian)'
1187     elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
1188     ac_cv_c_float_format='IEEE (little-endian)'
1189     elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
1190     ac_cv_c_float_format='IEEE (little-endian)'
1191     elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
1192     ac_cv_c_float_format='VAX D-float'
1193     elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
1194     ac_cv_c_float_format='PDP-10'
1195     elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1196     ac_cv_c_float_format='IBM 370 hex'
1197     else
1198     AC_MSG_ERROR(Unknown floating point format)
1199     fi],
1200     [AC_MSG_ERROR(compile failed)])
1201     ])
1202     # IEEE is the default format. If the float endianness isn't the same
1203     # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
1204     # (which is a tristate: yes, no, default). This is only an issue with
1205     # IEEE; the other formats are only supported by a few machines each,
1206     # all with the same endianness.
1207     format=IEEE_FLOAT_FORMAT
1208     fbigend=
1209     case $ac_cv_c_float_format in
1210     'IEEE (big-endian)' )
1211     if test $ac_cv_c_bigendian = no; then
1212     fbigend=1
1213     fi
1214     ;;
1215     'IEEE (little-endian)' )
1216     if test $ac_cv_c_bigendian = yes; then
1217     fbigend=0
1218     fi
1219     ;;
1220     'VAX D-float' )
1221     format=VAX_FLOAT_FORMAT
1222     ;;
1223     'PDP-10' )
1224     format=PDP10_FLOAT_FORMAT
1225     ;;
1226     'IBM 370 hex' )
1227     format=IBM_FLOAT_FORMAT
1228     ;;
1229     esac
1230     AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1231     [Define to the floating point format of the host machine.])
1232     if test -n "$fbigend"; then
1233     AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1234     [Define to 1 if the host machine stores floating point numbers in
1235     memory with the word containing the sign bit at the lowest address,
1236     or to 0 if it does it the other way around.
1237    
1238     This macro should not be defined if the ordering is the same as for
1239     multi-word integers.])
1240     fi
1241     ])
1242    
1243     dnl Check for host float format
1244     gcc_AC_C_FLOAT_FORMAT
1245    
1246 gbeauche 1.1 dnl Platform specific binary postprocessor
1247     AC_PATH_PROG(BLESS, "true")
1248     if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
1249     BLESS=Darwin/lowmem
1250     LDFLAGS="$LDFLAGS -pagezero_size 0x3000"
1251     fi
1252    
1253     dnl Check for GCC 2.7 or higher.
1254     HAVE_GCC27=no
1255     AC_MSG_CHECKING(for GCC 2.7 or higher)
1256 gbeauche 1.36 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1257     # error gcc < 2.7
1258 gbeauche 1.44 typedef syntax error;
1259 gbeauche 1.36 #endif
1260     ]])],
1261     [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1262     [AC_MSG_RESULT(no)])
1263 gbeauche 1.1
1264     dnl Check for GCC 3.0 or higher.
1265     HAVE_GCC30=no
1266     AC_MSG_CHECKING(for GCC 3.0 or higher)
1267 gbeauche 1.36 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1268     # error gcc < 3
1269 gbeauche 1.44 typedef syntax error;
1270 gbeauche 1.36 #endif
1271     ]])],
1272     [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1273     [AC_MSG_RESULT(no)])
1274 gbeauche 1.1
1275     dnl Check for ICC.
1276     AC_MSG_CHECKING(for ICC)
1277     HAVE_ICC=no
1278     if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
1279     HAVE_ICC=yes
1280     fi
1281     AC_MSG_RESULT($HAVE_ICC)
1282    
1283 gbeauche 1.9 dnl Determine the generated object format
1284 gbeauche 1.24 AC_CACHE_CHECK([the format of compiler generated objects],
1285 gbeauche 1.9 ac_cv_object_format, [
1286 gbeauche 1.1 echo 'int i;' > conftest.$ac_ext
1287 gbeauche 1.9 ac_cv_object_format=no
1288 gbeauche 1.1 if AC_TRY_EVAL(ac_compile); then
1289     case `/usr/bin/file conftest.$ac_objext` in
1290     *"ELF"*)
1291 gbeauche 1.9 ac_cv_object_format=elf
1292     ;;
1293 gbeauche 1.24 *"Mach-O"*)
1294     ac_cv_object_format=mach
1295     ;;
1296 gbeauche 1.9 *)
1297     ac_cv_object_format=unknown
1298 gbeauche 1.1 ;;
1299     esac
1300     fi
1301     rm -rf conftest*
1302     ])
1303    
1304 gbeauche 1.32 dnl Add -fno-strict-aliasing for slirp sources
1305     if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1306     SAVED_CFLAGS="$CFLAGS"
1307     CFLAGS="$CFLAGS -fno-strict-aliasing"
1308     AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1309     ac_cv_gcc_no_strict_aliasing, [
1310     AC_TRY_COMPILE([],[],
1311     [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1312     [ac_cv_gcc_no_strict_aliasing=no])
1313     ])
1314     CFLAGS="$SAVED_CFLAGS"
1315     fi
1316    
1317 gbeauche 1.39 dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1318     if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1319 gbeauche 1.31 SAVED_CFLAGS="$CFLAGS"
1320     CFLAGS="$CFLAGS -mdynamic-no-pic"
1321     AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1322     ac_cv_gcc_mdynamic_no_pic, [
1323     AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1324     ])
1325     if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1326     CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1327     else
1328     CFLAGS="$SAVED_CFLAGS"
1329     fi
1330     fi
1331    
1332 gbeauche 1.1 dnl CPU emulator sources
1333     if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1334     CPUSRCS="\
1335 gbeauche 1.9 ../kpx_cpu/src/mathlib/ieeefp.cpp \
1336 gbeauche 1.26 ../kpx_cpu/src/mathlib/mathlib.cpp \
1337 gbeauche 1.1 ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
1338     ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
1339     ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
1340     ../kpx_cpu/src/cpu/ppc/ppc-translate.cpp"
1341     CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src"
1342    
1343     dnl Enable JIT compiler, if possible
1344     if [[ "x$WANT_JIT" = "xyes" ]]; then
1345     AC_CACHE_CHECK([whether dyngen can be used],
1346     ac_cv_use_dyngen, [
1347 gbeauche 1.9 case $host_cpu:$ac_cv_object_format in
1348     powerpc:elf)
1349 gbeauche 1.1 ac_cv_use_dyngen=yes
1350     ;;
1351 gbeauche 1.9 x86_64:elf)
1352 gbeauche 1.1 ac_cv_use_dyngen=yes
1353     ;;
1354 gbeauche 1.9 i?86:elf)
1355 gbeauche 1.1 ac_cv_use_dyngen=yes
1356     ;;
1357 gbeauche 1.43 mips:elf)
1358     ac_cv_use_dyngen=yes
1359     ;;
1360 gbeauche 1.24 powerpc:mach)
1361     ac_cv_use_dyngen=yes
1362     ;;
1363 gbeauche 1.41 i?86:mach)
1364     ac_cv_use_dyngen=yes
1365     ;;
1366 gbeauche 1.1 *:*)
1367     ac_cv_use_dyngen=no
1368     ;;
1369     esac
1370     dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2)
1371     if [[ -z "$DYNGEN_CC" ]]; then
1372     if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1373     DYNGEN_CC=$CXX
1374     else
1375 gbeauche 1.44 for p in /usr/bin /usr/local/bin /usr/freeware/bin; do
1376 gbeauche 1.1 gxx="$p/g++"
1377     if [[ -x "$gxx" ]]; then
1378     DYNGEN_CC="$gxx"
1379     fi
1380     done
1381     fi
1382     fi
1383 gbeauche 1.27 if [[ -z "$DYNGEN_CC" ]]; then
1384 gbeauche 1.1 ac_cv_use_dyngen=no
1385     fi
1386     ])
1387     if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
1388     case $host_cpu in
1389     i?86)
1390 gbeauche 1.46 DYNGEN_OP_FLAGS="-fomit-frame-pointer"
1391 gbeauche 1.24 ;;
1392 gbeauche 1.43 mips)
1393     DYNGEN_OP_FLAGS="-fno-delayed-branch -mno-abicalls"
1394     ;;
1395 gbeauche 1.24 powerpc)
1396     if [[ "x$ac_cv_object_format" = "xmach" ]]; then
1397     DYNGEN_OP_FLAGS="-mdynamic-no-pic"
1398 gbeauche 1.1 fi
1399     ;;
1400     esac
1401 gbeauche 1.44 have_dyngen_gcc3=no
1402     case "x`$DYNGEN_CC -dumpversion`" in
1403     x[12].*) ;;
1404     x*) have_dyngen_gcc3=yes ;;
1405     esac
1406     if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1407 gbeauche 1.24 DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
1408     else
1409     DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
1410     fi
1411 gbeauche 1.38 DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-functions -finline-limit=10000 -fno-exceptions -g0"
1412 gbeauche 1.44 if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1413 gbeauche 1.1 DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
1414     fi
1415 gbeauche 1.43 if [[ "x$DYNGEN_CC" != "x$CXX" ]]; then
1416     DYNGEN_CFLAGS="-O2 $CFLAGS"
1417     DYNGEN_CXXFLAGS="-O2 $CXXFLAGS"
1418     else
1419     DYNGEN_CFLAGS="\$(CFLAGS)"
1420     DYNGEN_CXXFLAGS="\$(CXXFLAGS)"
1421     fi
1422 gbeauche 1.1 else
1423     WANT_JIT=no
1424     fi
1425     AC_TRANSLATE_DEFINE(ENABLE_DYNGEN, $ac_cv_use_dyngen, [Define to enable dyngen engine])
1426     if [[ "x$WANT_JIT" = "xyes" ]]; then
1427     DYNGENSRCS="\
1428     ../kpx_cpu/src/cpu/jit/dyngen.c \
1429     ../kpx_cpu/src/cpu/jit/cxxdemangle.cpp"
1430     CPUSRCS="\
1431     ../kpx_cpu/src/cpu/jit/jit-cache.cpp \
1432     ../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \
1433     ../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp $CPUSRCS"
1434     fi
1435     fi
1436     CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp"
1437     else
1438     WANT_JIT=no
1439     fi
1440     if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
1441     AC_CACHE_CHECK([whether static data regions are executable],
1442     ac_cv_have_static_data_exec, [
1443     AC_TRY_RUN([int main(void) {
1444 gbeauche 1.25 #if defined(__powerpc__) || defined(__ppc__)
1445 gbeauche 1.1 static unsigned int p[8] = {0x4e800020,};
1446     asm volatile("dcbst 0,%0" : : "r" (p) : "memory");
1447     asm volatile("sync" : : : "memory");
1448     asm volatile("icbi 0,%0" : : "r" (p) : "memory");
1449     asm volatile("sync" : : : "memory");
1450     asm volatile("isync" : : : "memory");
1451     ((void (*)(void))p)();
1452     return 0;
1453     #endif
1454     return 1;
1455     }], ac_cv_have_static_data_exec=yes, ac_cv_have_static_data_exec=no,
1456     dnl When cross-compiling, do not assume anything.
1457     ac_cv_have_static_data_exec=no
1458     )
1459     ])
1460 gbeauche 1.14 else
1461     ac_cv_use_dyngen=no
1462 gbeauche 1.1 fi
1463     AC_TRANSLATE_DEFINE(HAVE_STATIC_DATA_EXEC, "$ac_cv_have_static_data_exec",
1464     [Define if your system marks static data pages as executable.])
1465    
1466     if [[ "x$WANT_JIT" = "xyes" ]]; then
1467     CPPFLAGS="$CPPFLAGS -DUSE_JIT"
1468     fi
1469    
1470 gbeauche 1.43 dnl Higher level optimizations with MIPSPro compilers are possible
1471     if [[ "x$HAVE_IPA" = "xyes" ]]; then
1472     CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1473     CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1474     CXXFLAGS="-LANG:std $CXXFLAGS"
1475     LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
1476     fi
1477    
1478 gbeauche 1.1 dnl Generate Makefile.
1479 gbeauche 1.16 AC_SUBST(PERL)
1480 gbeauche 1.14 AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen])
1481 gbeauche 1.1 AC_SUBST(DYNGENSRCS)
1482     AC_SUBST(DYNGEN_CC)
1483 gbeauche 1.43 AC_SUBST(DYNGEN_CFLAGS)
1484     AC_SUBST(DYNGEN_CXXFLAGS)
1485 gbeauche 1.1 AC_SUBST(DYNGEN_OP_FLAGS)
1486     AC_SUBST(SYSSRCS)
1487     AC_SUBST(CPUSRCS)
1488     AC_SUBST(BLESS)
1489     AC_SUBST(KEYCODES)
1490 gbeauche 1.5 AC_OUTPUT([
1491     Makefile
1492     ../MacOSX/Info.plist
1493     ])
1494 gbeauche 1.1
1495     dnl Print summary.
1496     echo
1497     echo SheepShaver configuration summary:
1498     echo
1499     echo SDL support ...................... : $SDL_SUPPORT
1500 gbeauche 1.21 echo FBDev DGA support ................ : $WANT_FBDEV_DGA
1501 gbeauche 1.1 echo XFree86 DGA support .............. : $WANT_XF86_DGA
1502     echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
1503     echo Using PowerPC emulator ........... : $EMULATED_PPC
1504     echo Enable JIT compiler .............. : $WANT_JIT
1505     echo Enable video on SEGV signals ..... : $WANT_VOSF
1506     echo ESD sound support ................ : $WANT_ESD
1507     echo GTK user interface ............... : $WANT_GTK
1508     echo mon debugger support ............. : $WANT_MON
1509 gbeauche 1.8 echo Addressing mode .................. : $WANT_ADDRESSING_MODE
1510 gbeauche 1.1 echo Bad memory access recovery type .. : $sigsegv_recovery
1511     echo
1512     echo "Configuration done. Now type \"make\"."