ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/configure.ac
Revision: 1.58
Committed: 2007-06-13T12:11:55Z (17 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.57: +1 -1 lines
Log Message:
Add mips cxmon files

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