ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/configure.ac
Revision: 1.62
Committed: 2008-11-21T01:09:28Z (15 years, 11 months ago) by asvitkine
Branch: MAIN
Changes since 1.61: +3 -0 lines
Log Message:
Fix Leopard build.

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 asvitkine 1.62 *-*-darwin*)
429     no_dev_ptmx=1
430     ;;
431 gbeauche 1.9 esac
432    
433     if test -z "$no_dev_ptmx" ; then
434     if test "x$disable_ptmx_check" != "xyes" ; then
435     AC_CHECK_FILE([/dev/ptmx],
436     [
437     AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.])
438     have_dev_ptmx=1
439     ]
440     )
441     fi
442     fi
443     AC_CHECK_FILE([/dev/ptc],
444     [
445     AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.])
446     have_dev_ptc=1
447     ]
448     )
449     dnl (end of code from openssh-3.2.2p1 configure.ac)
450    
451 gbeauche 1.47 dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
452     dnl doesn't work or is unimplemented. On these systems (mostly older
453     dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
454     AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O],
455     ac_cv_nonblocking_io, [
456     case "$host" in
457     *-*-osf*)
458     ac_cv_nonblocking_io=FIONBIO
459     ;;
460     *-*-sunos4*)
461     ac_cv_nonblocking_io=FIONBIO
462     ;;
463     *-*-ultrix*)
464     ac_cv_nonblocking_io=FIONBIO
465     ;;
466     *)
467     ac_cv_nonblocking_io=O_NONBLOCK
468     ;;
469     esac
470     ])
471     if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then
472     AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used])
473     fi
474    
475 gbeauche 1.48 dnl Check whether compiler supports byte bit-fields
476     AC_CACHE_CHECK([whether compiler supports byte bit-fields],
477     ac_cv_have_byte_bitfields, [
478     AC_LANG_SAVE
479     AC_LANG_CPLUSPLUS
480     AC_TRY_RUN([
481     struct A {
482     unsigned char b1:4;
483     unsigned char b2:4;
484     unsigned char c;
485     unsigned short s;
486     unsigned char a[4];
487     };
488    
489     int main(void) {
490     A a;
491     return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1));
492     }],
493     [ac_cv_have_byte_bitfields=yes],
494     [ac_cv_have_byte_bitfields=no],
495     dnl When cross-compiling, assume only GCC supports this
496     [if [[ "$GCC" = "yes" ]]; then
497     ac_cv_have_byte_bitfields="guessing yes"
498     else
499     ac_cv_have_byte_bitfields="guessing no"
500     fi]
501     )
502     AC_LANG_RESTORE
503     ])
504    
505 gbeauche 1.1 dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
506 gbeauche 1.49 AC_DEFUN([AC_CHECK_FRAMEWORK], [
507 gbeauche 1.1 AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
508     AC_CACHE_CHECK([whether compiler supports framework $1],
509     ac_Framework, [
510     saved_LIBS="$LIBS"
511     LIBS="$LIBS -framework $1"
512     AC_TRY_LINK(
513 gbeauche 1.45 [$2], [],
514 gbeauche 1.1 [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
515     )
516     ])
517     AS_IF([test AS_VAR_GET(ac_Framework) = yes],
518     [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
519     )
520     AS_VAR_POPDEF([ac_Framework])dnl
521     ])
522    
523     dnl Check for some MacOS X frameworks
524     AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
525     AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
526 gbeauche 1.37 AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
527 gbeauche 1.59 AC_CHECK_FRAMEWORK(CoreAudio, [#include <CoreAudio/CoreAudio.h>])
528     AC_CHECK_FRAMEWORK(AudioUnit, [#include <AudioUnit/AudioUnit.h>])
529     AC_CHECK_FRAMEWORK(AudioToolbox, [#include <AudioToolbox/AudioToolbox.h>])
530 gbeauche 1.1
531     dnl Select system-dependant sources.
532     SERIALSRC=serial_unix.cpp
533     ETHERSRC=../dummy/ether_dummy.cpp
534     SCSISRC=../dummy/scsi_dummy.cpp
535     AUDIOSRC=../dummy/audio_dummy.cpp
536 asvitkine 1.60 PREFSSRC=../dummy/prefs_dummy.cpp
537 gbeauche 1.6 EXTFSSRC=extfs_unix.cpp
538 gbeauche 1.1 EXTRASYSSRCS=
539     case "$target_os" in
540     linux*)
541 gbeauche 1.32 ETHERSRC=ether_unix.cpp
542 gbeauche 1.1 AUDIOSRC=audio_oss_esd.cpp
543     SCSISRC=Linux/scsi_linux.cpp
544     if [[ "x$EMULATED_PPC" = "xno" ]]; then
545 gbeauche 1.35 EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S"
546 gbeauche 1.17 fi
547     ;;
548 gbeauche 1.32 freebsd*)
549     ETHERSRC=ether_unix.cpp
550     ;;
551 gbeauche 1.17 netbsd*)
552 gbeauche 1.32 ETHERSRC=ether_unix.cpp
553 gbeauche 1.17 if [[ "x$EMULATED_PPC" = "xno" ]]; then
554 gbeauche 1.35 EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S"
555 gbeauche 1.1 fi
556     ;;
557     darwin*)
558 gbeauche 1.32 ETHERSRC=ether_unix.cpp
559 gbeauche 1.1 if [[ "x$EMULATED_PPC" = "xno" ]]; then
560 gbeauche 1.35 EXTRASYSSRCS="paranoia.cpp ppc_asm.S"
561 gbeauche 1.1 fi
562 gbeauche 1.37 if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
563 gbeauche 1.1 EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp"
564     fi
565 gbeauche 1.6 if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
566 gbeauche 1.61 EXTFSSRC=../MacOSX/extfs_macosx.cpp
567 asvitkine 1.60 PREFSSRC="../MacOSX/prefs_macosx.mm ../MacOSX/PrefsEditor/PrefsEditor.mm"
568     CPPFLAGS="$CPPFLAGS -I../MacOSX/PrefsEditor"
569     fi
570 gbeauche 1.59 if [[ "x$ac_cv_framework_CoreAudio" = "xyes" ]]; then
571     AUDIOSRC="../MacOSX/audio_macosx.cpp ../MacOSX/AudioBackEnd.cpp ../MacOSX/AudioDevice.cpp ../MacOSX/MacOSX_sound_if.cpp"
572     fi
573 gbeauche 1.1 ;;
574 gbeauche 1.42 irix*)
575     AUDIOSRC=Irix/audio_irix.cpp
576     LIBS="$LIBS -laudio"
577     WANT_ESD=no
578 gbeauche 1.43
579     dnl Check if our compiler supports -IPA (MIPSPro)
580     HAVE_IPA=no
581     ocflags="$CFLAGS"
582     CFLAGS=`echo " $CFLAGS -IPA" | sed -e "s/ -g //g"`
583     AC_MSG_CHECKING(if "-IPA" works)
584     dnl Do a test compile of an empty function
585     AC_TRY_COMPILE([#if defined __GNUC__
586     # error GCC does not support IPA yet
587     #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
588     CFLAGS="$ocflags"
589 gbeauche 1.42 ;;
590 gbeauche 1.1 esac
591    
592 gbeauche 1.32 dnl Is the slirp library supported?
593 gbeauche 1.48 case "$ac_cv_have_byte_bitfields" in
594     yes|"guessing yes")
595     CAN_SLIRP=yes
596     ETHERSRC=ether_unix.cpp
597     ;;
598     esac
599     if [[ -n "$CAN_SLIRP" ]]; then
600 gbeauche 1.32 AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
601     SLIRP_SRCS="\
602     ../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \
603     ../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \
604     ../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \
605     ../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \
606     ../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \
607     ../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c"
608     fi
609     AC_SUBST(SLIRP_SRCS)
610    
611 gbeauche 1.1 dnl SDL overrides
612     if [[ "x$WANT_SDL" = "xyes" ]]; then
613     AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.])
614     fi
615     if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
616 gbeauche 1.7 AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support.])
617 gbeauche 1.1 VIDEOSRCS="../SDL/video_sdl.cpp"
618     KEYCODES="../SDL/keycodes"
619     if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
620     EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
621     else
622 gbeauche 1.33 EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
623 gbeauche 1.1 fi
624     else
625     VIDEOSRCS="video_x.cpp"
626     KEYCODES="keycodes"
627     EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp"
628     fi
629 gbeauche 1.7 if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
630     AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
631     AUDIOSRC="../SDL/audio_sdl.cpp"
632     fi
633 gbeauche 1.1
634 asvitkine 1.60 SYSSRCS="$VIDEOSRCS $EXTFSSRC $PREFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $EXTRASYSSRCS"
635 gbeauche 1.1
636     dnl Define a macro that translates a yesno-variable into a C macro definition
637     dnl to be put into the config.h file
638     dnl $1 -- the macro to define
639     dnl $2 -- the value to translate
640     dnl $3 -- template name
641 gbeauche 1.49 AC_DEFUN([AC_TRANSLATE_DEFINE], [
642 gbeauche 1.1 if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
643     AC_DEFINE($1, 1, $3)
644     fi
645     ])
646    
647     dnl Check that the host supports TUN/TAP devices
648     AC_CACHE_CHECK([whether TUN/TAP is supported],
649     ac_cv_tun_tap_support, [
650     AC_TRY_COMPILE([
651     #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
652     #include <linux/if.h>
653     #include <linux/if_tun.h>
654     #endif
655     #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
656     #include <net/if.h>
657     #include <net/if_tun.h>
658     #endif
659     ], [
660     struct ifreq ifr;
661     memset(&ifr, 0, sizeof(ifr));
662     ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
663     ],
664     ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
665     )
666     ])
667     AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
668     [Define if your system supports TUN/TAP devices.])
669    
670     dnl Various checks if the system supports vm_allocate() and the like functions.
671     have_mach_vm=no
672     if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
673     "x$ac_cv_func_vm_protect" = "xyes" ]]; then
674     have_mach_vm=yes
675     fi
676     AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
677     [Define if your system has a working vm_allocate()-based memory allocator.])
678    
679     dnl Check that vm_allocate(), vm_protect() work
680     if [[ "x$have_mach_vm" = "xyes" ]]; then
681    
682     AC_CACHE_CHECK([whether vm_protect works],
683     ac_cv_vm_protect_works, [
684     AC_LANG_SAVE
685     AC_LANG_CPLUSPLUS
686     ac_cv_vm_protect_works=yes
687     dnl First the tests that should segfault
688     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
689     AC_TRY_RUN([
690     #define CONFIGURE_TEST_VM_MAP
691     #define TEST_VM_PROT_$test_def
692     #include "vm_alloc.cpp"
693     ], ac_cv_vm_protect_works=no, rm -f core,
694     dnl When cross-compiling, do not assume anything
695     ac_cv_vm_protect_works="guessing no"
696     )
697     done
698     AC_TRY_RUN([
699     #define CONFIGURE_TEST_VM_MAP
700     #define TEST_VM_PROT_RDWR_WRITE
701     #include "vm_alloc.cpp"
702     ], , ac_cv_vm_protect_works=no,
703     dnl When cross-compiling, do not assume anything
704     ac_cv_vm_protect_works="guessing no"
705     )
706     AC_LANG_RESTORE
707     ]
708     )
709    
710     dnl Remove support for vm_allocate() if vm_protect() does not work
711     if [[ "x$have_mach_vm" = "xyes" ]]; then
712     case $ac_cv_vm_protect_works in
713     *yes) have_mach_vm=yes;;
714     *no) have_mach_vm=no;;
715     esac
716     fi
717     AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
718     [Define if your system has a working vm_allocate()-based memory allocator.])
719    
720     fi dnl HAVE_MACH_VM
721    
722     dnl Various checks if the system supports mmap() and the like functions.
723     dnl ... and Mach memory allocators are not supported
724     have_mmap_vm=no
725     if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
726     "x$ac_cv_func_mprotect" = "xyes" ]]; then
727     if [[ "x$have_mach_vm" = "xno" ]]; then
728     have_mmap_vm=yes
729     fi
730     fi
731     AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
732     [Define if your system has a working mmap()-based memory allocator.])
733    
734     dnl Check that mmap() and associated functions work.
735     if [[ "x$have_mmap_vm" = "xyes" ]]; then
736    
737     dnl Check if we have a working anonymous mmap()
738     AC_CACHE_CHECK([whether mmap supports MAP_ANON],
739     ac_cv_mmap_anon, [
740     AC_LANG_SAVE
741     AC_LANG_CPLUSPLUS
742     AC_TRY_RUN([
743     #define HAVE_MMAP_ANON
744     #define CONFIGURE_TEST_VM_MAP
745     #define TEST_VM_MMAP_ANON
746     #include "vm_alloc.cpp"
747     ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
748     dnl When cross-compiling, do not assume anything.
749     ac_cv_mmap_anon="guessing no"
750     )
751     AC_LANG_RESTORE
752     ]
753     )
754     AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon",
755     [Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.])
756    
757     AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS],
758     ac_cv_mmap_anonymous, [
759     AC_LANG_SAVE
760     AC_LANG_CPLUSPLUS
761     AC_TRY_RUN([
762     #define HAVE_MMAP_ANONYMOUS
763     #define CONFIGURE_TEST_VM_MAP
764     #define TEST_VM_MMAP_ANON
765     #include "vm_alloc.cpp"
766     ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
767     dnl When cross-compiling, do not assume anything.
768     ac_cv_mmap_anonymous="guessing no"
769     )
770     AC_LANG_RESTORE
771     ]
772     )
773     AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous",
774     [Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.])
775    
776     AC_CACHE_CHECK([whether mprotect works],
777     ac_cv_mprotect_works, [
778     AC_LANG_SAVE
779     AC_LANG_CPLUSPLUS
780     ac_cv_mprotect_works=yes
781     dnl First the tests that should segfault
782     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
783     AC_TRY_RUN([
784     #define CONFIGURE_TEST_VM_MAP
785     #define TEST_VM_PROT_$test_def
786     #include "vm_alloc.cpp"
787     ], ac_cv_mprotect_works=no, rm -f core,
788     dnl When cross-compiling, do not assume anything
789     ac_cv_mprotect_works="guessing no"
790     )
791     done
792     AC_TRY_RUN([
793     #define CONFIGURE_TEST_VM_MAP
794     #define TEST_VM_PROT_RDWR_WRITE
795     #include "vm_alloc.cpp"
796     ], , ac_cv_mprotect_works=no,
797     dnl When cross-compiling, do not assume anything
798     ac_cv_mprotect_works="guessing no"
799     )
800     AC_LANG_RESTORE
801     ]
802     )
803    
804     dnl Remove support for mmap() if mprotect() does not work
805     if [[ "x$have_mmap_vm" = "xyes" ]]; then
806     case $ac_cv_mprotect_works in
807     *yes) have_mmap_vm=yes;;
808     *no) have_mmap_vm=no;;
809     esac
810     fi
811     AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm,
812     [Define if your system has a working mmap()-based memory allocator.])
813    
814     fi dnl HAVE_MMAP_VM
815    
816     dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
817     AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x3000],
818     ac_cv_pagezero_hack, [
819     ac_cv_pagezero_hack=no
820     if AC_TRY_COMMAND([Darwin/testlmem.sh 0x3000]); then
821     ac_cv_pagezero_hack=yes
822     dnl might as well skip the test for mmap-able low memory
823     ac_cv_can_map_lm=no
824     fi
825     ])
826     AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
827     [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
828    
829     dnl Check if we can mmap 0x3000 bytes from 0x0000
830     AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x3000],
831     ac_cv_can_map_lm, [
832     AC_LANG_SAVE
833     AC_LANG_CPLUSPLUS
834     AC_TRY_RUN([
835     #include "vm_alloc.cpp"
836     int main(void) { /* returns 0 if we could map the lowmem globals */
837     volatile char * lm = 0;
838     if (vm_init() < 0) exit(1);
839     if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
840     lm[0] = 'z';
841     if (vm_release((char *)lm, 0x2000) < 0) exit(1);
842     vm_exit(); exit(0);
843     }
844     ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
845     dnl When cross-compiling, do not assume anything.
846     ac_cv_can_map_lm="guessing no"
847     )
848     AC_LANG_RESTORE
849     ]
850     )
851    
852     dnl Check signal handlers need to be reinstalled
853     AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
854     ac_cv_signal_need_reinstall, [
855     AC_LANG_SAVE
856     AC_LANG_CPLUSPLUS
857     AC_TRY_RUN([
858     #include <stdlib.h>
859     #ifdef HAVE_UNISTD_H
860     #include <unistd.h>
861     #endif
862     #include <signal.h>
863     static int handled_signal = 0;
864     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
865     int main(void) { /* returns 0 if signals need not to be reinstalled */
866     signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
867     exit(handled_signal == 2);
868     }
869     ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
870     dnl When cross-compiling, do not assume anything.
871     ac_cv_signal_need_reinstall="guessing yes"
872     )
873     AC_LANG_RESTORE
874     ]
875     )
876     AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall",
877     [Define if your system requires signals to be reinstalled.])
878    
879     dnl Check if sigaction handlers need to be reinstalled
880     AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
881     ac_cv_sigaction_need_reinstall, [
882     AC_LANG_SAVE
883     AC_LANG_CPLUSPLUS
884     AC_TRY_RUN([
885     #include <stdlib.h>
886     #ifdef HAVE_UNISTD_H
887     #include <unistd.h>
888     #endif
889     #include <signal.h>
890     static int handled_signal = 0;
891     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
892     typedef RETSIGTYPE (*signal_handler)(int);
893     static signal_handler mysignal(int sig, signal_handler handler) {
894     struct sigaction old_sa;
895     struct sigaction new_sa;
896     new_sa.sa_handler = handler;
897     return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
898     }
899     int main(void) { /* returns 0 if signals need not to be reinstalled */
900     mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
901     exit(handled_signal == 2);
902     }
903     ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
904     dnl When cross-compiling, do not assume anything.
905     ac_cv_sigaction_need_reinstall="guessing yes"
906     )
907     AC_LANG_RESTORE
908     ]
909     )
910     AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
911     [Define if your system requires sigactions to be reinstalled.])
912    
913     dnl Check if Mach exceptions supported.
914     AC_CACHE_CHECK([whether your system supports Mach exceptions],
915     ac_cv_have_mach_exceptions, [
916     AC_LANG_SAVE
917     AC_LANG_CPLUSPLUS
918     AC_TRY_RUN([
919     #define HAVE_MACH_EXCEPTIONS 1
920     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
921     #include "vm_alloc.cpp"
922     #include "sigsegv.cpp"
923     ],
924     ac_cv_have_mach_exceptions=yes,
925     ac_cv_have_mach_exceptions=no,
926     dnl When cross-compiling, do not assume anything.
927     ac_cv_have_mach_exceptions=no
928     )
929     AC_LANG_RESTORE
930     ]
931     )
932     if [[ "$ac_cv_have_mach_exceptions" = "yes" ]]; then
933     sigsegv_recovery=mach
934     fi
935     AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
936     [Define if your system supports Mach exceptions.])
937    
938 gbeauche 1.9 dnl Check if Windows exceptions are supported.
939     AC_CACHE_CHECK([whether your system supports Windows exceptions],
940     ac_cv_have_win32_exceptions, [
941     AC_LANG_SAVE
942     AC_LANG_CPLUSPLUS
943     AC_TRY_RUN([
944     #define HAVE_WIN32_EXCEPTIONS 1
945     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
946     #include "vm_alloc.cpp"
947     #include "sigsegv.cpp"
948     ], [
949     sigsegv_recovery=win32
950     ac_cv_have_win32_exceptions=yes
951     ],
952     ac_cv_have_win32_exceptions=no,
953     dnl When cross-compiling, do not assume anything.
954     ac_cv_have_win32_exceptions=no
955     )
956     AC_LANG_RESTORE
957     ]
958     )
959     AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
960     [Define if your system supports Windows exceptions.])
961    
962 gbeauche 1.1 dnl Otherwise, check if extended signals are supported.
963     if [[ -z "$sigsegv_recovery" ]]; then
964     AC_CACHE_CHECK([whether your system supports extended signal handlers],
965     ac_cv_have_extended_signals, [
966     AC_LANG_SAVE
967     AC_LANG_CPLUSPLUS
968     AC_TRY_RUN([
969     #define HAVE_SIGINFO_T 1
970     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
971     #include "vm_alloc.cpp"
972     #include "sigsegv.cpp"
973     ],
974     ac_cv_have_extended_signals=yes,
975     ac_cv_have_extended_signals=no,
976     dnl When cross-compiling, do not assume anything.
977     ac_cv_have_extended_signals=no
978     )
979     AC_LANG_RESTORE
980     ]
981     )
982     if [[ "$ac_cv_have_extended_signals" = "yes" ]]; then
983     sigsegv_recovery=siginfo
984     fi
985     AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
986     [Define if your system support extended signals.])
987     fi
988    
989     dnl Otherwise, check for subterfuges.
990     if [[ -z "$sigsegv_recovery" ]]; then
991     AC_CACHE_CHECK([whether we then have a subterfuge for your system],
992     ac_cv_have_sigcontext_hack, [
993     AC_LANG_SAVE
994     AC_LANG_CPLUSPLUS
995     AC_TRY_RUN([
996     #define HAVE_SIGCONTEXT_SUBTERFUGE 1
997     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
998     #include "vm_alloc.cpp"
999     #include "sigsegv.cpp"
1000     ],
1001     ac_cv_have_sigcontext_hack=yes,
1002     ac_cv_have_sigcontext_hack=no,
1003     dnl When cross-compiling, do not assume anything.
1004     ac_cv_have_sigcontext_hack=no
1005     )
1006     AC_LANG_RESTORE
1007     ])
1008     if [[ "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
1009     sigsegv_recovery=sigcontext
1010     fi
1011     AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
1012     [Define if we know a hack to replace siginfo_t->si_addr member.])
1013     fi
1014    
1015     dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
1016     AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
1017     ac_cv_have_skip_instruction, [
1018     AC_LANG_SAVE
1019     AC_LANG_CPLUSPLUS
1020     AC_TRY_RUN([
1021     #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
1022     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
1023     #include "vm_alloc.cpp"
1024     #include "sigsegv.cpp"
1025     ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
1026     dnl When cross-compiling, do not assume anything.
1027     ac_cv_have_skip_instruction=no
1028     )
1029     AC_LANG_RESTORE
1030     ]
1031     )
1032     AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
1033     [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
1034    
1035     dnl Can we do Video on SEGV Signals ?
1036     CAN_VOSF=no
1037     if [[ -n "$sigsegv_recovery" ]]; then
1038     CAN_VOSF=yes
1039     fi
1040    
1041     dnl Enable VOSF screen updates with this feature is requested and feasible
1042     if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
1043     AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
1044     else
1045     WANT_VOSF=no
1046     fi
1047    
1048 gbeauche 1.8 dnl Check addressing mode to use
1049     AC_MSG_CHECKING([for addressing mode to use])
1050     if [[ "$EMULATED_PPC" != "yes" ]]; then
1051     if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then
1052     AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.])
1053     WANT_ADDRESSING_MODE="real"
1054     fi
1055     fi
1056     if [[ "$WANT_ADDRESSING_MODE" = "direct" ]]; then
1057     if [[ -n "$NATMEM_OFFSET" ]]; then
1058     NATMEM_OFFSET_DEF="-DNATMEM_OFFSET=$NATMEM_OFFSET"
1059     fi
1060     AC_LANG_SAVE
1061     AC_LANG_CPLUSPLUS
1062     cat confdefs.h > conftest.$ac_ext
1063     cat >> conftest.$ac_ext << EOF
1064     #include <stdio.h>
1065     #include <string.h>
1066     #include "vm_alloc.cpp"
1067    
1068     int main(void)
1069     {
1070     if (vm_init() < 0)
1071     return 1;
1072    
1073     static const struct {
1074     unsigned long base;
1075     unsigned int size;
1076     } ranges[[]] = {
1077     { 0x00000000, 0x0003000 },
1078     { 0x10000000, 0x2000000 },
1079     { 0x40800000, 0x0400000 },
1080     { 0x68070000, 0x0010000 },
1081     { 0x69000000, 0x0080000 },
1082     { 0x68ffe000, 0x0002000 },
1083     { 0x5fffe000, 0x0002000 },
1084     { 0x60000000, 0x0040000 },
1085     };
1086     const int n_ranges = sizeof(ranges)/ sizeof(ranges[[0]]);
1087    
1088     #ifdef NATMEM_OFFSET
1089     unsigned long ofs = NATMEM_OFFSET;
1090     #else
1091     for (unsigned long ofs = 0x10000000; ofs <= 0x90000000; ofs += 0x10000000)
1092     #endif
1093     for (int i = 0; i < n_ranges; i++) {
1094     char *m = (char *)(ranges[[i]].base + ofs);
1095     if (vm_acquire_fixed(m, ranges[[i]].size) != 0)
1096     break;
1097     memset(m, 0, ranges[[i]].size);
1098     vm_release(m, ranges[[i]].size);
1099     if (i == n_ranges - 1) {
1100 gbeauche 1.13 if (sizeof(void *) == 8 && ofs > 0xffffffff)
1101     printf("0x%lxul\n", ofs);
1102     else
1103     printf("0x%08x\n", ofs);
1104 gbeauche 1.8 return 0;
1105     }
1106     }
1107    
1108     vm_exit();
1109     return 1;
1110     }
1111     EOF
1112     doit='$CXX conftest.$ac_ext -o conftest.$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS $NATMEM_OFFSET_DEF >& AS_MESSAGE_LOG_FD'
1113     if AC_TRY_EVAL(doit); then
1114     NATMEM_OFFSET=`./conftest.$ac_exeext`
1115 gbeauche 1.9 else
1116     NATMEM_OFFSET=
1117 gbeauche 1.8 fi
1118     rm -f conftest*
1119     AC_LANG_RESTORE
1120 gbeauche 1.9
1121     if [[ -z "$NATMEM_OFFSET" ]]; then
1122     AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value])
1123     else
1124     WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET"
1125     AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET,
1126     [Define constant offset for Mac address translation])
1127     fi
1128 gbeauche 1.8 fi
1129     AC_MSG_RESULT($WANT_ADDRESSING_MODE)
1130    
1131 gbeauche 1.26 dnl Utility macro used by next two tests.
1132     dnl AC_EXAMINE_OBJECT(C source code,
1133     dnl commands examining object file,
1134     dnl [commands to run if compile failed]):
1135     dnl
1136     dnl Compile the source code to an object file; then convert it into a
1137     dnl printable representation. All unprintable characters and
1138     dnl asterisks (*) are replaced by dots (.). All white space is
1139     dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
1140     dnl output, but runs of newlines are compressed to a single newline.
1141     dnl Finally, line breaks are forcibly inserted so that no line is
1142     dnl longer than 80 columns and the file ends with a newline. The
1143     dnl result of all this processing is in the file conftest.dmp, which
1144     dnl may be examined by the commands in the second argument.
1145     dnl
1146     AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
1147     [AC_LANG_SAVE
1148     AC_LANG_C
1149     dnl Next bit cribbed from AC_TRY_COMPILE.
1150     cat > conftest.$ac_ext <<EOF
1151     [#line __oline__ "configure"
1152     #include "confdefs.h"
1153     $1
1154     ]EOF
1155     if AC_TRY_EVAL(ac_compile); then
1156     od -c conftest.o |
1157     sed ['s/^[0-7]*[ ]*/ /
1158     s/\*/./g
1159     s/ \\n/*/g
1160     s/ [0-9][0-9][0-9]/./g
1161     s/ \\[^ ]/./g'] |
1162     tr -d '
1163     ' | tr -s '*' '
1164     ' | fold | sed '$a\
1165     ' > conftest.dmp
1166     $2
1167     ifelse($3, , , else
1168     $3
1169     )dnl
1170     fi
1171     rm -rf conftest*
1172     AC_LANG_RESTORE])
1173    
1174     dnl Floating point format probe.
1175     dnl The basic concept is the same as the above: grep the object
1176     dnl file for an interesting string. We have to watch out for
1177     dnl rounding changing the values in the object, however; this is
1178     dnl handled by ignoring the least significant byte of the float.
1179     dnl
1180     dnl Does not know about VAX G-float or C4x idiosyncratic format.
1181     dnl It does know about PDP-10 idiosyncratic format, but this is
1182     dnl not presently supported by GCC. S/390 "binary floating point"
1183     dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
1184     dnl as ASCII?)
1185     dnl
1186     AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
1187     [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
1188     [gcc_AC_EXAMINE_OBJECT(
1189     [/* This will not work unless sizeof(double) == 8. */
1190     extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
1191    
1192     /* This structure must have no internal padding. */
1193     struct possibility {
1194     char prefix[8];
1195     double candidate;
1196     char postfix[8];
1197     };
1198    
1199     #define C(cand) { "\nformat:", cand, ":tamrof\n" }
1200     struct possibility table [] =
1201     {
1202     C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
1203     C( 3.53802595280598432000e+18), /* D__float - VAX */
1204     C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
1205     C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
1206     C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
1207     };],
1208     [if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1209     ac_cv_c_float_format='IEEE (big-endian)'
1210     elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
1211     ac_cv_c_float_format='IEEE (big-endian)'
1212     elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
1213     ac_cv_c_float_format='IEEE (little-endian)'
1214     elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
1215     ac_cv_c_float_format='IEEE (little-endian)'
1216     elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
1217     ac_cv_c_float_format='VAX D-float'
1218     elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
1219     ac_cv_c_float_format='PDP-10'
1220     elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1221     ac_cv_c_float_format='IBM 370 hex'
1222     else
1223     AC_MSG_ERROR(Unknown floating point format)
1224     fi],
1225     [AC_MSG_ERROR(compile failed)])
1226     ])
1227     # IEEE is the default format. If the float endianness isn't the same
1228     # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
1229     # (which is a tristate: yes, no, default). This is only an issue with
1230     # IEEE; the other formats are only supported by a few machines each,
1231     # all with the same endianness.
1232     format=IEEE_FLOAT_FORMAT
1233     fbigend=
1234     case $ac_cv_c_float_format in
1235     'IEEE (big-endian)' )
1236     if test $ac_cv_c_bigendian = no; then
1237     fbigend=1
1238     fi
1239     ;;
1240     'IEEE (little-endian)' )
1241     if test $ac_cv_c_bigendian = yes; then
1242     fbigend=0
1243     fi
1244     ;;
1245     'VAX D-float' )
1246     format=VAX_FLOAT_FORMAT
1247     ;;
1248     'PDP-10' )
1249     format=PDP10_FLOAT_FORMAT
1250     ;;
1251     'IBM 370 hex' )
1252     format=IBM_FLOAT_FORMAT
1253     ;;
1254     esac
1255     AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1256     [Define to the floating point format of the host machine.])
1257     if test -n "$fbigend"; then
1258     AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1259     [Define to 1 if the host machine stores floating point numbers in
1260     memory with the word containing the sign bit at the lowest address,
1261     or to 0 if it does it the other way around.
1262    
1263     This macro should not be defined if the ordering is the same as for
1264     multi-word integers.])
1265     fi
1266     ])
1267    
1268     dnl Check for host float format
1269     gcc_AC_C_FLOAT_FORMAT
1270    
1271 gbeauche 1.1 dnl Platform specific binary postprocessor
1272     AC_PATH_PROG(BLESS, "true")
1273     if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
1274     BLESS=Darwin/lowmem
1275     LDFLAGS="$LDFLAGS -pagezero_size 0x3000"
1276     fi
1277    
1278     dnl Check for GCC 2.7 or higher.
1279     HAVE_GCC27=no
1280     AC_MSG_CHECKING(for GCC 2.7 or higher)
1281 gbeauche 1.36 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1282     # error gcc < 2.7
1283 gbeauche 1.44 typedef syntax error;
1284 gbeauche 1.36 #endif
1285     ]])],
1286     [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1287     [AC_MSG_RESULT(no)])
1288 gbeauche 1.1
1289     dnl Check for GCC 3.0 or higher.
1290     HAVE_GCC30=no
1291     AC_MSG_CHECKING(for GCC 3.0 or higher)
1292 gbeauche 1.36 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1293     # error gcc < 3
1294 gbeauche 1.44 typedef syntax error;
1295 gbeauche 1.36 #endif
1296     ]])],
1297     [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1298     [AC_MSG_RESULT(no)])
1299 gbeauche 1.1
1300     dnl Check for ICC.
1301     AC_MSG_CHECKING(for ICC)
1302     HAVE_ICC=no
1303     if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
1304     HAVE_ICC=yes
1305     fi
1306     AC_MSG_RESULT($HAVE_ICC)
1307    
1308 gbeauche 1.9 dnl Determine the generated object format
1309 gbeauche 1.24 AC_CACHE_CHECK([the format of compiler generated objects],
1310 gbeauche 1.9 ac_cv_object_format, [
1311 gbeauche 1.1 echo 'int i;' > conftest.$ac_ext
1312 gbeauche 1.9 ac_cv_object_format=no
1313 gbeauche 1.1 if AC_TRY_EVAL(ac_compile); then
1314     case `/usr/bin/file conftest.$ac_objext` in
1315     *"ELF"*)
1316 gbeauche 1.9 ac_cv_object_format=elf
1317     ;;
1318 gbeauche 1.24 *"Mach-O"*)
1319     ac_cv_object_format=mach
1320     ;;
1321 gbeauche 1.9 *)
1322     ac_cv_object_format=unknown
1323 gbeauche 1.1 ;;
1324     esac
1325     fi
1326     rm -rf conftest*
1327     ])
1328    
1329 gbeauche 1.32 dnl Add -fno-strict-aliasing for slirp sources
1330     if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1331     SAVED_CFLAGS="$CFLAGS"
1332     CFLAGS="$CFLAGS -fno-strict-aliasing"
1333     AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1334     ac_cv_gcc_no_strict_aliasing, [
1335     AC_TRY_COMPILE([],[],
1336     [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1337     [ac_cv_gcc_no_strict_aliasing=no])
1338     ])
1339     CFLAGS="$SAVED_CFLAGS"
1340     fi
1341    
1342 gbeauche 1.39 dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1343     if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1344 gbeauche 1.31 SAVED_CFLAGS="$CFLAGS"
1345     CFLAGS="$CFLAGS -mdynamic-no-pic"
1346     AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1347     ac_cv_gcc_mdynamic_no_pic, [
1348     AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1349     ])
1350     if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1351     CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1352     else
1353     CFLAGS="$SAVED_CFLAGS"
1354     fi
1355     fi
1356    
1357 gbeauche 1.1 dnl CPU emulator sources
1358     if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1359     CPUSRCS="\
1360 gbeauche 1.9 ../kpx_cpu/src/mathlib/ieeefp.cpp \
1361 gbeauche 1.26 ../kpx_cpu/src/mathlib/mathlib.cpp \
1362 gbeauche 1.1 ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
1363     ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
1364     ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
1365 gbeauche 1.55 ../kpx_cpu/src/cpu/ppc/ppc-translate.cpp \
1366     ../kpx_cpu/src/utils/utils-cpuinfo.cpp"
1367 gbeauche 1.1 CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src"
1368    
1369     dnl Enable JIT compiler, if possible
1370     if [[ "x$WANT_JIT" = "xyes" ]]; then
1371     AC_CACHE_CHECK([whether dyngen can be used],
1372     ac_cv_use_dyngen, [
1373 gbeauche 1.9 case $host_cpu:$ac_cv_object_format in
1374     powerpc:elf)
1375 gbeauche 1.1 ac_cv_use_dyngen=yes
1376     ;;
1377 gbeauche 1.9 x86_64:elf)
1378 gbeauche 1.1 ac_cv_use_dyngen=yes
1379     ;;
1380 gbeauche 1.9 i?86:elf)
1381 gbeauche 1.1 ac_cv_use_dyngen=yes
1382     ;;
1383 gbeauche 1.43 mips:elf)
1384     ac_cv_use_dyngen=yes
1385     ;;
1386 gbeauche 1.24 powerpc:mach)
1387     ac_cv_use_dyngen=yes
1388     ;;
1389 gbeauche 1.41 i?86:mach)
1390     ac_cv_use_dyngen=yes
1391     ;;
1392 gbeauche 1.1 *:*)
1393     ac_cv_use_dyngen=no
1394     ;;
1395     esac
1396     dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2)
1397     if [[ -z "$DYNGEN_CC" ]]; then
1398     if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1399     DYNGEN_CC=$CXX
1400     else
1401 gbeauche 1.44 for p in /usr/bin /usr/local/bin /usr/freeware/bin; do
1402 gbeauche 1.1 gxx="$p/g++"
1403     if [[ -x "$gxx" ]]; then
1404     DYNGEN_CC="$gxx"
1405     fi
1406     done
1407     fi
1408     fi
1409 gbeauche 1.27 if [[ -z "$DYNGEN_CC" ]]; then
1410 gbeauche 1.1 ac_cv_use_dyngen=no
1411     fi
1412     ])
1413     if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
1414     case $host_cpu in
1415     i?86)
1416 gbeauche 1.46 DYNGEN_OP_FLAGS="-fomit-frame-pointer"
1417 gbeauche 1.24 ;;
1418 gbeauche 1.43 mips)
1419     DYNGEN_OP_FLAGS="-fno-delayed-branch -mno-abicalls"
1420     ;;
1421 gbeauche 1.24 powerpc)
1422     if [[ "x$ac_cv_object_format" = "xmach" ]]; then
1423     DYNGEN_OP_FLAGS="-mdynamic-no-pic"
1424 gbeauche 1.1 fi
1425     ;;
1426     esac
1427 gbeauche 1.44 have_dyngen_gcc3=no
1428     case "x`$DYNGEN_CC -dumpversion`" in
1429     x[12].*) ;;
1430     x*) have_dyngen_gcc3=yes ;;
1431     esac
1432     if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1433 gbeauche 1.53 DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-align-functions"
1434 gbeauche 1.24 else
1435     DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
1436     fi
1437 gbeauche 1.38 DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-functions -finline-limit=10000 -fno-exceptions -g0"
1438 gbeauche 1.44 if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1439 gbeauche 1.1 DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
1440     fi
1441 gbeauche 1.43 if [[ "x$DYNGEN_CC" != "x$CXX" ]]; then
1442     DYNGEN_CFLAGS="-O2 $CFLAGS"
1443     DYNGEN_CXXFLAGS="-O2 $CXXFLAGS"
1444     else
1445     DYNGEN_CFLAGS="\$(CFLAGS)"
1446     DYNGEN_CXXFLAGS="\$(CXXFLAGS)"
1447     fi
1448 gbeauche 1.1 else
1449     WANT_JIT=no
1450     fi
1451     AC_TRANSLATE_DEFINE(ENABLE_DYNGEN, $ac_cv_use_dyngen, [Define to enable dyngen engine])
1452     if [[ "x$WANT_JIT" = "xyes" ]]; then
1453     DYNGENSRCS="\
1454     ../kpx_cpu/src/cpu/jit/dyngen.c \
1455     ../kpx_cpu/src/cpu/jit/cxxdemangle.cpp"
1456     CPUSRCS="\
1457     ../kpx_cpu/src/cpu/jit/jit-cache.cpp \
1458     ../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \
1459 gbeauche 1.55 ../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp \
1460     ../kpx_cpu/src/cpu/ppc/ppc-jit.cpp $CPUSRCS"
1461 gbeauche 1.1 fi
1462     fi
1463     CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp"
1464     else
1465     WANT_JIT=no
1466     fi
1467     if [[ "x$WANT_JIT" = "xyes" ]]; then
1468     CPPFLAGS="$CPPFLAGS -DUSE_JIT"
1469     fi
1470    
1471 gbeauche 1.43 dnl Higher level optimizations with MIPSPro compilers are possible
1472     if [[ "x$HAVE_IPA" = "xyes" ]]; then
1473     CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1474     CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1475     CXXFLAGS="-LANG:std $CXXFLAGS"
1476     LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
1477     fi
1478    
1479 gbeauche 1.52 dnl Check for linker script support
1480     case $target_os:$target_cpu in
1481     linux*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1482     linux*:x86_64) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";;
1483     linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";;
1484     netbsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1485     freebsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";;
1486     darwin*:*) LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
1487     esac
1488     if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then
1489     AC_CACHE_CHECK([whether linker script is usable],
1490     ac_cv_linker_script_works, [
1491     AC_LANG_SAVE
1492     AC_LANG_CPLUSPLUS
1493     saved_LDFLAGS="$LDFLAGS"
1494     LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS"
1495     AC_TRY_RUN(
1496     [int main() {if ((char *)&main < (char *)0x70000000) return 1;}],
1497     [ac_cv_linker_script_works=yes],
1498     [ac_cv_linker_script_works=no],
1499     dnl When cross-compiling, assume it works
1500     [ac_cv_linker_script_works="guessing yes"]
1501     )
1502     AC_LANG_RESTORE
1503     if [[ "$ac_cv_linker_script_works" = "no" ]]; then
1504     LDFLAGS="$saved_LDFLAGS"
1505     LINKER_SCRIPT_FLAGS=""
1506     fi
1507     ])
1508     fi
1509     AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
1510     [Define if there is a linker script to relocate the executable above 0x70000000.])
1511    
1512 gbeauche 1.1 dnl Generate Makefile.
1513 gbeauche 1.16 AC_SUBST(PERL)
1514 gbeauche 1.14 AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen])
1515 gbeauche 1.1 AC_SUBST(DYNGENSRCS)
1516     AC_SUBST(DYNGEN_CC)
1517 gbeauche 1.43 AC_SUBST(DYNGEN_CFLAGS)
1518     AC_SUBST(DYNGEN_CXXFLAGS)
1519 gbeauche 1.1 AC_SUBST(DYNGEN_OP_FLAGS)
1520     AC_SUBST(SYSSRCS)
1521     AC_SUBST(CPUSRCS)
1522     AC_SUBST(BLESS)
1523     AC_SUBST(KEYCODES)
1524 gbeauche 1.5 AC_OUTPUT([
1525     Makefile
1526     ../MacOSX/Info.plist
1527     ])
1528 gbeauche 1.1
1529     dnl Print summary.
1530     echo
1531     echo SheepShaver configuration summary:
1532     echo
1533     echo SDL support ...................... : $SDL_SUPPORT
1534 gbeauche 1.21 echo FBDev DGA support ................ : $WANT_FBDEV_DGA
1535 gbeauche 1.1 echo XFree86 DGA support .............. : $WANT_XF86_DGA
1536     echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
1537     echo Using PowerPC emulator ........... : $EMULATED_PPC
1538     echo Enable JIT compiler .............. : $WANT_JIT
1539     echo Enable video on SEGV signals ..... : $WANT_VOSF
1540     echo ESD sound support ................ : $WANT_ESD
1541     echo GTK user interface ............... : $WANT_GTK
1542     echo mon debugger support ............. : $WANT_MON
1543 gbeauche 1.8 echo Addressing mode .................. : $WANT_ADDRESSING_MODE
1544 gbeauche 1.1 echo Bad memory access recovery type .. : $sigsegv_recovery
1545     echo
1546     echo "Configuration done. Now type \"make\"."