ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/configure.ac
(Generate patch)

Comparing SheepShaver/src/Unix/configure.ac (file contents):
Revision 1.8 by gbeauche, 2004-11-13T14:09:15Z vs.
Revision 1.56 by asvitkine, 2007-01-24T14:33:52Z

# Line 1 | Line 1
1   dnl Process this file with autoconf to produce a configure script.
2   dnl Written in 2002 by Christian Bauer
3  
4 < AC_INIT([SheepShaver], 2.2, [Christian.Bauer@uni-mainz.de], SheepShaver)
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)
# Line 14 | Line 14 | dnl Some systems do not put corefiles in
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=no]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=no])
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]], [WANT_GTK=$withval], [WANT_GTK=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  
# Line 31 | Line 47 | AC_ARG_ENABLE(addressing,
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]]*\)/s//\1/p'`;;
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   )
# Line 48 | Line 64 | 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
# Line 104 | Line 122 | if [[ "x$WANT_MON" = "xyes" ]]; then
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
# Line 135 | Line 155 | if [[ "x$WANT_SDL" = "xyes" ]]; then
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
# Line 142 | Line 164 | else
164   fi
165  
166   dnl We need X11, if not using SDL.
167 < if [[ "x$WANT_SDL" = "xno" ]]; then
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.])
# Line 155 | Line 177 | fi
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*)
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    ;;
# Line 163 | Line 185 | no:linux*)
185    AC_CHECK_LIB(pthread, pthread_create, , [
186      AC_CHECK_LIB(c_r, pthread_create, , [
187        AC_CHECK_LIB(PTL, pthread_create, , [
188 <        AC_MSG_ERROR([You need pthreads to run Basilisk II.])
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)
174  if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
175    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
176  fi
199    dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
200    SEMSRC=
201    AC_CHECK_FUNCS(sem_init, , [
# Line 183 | Line 205 | no:linux*)
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
# Line 208 | Line 243 | fi
243  
244   dnl We use GTK+ if possible.
245   UISRCS=../dummy/prefs_editor_dummy.cpp
246 < if [[ "x$WANT_GTK" = "xyes" ]]; then
246 > case "x$WANT_GTK" in
247 > xgtk2*)
248 >  WANT_GTK=no
249 >  ifdef([AM_PATH_GTK_2_0],
250 >  AM_PATH_GTK_2_0(1.3.15, [
251 >    GUI_CFLAGS="$GTK_CFLAGS"
252 >    GUI_LIBS="$GTK_LIBS"
253 >    WANT_GTK=gtk2
254 >  ], [
255 >    case "x${WANT_GTK}x" in
256 >    *gtkx)
257 >      AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
258 >      WANT_GTK=gtk
259 >      ;;
260 >    *)
261 >      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
262 >      WANT_GTK=no
263 >     ;;
264 >    esac
265 >  ]))
266 > esac
267 > if [[ "x$WANT_GTK" = "xgtk" ]]; then
268 >  WANT_GTK=no
269 >  ifdef([AM_PATH_GTK],
270    AM_PATH_GTK(1.2.0, [
271 <    AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
272 <    CFLAGS="$CFLAGS $GTK_CFLAGS"
273 <    CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
216 <    LIBS="$LIBS $GTK_LIBS"
217 <    UISRCS=prefs_editor_gtk.cpp
271 >    GUI_CFLAGS="$GTK_CFLAGS"
272 >    GUI_LIBS="$GTK_LIBS"
273 >    WANT_GTK=gtk
274    ], [
275      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
276 <    WANT_GTK=no
221 <  ])
276 >  ]))
277   fi
278 + if [[ "x$WANT_GTK" != "xno" -a "x$WANT_STANDALONE_GUI" = "xno" ]]; then
279 +  AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
280 +  UISRCS=prefs_editor_gtk.cpp
281 + fi
282 + AC_SUBST(GUI_CFLAGS)
283 + AC_SUBST(GUI_LIBS)
284 +
285 + dnl Build external GUI if requested.
286 + if [[ "$WANT_STANDALONE_GUI" != "yes" ]]; then
287 +  WANT_STANDALONE_GUI=no
288 + fi
289 + if [[ "$WANT_GTK" = "no" ]]; then
290 +  WANT_STANDALONE_GUI=no
291 + fi
292 + AC_SUBST(STANDALONE_GUI, [$WANT_STANDALONE_GUI])
293  
294   dnl We use ESD if possible.
295   if [[ "x$WANT_ESD" = "xyes" ]]; then
296 +  WANT_ESD=no
297 +  ifdef([AM_PATH_ESD],
298    AM_PATH_ESD(0.2.8, [
299      AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.])
300      CFLAGS="$CFLAGS $ESD_CFLAGS"
301      CXXFLAGS="$CXXFLAGS $ESD_CFLAGS"
302      LIBS="$LIBS $ESD_LIBS"
303 +    WANT_ESD=yes
304    ], [
305      AC_MSG_WARN([Could not find ESD, disabling ESD support.])
306 <    WANT_ESD=no
234 <  ])
306 >  ]))
307   fi
308  
309   dnl We use 64-bit file size support if possible.
# Line 240 | Line 312 | AC_SYS_LARGEFILE
312   dnl Checks for header files.
313   AC_HEADER_STDC
314   AC_HEADER_SYS_WAIT
315 + AC_CHECK_HEADERS(malloc.h stdint.h)
316   AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h)
244 AC_CHECK_HEADERS(sys/time.h sys/times.h sys/socket.h)
317   AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h)
318 < AC_CHECK_HEADERS(linux/if.h, [], [], [
319 < #if HAVE_SYS_SOCKET_H
320 < # include <sys/socket.h>
318 > AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
319 > AC_CHECK_HEADERS(sys/time.h sys/poll.h sys/select.h arpa/inet.h)
320 > AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
321 > #ifdef HAVE_SYS_TYPES_H
322 > #include <sys/types.h>
323 > #endif
324 > #ifdef HAVE_SYS_SOCKET_H
325 > #include <sys/socket.h>
326   #endif
327   ])
328 < AC_CHECK_HEADERS(linux/if_tun.h net/if.h net/if_tun.h)
328 > AC_CHECK_HEADERS(AvailabilityMacros.h)
329 > AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
330 > AC_CHECK_HEADERS(fenv.h)
331  
332   dnl Checks for typedefs, structures, and compiler characteristics.
333   AC_C_BIGENDIAN
# Line 268 | Line 347 | AC_TYPE_SIGNAL
347   AC_HEADER_TIME
348   AC_STRUCT_TM
349  
350 + dnl Check whether sys/socket.h defines type socklen_t.
351 + dnl (extracted from ac-archive/Miscellaneous)
352 + AC_CACHE_CHECK([for socklen_t],
353 +  ac_cv_type_socklen_t, [
354 +  AC_TRY_COMPILE([
355 +    #include <sys/types.h>
356 +    #include <sys/socket.h>
357 +  ], [socklen_t len = 42; return 0;],
358 +  ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
359 +  dnl When cross-compiling, do not assume anything.
360 +  ac_cv_type_socklen_t="guessing no"
361 +  )
362 + ])
363 + if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
364 +  AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.])
365 + fi
366 +
367   dnl Check whether struct sigaction has sa_restorer member.
368   AC_CACHE_CHECK([whether struct sigaction has sa_restorer],
369    ac_cv_signal_sa_restorer, [
# Line 284 | Line 380 | if [[ "x$ac_cv_signal_sa_restorer" = "xy
380   fi
381  
382   dnl Checks for library functions.
383 < AC_CHECK_FUNCS(strdup strlcpy cfmakeraw)
383 > AC_CHECK_FUNCS(strdup strerror strlcpy cfmakeraw)
384   AC_CHECK_FUNCS(nanosleep)
385   AC_CHECK_FUNCS(sigaction signal)
386   AC_CHECK_FUNCS(mmap mprotect munmap)
387   AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
388 < AC_CHECK_FUNCS(posix_memalign memalign valloc)
388 > AC_CHECK_FUNCS(exp2f log2f exp2 log2)
389 > AC_CHECK_FUNCS(floorf roundf ceilf truncf floor round ceil trunc)
390 > AC_CHECK_FUNCS(poll inet_aton)
391  
392   dnl Darwin seems to define mach_task_self() instead of task_self().
393   AC_CHECK_FUNCS(mach_task_self task_self)
# Line 301 | Line 399 | no:linux*)
399    ;;
400   *:*)
401    AC_SEARCH_LIBS(clock_gettime, [rt posix4])
402 <  AC_CHECK_FUNCS(clock_gettime)
402 >  AC_CHECK_FUNCS(clock_gettime clock_nanosleep)
403    ;;
404   esac
405  
406 + dnl Check for headers and functions related to pty support (sshpty.c)
407 + dnl From openssh-3.2.2p1 configure.ac
408 + AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
409 + AC_CHECK_FUNCS(_getpty vhangup strlcpy)
410 +
411 + case "$host" in
412 + *-*-hpux10.26)
413 +        disable_ptmx_check=yes
414 +        ;;
415 + *-*-linux*)
416 +        no_dev_ptmx=1
417 +        ;;
418 + mips-sony-bsd|mips-sony-newsos4)
419 +        AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).])
420 +        ;;
421 + *-*-sco3.2v4*)
422 +        no_dev_ptmx=1
423 +        ;;
424 + *-*-sco3.2v5*)
425 +        no_dev_ptmx=1
426 +        ;;
427 + *-*-cygwin*)
428 +        no_dev_ptmx=1
429 +        ;;
430 + esac
431 +
432 + if test -z "$no_dev_ptmx" ; then
433 +        if test "x$disable_ptmx_check" != "xyes" ; then
434 +                AC_CHECK_FILE([/dev/ptmx],
435 +                        [
436 +                                AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.])
437 +                                have_dev_ptmx=1
438 +                        ]
439 +                )
440 +        fi
441 + fi
442 + AC_CHECK_FILE([/dev/ptc],
443 +        [
444 +                AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.])
445 +                have_dev_ptc=1
446 +        ]
447 + )
448 + dnl (end of code from openssh-3.2.2p1 configure.ac)
449 +
450 + dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
451 + dnl doesn't work or is unimplemented. On these systems (mostly older
452 + dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
453 + AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O],
454 +  ac_cv_nonblocking_io, [
455 +  case "$host" in
456 +  *-*-osf*)
457 +    ac_cv_nonblocking_io=FIONBIO
458 +    ;;
459 +  *-*-sunos4*)
460 +    ac_cv_nonblocking_io=FIONBIO
461 +    ;;
462 +  *-*-ultrix*)
463 +    ac_cv_nonblocking_io=FIONBIO
464 +    ;;
465 +  *)
466 +    ac_cv_nonblocking_io=O_NONBLOCK
467 +    ;;
468 +  esac
469 + ])
470 + if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then
471 +  AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used])
472 + fi
473 +
474 + dnl Check whether compiler supports byte bit-fields
475 + AC_CACHE_CHECK([whether compiler supports byte bit-fields],
476 +  ac_cv_have_byte_bitfields, [
477 +  AC_LANG_SAVE
478 +  AC_LANG_CPLUSPLUS
479 +  AC_TRY_RUN([
480 +    struct A {
481 +      unsigned char b1:4;
482 +      unsigned char b2:4;
483 +      unsigned char c;
484 +      unsigned short s;
485 +      unsigned char a[4];
486 +    };
487 +
488 +    int main(void) {
489 +      A a;
490 +      return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1));
491 +    }],
492 +    [ac_cv_have_byte_bitfields=yes],
493 +    [ac_cv_have_byte_bitfields=no],
494 +    dnl When cross-compiling, assume only GCC supports this
495 +    [if [[ "$GCC" = "yes" ]]; then
496 +      ac_cv_have_byte_bitfields="guessing yes"
497 +    else
498 +      ac_cv_have_byte_bitfields="guessing no"
499 +    fi]
500 +    )
501 +  AC_LANG_RESTORE
502 + ])
503 +
504   dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
505 < AC_DEFUN(AC_CHECK_FRAMEWORK, [
505 > AC_DEFUN([AC_CHECK_FRAMEWORK], [
506    AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
507    AC_CACHE_CHECK([whether compiler supports framework $1],
508      ac_Framework, [
509      saved_LIBS="$LIBS"
510      LIBS="$LIBS -framework $1"
511      AC_TRY_LINK(
512 <      [$2], [int main(void) { return 0; }],
512 >      [$2], [],
513        [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
514      )
515    ])
# Line 326 | Line 522 | AC_DEFUN(AC_CHECK_FRAMEWORK, [
522   dnl Check for some MacOS X frameworks
523   AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
524   AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
525 + AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
526  
527   dnl Select system-dependant sources.
528   SERIALSRC=serial_unix.cpp
# Line 336 | Line 533 | EXTFSSRC=extfs_unix.cpp
533   EXTRASYSSRCS=
534   case "$target_os" in
535   linux*)
536 <  ETHERSRC=Linux/ether_linux.cpp
536 >  ETHERSRC=ether_unix.cpp
537    AUDIOSRC=audio_oss_esd.cpp
538    SCSISRC=Linux/scsi_linux.cpp
539    if [[ "x$EMULATED_PPC" = "xno" ]]; then
540 <    EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S"
540 >    EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S"
541 >  fi
542 >  ;;
543 > freebsd*)
544 >  ETHERSRC=ether_unix.cpp
545 >  ;;
546 > netbsd*)
547 >  ETHERSRC=ether_unix.cpp
548 >  if [[ "x$EMULATED_PPC" = "xno" ]]; then
549 >    EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S"
550    fi
551    ;;
552   darwin*)
553 +  ETHERSRC=ether_unix.cpp
554    if [[ "x$EMULATED_PPC" = "xno" ]]; then
555 <    EXTRASYSSRCS="Darwin/paranoia.cpp Linux/asm_linux.S"
555 >    EXTRASYSSRCS="paranoia.cpp ppc_asm.S"
556    fi
557 <  if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then
557 >  if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
558      EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp"
559    fi
560    if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
561      EXTFSSRC=../MacOSX/extfs_macosx.mm
562    fi
563    ;;
564 + irix*)
565 +  AUDIOSRC=Irix/audio_irix.cpp
566 +  LIBS="$LIBS -laudio"
567 +  WANT_ESD=no
568 +
569 +  dnl Check if our compiler supports -IPA (MIPSPro)
570 +  HAVE_IPA=no
571 +  ocflags="$CFLAGS"
572 +  CFLAGS=`echo " $CFLAGS -IPA" | sed -e "s/ -g //g"`
573 +  AC_MSG_CHECKING(if "-IPA" works)
574 +  dnl Do a test compile of an empty function
575 +  AC_TRY_COMPILE([#if defined __GNUC__
576 +                  # error GCC does not support IPA yet
577 +                  #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
578 +  CFLAGS="$ocflags"
579 +  ;;
580 + esac
581 +
582 + dnl Is the slirp library supported?
583 + case "$ac_cv_have_byte_bitfields" in
584 + yes|"guessing yes")
585 +  CAN_SLIRP=yes
586 +  ETHERSRC=ether_unix.cpp
587 +  ;;
588   esac
589 + if [[ -n "$CAN_SLIRP" ]]; then
590 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
591 +  SLIRP_SRCS="\
592 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
593 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
594 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
595 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
596 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
597 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
598 + fi
599 + AC_SUBST(SLIRP_SRCS)
600  
601   dnl SDL overrides
602   if [[ "x$WANT_SDL" = "xyes" ]]; then
# Line 379 | Line 621 | if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; th
621    AUDIOSRC="../SDL/audio_sdl.cpp"
622   fi
623  
624 < SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
624 > SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $EXTRASYSSRCS"
625  
626   dnl Define a macro that translates a yesno-variable into a C macro definition
627   dnl to be put into the config.h file
628   dnl $1 -- the macro to define
629   dnl $2 -- the value to translate
630   dnl $3 -- template name
631 < AC_DEFUN(AC_TRANSLATE_DEFINE, [
631 > AC_DEFUN([AC_TRANSLATE_DEFINE], [
632      if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
633          AC_DEFINE($1, 1, $3)
634      fi
# Line 683 | Line 925 | fi
925   AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
926    [Define if your system supports Mach exceptions.])
927  
928 + dnl Check if Windows exceptions are supported.
929 + AC_CACHE_CHECK([whether your system supports Windows exceptions],
930 +  ac_cv_have_win32_exceptions, [
931 +  AC_LANG_SAVE
932 +  AC_LANG_CPLUSPLUS
933 +  AC_TRY_RUN([
934 +    #define HAVE_WIN32_EXCEPTIONS 1
935 +    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
936 +    #include "vm_alloc.cpp"
937 +    #include "sigsegv.cpp"
938 +  ], [
939 +  sigsegv_recovery=win32
940 +  ac_cv_have_win32_exceptions=yes
941 +  ],
942 +  ac_cv_have_win32_exceptions=no,
943 +  dnl When cross-compiling, do not assume anything.
944 +  ac_cv_have_win32_exceptions=no
945 +  )
946 +  AC_LANG_RESTORE
947 +  ]
948 + )
949 + AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
950 +  [Define if your system supports Windows exceptions.])
951 +
952   dnl Otherwise, check if extended signals are supported.
953   if [[ -z "$sigsegv_recovery" ]]; then
954    AC_CACHE_CHECK([whether your system supports extended signal handlers],
# Line 821 | Line 1087 | int main(void)
1087                  memset(m, 0, ranges[[i]].size);
1088                  vm_release(m, ranges[[i]].size);
1089                  if (i == n_ranges - 1) {
1090 <                        printf("0x%08x\n", ofs);
1090 >                        if (sizeof(void *) == 8 && ofs > 0xffffffff)
1091 >                                printf("0x%lxul\n", ofs);
1092 >                        else
1093 >                                printf("0x%08x\n", ofs);
1094                          return 0;
1095                  }
1096          }
# Line 833 | Line 1102 | EOF
1102    doit='$CXX conftest.$ac_ext -o conftest.$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS $NATMEM_OFFSET_DEF >& AS_MESSAGE_LOG_FD'
1103    if AC_TRY_EVAL(doit); then
1104      NATMEM_OFFSET=`./conftest.$ac_exeext`
1105 <    if [[ -z "$NATMEM_OFFSET" ]]; then
1106 <      AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value])
838 <    else
839 <      WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET"
840 <    fi
1105 >  else
1106 >    NATMEM_OFFSET=
1107    fi
1108    rm -f conftest*
1109    AC_LANG_RESTORE
1110 +
1111 +  if [[ -z "$NATMEM_OFFSET" ]]; then
1112 +    AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value])
1113 +  else
1114 +    WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET"
1115 +    AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET,
1116 +      [Define constant offset for Mac address translation])
1117 +  fi
1118   fi
1119   AC_MSG_RESULT($WANT_ADDRESSING_MODE)
1120  
1121 < if [[ -z "$NATMEM_OFFSET" ]]; then
1122 <  NATMEM_OFFSET=0
1121 > dnl Utility macro used by next two tests.
1122 > dnl AC_EXAMINE_OBJECT(C source code,
1123 > dnl     commands examining object file,
1124 > dnl     [commands to run if compile failed]):
1125 > dnl
1126 > dnl Compile the source code to an object file; then convert it into a
1127 > dnl printable representation.  All unprintable characters and
1128 > dnl asterisks (*) are replaced by dots (.).  All white space is
1129 > dnl deleted.  Newlines (ASCII 0x10) in the input are preserved in the
1130 > dnl output, but runs of newlines are compressed to a single newline.
1131 > dnl Finally, line breaks are forcibly inserted so that no line is
1132 > dnl longer than 80 columns and the file ends with a newline.  The
1133 > dnl result of all this processing is in the file conftest.dmp, which
1134 > dnl may be examined by the commands in the second argument.
1135 > dnl
1136 > AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
1137 > [AC_LANG_SAVE
1138 > AC_LANG_C
1139 > dnl Next bit cribbed from AC_TRY_COMPILE.
1140 > cat > conftest.$ac_ext <<EOF
1141 > [#line __oline__ "configure"
1142 > #include "confdefs.h"
1143 > $1
1144 > ]EOF
1145 > if AC_TRY_EVAL(ac_compile); then
1146 >  od -c conftest.o |
1147 >    sed ['s/^[0-7]*[    ]*/ /
1148 >          s/\*/./g
1149 >          s/ \\n/*/g
1150 >          s/ [0-9][0-9][0-9]/./g
1151 >          s/  \\[^ ]/./g'] |
1152 >    tr -d '
1153 > ' | tr -s '*' '
1154 > ' | fold | sed '$a\
1155 > ' > conftest.dmp
1156 >  $2
1157 > ifelse($3, , , else
1158 >  $3
1159 > )dnl
1160 > fi
1161 > rm -rf conftest*
1162 > AC_LANG_RESTORE])
1163 >
1164 > dnl Floating point format probe.
1165 > dnl The basic concept is the same as the above: grep the object
1166 > dnl file for an interesting string.  We have to watch out for
1167 > dnl rounding changing the values in the object, however; this is
1168 > dnl handled by ignoring the least significant byte of the float.
1169 > dnl
1170 > dnl Does not know about VAX G-float or C4x idiosyncratic format.
1171 > dnl It does know about PDP-10 idiosyncratic format, but this is
1172 > dnl not presently supported by GCC.  S/390 "binary floating point"
1173 > dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
1174 > dnl as ASCII?)
1175 > dnl
1176 > AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
1177 > [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
1178 > [gcc_AC_EXAMINE_OBJECT(
1179 > [/* This will not work unless sizeof(double) == 8.  */
1180 > extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
1181 >
1182 > /* This structure must have no internal padding.  */
1183 > struct possibility {
1184 >  char prefix[8];
1185 >  double candidate;
1186 >  char postfix[8];
1187 > };
1188 >
1189 > #define C(cand) { "\nformat:", cand, ":tamrof\n" }
1190 > struct possibility table [] =
1191 > {
1192 >  C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
1193 >  C( 3.53802595280598432000e+18), /* D__float - VAX */
1194 >  C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
1195 >  C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
1196 >  C(-5.22995989424860458374e+10)  /* IBMHEXFP - s/390 format, EBCDIC */
1197 > };],
1198 > [if   grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1199 >    ac_cv_c_float_format='IEEE (big-endian)'
1200 >  elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
1201 >    ac_cv_c_float_format='IEEE (big-endian)'
1202 >  elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
1203 >    ac_cv_c_float_format='IEEE (little-endian)'
1204 >  elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
1205 >    ac_cv_c_float_format='IEEE (little-endian)'
1206 >  elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
1207 >    ac_cv_c_float_format='VAX D-float'
1208 >  elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
1209 >    ac_cv_c_float_format='PDP-10'
1210 >  elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1211 >    ac_cv_c_float_format='IBM 370 hex'
1212 >  else
1213 >    AC_MSG_ERROR(Unknown floating point format)
1214 >  fi],
1215 >  [AC_MSG_ERROR(compile failed)])
1216 > ])
1217 > # IEEE is the default format.  If the float endianness isn't the same
1218 > # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
1219 > # (which is a tristate: yes, no, default).  This is only an issue with
1220 > # IEEE; the other formats are only supported by a few machines each,
1221 > # all with the same endianness.
1222 > format=IEEE_FLOAT_FORMAT
1223 > fbigend=
1224 > case $ac_cv_c_float_format in
1225 >    'IEEE (big-endian)' )
1226 >        if test $ac_cv_c_bigendian = no; then
1227 >            fbigend=1
1228 >        fi
1229 >        ;;
1230 >    'IEEE (little-endian)' )
1231 >        if test $ac_cv_c_bigendian = yes; then
1232 >            fbigend=0
1233 >        fi
1234 >        ;;
1235 >    'VAX D-float' )
1236 >        format=VAX_FLOAT_FORMAT
1237 >        ;;
1238 >    'PDP-10' )
1239 >        format=PDP10_FLOAT_FORMAT
1240 >        ;;
1241 >    'IBM 370 hex' )
1242 >        format=IBM_FLOAT_FORMAT
1243 >        ;;
1244 > esac
1245 > AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1246 >  [Define to the floating point format of the host machine.])
1247 > if test -n "$fbigend"; then
1248 >        AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1249 >  [Define to 1 if the host machine stores floating point numbers in
1250 >   memory with the word containing the sign bit at the lowest address,
1251 >   or to 0 if it does it the other way around.
1252 >
1253 >   This macro should not be defined if the ordering is the same as for
1254 >   multi-word integers.])
1255   fi
1256 < AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET,
1257 <  [Define constant offset for Mac address translation])
1256 > ])
1257 >
1258 > dnl Check for host float format
1259 > gcc_AC_C_FLOAT_FORMAT
1260  
1261   dnl Platform specific binary postprocessor
1262   AC_PATH_PROG(BLESS, "true")
# Line 860 | Line 1268 | fi
1268   dnl Check for GCC 2.7 or higher.
1269   HAVE_GCC27=no
1270   AC_MSG_CHECKING(for GCC 2.7 or higher)
1271 < AC_EGREP_CPP(xyes,
1272 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1273 <  xyes
1274 < #endif
1275 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1271 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1272 >                                     # error gcc < 2.7
1273 >                                     typedef syntax error;
1274 >                                     #endif
1275 >                                   ]])],
1276 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1277 >                  [AC_MSG_RESULT(no)])
1278  
1279   dnl Check for GCC 3.0 or higher.
1280   HAVE_GCC30=no
1281   AC_MSG_CHECKING(for GCC 3.0 or higher)
1282 < AC_EGREP_CPP(xyes,
1283 < [#if __GNUC__ >= 3
1284 <  xyes
1285 < #endif
1286 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1282 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1283 >                                     # error gcc < 3
1284 >                                     typedef syntax error;
1285 >                                     #endif
1286 >                                   ]])],
1287 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1288 >                  [AC_MSG_RESULT(no)])
1289  
1290   dnl Check for ICC.
1291   AC_MSG_CHECKING(for ICC)
# Line 883 | Line 1295 | if $CXX -V -v 2>&1 | grep -q "Intel(R) C
1295   fi
1296   AC_MSG_RESULT($HAVE_ICC)
1297  
1298 < dnl Test if the compiler can generate ELF objects
1299 < AC_CACHE_CHECK([whether the compiler can generate ELF objects],
1300 <  ac_cv_elf_objects, [
1298 > dnl Determine the generated object format
1299 > AC_CACHE_CHECK([the format of compiler generated objects],
1300 >  ac_cv_object_format, [
1301    echo 'int i;' > conftest.$ac_ext
1302 <  ac_cv_elf_objects=no
1302 >  ac_cv_object_format=no
1303    if AC_TRY_EVAL(ac_compile); then
1304      case `/usr/bin/file conftest.$ac_objext` in
1305      *"ELF"*)
1306 <      ac_cv_elf_objects=yes
1306 >      ac_cv_object_format=elf
1307 >      ;;
1308 >    *"Mach-O"*)
1309 >      ac_cv_object_format=mach
1310 >      ;;
1311 >    *)
1312 >      ac_cv_object_format=unknown
1313        ;;
1314      esac
1315    fi
1316    rm -rf conftest*
1317   ])
1318 < ELF_OBJECTS=$ac_cv_elf_objects
1318 >
1319 > dnl Add -fno-strict-aliasing for slirp sources
1320 > if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1321 >  SAVED_CFLAGS="$CFLAGS"
1322 >  CFLAGS="$CFLAGS -fno-strict-aliasing"
1323 >  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1324 >    ac_cv_gcc_no_strict_aliasing, [
1325 >    AC_TRY_COMPILE([],[],
1326 >      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1327 >      [ac_cv_gcc_no_strict_aliasing=no])
1328 >  ])
1329 >  CFLAGS="$SAVED_CFLAGS"
1330 > fi
1331 >
1332 > dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1333 > if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1334 >  SAVED_CFLAGS="$CFLAGS"
1335 >  CFLAGS="$CFLAGS -mdynamic-no-pic"
1336 >  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1337 >    ac_cv_gcc_mdynamic_no_pic, [
1338 >    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1339 >  ])
1340 >  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1341 >    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1342 >  else
1343 >    CFLAGS="$SAVED_CFLAGS"
1344 >  fi
1345 > fi
1346  
1347   dnl CPU emulator sources
1348   if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1349    CPUSRCS="\
1350 +    ../kpx_cpu/src/mathlib/ieeefp.cpp \
1351 +    ../kpx_cpu/src/mathlib/mathlib.cpp \
1352      ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
1353      ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
1354      ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
1355 <    ../kpx_cpu/src/cpu/ppc/ppc-translate.cpp"
1355 >    ../kpx_cpu/src/cpu/ppc/ppc-translate.cpp \
1356 >    ../kpx_cpu/src/utils/utils-cpuinfo.cpp"
1357    CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src"
1358  
1359    dnl Enable JIT compiler, if possible
1360    if [[ "x$WANT_JIT" = "xyes" ]]; then
1361      AC_CACHE_CHECK([whether dyngen can be used],
1362        ac_cv_use_dyngen, [
1363 <      case $host_cpu:$ELF_OBJECTS in
1364 <      powerpc:yes)
1363 >      case $host_cpu:$ac_cv_object_format in
1364 >      powerpc:elf)
1365 >        ac_cv_use_dyngen=yes
1366 >        ;;
1367 >      x86_64:elf)
1368 >        ac_cv_use_dyngen=yes
1369 >        ;;
1370 >      i?86:elf)
1371 >        ac_cv_use_dyngen=yes
1372 >        ;;
1373 >      mips:elf)
1374          ac_cv_use_dyngen=yes
1375          ;;
1376 <      x86_64:yes)
1376 >      powerpc:mach)
1377          ac_cv_use_dyngen=yes
1378          ;;
1379 <      i?86:yes)
1379 >      i?86:mach)
1380          ac_cv_use_dyngen=yes
1381          ;;
1382        *:*)
# Line 931 | Line 1388 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1388          if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1389            DYNGEN_CC=$CXX
1390          else
1391 <          for p in /usr/bin /usr/local/bin; do
1391 >          for p in /usr/bin /usr/local/bin /usr/freeware/bin; do
1392              gxx="$p/g++"
1393              if [[ -x "$gxx" ]]; then
1394                DYNGEN_CC="$gxx"
# Line 939 | Line 1396 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1396            done
1397          fi
1398        fi
1399 <      if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then
1399 >      if [[ -z "$DYNGEN_CC" ]]; then
1400          ac_cv_use_dyngen=no
1401        fi
1402      ])
1403      if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
1404        case $host_cpu in
1405        i?86)
1406 <        DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2"
950 <        if [[ "x$HAVE_GCC30" = "xyes" ]]; then
951 <          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
952 <        else
953 <          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
954 <        fi
955 <        saved_CPPFLAGS=$CPPFLAGS
956 <        CPPFLAGS="$CPPFLAGS -mmmx"
957 <        AC_CHECK_HEADERS(mmintrin.h,  [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -mmmx"])
958 <        CPPFLAGS="$CPPFLAGS -msse"
959 <        AC_CHECK_HEADERS(xmmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse"])
960 <        CPPFLAGS="$CPPFLAGS -msse2"
961 <        AC_CHECK_HEADERS(emmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse2"])
962 <        CPPFLAGS=$saved_CPPFLAGS
1406 >        DYNGEN_OP_FLAGS="-fomit-frame-pointer"
1407          ;;
1408 <      x86_64)
1409 <        AC_CHECK_HEADERS(mmintrin.h xmmintrin.h emmintrin.h)
1408 >      mips)
1409 >        DYNGEN_OP_FLAGS="-fno-delayed-branch -mno-abicalls"
1410 >        ;;
1411 >      powerpc)
1412 >        if [[ "x$ac_cv_object_format" = "xmach" ]]; then
1413 >          DYNGEN_OP_FLAGS="-mdynamic-no-pic"
1414 >        fi
1415          ;;
1416        esac
1417 <      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000"
1418 <      if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1417 >      have_dyngen_gcc3=no
1418 >      case "x`$DYNGEN_CC -dumpversion`" in
1419 >      x[12].*) ;;
1420 >      x*) have_dyngen_gcc3=yes ;;
1421 >      esac
1422 >      if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1423 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-align-functions"
1424 >      else
1425 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
1426 >      fi
1427 >      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-functions -finline-limit=10000 -fno-exceptions -g0"
1428 >      if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1429          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
1430        fi
1431 +      if [[ "x$DYNGEN_CC" != "x$CXX" ]]; then
1432 +        DYNGEN_CFLAGS="-O2 $CFLAGS"
1433 +        DYNGEN_CXXFLAGS="-O2 $CXXFLAGS"
1434 +      else
1435 +        DYNGEN_CFLAGS="\$(CFLAGS)"
1436 +        DYNGEN_CXXFLAGS="\$(CXXFLAGS)"
1437 +      fi
1438      else
1439        WANT_JIT=no
1440      fi
# Line 980 | Line 1446 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1446        CPUSRCS="\
1447          ../kpx_cpu/src/cpu/jit/jit-cache.cpp \
1448          ../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \
1449 <        ../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp $CPUSRCS"
1449 >        ../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp \
1450 >        ../kpx_cpu/src/cpu/ppc/ppc-jit.cpp $CPUSRCS"
1451      fi
1452    fi
1453    CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp"
1454   else
1455    WANT_JIT=no
1456   fi
990 if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
991  AC_CACHE_CHECK([whether static data regions are executable],
992    ac_cv_have_static_data_exec, [
993    AC_TRY_RUN([int main(void) {
994 #if defined(__powerpc__)
995      static unsigned int p[8] = {0x4e800020,};
996      asm volatile("dcbst 0,%0" : : "r" (p) : "memory");
997      asm volatile("sync" : : : "memory");
998      asm volatile("icbi 0,%0" : : "r" (p) : "memory");
999      asm volatile("sync" : : : "memory");
1000      asm volatile("isync" : : : "memory");
1001      ((void (*)(void))p)();
1002      return 0;
1003 #endif
1004      return 1;
1005    }], ac_cv_have_static_data_exec=yes, ac_cv_have_static_data_exec=no,
1006    dnl When cross-compiling, do not assume anything.
1007    ac_cv_have_static_data_exec=no
1008    )
1009  ])
1010 fi
1011 AC_TRANSLATE_DEFINE(HAVE_STATIC_DATA_EXEC, "$ac_cv_have_static_data_exec",
1012  [Define if your system marks static data pages as executable.])
1013
1457   if [[ "x$WANT_JIT" = "xyes" ]]; then
1458    CPPFLAGS="$CPPFLAGS -DUSE_JIT"
1459   fi
1460  
1461 + dnl Higher level optimizations with MIPSPro compilers are possible
1462 + if [[ "x$HAVE_IPA" = "xyes" ]]; then
1463 +  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1464 +  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1465 +  CXXFLAGS="-LANG:std $CXXFLAGS"
1466 +  LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
1467 + fi
1468 +
1469 + dnl Check for linker script support
1470 + case $target_os:$target_cpu in
1471 + linux*:i?86)    LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1472 + linux*:x86_64)  LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";;
1473 + linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";;
1474 + netbsd*:i?86)   LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1475 + freebsd*:i?86)  LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";;
1476 + darwin*:*)      LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
1477 + esac
1478 + if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then
1479 +  AC_CACHE_CHECK([whether linker script is usable],
1480 +    ac_cv_linker_script_works, [
1481 +    AC_LANG_SAVE
1482 +    AC_LANG_CPLUSPLUS
1483 +    saved_LDFLAGS="$LDFLAGS"
1484 +    LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS"
1485 +    AC_TRY_RUN(
1486 +      [int main() {if ((char *)&main < (char *)0x70000000) return 1;}],
1487 +      [ac_cv_linker_script_works=yes],
1488 +      [ac_cv_linker_script_works=no],
1489 +      dnl When cross-compiling, assume it works
1490 +      [ac_cv_linker_script_works="guessing yes"]
1491 +    )
1492 +    AC_LANG_RESTORE
1493 +    if [[ "$ac_cv_linker_script_works" = "no" ]]; then
1494 +      LDFLAGS="$saved_LDFLAGS"
1495 +      LINKER_SCRIPT_FLAGS=""
1496 +    fi
1497 +  ])
1498 + fi
1499 + AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
1500 +  [Define if there is a linker script to relocate the executable above 0x70000000.])
1501 +
1502   dnl Generate Makefile.
1503 + AC_SUBST(PERL)
1504 + AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen])
1505   AC_SUBST(DYNGENSRCS)
1506   AC_SUBST(DYNGEN_CC)
1507 + AC_SUBST(DYNGEN_CFLAGS)
1508 + AC_SUBST(DYNGEN_CXXFLAGS)
1509   AC_SUBST(DYNGEN_OP_FLAGS)
1510   AC_SUBST(SYSSRCS)
1511   AC_SUBST(CPUSRCS)
# Line 1033 | Line 1521 | echo
1521   echo SheepShaver configuration summary:
1522   echo
1523   echo SDL support ...................... : $SDL_SUPPORT
1524 + echo FBDev DGA support ................ : $WANT_FBDEV_DGA
1525   echo XFree86 DGA support .............. : $WANT_XF86_DGA
1526   echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
1527   echo Using PowerPC emulator ........... : $EMULATED_PPC

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines