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.7 by gbeauche, 2004-07-19T19:42:21Z vs.
Revision 1.53 by gbeauche, 2006-07-06T00:07:47Z

# 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  
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])
# Line 37 | 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 93 | 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 124 | 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 131 | 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 144 | 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 152 | 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)
163  if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
164    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
165  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 172 | 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 197 | 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 >  AM_PATH_GTK_2_0(1.3.15, [
249 >    GUI_CFLAGS="$GTK_CFLAGS"
250 >    GUI_LIBS="$GTK_LIBS"
251 >    WANT_GTK=gtk2
252 >  ], [
253 >    case "x${WANT_GTK}x" in
254 >    *gtkx)
255 >      AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
256 >      WANT_GTK=gtk
257 >      ;;
258 >    *)
259 >      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
260 >      WANT_GTK=no
261 >      ;;
262 >    esac
263 >  ])
264 >  ;;
265 > esac
266 > if [[ "x$WANT_GTK" = "xgtk" ]]; then
267    AM_PATH_GTK(1.2.0, [
268 <    AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
269 <    CFLAGS="$CFLAGS $GTK_CFLAGS"
204 <    CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
205 <    LIBS="$LIBS $GTK_LIBS"
206 <    UISRCS=prefs_editor_gtk.cpp
268 >    GUI_CFLAGS="$GTK_CFLAGS"
269 >    GUI_LIBS="$GTK_LIBS"
270    ], [
271      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
272      WANT_GTK=no
273    ])
274   fi
275 + if [[ "x$WANT_GTK" != "xno" -a "x$WANT_STANDALONE_GUI" = "xno" ]]; then
276 +  AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
277 +  UISRCS=prefs_editor_gtk.cpp
278 + fi
279 + AC_SUBST(GUI_CFLAGS)
280 + AC_SUBST(GUI_LIBS)
281 +
282 + dnl Build external GUI if requested.
283 + if [[ "$WANT_STANDALONE_GUI" != "yes" ]]; then
284 +  WANT_STANDALONE_GUI=no
285 + fi
286 + if [[ "$WANT_GTK" = "no" ]]; then
287 +  WANT_STANDALONE_GUI=no
288 + fi
289 + AC_SUBST(STANDALONE_GUI, [$WANT_STANDALONE_GUI])
290  
291   dnl We use ESD if possible.
292   if [[ "x$WANT_ESD" = "xyes" ]]; then
# Line 229 | Line 307 | AC_SYS_LARGEFILE
307   dnl Checks for header files.
308   AC_HEADER_STDC
309   AC_HEADER_SYS_WAIT
310 + AC_CHECK_HEADERS(malloc.h stdint.h)
311   AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h)
233 AC_CHECK_HEADERS(sys/time.h sys/times.h sys/socket.h)
312   AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h)
313 < AC_CHECK_HEADERS(linux/if.h, [], [], [
314 < #if HAVE_SYS_SOCKET_H
315 < # include <sys/socket.h>
313 > AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
314 > AC_CHECK_HEADERS(sys/time.h sys/poll.h sys/select.h arpa/inet.h)
315 > AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
316 > #ifdef HAVE_SYS_TYPES_H
317 > #include <sys/types.h>
318 > #endif
319 > #ifdef HAVE_SYS_SOCKET_H
320 > #include <sys/socket.h>
321   #endif
322   ])
323 < AC_CHECK_HEADERS(linux/if_tun.h net/if.h net/if_tun.h)
323 > AC_CHECK_HEADERS(AvailabilityMacros.h)
324 > AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
325 > AC_CHECK_HEADERS(fenv.h)
326  
327   dnl Checks for typedefs, structures, and compiler characteristics.
328   AC_C_BIGENDIAN
# Line 257 | Line 342 | AC_TYPE_SIGNAL
342   AC_HEADER_TIME
343   AC_STRUCT_TM
344  
345 + dnl Check whether sys/socket.h defines type socklen_t.
346 + dnl (extracted from ac-archive/Miscellaneous)
347 + AC_CACHE_CHECK([for socklen_t],
348 +  ac_cv_type_socklen_t, [
349 +  AC_TRY_COMPILE([
350 +    #include <sys/types.h>
351 +    #include <sys/socket.h>
352 +  ], [socklen_t len = 42; return 0;],
353 +  ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
354 +  dnl When cross-compiling, do not assume anything.
355 +  ac_cv_type_socklen_t="guessing no"
356 +  )
357 + ])
358 + if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
359 +  AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.])
360 + fi
361 +
362   dnl Check whether struct sigaction has sa_restorer member.
363   AC_CACHE_CHECK([whether struct sigaction has sa_restorer],
364    ac_cv_signal_sa_restorer, [
# Line 273 | Line 375 | if [[ "x$ac_cv_signal_sa_restorer" = "xy
375   fi
376  
377   dnl Checks for library functions.
378 < AC_CHECK_FUNCS(strdup strlcpy cfmakeraw)
378 > AC_CHECK_FUNCS(strdup strerror strlcpy cfmakeraw)
379   AC_CHECK_FUNCS(nanosleep)
380   AC_CHECK_FUNCS(sigaction signal)
381   AC_CHECK_FUNCS(mmap mprotect munmap)
382   AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
383 < AC_CHECK_FUNCS(posix_memalign memalign valloc)
383 > AC_CHECK_FUNCS(exp2f log2f exp2 log2)
384 > AC_CHECK_FUNCS(floorf roundf ceilf truncf floor round ceil trunc)
385 > AC_CHECK_FUNCS(poll inet_aton)
386  
387   dnl Darwin seems to define mach_task_self() instead of task_self().
388   AC_CHECK_FUNCS(mach_task_self task_self)
# Line 290 | Line 394 | no:linux*)
394    ;;
395   *:*)
396    AC_SEARCH_LIBS(clock_gettime, [rt posix4])
397 <  AC_CHECK_FUNCS(clock_gettime)
397 >  AC_CHECK_FUNCS(clock_gettime clock_nanosleep)
398    ;;
399   esac
400  
401 + dnl Check for headers and functions related to pty support (sshpty.c)
402 + dnl From openssh-3.2.2p1 configure.ac
403 + AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
404 + AC_CHECK_FUNCS(_getpty vhangup strlcpy)
405 +
406 + case "$host" in
407 + *-*-hpux10.26)
408 +        disable_ptmx_check=yes
409 +        ;;
410 + *-*-linux*)
411 +        no_dev_ptmx=1
412 +        ;;
413 + mips-sony-bsd|mips-sony-newsos4)
414 +        AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).])
415 +        ;;
416 + *-*-sco3.2v4*)
417 +        no_dev_ptmx=1
418 +        ;;
419 + *-*-sco3.2v5*)
420 +        no_dev_ptmx=1
421 +        ;;
422 + *-*-cygwin*)
423 +        no_dev_ptmx=1
424 +        ;;
425 + esac
426 +
427 + if test -z "$no_dev_ptmx" ; then
428 +        if test "x$disable_ptmx_check" != "xyes" ; then
429 +                AC_CHECK_FILE([/dev/ptmx],
430 +                        [
431 +                                AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.])
432 +                                have_dev_ptmx=1
433 +                        ]
434 +                )
435 +        fi
436 + fi
437 + AC_CHECK_FILE([/dev/ptc],
438 +        [
439 +                AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.])
440 +                have_dev_ptc=1
441 +        ]
442 + )
443 + dnl (end of code from openssh-3.2.2p1 configure.ac)
444 +
445 + dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
446 + dnl doesn't work or is unimplemented. On these systems (mostly older
447 + dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
448 + AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O],
449 +  ac_cv_nonblocking_io, [
450 +  case "$host" in
451 +  *-*-osf*)
452 +    ac_cv_nonblocking_io=FIONBIO
453 +    ;;
454 +  *-*-sunos4*)
455 +    ac_cv_nonblocking_io=FIONBIO
456 +    ;;
457 +  *-*-ultrix*)
458 +    ac_cv_nonblocking_io=FIONBIO
459 +    ;;
460 +  *)
461 +    ac_cv_nonblocking_io=O_NONBLOCK
462 +    ;;
463 +  esac
464 + ])
465 + if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then
466 +  AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used])
467 + fi
468 +
469 + dnl Check whether compiler supports byte bit-fields
470 + AC_CACHE_CHECK([whether compiler supports byte bit-fields],
471 +  ac_cv_have_byte_bitfields, [
472 +  AC_LANG_SAVE
473 +  AC_LANG_CPLUSPLUS
474 +  AC_TRY_RUN([
475 +    struct A {
476 +      unsigned char b1:4;
477 +      unsigned char b2:4;
478 +      unsigned char c;
479 +      unsigned short s;
480 +      unsigned char a[4];
481 +    };
482 +
483 +    int main(void) {
484 +      A a;
485 +      return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1));
486 +    }],
487 +    [ac_cv_have_byte_bitfields=yes],
488 +    [ac_cv_have_byte_bitfields=no],
489 +    dnl When cross-compiling, assume only GCC supports this
490 +    [if [[ "$GCC" = "yes" ]]; then
491 +      ac_cv_have_byte_bitfields="guessing yes"
492 +    else
493 +      ac_cv_have_byte_bitfields="guessing no"
494 +    fi]
495 +    )
496 +  AC_LANG_RESTORE
497 + ])
498 +
499   dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
500 < AC_DEFUN(AC_CHECK_FRAMEWORK, [
500 > AC_DEFUN([AC_CHECK_FRAMEWORK], [
501    AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
502    AC_CACHE_CHECK([whether compiler supports framework $1],
503      ac_Framework, [
504      saved_LIBS="$LIBS"
505      LIBS="$LIBS -framework $1"
506      AC_TRY_LINK(
507 <      [$2], [int main(void) { return 0; }],
507 >      [$2], [],
508        [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
509      )
510    ])
# Line 315 | Line 517 | AC_DEFUN(AC_CHECK_FRAMEWORK, [
517   dnl Check for some MacOS X frameworks
518   AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
519   AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
520 + AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
521  
522   dnl Select system-dependant sources.
523   SERIALSRC=serial_unix.cpp
# Line 325 | Line 528 | EXTFSSRC=extfs_unix.cpp
528   EXTRASYSSRCS=
529   case "$target_os" in
530   linux*)
531 <  ETHERSRC=Linux/ether_linux.cpp
531 >  ETHERSRC=ether_unix.cpp
532    AUDIOSRC=audio_oss_esd.cpp
533    SCSISRC=Linux/scsi_linux.cpp
534    if [[ "x$EMULATED_PPC" = "xno" ]]; then
535 <    EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S"
535 >    EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S"
536 >  fi
537 >  ;;
538 > freebsd*)
539 >  ETHERSRC=ether_unix.cpp
540 >  ;;
541 > netbsd*)
542 >  ETHERSRC=ether_unix.cpp
543 >  if [[ "x$EMULATED_PPC" = "xno" ]]; then
544 >    EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S"
545    fi
546    ;;
547   darwin*)
548 +  ETHERSRC=ether_unix.cpp
549    if [[ "x$EMULATED_PPC" = "xno" ]]; then
550 <    EXTRASYSSRCS="Darwin/paranoia.cpp Linux/asm_linux.S"
550 >    EXTRASYSSRCS="paranoia.cpp ppc_asm.S"
551    fi
552 <  if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then
552 >  if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
553      EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp"
554    fi
555    if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
556      EXTFSSRC=../MacOSX/extfs_macosx.mm
557    fi
558    ;;
559 + irix*)
560 +  AUDIOSRC=Irix/audio_irix.cpp
561 +  LIBS="$LIBS -laudio"
562 +  WANT_ESD=no
563 +
564 +  dnl Check if our compiler supports -IPA (MIPSPro)
565 +  HAVE_IPA=no
566 +  ocflags="$CFLAGS"
567 +  CFLAGS=`echo " $CFLAGS -IPA" | sed -e "s/ -g //g"`
568 +  AC_MSG_CHECKING(if "-IPA" works)
569 +  dnl Do a test compile of an empty function
570 +  AC_TRY_COMPILE([#if defined __GNUC__
571 +                  # error GCC does not support IPA yet
572 +                  #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
573 +  CFLAGS="$ocflags"
574 +  ;;
575 + esac
576 +
577 + dnl Is the slirp library supported?
578 + case "$ac_cv_have_byte_bitfields" in
579 + yes|"guessing yes")
580 +  CAN_SLIRP=yes
581 +  ETHERSRC=ether_unix.cpp
582 +  ;;
583   esac
584 + if [[ -n "$CAN_SLIRP" ]]; then
585 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
586 +  SLIRP_SRCS="\
587 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
588 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
589 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
590 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
591 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
592 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
593 + fi
594 + AC_SUBST(SLIRP_SRCS)
595  
596   dnl SDL overrides
597   if [[ "x$WANT_SDL" = "xyes" ]]; then
# Line 368 | Line 616 | if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; th
616    AUDIOSRC="../SDL/audio_sdl.cpp"
617   fi
618  
619 < SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
619 > SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $EXTRASYSSRCS"
620  
621   dnl Define a macro that translates a yesno-variable into a C macro definition
622   dnl to be put into the config.h file
623   dnl $1 -- the macro to define
624   dnl $2 -- the value to translate
625   dnl $3 -- template name
626 < AC_DEFUN(AC_TRANSLATE_DEFINE, [
626 > AC_DEFUN([AC_TRANSLATE_DEFINE], [
627      if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
628          AC_DEFINE($1, 1, $3)
629      fi
# Line 672 | Line 920 | fi
920   AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
921    [Define if your system supports Mach exceptions.])
922  
923 + dnl Check if Windows exceptions are supported.
924 + AC_CACHE_CHECK([whether your system supports Windows exceptions],
925 +  ac_cv_have_win32_exceptions, [
926 +  AC_LANG_SAVE
927 +  AC_LANG_CPLUSPLUS
928 +  AC_TRY_RUN([
929 +    #define HAVE_WIN32_EXCEPTIONS 1
930 +    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
931 +    #include "vm_alloc.cpp"
932 +    #include "sigsegv.cpp"
933 +  ], [
934 +  sigsegv_recovery=win32
935 +  ac_cv_have_win32_exceptions=yes
936 +  ],
937 +  ac_cv_have_win32_exceptions=no,
938 +  dnl When cross-compiling, do not assume anything.
939 +  ac_cv_have_win32_exceptions=no
940 +  )
941 +  AC_LANG_RESTORE
942 +  ]
943 + )
944 + AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
945 +  [Define if your system supports Windows exceptions.])
946 +
947   dnl Otherwise, check if extended signals are supported.
948   if [[ -z "$sigsegv_recovery" ]]; then
949    AC_CACHE_CHECK([whether your system supports extended signal handlers],
# Line 758 | Line 1030 | else
1030      WANT_VOSF=no
1031   fi
1032  
1033 + dnl Check addressing mode to use
1034 + AC_MSG_CHECKING([for addressing mode to use])
1035 + if [[ "$EMULATED_PPC" != "yes" ]]; then
1036 +  if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then
1037 +    AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.])
1038 +    WANT_ADDRESSING_MODE="real"
1039 +  fi
1040 + fi
1041 + if [[ "$WANT_ADDRESSING_MODE" = "direct" ]]; then
1042 +  if [[ -n "$NATMEM_OFFSET" ]]; then
1043 +    NATMEM_OFFSET_DEF="-DNATMEM_OFFSET=$NATMEM_OFFSET"
1044 +  fi
1045 +  AC_LANG_SAVE
1046 +  AC_LANG_CPLUSPLUS
1047 +  cat confdefs.h > conftest.$ac_ext
1048 +  cat >> conftest.$ac_ext << EOF
1049 + #include <stdio.h>
1050 + #include <string.h>
1051 + #include "vm_alloc.cpp"
1052 +
1053 + int main(void)
1054 + {
1055 +        if (vm_init() < 0)
1056 +                return 1;
1057 +
1058 +        static const struct {
1059 +                unsigned long base;
1060 +                unsigned int size;
1061 +        } ranges[[]] = {
1062 +                { 0x00000000, 0x0003000 },
1063 +                { 0x10000000, 0x2000000 },
1064 +                { 0x40800000, 0x0400000 },
1065 +                { 0x68070000, 0x0010000 },
1066 +                { 0x69000000, 0x0080000 },
1067 +                { 0x68ffe000, 0x0002000 },
1068 +                { 0x5fffe000, 0x0002000 },
1069 +                { 0x60000000, 0x0040000 },
1070 +        };
1071 +        const int n_ranges = sizeof(ranges)/ sizeof(ranges[[0]]);
1072 +
1073 + #ifdef NATMEM_OFFSET
1074 +        unsigned long ofs = NATMEM_OFFSET;
1075 + #else
1076 +        for (unsigned long ofs = 0x10000000; ofs <= 0x90000000; ofs += 0x10000000)
1077 + #endif
1078 +        for (int i = 0; i < n_ranges; i++) {
1079 +                char *m = (char *)(ranges[[i]].base + ofs);
1080 +                if (vm_acquire_fixed(m, ranges[[i]].size) != 0)
1081 +                        break;
1082 +                memset(m, 0, ranges[[i]].size);
1083 +                vm_release(m, ranges[[i]].size);
1084 +                if (i == n_ranges - 1) {
1085 +                        if (sizeof(void *) == 8 && ofs > 0xffffffff)
1086 +                                printf("0x%lxul\n", ofs);
1087 +                        else
1088 +                                printf("0x%08x\n", ofs);
1089 +                        return 0;
1090 +                }
1091 +        }
1092 +
1093 +        vm_exit();
1094 +        return 1;
1095 + }
1096 + EOF
1097 +  doit='$CXX conftest.$ac_ext -o conftest.$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS $NATMEM_OFFSET_DEF >& AS_MESSAGE_LOG_FD'
1098 +  if AC_TRY_EVAL(doit); then
1099 +    NATMEM_OFFSET=`./conftest.$ac_exeext`
1100 +  else
1101 +    NATMEM_OFFSET=
1102 +  fi
1103 +  rm -f conftest*
1104 +  AC_LANG_RESTORE
1105 +
1106 +  if [[ -z "$NATMEM_OFFSET" ]]; then
1107 +    AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value])
1108 +  else
1109 +    WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET"
1110 +    AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET,
1111 +      [Define constant offset for Mac address translation])
1112 +  fi
1113 + fi
1114 + AC_MSG_RESULT($WANT_ADDRESSING_MODE)
1115 +
1116 + dnl Utility macro used by next two tests.
1117 + dnl AC_EXAMINE_OBJECT(C source code,
1118 + dnl     commands examining object file,
1119 + dnl     [commands to run if compile failed]):
1120 + dnl
1121 + dnl Compile the source code to an object file; then convert it into a
1122 + dnl printable representation.  All unprintable characters and
1123 + dnl asterisks (*) are replaced by dots (.).  All white space is
1124 + dnl deleted.  Newlines (ASCII 0x10) in the input are preserved in the
1125 + dnl output, but runs of newlines are compressed to a single newline.
1126 + dnl Finally, line breaks are forcibly inserted so that no line is
1127 + dnl longer than 80 columns and the file ends with a newline.  The
1128 + dnl result of all this processing is in the file conftest.dmp, which
1129 + dnl may be examined by the commands in the second argument.
1130 + dnl
1131 + AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
1132 + [AC_LANG_SAVE
1133 + AC_LANG_C
1134 + dnl Next bit cribbed from AC_TRY_COMPILE.
1135 + cat > conftest.$ac_ext <<EOF
1136 + [#line __oline__ "configure"
1137 + #include "confdefs.h"
1138 + $1
1139 + ]EOF
1140 + if AC_TRY_EVAL(ac_compile); then
1141 +  od -c conftest.o |
1142 +    sed ['s/^[0-7]*[    ]*/ /
1143 +          s/\*/./g
1144 +          s/ \\n/*/g
1145 +          s/ [0-9][0-9][0-9]/./g
1146 +          s/  \\[^ ]/./g'] |
1147 +    tr -d '
1148 + ' | tr -s '*' '
1149 + ' | fold | sed '$a\
1150 + ' > conftest.dmp
1151 +  $2
1152 + ifelse($3, , , else
1153 +  $3
1154 + )dnl
1155 + fi
1156 + rm -rf conftest*
1157 + AC_LANG_RESTORE])
1158 +
1159 + dnl Floating point format probe.
1160 + dnl The basic concept is the same as the above: grep the object
1161 + dnl file for an interesting string.  We have to watch out for
1162 + dnl rounding changing the values in the object, however; this is
1163 + dnl handled by ignoring the least significant byte of the float.
1164 + dnl
1165 + dnl Does not know about VAX G-float or C4x idiosyncratic format.
1166 + dnl It does know about PDP-10 idiosyncratic format, but this is
1167 + dnl not presently supported by GCC.  S/390 "binary floating point"
1168 + dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
1169 + dnl as ASCII?)
1170 + dnl
1171 + AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
1172 + [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
1173 + [gcc_AC_EXAMINE_OBJECT(
1174 + [/* This will not work unless sizeof(double) == 8.  */
1175 + extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
1176 +
1177 + /* This structure must have no internal padding.  */
1178 + struct possibility {
1179 +  char prefix[8];
1180 +  double candidate;
1181 +  char postfix[8];
1182 + };
1183 +
1184 + #define C(cand) { "\nformat:", cand, ":tamrof\n" }
1185 + struct possibility table [] =
1186 + {
1187 +  C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
1188 +  C( 3.53802595280598432000e+18), /* D__float - VAX */
1189 +  C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
1190 +  C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
1191 +  C(-5.22995989424860458374e+10)  /* IBMHEXFP - s/390 format, EBCDIC */
1192 + };],
1193 + [if   grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1194 +    ac_cv_c_float_format='IEEE (big-endian)'
1195 +  elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
1196 +    ac_cv_c_float_format='IEEE (big-endian)'
1197 +  elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
1198 +    ac_cv_c_float_format='IEEE (little-endian)'
1199 +  elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
1200 +    ac_cv_c_float_format='IEEE (little-endian)'
1201 +  elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
1202 +    ac_cv_c_float_format='VAX D-float'
1203 +  elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
1204 +    ac_cv_c_float_format='PDP-10'
1205 +  elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1206 +    ac_cv_c_float_format='IBM 370 hex'
1207 +  else
1208 +    AC_MSG_ERROR(Unknown floating point format)
1209 +  fi],
1210 +  [AC_MSG_ERROR(compile failed)])
1211 + ])
1212 + # IEEE is the default format.  If the float endianness isn't the same
1213 + # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
1214 + # (which is a tristate: yes, no, default).  This is only an issue with
1215 + # IEEE; the other formats are only supported by a few machines each,
1216 + # all with the same endianness.
1217 + format=IEEE_FLOAT_FORMAT
1218 + fbigend=
1219 + case $ac_cv_c_float_format in
1220 +    'IEEE (big-endian)' )
1221 +        if test $ac_cv_c_bigendian = no; then
1222 +            fbigend=1
1223 +        fi
1224 +        ;;
1225 +    'IEEE (little-endian)' )
1226 +        if test $ac_cv_c_bigendian = yes; then
1227 +            fbigend=0
1228 +        fi
1229 +        ;;
1230 +    'VAX D-float' )
1231 +        format=VAX_FLOAT_FORMAT
1232 +        ;;
1233 +    'PDP-10' )
1234 +        format=PDP10_FLOAT_FORMAT
1235 +        ;;
1236 +    'IBM 370 hex' )
1237 +        format=IBM_FLOAT_FORMAT
1238 +        ;;
1239 + esac
1240 + AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1241 +  [Define to the floating point format of the host machine.])
1242 + if test -n "$fbigend"; then
1243 +        AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1244 +  [Define to 1 if the host machine stores floating point numbers in
1245 +   memory with the word containing the sign bit at the lowest address,
1246 +   or to 0 if it does it the other way around.
1247 +
1248 +   This macro should not be defined if the ordering is the same as for
1249 +   multi-word integers.])
1250 + fi
1251 + ])
1252 +
1253 + dnl Check for host float format
1254 + gcc_AC_C_FLOAT_FORMAT
1255 +
1256   dnl Platform specific binary postprocessor
1257   AC_PATH_PROG(BLESS, "true")
1258   if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
# Line 768 | Line 1263 | fi
1263   dnl Check for GCC 2.7 or higher.
1264   HAVE_GCC27=no
1265   AC_MSG_CHECKING(for GCC 2.7 or higher)
1266 < AC_EGREP_CPP(xyes,
1267 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1268 <  xyes
1269 < #endif
1270 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1266 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1267 >                                     # error gcc < 2.7
1268 >                                     typedef syntax error;
1269 >                                     #endif
1270 >                                   ]])],
1271 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1272 >                  [AC_MSG_RESULT(no)])
1273  
1274   dnl Check for GCC 3.0 or higher.
1275   HAVE_GCC30=no
1276   AC_MSG_CHECKING(for GCC 3.0 or higher)
1277 < AC_EGREP_CPP(xyes,
1278 < [#if __GNUC__ >= 3
1279 <  xyes
1280 < #endif
1281 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1277 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1278 >                                     # error gcc < 3
1279 >                                     typedef syntax error;
1280 >                                     #endif
1281 >                                   ]])],
1282 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1283 >                  [AC_MSG_RESULT(no)])
1284  
1285   dnl Check for ICC.
1286   AC_MSG_CHECKING(for ICC)
# Line 791 | Line 1290 | if $CXX -V -v 2>&1 | grep -q "Intel(R) C
1290   fi
1291   AC_MSG_RESULT($HAVE_ICC)
1292  
1293 < # Test if the compiler can generate ELF objects
1294 < AC_CACHE_CHECK([whether the compiler can generate ELF objects],
1295 <  ac_cv_elf_objects, [
1293 > dnl Determine the generated object format
1294 > AC_CACHE_CHECK([the format of compiler generated objects],
1295 >  ac_cv_object_format, [
1296    echo 'int i;' > conftest.$ac_ext
1297 <  ac_cv_elf_objects=no
1297 >  ac_cv_object_format=no
1298    if AC_TRY_EVAL(ac_compile); then
1299      case `/usr/bin/file conftest.$ac_objext` in
1300      *"ELF"*)
1301 <      ac_cv_elf_objects=yes
1301 >      ac_cv_object_format=elf
1302 >      ;;
1303 >    *"Mach-O"*)
1304 >      ac_cv_object_format=mach
1305 >      ;;
1306 >    *)
1307 >      ac_cv_object_format=unknown
1308        ;;
1309      esac
1310    fi
1311    rm -rf conftest*
1312   ])
1313 < ELF_OBJECTS=$ac_cv_elf_objects
1313 >
1314 > dnl Add -fno-strict-aliasing for slirp sources
1315 > if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1316 >  SAVED_CFLAGS="$CFLAGS"
1317 >  CFLAGS="$CFLAGS -fno-strict-aliasing"
1318 >  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1319 >    ac_cv_gcc_no_strict_aliasing, [
1320 >    AC_TRY_COMPILE([],[],
1321 >      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1322 >      [ac_cv_gcc_no_strict_aliasing=no])
1323 >  ])
1324 >  CFLAGS="$SAVED_CFLAGS"
1325 > fi
1326 >
1327 > dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1328 > if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1329 >  SAVED_CFLAGS="$CFLAGS"
1330 >  CFLAGS="$CFLAGS -mdynamic-no-pic"
1331 >  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1332 >    ac_cv_gcc_mdynamic_no_pic, [
1333 >    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1334 >  ])
1335 >  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1336 >    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1337 >  else
1338 >    CFLAGS="$SAVED_CFLAGS"
1339 >  fi
1340 > fi
1341  
1342   dnl CPU emulator sources
1343   if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1344    CPUSRCS="\
1345 +    ../kpx_cpu/src/mathlib/ieeefp.cpp \
1346 +    ../kpx_cpu/src/mathlib/mathlib.cpp \
1347      ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
1348      ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
1349      ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
# Line 820 | Line 1354 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1354    if [[ "x$WANT_JIT" = "xyes" ]]; then
1355      AC_CACHE_CHECK([whether dyngen can be used],
1356        ac_cv_use_dyngen, [
1357 <      case $host_cpu:$ELF_OBJECTS in
1358 <      powerpc:yes)
1357 >      case $host_cpu:$ac_cv_object_format in
1358 >      powerpc:elf)
1359 >        ac_cv_use_dyngen=yes
1360 >        ;;
1361 >      x86_64:elf)
1362 >        ac_cv_use_dyngen=yes
1363 >        ;;
1364 >      i?86:elf)
1365 >        ac_cv_use_dyngen=yes
1366 >        ;;
1367 >      mips:elf)
1368          ac_cv_use_dyngen=yes
1369          ;;
1370 <      x86_64:yes)
1370 >      powerpc:mach)
1371          ac_cv_use_dyngen=yes
1372          ;;
1373 <      i?86:yes)
1373 >      i?86:mach)
1374          ac_cv_use_dyngen=yes
1375          ;;
1376        *:*)
# Line 839 | Line 1382 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1382          if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1383            DYNGEN_CC=$CXX
1384          else
1385 <          for p in /usr/bin /usr/local/bin; do
1385 >          for p in /usr/bin /usr/local/bin /usr/freeware/bin; do
1386              gxx="$p/g++"
1387              if [[ -x "$gxx" ]]; then
1388                DYNGEN_CC="$gxx"
# Line 847 | Line 1390 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1390            done
1391          fi
1392        fi
1393 <      if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then
1393 >      if [[ -z "$DYNGEN_CC" ]]; then
1394          ac_cv_use_dyngen=no
1395        fi
1396      ])
1397      if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
1398        case $host_cpu in
1399        i?86)
1400 <        DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2"
858 <        if [[ "x$HAVE_GCC30" = "xyes" ]]; then
859 <          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
860 <        else
861 <          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
862 <        fi
863 <        saved_CPPFLAGS=$CPPFLAGS
864 <        CPPFLAGS="$CPPFLAGS -mmmx"
865 <        AC_CHECK_HEADERS(mmintrin.h,  [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -mmmx"])
866 <        CPPFLAGS="$CPPFLAGS -msse"
867 <        AC_CHECK_HEADERS(xmmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse"])
868 <        CPPFLAGS="$CPPFLAGS -msse2"
869 <        AC_CHECK_HEADERS(emmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse2"])
870 <        CPPFLAGS=$saved_CPPFLAGS
1400 >        DYNGEN_OP_FLAGS="-fomit-frame-pointer"
1401          ;;
1402 <      x86_64)
1403 <        AC_CHECK_HEADERS(mmintrin.h xmmintrin.h emmintrin.h)
1402 >      mips)
1403 >        DYNGEN_OP_FLAGS="-fno-delayed-branch -mno-abicalls"
1404 >        ;;
1405 >      powerpc)
1406 >        if [[ "x$ac_cv_object_format" = "xmach" ]]; then
1407 >          DYNGEN_OP_FLAGS="-mdynamic-no-pic"
1408 >        fi
1409          ;;
1410        esac
1411 <      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000"
1412 <      if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1411 >      have_dyngen_gcc3=no
1412 >      case "x`$DYNGEN_CC -dumpversion`" in
1413 >      x[12].*) ;;
1414 >      x*) have_dyngen_gcc3=yes ;;
1415 >      esac
1416 >      if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1417 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-align-functions"
1418 >      else
1419 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
1420 >      fi
1421 >      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-functions -finline-limit=10000 -fno-exceptions -g0"
1422 >      if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1423          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
1424        fi
1425 +      if [[ "x$DYNGEN_CC" != "x$CXX" ]]; then
1426 +        DYNGEN_CFLAGS="-O2 $CFLAGS"
1427 +        DYNGEN_CXXFLAGS="-O2 $CXXFLAGS"
1428 +      else
1429 +        DYNGEN_CFLAGS="\$(CFLAGS)"
1430 +        DYNGEN_CXXFLAGS="\$(CXXFLAGS)"
1431 +      fi
1432      else
1433        WANT_JIT=no
1434      fi
# Line 899 | Line 1451 | if [[ "x$ac_cv_use_dyngen" = "xyes" ]];
1451    AC_CACHE_CHECK([whether static data regions are executable],
1452      ac_cv_have_static_data_exec, [
1453      AC_TRY_RUN([int main(void) {
1454 < #if defined(__powerpc__)
1454 > #if defined(__powerpc__) || defined(__ppc__)
1455        static unsigned int p[8] = {0x4e800020,};
1456        asm volatile("dcbst 0,%0" : : "r" (p) : "memory");
1457        asm volatile("sync" : : : "memory");
# Line 915 | Line 1467 | if [[ "x$ac_cv_use_dyngen" = "xyes" ]];
1467      ac_cv_have_static_data_exec=no
1468      )
1469    ])
1470 + else
1471 +  ac_cv_use_dyngen=no
1472   fi
1473   AC_TRANSLATE_DEFINE(HAVE_STATIC_DATA_EXEC, "$ac_cv_have_static_data_exec",
1474    [Define if your system marks static data pages as executable.])
# Line 923 | Line 1477 | if [[ "x$WANT_JIT" = "xyes" ]]; then
1477    CPPFLAGS="$CPPFLAGS -DUSE_JIT"
1478   fi
1479  
1480 + dnl Higher level optimizations with MIPSPro compilers are possible
1481 + if [[ "x$HAVE_IPA" = "xyes" ]]; then
1482 +  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1483 +  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1484 +  CXXFLAGS="-LANG:std $CXXFLAGS"
1485 +  LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
1486 + fi
1487 +
1488 + dnl Check for linker script support
1489 + case $target_os:$target_cpu in
1490 + linux*:i?86)    LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1491 + linux*:x86_64)  LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";;
1492 + linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";;
1493 + netbsd*:i?86)   LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1494 + freebsd*:i?86)  LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";;
1495 + darwin*:*)      LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
1496 + esac
1497 + if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then
1498 +  AC_CACHE_CHECK([whether linker script is usable],
1499 +    ac_cv_linker_script_works, [
1500 +    AC_LANG_SAVE
1501 +    AC_LANG_CPLUSPLUS
1502 +    saved_LDFLAGS="$LDFLAGS"
1503 +    LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS"
1504 +    AC_TRY_RUN(
1505 +      [int main() {if ((char *)&main < (char *)0x70000000) return 1;}],
1506 +      [ac_cv_linker_script_works=yes],
1507 +      [ac_cv_linker_script_works=no],
1508 +      dnl When cross-compiling, assume it works
1509 +      [ac_cv_linker_script_works="guessing yes"]
1510 +    )
1511 +    AC_LANG_RESTORE
1512 +    if [[ "$ac_cv_linker_script_works" = "no" ]]; then
1513 +      LDFLAGS="$saved_LDFLAGS"
1514 +      LINKER_SCRIPT_FLAGS=""
1515 +    fi
1516 +  ])
1517 + fi
1518 + AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
1519 +  [Define if there is a linker script to relocate the executable above 0x70000000.])
1520 +
1521   dnl Generate Makefile.
1522 + AC_SUBST(PERL)
1523 + AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen])
1524   AC_SUBST(DYNGENSRCS)
1525   AC_SUBST(DYNGEN_CC)
1526 + AC_SUBST(DYNGEN_CFLAGS)
1527 + AC_SUBST(DYNGEN_CXXFLAGS)
1528   AC_SUBST(DYNGEN_OP_FLAGS)
1529   AC_SUBST(SYSSRCS)
1530   AC_SUBST(CPUSRCS)
# Line 941 | Line 1540 | echo
1540   echo SheepShaver configuration summary:
1541   echo
1542   echo SDL support ...................... : $SDL_SUPPORT
1543 + echo FBDev DGA support ................ : $WANT_FBDEV_DGA
1544   echo XFree86 DGA support .............. : $WANT_XF86_DGA
1545   echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
1546   echo Using PowerPC emulator ........... : $EMULATED_PPC
# Line 949 | Line 1549 | echo Enable video on SEGV signals .....
1549   echo ESD sound support ................ : $WANT_ESD
1550   echo GTK user interface ............... : $WANT_GTK
1551   echo mon debugger support ............. : $WANT_MON
1552 + echo Addressing mode .................. : $WANT_ADDRESSING_MODE
1553   echo Bad memory access recovery type .. : $sigsegv_recovery
1554   echo
1555   echo "Configuration done. Now type \"make\"."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines