ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/configure.ac
Revision: 1.60
Committed: 2007-07-28T15:44:36Z (17 years, 3 months ago) by asvitkine
Branch: MAIN
Changes since 1.59: +5 -2 lines
Log Message:
support new prefs editor handling (rerun autogen)

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