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

Comparing BasiliskII/src/Unix/configure.ac (file contents):
Revision 1.1 by gbeauche, 2002-09-16T13:29:33Z vs.
Revision 1.63 by gbeauche, 2006-03-14T22:14:13Z

# Line 1 | Line 1
1   dnl Process this file with autoconf to produce a configure script.
2   dnl Written in 2002 by Christian Bauer et al.
3  
4 < AC_INIT(main_unix.cpp)
4 > AC_INIT([Basilisk II], 1.0, [Christian.Bauer@uni-mainz.de], BasiliskII)
5 > AC_CONFIG_SRCDIR(main_unix.cpp)
6   AC_PREREQ(2.52)
7   AC_CONFIG_HEADER(config.h)
8  
9 < dnl Options.
9 > dnl Aliases for PACKAGE and VERSION macros.
10 > AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.])
11 > AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [Define this program version.])
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 Video options.
18   AC_ARG_ENABLE(xf86-dga,      [  --enable-xf86-dga       use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
19   AC_ARG_ENABLE(xf86-vidmode,  [  --enable-xf86-vidmode   use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
20   AC_ARG_ENABLE(fbdev-dga,     [  --enable-fbdev-dga      use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
21   AC_ARG_ENABLE(vosf,          [  --enable-vosf           enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
22  
23 + dnl SDL options.
24 + AC_ARG_ENABLE(sdl-static,    [  --enable-sdl-static     use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no])
25 + AC_ARG_ENABLE(sdl-video,     [  --enable-sdl-video      use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no])
26 + AC_ARG_ENABLE(sdl-audio,     [  --enable-sdl-audio      use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no])
27 +
28 + dnl JIT compiler options.
29 + AC_ARG_ENABLE(jit-compiler,  [  --enable-jit-compiler   enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
30 + AC_ARG_ENABLE(jit-debug,     [  --enable-jit-debug      activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
31 +
32   dnl FPU emulation core.
33   AC_ARG_ENABLE(fpe,
34   [  --enable-fpe=FPE        specify which fpu emulator to use [default=auto]],
# Line 42 | Line 60 | AC_ARG_ENABLE(addressing,
60  
61   dnl External packages.
62   AC_ARG_WITH(esd,             [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
63 < AC_ARG_WITH(gtk,             [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
63 > AC_ARG_WITH(gtk,             [  --with-gtk              use GTK user interface [default=yes]],
64 >  [case "$withval" in
65 >   gtk1)      WANT_GTK="gtk";;
66 >   gtk|gtk2)  WANT_GTK="$withval";;
67 >   yes)       WANT_GTK="gtk2 gtk";;
68 >   *)         WANT_GTK="no";;
69 >   esac],
70 >  [WANT_GTK="gtk2 gtk"])
71   AC_ARG_WITH(mon,             [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
72  
73   dnl Canonical system information.
# Line 65 | Line 90 | HAVE_I386=no
90   HAVE_M68K=no
91   HAVE_SPARC=no
92   HAVE_POWERPC=no
93 + HAVE_X86_64=no
94   case "$target_cpu" in
95 <  i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;;
96 <  m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;;
97 <  sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;;
98 <  powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;;
99 <  *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;;
95 >  i386* | i486* | i586* | i686* | i786* ) HAVE_I386=yes;;
96 >  m68k* ) HAVE_M68K=yes;;
97 >  sparc* ) HAVE_SPARC=yes;;
98 >  powerpc* ) HAVE_POWERPC=yes;;
99 >  x86_64* ) HAVE_X86_64=yes;;
100   esac
75 DEFINES="$DEFINES -DCPU_$CPU_TYPE"
101  
102   dnl Checks for programs.
103   AC_PROG_CC
# Line 81 | Line 106 | AC_PROG_CPP
106   AC_PROG_CXX
107   AC_PROG_MAKE_SET
108   AC_PROG_INSTALL
109 + AC_PROG_EGREP
110  
111   dnl We use mon if possible.
112   MONSRCS=
# Line 99 | Line 125 | if [[ "x$WANT_MON" = "xyes" ]]; then
125              AC_CHECK_LIB(Hcurses, tgetent, ,
126                AC_CHECK_LIB(curses, tgetent))))))
127      AC_CHECK_LIB(readline, readline)
102    AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
128    else
129      AC_MSG_RESULT(no)
130      AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
# Line 110 | Line 135 | fi
135   dnl Checks for libraries.
136   AC_CHECK_LIB(posix4, sem_init)
137   AC_CHECK_LIB(rt, timer_create)
138 + AC_CHECK_LIB(rt, shm_open)
139 + AC_CHECK_LIB(m, cos)
140 +
141 + dnl Do we need SDL?
142 + WANT_SDL=no
143 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
144 +  WANT_SDL=yes
145 +  WANT_XF86_DGA=no
146 +  WANT_XF86_VIDMODE=no
147 +  WANT_FBDEV_DGA=no
148 +  SDL_SUPPORT="$SDL_SUPPORT video"
149 + fi
150 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
151 +  WANT_SDL=yes
152 +  SDL_SUPPORT="$SDL_SUPPORT audio"
153 + fi
154 + if [[ "x$WANT_SDL" = "xyes" ]]; then
155 +  AC_PATH_PROG(sdl_config, "sdl-config")
156 +  if [[ -n "$sdl_config" ]]; then
157 +    case $target_os in
158 +    # Special treatment for Cygwin so that we can still use the POSIX layer
159 +    *cygwin*)
160 +      sdl_cflags="-I`$sdl_config --prefix`/include/SDL"
161 +      sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL"
162 +      ;;
163 +    *)
164 +      sdl_cflags=`$sdl_config --cflags`
165 +      if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
166 +        sdl_libs=`$sdl_config --static-libs`
167 +      else
168 +        sdl_libs=`$sdl_config --libs`
169 +      fi
170 +      ;;
171 +    esac
172 +    CFLAGS="$CFLAGS $sdl_cflags"
173 +    CXXFLAGS="$CXXFLAGS $sdl_cflags"
174 +    LIBS="$LIBS $sdl_libs"
175 +  else
176 +    WANT_SDL=no
177 +  fi
178 +  SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
179 + else
180 +  SDL_SUPPORT="none"
181 + fi
182  
183 < dnl We need X11.
184 < AC_PATH_XTRA
185 < if [[ "x$no_x" = "xyes" ]]; then
186 <  AC_MSG_ERROR([You need X11 to run Basilisk II.])
187 < fi
188 < CFLAGS="$CFLAGS $X_CFLAGS"
189 < CXXFLAGS="$CXXFLAGS $X_CFLAGS"
190 < LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
183 > dnl We need X11, if not using SDL.
184 > if [[ "x$WANT_SDL" = "xno" ]]; then
185 >  AC_PATH_XTRA
186 >  if [[ "x$no_x" = "xyes" ]]; then
187 >    AC_MSG_ERROR([You need X11 to run Basilisk II.])
188 >  fi
189 >  CFLAGS="$CFLAGS $X_CFLAGS"
190 >  CXXFLAGS="$CXXFLAGS $X_CFLAGS"
191 >  LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
192 > fi
193  
194   dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
195   HAVE_PTHREADS=yes
# Line 132 | Line 203 | AC_CHECK_LIB(pthread, pthread_create, ,
203   if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
204    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
205   fi
206 < AC_CHECK_FUNCS(pthread_cancel)
206 > AC_CHECK_FUNCS(pthread_cond_init)
207 > AC_CHECK_FUNCS(pthread_cancel pthread_testcancel)
208   AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
209   AC_CHECK_FUNCS(pthread_mutexattr_settype)
210 + AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
211  
212   dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
213   SEMSRC=
# Line 175 | Line 248 | fi
248  
249   dnl We use GTK+ if possible.
250   UISRCS=../dummy/prefs_editor_dummy.cpp
251 < if [[ "x$WANT_GTK" = "xyes" ]]; then
251 > case "x$WANT_GTK" in
252 > xgtk2*)
253 >  AM_PATH_GTK_2_0(1.3.15, [
254 >    AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
255 >    CFLAGS="$CFLAGS $GTK_CFLAGS"
256 >    CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
257 >    LIBS="$LIBS $GTK_LIBS"
258 >    UISRCS=prefs_editor_gtk.cpp
259 >    WANT_GTK=gtk2
260 >  ], [
261 >    case "x${WANT_GTK}x" in
262 >    *gtkx)
263 >      AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
264 >      WANT_GTK=gtk
265 >      ;;
266 >    *)
267 >      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
268 >      WANT_GTK=no
269 >      ;;
270 >    esac
271 >  ])
272 >  ;;
273 > esac
274 > if [[ "x$WANT_GTK" = "xgtk" ]]; then
275    AM_PATH_GTK(1.2.0, [
276      AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
277      CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
278      LIBS="$LIBS $GTK_LIBS"
279      UISRCS=prefs_editor_gtk.cpp
280 +    dnl somehow, <gnome-i18n.h> would redefine gettext() to nothing if
281 +    dnl ENABLE_NLS is not set, thusly conflicting with C++ <string> which
282 +    dnl includes <libintl.h>
283 +    AM_GNU_GETTEXT
284      B2_PATH_GNOMEUI([
285        AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.])
286        CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS"
# Line 210 | Line 310 | AC_SYS_LARGEFILE
310  
311   dnl Checks for header files.
312   AC_HEADER_STDC
313 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
313 > AC_CHECK_HEADERS(stdlib.h stdint.h)
314 > AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h)
315 > AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.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/poll.h sys/select.h)
318 > AC_CHECK_HEADERS(arpa/inet.h)
319 > AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
320 > #ifdef HAVE_SYS_TYPES_H
321 > #include <sys/types.h>
322 > #endif
323 > #ifdef HAVE_SYS_SOCKET_H
324 > #include <sys/socket.h>
325 > #endif
326 > ])
327 > AC_CHECK_HEADERS(AvailabilityMacros.h)
328 > AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
329  
330   dnl Checks for typedefs, structures, and compiler characteristics.
331   AC_C_BIGENDIAN
# Line 225 | Line 340 | AC_CHECK_SIZEOF(double, 8)
340   AC_CHECK_SIZEOF(long double, 12)
341   AC_CHECK_SIZEOF(void *, 4)
342   AC_TYPE_OFF_T
343 < AC_CHECK_TYPE(loff_t, off_t)
344 < AC_CHECK_TYPE(caddr_t, [char *])
343 > AC_CHECK_TYPES(loff_t)
344 > AC_CHECK_TYPES(caddr_t)
345   AC_TYPE_SIZE_T
346   AC_TYPE_SIGNAL
347   AC_HEADER_TIME
# Line 250 | Line 365 | if [[ "x$ac_cv_type_socklen_t" != "xyes"
365   fi
366  
367   dnl Checks for library functions.
368 < AC_CHECK_FUNCS(strdup cfmakeraw)
368 > AC_CHECK_FUNCS(strdup strerror cfmakeraw)
369   AC_CHECK_FUNCS(clock_gettime timer_create)
370   AC_CHECK_FUNCS(sigaction signal)
371   AC_CHECK_FUNCS(mmap mprotect munmap)
372   AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
373 + AC_CHECK_FUNCS(poll inet_aton)
374  
375   dnl Darwin seems to define mach_task_self() instead of task_self().
376   AC_CHECK_FUNCS(mach_task_self task_self)
# Line 281 | Line 397 | mips-sony-bsd|mips-sony-newsos4)
397   *-*-sco3.2v5*)
398          no_dev_ptmx=1
399          ;;
400 + *-*-cygwin*)
401 +        no_dev_ptmx=1
402 +        ;;
403   esac
404  
405   if test -z "$no_dev_ptmx" ; then
# Line 303 | Line 422 | AC_CHECK_FILE([/dev/ptc],
422   dnl (end of code from openssh-3.2.2p1 configure.ac)
423  
424  
425 + dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
426 + dnl doesn't work or is unimplemented. On these systems (mostly older
427 + dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
428 + AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O],
429 +  ac_cv_nonblocking_io, [
430 +  case "$host" in
431 +  *-*-osf*)
432 +    ac_cv_nonblocking_io=FIONBIO
433 +    ;;
434 +  *-*-sunos4*)
435 +    ac_cv_nonblocking_io=FIONBIO
436 +    ;;
437 +  *-*-ultrix*)
438 +    ac_cv_nonblocking_io=FIONBIO
439 +    ;;
440 +  *)
441 +    ac_cv_nonblocking_io=O_NONBLOCK
442 +    ;;
443 +  esac
444 + ])
445 + if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then
446 +  AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used])
447 + fi
448 +
449 + dnl Check whether compiler supports byte bit-fields
450 + AC_CACHE_CHECK([whether compiler supports byte bit-fields],
451 +  ac_cv_have_byte_bitfields, [
452 +  AC_LANG_SAVE
453 +  AC_LANG_CPLUSPLUS
454 +  AC_TRY_RUN([
455 +    struct A {
456 +      unsigned char b1:4;
457 +      unsigned char b2:4;
458 +      unsigned char c;
459 +      unsigned short s;
460 +      unsigned char a[4];
461 +    };
462 +
463 +    int main(void) {
464 +      A a;
465 +      return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1));
466 +    }],
467 +    [ac_cv_have_byte_bitfields=yes],
468 +    [ac_cv_have_byte_bitfields=no],
469 +    dnl When cross-compiling, assume only GCC supports this
470 +    [if [[ "$GCC" = "yes" ]]; then
471 +      ac_cv_have_byte_bitfields="guessing yes"
472 +    else
473 +      ac_cv_have_byte_bitfields="guessing no"
474 +    fi]
475 +    )
476 +  AC_LANG_RESTORE
477 + ])
478 +
479 + dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
480 + AC_DEFUN([AC_CHECK_FRAMEWORK], [
481 +  AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
482 +  AC_CACHE_CHECK([whether compiler supports framework $1],
483 +    ac_Framework, [
484 +    saved_LIBS="$LIBS"
485 +    LIBS="$LIBS -framework $1"
486 +    AC_TRY_LINK(
487 +      [$2], [],
488 +      [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
489 +    )
490 +  ])
491 +  AS_IF([test AS_VAR_GET(ac_Framework) = yes],
492 +    [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
493 +  )
494 +  AS_VAR_POPDEF([ac_Framework])dnl
495 + ])
496 +
497 + dnl Check for some MacOS X frameworks
498 + AC_CHECK_FRAMEWORK(AppKit, [])
499 + AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
500 + AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
501 + AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
502 +
503   dnl Select system-dependant source files.
504   SERIALSRC=serial_unix.cpp
505   ETHERSRC=../dummy/ether_dummy.cpp
506   SCSISRC=../dummy/scsi_dummy.cpp
507   AUDIOSRC=../dummy/audio_dummy.cpp
508 + EXTFSSRC=extfs_unix.cpp
509   EXTRASYSSRCS=
510   CAN_NATIVE_M68K=no
511   case "$target_os" in
# Line 341 | Line 539 | freebsd*)
539    ;;
540   netbsd*)
541    CAN_NATIVE_M68K=yes
542 +  ETHERSRC=ether_unix.cpp
543    ;;
544   solaris*)
545    AUDIOSRC=Solaris/audio_solaris.cpp
546    DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
547    ;;
548   irix*)
350  ETHERSRC=ether_unix.cpp
549    AUDIOSRC=Irix/audio_irix.cpp
550    EXTRASYSSRCS=Irix/unaligned.c
353  dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
354  DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
551    LIBS="$LIBS -laudio"
552    WANT_ESD=no
553  
554 <  dnl Check if our compiler supports -Ofast (MIPSPro)
555 <  HAVE_OFAST=no
554 >  dnl Check if our compiler supports -IPA (MIPSPro)
555 >  HAVE_IPA=no
556    ocflags="$CFLAGS"
557 <  CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'`
558 <  AC_MSG_CHECKING(if "-Ofast" works)
557 >  CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"`
558 >  AC_MSG_CHECKING(if "-IPA" works)
559    dnl Do a test compile of an empty function
560 <  AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no))
560 >  AC_TRY_COMPILE([#if defined __GNUC__
561 >                  # error GCC does not support IPA yet
562 >                  #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
563    CFLAGS="$ocflags"
564 +  ;;
565 + darwin*)
566 +  ETHERSRC=ether_unix.cpp
567 +  if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
568 +    EXTRASYSSRCS="../MacOSX/sys_darwin.cpp"
569 +  fi
570 +  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
571 +    EXTFSSRC=../MacOSX/extfs_macosx.mm
572 +  fi
573 +  ;;
574 + cygwin*)
575 +  SERIALSRC="../dummy/serial_dummy.cpp"
576 +  EXTRASYSSRCS="../Windows/BasiliskII.rc"
577 +  ;;
578 + esac
579  
580 + dnl Is the slirp library supported?
581 + case "$ac_cv_have_byte_bitfields" in
582 + yes|"guessing yes")
583 +  CAN_SLIRP=yes
584 +  ETHERSRC=ether_unix.cpp
585    ;;
586   esac
587 + if [[ -n "$CAN_SLIRP" ]]; then
588 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
589 +  SLIRP_SRCS="\
590 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
591 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
592 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
593 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
594 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
595 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
596 + fi
597 + AC_SUBST(SLIRP_SRCS)
598 +
599 + dnl SDL overrides
600 + if [[ "x$WANT_SDL" = "xyes" ]]; then
601 +  AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
602 + fi
603 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
604 +  AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
605 +  VIDEOSRCS="../SDL/video_sdl.cpp"
606 +  KEYCODES="../SDL/keycodes"
607 +  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
608 +    EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
609 +  else
610 +    case "$target_os" in
611 +    cygwin*)
612 +      EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
613 +      ;;
614 +    *)
615 +      EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
616 +      ;;
617 +    esac
618 +  fi
619 + else
620 +  VIDEOSRCS="video_x.cpp"
621 +  KEYCODES="keycodes"
622 +  EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp"
623 + fi
624 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
625 +  AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
626 +  AUDIOSRC="../SDL/audio_sdl.cpp"
627 + fi
628  
629   dnl Use 68k CPU natively?
630   WANT_NATIVE_M68K=no
# Line 381 | Line 640 | if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
640    ETHERSRC=../dummy/ether_dummy.cpp
641    AUDIOSRC=../dummy/audio_dummy.cpp
642   fi
643 < SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
643 > SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
644  
645   dnl Define a macro that translates a yesno-variable into a C macro definition
646   dnl to be put into the config.h file
647   dnl $1 -- the macro to define
648   dnl $2 -- the value to translate
649   dnl $3 -- template name
650 < AC_DEFUN(AC_TRANSLATE_DEFINE, [
650 > AC_DEFUN([AC_TRANSLATE_DEFINE], [
651      if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
652          AC_DEFINE($1, 1, $3)
653      fi
654   ])
655  
656 + dnl Check that the host supports TUN/TAP devices
657 + AC_CACHE_CHECK([whether TUN/TAP is supported],
658 +  ac_cv_tun_tap_support, [
659 +  AC_TRY_COMPILE([
660 +    #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
661 +    #include <linux/if.h>
662 +    #include <linux/if_tun.h>
663 +    #endif
664 +    #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
665 +    #include <net/if.h>
666 +    #include <net/if_tun.h>
667 +    #endif
668 +  ], [
669 +    struct ifreq ifr;
670 +    memset(&ifr, 0, sizeof(ifr));
671 +    ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
672 +  ],
673 +  ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
674 +  )
675 + ])
676 + AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
677 +  [Define if your system supports TUN/TAP devices.])
678 +
679   dnl Various checks if the system supports vm_allocate() and the like functions.
680   have_mach_vm=no
681   if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
# Line 540 | Line 822 | AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_
822  
823   fi dnl HAVE_MMAP_VM
824  
825 + dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
826 + AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
827 +  ac_cv_pagezero_hack, [
828 +  ac_cv_pagezero_hack=no
829 +  if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
830 +    ac_cv_pagezero_hack=yes
831 +    dnl might as well skip the test for mmap-able low memory
832 +    ac_cv_can_map_lm=no
833 +  fi
834 + ])
835 + AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
836 +  [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
837 +
838   dnl Check if we can mmap 0x2000 bytes from 0x0000
839   AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
840    ac_cv_can_map_lm, [
# Line 548 | Line 843 | AC_CACHE_CHECK([whether we can map Low M
843    AC_TRY_RUN([
844      #include "vm_alloc.cpp"
845      int main(void) { /* returns 0 if we could map the lowmem globals */
846 <      volatile char * lm;
846 >      volatile char * lm = 0;
847        if (vm_init() < 0) exit(1);
848 <      if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1);
848 >      if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
849        lm[0] = 'z';
850        if (vm_release((char *)lm, 0x2000) < 0) exit(1);
851        vm_exit(); exit(0);
# Line 563 | Line 858 | AC_CACHE_CHECK([whether we can map Low M
858    ]
859   )
860  
861 + dnl Check if we have POSIX shared memory support
862 + AC_CACHE_CHECK([whether POSIX shared memory is working],
863 +  ac_cv_have_posix_shm, [
864 +  AC_LANG_SAVE
865 +  AC_LANG_CPLUSPLUS
866 +  AC_TRY_RUN([
867 +    #define HAVE_POSIX_SHM
868 +    #include "vm_alloc.cpp"
869 +    int main(void) { /* returns 0 if we have working POSIX shm */
870 +      if (vm_init() < 0) exit(2);
871 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
872 +      if (m1 == VM_MAP_FAILED) exit(3);
873 +      vm_exit(); exit(0);
874 +    }
875 +  ], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no,
876 +  dnl When cross-compiling, do not assume anything.
877 +  ac_cv_have_posix_shm="guessing no"
878 +  )
879 +  AC_LANG_RESTORE
880 +  ]
881 + )
882 + AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm",
883 +  [Define if your system supports POSIX shared memory.])
884 +
885 + dnl Check if we have working 33-bit memory addressing
886 + AC_CACHE_CHECK([whether 33-bit memory addressing is working],
887 +  ac_cv_have_33bit_addressing, [
888 +  AC_LANG_SAVE
889 +  AC_LANG_CPLUSPLUS
890 +  AC_TRY_RUN([
891 +    #define USE_33BIT_ADDRESSING 1
892 +    #include "vm_alloc.cpp"
893 +    int main(void) { /* returns 0 if we have working 33-bit addressing */
894 +      if (sizeof(void *) < 8) exit(1);
895 +      if (vm_init() < 0) exit(2);
896 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
897 +      if (m1 == VM_MAP_FAILED) exit(3);
898 +      char *m2 = m1 + (1L << 32);
899 +      m1[0] = 0x12; if (m2[0] != 0x12) exit(4);
900 +      m2[0] = 0x34; if (m1[0] != 0x34) exit(5);
901 +      vm_exit(); exit(0);
902 +    }
903 +  ], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no,
904 +  dnl When cross-compiling, do not assume anything.
905 +  ac_cv_have_33bit_addressing="guessing no"
906 +  )
907 +  AC_LANG_RESTORE
908 +  ]
909 + )
910 +
911   dnl Check signal handlers need to be reinstalled
912   AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
913    ac_cv_signal_need_reinstall, [
# Line 624 | Line 969 | AC_CACHE_CHECK([whether sigaction handle
969   AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
970    [Define if your system requires sigactions to be reinstalled.])
971  
972 < dnl Check if extended signals are supported.
973 < AC_CACHE_CHECK([whether your system supports extended signal handlers],
974 <  ac_cv_have_extended_signals, [
972 > dnl Check if Mach exceptions supported.
973 > AC_CACHE_CHECK([whether your system supports Mach exceptions],
974 >  ac_cv_have_mach_exceptions, [
975 >  AC_LANG_SAVE
976 >  AC_LANG_CPLUSPLUS
977 >  AC_TRY_RUN([
978 >    #define HAVE_MACH_EXCEPTIONS 1
979 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
980 >    #include "vm_alloc.cpp"
981 >    #include "sigsegv.cpp"
982 >  ], [
983 >  sigsegv_recovery=mach
984 >  ac_cv_have_mach_exceptions=yes
985 >  ],
986 >  ac_cv_have_mach_exceptions=no,
987 >  dnl When cross-compiling, do not assume anything.
988 >  ac_cv_have_mach_exceptions=no
989 >  )
990 >  AC_LANG_RESTORE
991 >  ]
992 > )
993 > AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
994 >  [Define if your system supports Mach exceptions.])
995 >
996 > dnl Check if Windows exceptions are supported.
997 > AC_CACHE_CHECK([whether your system supports Windows exceptions],
998 >  ac_cv_have_win32_exceptions, [
999    AC_LANG_SAVE
1000    AC_LANG_CPLUSPLUS
1001    AC_TRY_RUN([
1002 <    #define HAVE_SIGINFO_T 1
1002 >    #define HAVE_WIN32_EXCEPTIONS 1
1003      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
1004      #include "vm_alloc.cpp"
1005      #include "sigsegv.cpp"
1006 <  ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
1006 >  ], [
1007 >  sigsegv_recovery=win32
1008 >  ac_cv_have_win32_exceptions=yes
1009 >  ],
1010 >  ac_cv_have_win32_exceptions=no,
1011    dnl When cross-compiling, do not assume anything.
1012 <  ac_cv_have_extended_signals=no
1012 >  ac_cv_have_win32_exceptions=no
1013    )
1014    AC_LANG_RESTORE
1015    ]
1016   )
1017 < AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
1018 <  [Define if your system support extended signals.])
1017 > AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
1018 >  [Define if your system supports Windows exceptions.])
1019 >
1020 > dnl Otherwise, check if extended signals are supported.
1021 > if [[ -z "$sigsegv_recovery" ]]; then
1022 >  AC_CACHE_CHECK([whether your system supports extended signal handlers],
1023 >    ac_cv_have_extended_signals, [
1024 >    AC_LANG_SAVE
1025 >    AC_LANG_CPLUSPLUS
1026 >    AC_TRY_RUN([
1027 >      #define HAVE_SIGINFO_T 1
1028 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
1029 >      #include "vm_alloc.cpp"
1030 >      #include "sigsegv.cpp"
1031 >    ], [
1032 >    sigsegv_recovery=siginfo
1033 >    ac_cv_have_extended_signals=yes
1034 >    ],
1035 >    ac_cv_have_extended_signals=no,
1036 >    dnl When cross-compiling, do not assume anything.
1037 >    ac_cv_have_extended_signals=no
1038 >    )
1039 >    AC_LANG_RESTORE
1040 >    ]
1041 >  )
1042 >  AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
1043 >    [Define if your system support extended signals.])
1044 > fi
1045  
1046   dnl Otherwise, check for subterfuges.
1047 < if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
1047 > if [[ -z "$sigsegv_recovery" ]]; then
1048    AC_CACHE_CHECK([whether we then have a subterfuge for your system],
1049    ac_cv_have_sigcontext_hack, [
1050      AC_LANG_SAVE
# Line 655 | Line 1054 | if [[ "x$ac_cv_have_extended_signals" =
1054        #define CONFIGURE_TEST_SIGSEGV_RECOVERY
1055        #include "vm_alloc.cpp"
1056        #include "sigsegv.cpp"
1057 <    ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
1057 >    ], [
1058 >    sigsegv_recovery=sigcontext
1059 >    ac_cv_have_sigcontext_hack=yes
1060 >    ],
1061 >    ac_cv_have_sigcontext_hack=no,
1062      dnl When cross-compiling, do not assume anything.
1063      ac_cv_have_sigcontext_hack=no
1064      )
# Line 687 | Line 1090 | AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_IN
1090  
1091   dnl Can we do Video on SEGV Signals ?
1092   CAN_VOSF=no
1093 < if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
1093 > if [[ -n "$sigsegv_recovery" ]]; then
1094    CAN_VOSF=yes
1095   fi
1096  
1097 + dnl A dummy program that returns always true
1098 + AC_PATH_PROG([BLESS], "true")
1099 +
1100 + dnl Check for linker script support
1101 + case $target_os:$target_cpu in
1102 + linux*:i?86)    LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1103 + linux*:x86_64)  LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";;
1104 + darwin*:powerpc)LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
1105 + esac
1106 + if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then
1107 +  AC_CACHE_CHECK([whether linker script is usable],
1108 +    ac_cv_linker_script_works, [
1109 +    AC_LANG_SAVE
1110 +    AC_LANG_CPLUSPLUS
1111 +    saved_LDFLAGS="$LDFLAGS"
1112 +    LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS"
1113 +    AC_TRY_RUN(
1114 +      [int main() {if ((char *)&main < (char *)0x70000000) return 1;}],
1115 +      [ac_cv_linker_script_works=yes],
1116 +      [ac_cv_linker_script_works=no],
1117 +      dnl When cross-compiling, assume it works
1118 +      [ac_cv_linker_script_works="guessing yes"]
1119 +    )
1120 +    AC_LANG_RESTORE
1121 +    if [[ "$ac_cv_linker_script_works" = "no" ]]; then
1122 +      LDFLAGS="$saved_LDFLAGS"
1123 +      LINKER_SCRIPT_FLAGS=""
1124 +    fi
1125 +  ])
1126 + fi
1127 + AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
1128 +  [Define if there is a linker script to relocate the executable above 0x70000000.])
1129 +
1130   dnl Determine the addressing mode to use
1131   if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
1132    ADDRESSING_MODE="real"
# Line 701 | Line 1137 | else
1137      case $am in
1138      real)
1139        dnl Requires ability to mmap() Low Memory globals
1140 <      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
1140 >      if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
1141          continue
1142        fi
1143 <          dnl Requires VOSF screen updates
1143 >      dnl Requires VOSF screen updates
1144        if [[ "x$CAN_VOSF" = "xno" ]]; then
1145          continue
1146        fi
# Line 712 | Line 1148 | else
1148        ADDRESSING_MODE="real"
1149        WANT_VOSF=yes dnl we can use VOSF and we need it actually
1150        DEFINES="$DEFINES -DREAL_ADDRESSING"
1151 +      if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
1152 +        BLESS=Darwin/lowmem
1153 +        LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
1154 +      fi
1155        break
1156        ;;
1157      direct)
# Line 739 | Line 1179 | else
1179    fi
1180   fi
1181  
1182 + dnl Banked Memory Addressing mode is not supported by the JIT compiler
1183 + if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then
1184 +  AC_MSG_ERROR([Sorry, the JIT Compiler requires Direct Addressing, at least])
1185 + fi
1186 +
1187   dnl Enable VOSF screen updates with this feature is requested and feasible
1188   if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
1189      AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
# Line 759 | Line 1204 | AC_MSG_RESULT($HAVE_GAS)
1204   dnl Check for GCC 2.7 or higher.
1205   HAVE_GCC27=no
1206   AC_MSG_CHECKING(for GCC 2.7 or higher)
1207 < AC_EGREP_CPP(yes,
1208 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1209 <  yes
1210 < #endif
1211 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1207 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1208 >                                     # error gcc < 2.7
1209 >                                     #endif
1210 >                                   ]])],
1211 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1212 >                  [AC_MSG_RESULT(no)])
1213  
1214   dnl Check for GCC 3.0 or higher.
1215   HAVE_GCC30=no
1216   AC_MSG_CHECKING(for GCC 3.0 or higher)
1217 < AC_EGREP_CPP(yes,
1218 < [#if __GNUC__ >= 3
1219 <  yes
1220 < #endif
1221 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1217 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1218 >                                     # error gcc < 3
1219 >                                     #endif
1220 >                                   ]])],
1221 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1222 >                  [AC_MSG_RESULT(no)])
1223 >
1224 > dnl Check for ICC.
1225 > AC_MSG_CHECKING(for ICC)
1226 > HAVE_ICC=no
1227 > if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
1228 >  HAVE_ICC=yes
1229 > fi
1230 > AC_MSG_RESULT($HAVE_ICC)
1231  
1232   dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
1233   dnl Also set "-fno-exceptions" for C++ because exception handling requires
# Line 787 | Line 1242 | dnl As of 2001/08/02, this affects the f
1242   dnl Official: probably gcc-3.1 (mainline CVS)
1243   dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
1244   dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
1245 < if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1245 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1246    SAVED_CXXFLAGS="$CXXFLAGS"
1247    CXXFLAGS="$CXXFLAGS -fno-merge-constants"
1248    AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
# Line 801 | Line 1256 | if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1256    fi
1257   fi
1258  
1259 + dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4
1260 + dnl However, there are some corner cases exposed on x86-64
1261 + if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1262 +  SAVED_CXXFLAGS="$CXXFLAGS"
1263 +  CXXFLAGS="$CXXFLAGS -fno-gcse-sm"
1264 +  AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [
1265 +    AC_LANG_SAVE
1266 +    AC_LANG_CPLUSPLUS
1267 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_store_motion=yes],[ac_cv_gcc_store_motion=no])
1268 +    AC_LANG_RESTORE
1269 +  ])
1270 +  if [[ "x$ac_cv_gcc_store_motion" != "xyes" ]]; then
1271 +    CXXFLAGS="$SAVED_CXXFLAGS"
1272 +  fi
1273 + fi
1274 +
1275 + dnl Add -fno-strict-aliasing for slirp sources
1276 + if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1277 +  SAVED_CFLAGS="$CFLAGS"
1278 +  CFLAGS="$CFLAGS -fno-strict-aliasing"
1279 +  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1280 +    ac_cv_gcc_no_strict_aliasing, [
1281 +    AC_TRY_COMPILE([],[],
1282 +      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1283 +      [ac_cv_gcc_no_strict_aliasing=no])
1284 +  ])
1285 +  CFLAGS="$SAVED_CFLAGS"
1286 + fi
1287 +
1288 + dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1289 + if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1290 +  SAVED_CFLAGS="$CFLAGS"
1291 +  CFLAGS="$CFLAGS -mdynamic-no-pic"
1292 +  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1293 +    ac_cv_gcc_mdynamic_no_pic, [
1294 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1295 +  ])
1296 +  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1297 +    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1298 +  else
1299 +    CFLAGS="$SAVED_CFLAGS"
1300 +  fi
1301 + fi
1302 +
1303   dnl Select appropriate CPU source and REGPARAM define.
1304   ASM_OPTIMIZATIONS=none
1305   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
1306 < if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then
1306 >
1307 > dnl (gb) JITSRCS will be emptied later if the JIT is not available
1308 > dnl Other platforms should define their own set of noflags file variants
1309 > CAN_JIT=no
1310 > JITSRCS="compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp"
1311 >
1312 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
1313    dnl i386 CPU
1314 <  DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
1314 >  DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\""
1315    if [[ "x$HAVE_GAS" = "xyes" ]]; then
1316      ASM_OPTIMIZATIONS=i386
1317 <    DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS"
1318 <    CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
1317 >    DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE"
1318 >    JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS"
1319 >    CAN_JIT=yes
1320 >  fi
1321 > elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then
1322 >  dnl x86-64 CPU
1323 >  DEFINES="$DEFINES -DUNALIGNED_PROFITABLE"
1324 >  if [[ "x$HAVE_GAS" = "xyes" ]]; then
1325 >    ASM_OPTIMIZATIONS="x86-64"
1326 >    DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
1327 >    JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS"
1328 >    CAN_JIT=yes
1329 >    WANT_33BIT_ADDRESSING=yes
1330    fi
1331   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
1332    dnl SPARC CPU
# Line 841 | Line 1357 | elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]
1357    CPUSRCS="asm_support.s"
1358   fi
1359  
1360 + dnl Enable JIT compiler, if possible.
1361 + if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
1362 +  JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
1363 +  DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU"
1364 +  
1365 +  if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then
1366 +    if [[ "x$WANT_MON" = "xyes" ]]; then
1367 +      DEFINES="$DEFINES -DJIT_DEBUG=1"
1368 +    else
1369 +      AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug])
1370 +      WANT_JIT_DEBUG=no
1371 +    fi
1372 +  fi
1373 +
1374 +  dnl IEEE core is the only FPU emulator to use with the JIT compiler
1375 +  case $FPE_CORE_TEST_ORDER in
1376 +  ieee*) ;;
1377 +  *) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;;
1378 +  esac
1379 +  FPE_CORE_TEST_ORDER="ieee"
1380 + else
1381 +  WANT_JIT=no
1382 +  WANT_JIT_DEBUG=no
1383 +  JITSRCS=""
1384 + fi
1385 +
1386 + dnl Use 33-bit memory addressing?
1387 + if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then
1388 +  use_33bit_addressing=yes
1389 + fi
1390 + AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing",
1391 +  [Define to use 33-bit memory addressing on 64-bit JIT capable systems.])
1392 +
1393   dnl Utility macro used by next two tests.
1394   dnl AC_EXAMINE_OBJECT(C source code,
1395   dnl     commands examining object file,
# Line 985 | Line 1534 | AC_CHECK_HEADERS(ieee754.h ieeefp.h floa
1534   for fpe in $FPE_CORE_TEST_ORDER; do
1535    case $fpe in
1536    ieee)
1537 <    if echo "$ac_cv_c_float_format" | grep -q IEEE; then
1537 >    case $ac_cv_c_float_format in
1538 >    IEEE*)
1539        FPE_CORE="IEEE fpu core"
1540        DEFINES="$DEFINES -DFPU_IEEE"
1541        FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
1542 +      dnl Math functions not mandated by C99 standard
1543 +      AC_CHECK_FUNCS(isnanl isinfl)
1544 +      dnl Math functions required by C99 standard, but probably not
1545 +      dnl implemented everywhere. In that case, we fall back to the
1546 +      dnl regular variant for doubles.
1547 +      AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl)
1548 +      AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl)
1549 +      AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl)
1550 +      AC_CHECK_FUNCS(floorl ceill)
1551        break
1552 <    fi
1552 >      ;;
1553 >    esac
1554      ;;
1555    x86)
1556      if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then
# Line 1017 | Line 1577 | fi
1577  
1578   dnl Check for certain math functions
1579   AC_CHECK_FUNCS(atanh)
1580 < AC_CHECK_FUNCS(isnan isinf)             dnl C99
1021 < AC_CHECK_FUNCS(isnanl isinfl)   dnl IEEE ?
1580 > AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
1581  
1582   dnl UAE CPU sources for all non-m68k-native architectures.
1583   if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
1584    CPUINCLUDES="-I../uae_cpu"
1585 <  CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS"
1585 >  CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
1586   fi
1587  
1588   dnl Remove the "-g" option if set for GCC.
1589   if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1590 <  CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
1591 <  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1590 >  CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'`
1591 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
1592   fi
1593  
1594 < dnl Or if we have -Ofast
1595 < if [[ "x$HAVE_OFAST" = "xyes" ]]; then
1596 <  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
1597 <  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
1594 > dnl Or if we have -IPA (MIPSPro compilers)
1595 > if [[ "x$HAVE_IPA" = "xyes" ]]; then
1596 >  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1597 >  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1598    CXXFLAGS="-LANG:std $CXXFLAGS"
1599 <  LDFLAGS="$LDFLAGS -ipa"
1599 >  LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
1600   fi
1601  
1602   dnl Generate Makefile.
# Line 1045 | Line 1604 | AC_SUBST(DEFINES)
1604   AC_SUBST(SYSSRCS)
1605   AC_SUBST(CPUINCLUDES)
1606   AC_SUBST(CPUSRCS)
1607 < AC_OUTPUT(Makefile)
1607 > AC_SUBST(BLESS)
1608 > AC_SUBST(KEYCODES)
1609 > AC_CONFIG_FILES([Makefile])
1610 > AC_OUTPUT
1611  
1612   dnl Print summary.
1613   echo
1614   echo Basilisk II configuration summary:
1615   echo
1616 + echo SDL support ............................ : $SDL_SUPPORT
1617   echo XFree86 DGA support .................... : $WANT_XF86_DGA
1618   echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
1619   echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
# Line 1059 | Line 1622 | echo ESD sound support .................
1622   echo GTK user interface ..................... : $WANT_GTK
1623   echo mon debugger support ................... : $WANT_MON
1624   echo Running m68k code natively ............. : $WANT_NATIVE_M68K
1625 + echo Use JIT compiler ....................... : $WANT_JIT
1626 + echo JIT debug mode ......................... : $WANT_JIT_DEBUG
1627   echo Floating-Point emulation core .......... : $FPE_CORE
1628   echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
1629   echo Addressing mode ........................ : $ADDRESSING_MODE
1630 + echo Bad memory access recovery type ........ : $sigsegv_recovery
1631   echo
1632   echo "Configuration done. Now type \"make\" (or \"gmake\")."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines