ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/configure.ac
Revision: 1.8
Committed: 2004-11-13T14:09:15Z (20 years ago) by gbeauche
Branch: MAIN
Changes since 1.7: +94 -1 lines
Log Message:
Implement Direct Addressing mode similarly to Basilisk II. This is to get
SheepShaver working on OSes that don't support maipping of Low Memory globals
at 0x00000000, e.g. Windows.

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