ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/configure.ac
Revision: 1.63
Committed: 2009-02-11T19:22:16Z (15 years, 4 months ago) by asvitkine
Branch: MAIN
Changes since 1.62: +7 -4 lines
Log Message:
[Patch from Mike Sliczniak]

This first patch gets B2 and SS to build under Leopard and Tiger.

I tested this on a 32-bit intel 10.5.6 mac like so:

B2
./autogen.sh --disable-standalone-gui --enable-vosf --enable-sdl-video --enable-sdl-audio --enable-addressing=real --without-esd --without-gtk --without-mon --without-x

SS
./autogen.sh --disable-standalone-gui --enable-vosf -enable-sdl-video --disable-sdl-audio --enable-addressing=real --without-esd --without-gtk --without-mon --without-x --enable-jit

There is also a little tweak so that you can use sdl audio in SheepShaver when building for Mac OS X.

File Contents

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