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.18 by gbeauche, 2003-08-17T10:16:23Z vs.
Revision 1.60 by gbeauche, 2006-01-27T23:49:01Z

# Line 6 | Line 6 | AC_CONFIG_SRCDIR(main_unix.cpp)
6   AC_PREREQ(2.52)
7   AC_CONFIG_HEADER(config.h)
8  
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])
# Line 47 | 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 86 | 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 104 | 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)
107    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 115 | 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 137 | 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)
# Line 181 | 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"
# Line 220 | 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 235 | 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 260 | 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 291 | 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 313 | 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(Carbon, [#include <Carbon/Carbon.h>])
499 + AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
500 + AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
501 +
502   dnl Select system-dependant source files.
503   SERIALSRC=serial_unix.cpp
504   ETHERSRC=../dummy/ether_dummy.cpp
505   SCSISRC=../dummy/scsi_dummy.cpp
506   AUDIOSRC=../dummy/audio_dummy.cpp
507 + EXTFSSRC=extfs_unix.cpp
508   EXTRASYSSRCS=
509   CAN_NATIVE_M68K=no
510   case "$target_os" in
# Line 351 | Line 538 | freebsd*)
538    ;;
539   netbsd*)
540    CAN_NATIVE_M68K=yes
541 +  ETHERSRC=ether_unix.cpp
542    ;;
543   solaris*)
544    AUDIOSRC=Solaris/audio_solaris.cpp
545    DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
546    ;;
547   irix*)
360  ETHERSRC=ether_unix.cpp
548    AUDIOSRC=Irix/audio_irix.cpp
549    EXTRASYSSRCS=Irix/unaligned.c
363  dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
364  DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
550    LIBS="$LIBS -laudio"
551    WANT_ESD=no
552  
# Line 371 | Line 556 | irix*)
556    CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"`
557    AC_MSG_CHECKING(if "-IPA" works)
558    dnl Do a test compile of an empty function
559 <  AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
559 >  AC_TRY_COMPILE([#if defined __GNUC__
560 >                  # error GCC does not support IPA yet
561 >                  #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
562    CFLAGS="$ocflags"
563 +  ;;
564 + darwin*)
565 +  ETHERSRC=ether_unix.cpp
566 +  if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
567 +    EXTRASYSSRCS="../MacOSX/sys_darwin.cpp"
568 +  fi
569 +  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
570 +    EXTFSSRC=../MacOSX/extfs_macosx.mm
571 +  fi
572 +  ;;
573 + cygwin*)
574 +  SERIALSRC="../dummy/serial_dummy.cpp"
575 +  EXTRASYSSRCS="../Windows/BasiliskII.rc"
576 +  ;;
577 + esac
578  
579 + dnl Is the slirp library supported?
580 + case "$ac_cv_have_byte_bitfields" in
581 + yes|"guessing yes")
582 +  CAN_SLIRP=yes
583 +  ETHERSRC=ether_unix.cpp
584    ;;
585   esac
586 + if [[ -n "$CAN_SLIRP" ]]; then
587 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
588 +  SLIRP_SRCS="\
589 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
590 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
591 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
592 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
593 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
594 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
595 + fi
596 + AC_SUBST(SLIRP_SRCS)
597 +
598 + dnl SDL overrides
599 + if [[ "x$WANT_SDL" = "xyes" ]]; then
600 +  AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
601 + fi
602 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
603 +  AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
604 +  VIDEOSRCS="../SDL/video_sdl.cpp"
605 +  KEYCODES="../SDL/keycodes"
606 +  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
607 +    EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
608 +  else
609 +    case "$target_os" in
610 +    cygwin*)
611 +      EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
612 +      ;;
613 +    *)
614 +      EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
615 +      ;;
616 +    esac
617 +  fi
618 + else
619 +  VIDEOSRCS="video_x.cpp"
620 +  KEYCODES="keycodes"
621 +  EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp"
622 + fi
623 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
624 +  AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
625 +  AUDIOSRC="../SDL/audio_sdl.cpp"
626 + fi
627  
628   dnl Use 68k CPU natively?
629   WANT_NATIVE_M68K=no
# Line 391 | Line 639 | if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
639    ETHERSRC=../dummy/ether_dummy.cpp
640    AUDIOSRC=../dummy/audio_dummy.cpp
641   fi
642 < SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
642 > SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
643  
644   dnl Define a macro that translates a yesno-variable into a C macro definition
645   dnl to be put into the config.h file
646   dnl $1 -- the macro to define
647   dnl $2 -- the value to translate
648   dnl $3 -- template name
649 < AC_DEFUN(AC_TRANSLATE_DEFINE, [
649 > AC_DEFUN([AC_TRANSLATE_DEFINE], [
650      if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
651          AC_DEFINE($1, 1, $3)
652      fi
653   ])
654  
655 + dnl Check that the host supports TUN/TAP devices
656 + AC_CACHE_CHECK([whether TUN/TAP is supported],
657 +  ac_cv_tun_tap_support, [
658 +  AC_TRY_COMPILE([
659 +    #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
660 +    #include <linux/if.h>
661 +    #include <linux/if_tun.h>
662 +    #endif
663 +    #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
664 +    #include <net/if.h>
665 +    #include <net/if_tun.h>
666 +    #endif
667 +  ], [
668 +    struct ifreq ifr;
669 +    memset(&ifr, 0, sizeof(ifr));
670 +    ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
671 +  ],
672 +  ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
673 +  )
674 + ])
675 + AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
676 +  [Define if your system supports TUN/TAP devices.])
677 +
678   dnl Various checks if the system supports vm_allocate() and the like functions.
679   have_mach_vm=no
680   if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
# Line 550 | Line 821 | AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_
821  
822   fi dnl HAVE_MMAP_VM
823  
824 + dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
825 + AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
826 +  ac_cv_pagezero_hack, [
827 +  ac_cv_pagezero_hack=no
828 +  if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
829 +    ac_cv_pagezero_hack=yes
830 +    dnl might as well skip the test for mmap-able low memory
831 +    ac_cv_can_map_lm=no
832 +  fi
833 + ])
834 + AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
835 +  [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
836 +
837   dnl Check if we can mmap 0x2000 bytes from 0x0000
838   AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
839    ac_cv_can_map_lm, [
# Line 573 | Line 857 | AC_CACHE_CHECK([whether we can map Low M
857    ]
858   )
859  
860 + dnl Check if we have POSIX shared memory support
861 + AC_CACHE_CHECK([whether POSIX shared memory is working],
862 +  ac_cv_have_posix_shm, [
863 +  AC_LANG_SAVE
864 +  AC_LANG_CPLUSPLUS
865 +  AC_TRY_RUN([
866 +    #define HAVE_POSIX_SHM
867 +    #include "vm_alloc.cpp"
868 +    int main(void) { /* returns 0 if we have working POSIX shm */
869 +      if (vm_init() < 0) exit(2);
870 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
871 +      if (m1 == VM_MAP_FAILED) exit(3);
872 +      vm_exit(); exit(0);
873 +    }
874 +  ], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no,
875 +  dnl When cross-compiling, do not assume anything.
876 +  ac_cv_have_posix_shm="guessing no"
877 +  )
878 +  AC_LANG_RESTORE
879 +  ]
880 + )
881 + AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm",
882 +  [Define if your system supports POSIX shared memory.])
883 +
884 + dnl Check if we have working 33-bit memory addressing
885 + AC_CACHE_CHECK([whether 33-bit memory addressing is working],
886 +  ac_cv_have_33bit_addressing, [
887 +  AC_LANG_SAVE
888 +  AC_LANG_CPLUSPLUS
889 +  AC_TRY_RUN([
890 +    #define USE_33BIT_ADDRESSING 1
891 +    #include "vm_alloc.cpp"
892 +    int main(void) { /* returns 0 if we have working 33-bit addressing */
893 +      if (sizeof(void *) < 8) exit(1);
894 +      if (vm_init() < 0) exit(2);
895 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
896 +      if (m1 == VM_MAP_FAILED) exit(3);
897 +      char *m2 = m1 + (1L << 32);
898 +      m1[0] = 0x12; if (m2[0] != 0x12) exit(4);
899 +      m2[0] = 0x34; if (m1[0] != 0x34) exit(5);
900 +      vm_exit(); exit(0);
901 +    }
902 +  ], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no,
903 +  dnl When cross-compiling, do not assume anything.
904 +  ac_cv_have_33bit_addressing="guessing no"
905 +  )
906 +  AC_LANG_RESTORE
907 +  ]
908 + )
909 +
910   dnl Check signal handlers need to be reinstalled
911   AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
912    ac_cv_signal_need_reinstall, [
# Line 634 | Line 968 | AC_CACHE_CHECK([whether sigaction handle
968   AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
969    [Define if your system requires sigactions to be reinstalled.])
970  
971 < dnl Check if extended signals are supported.
972 < AC_CACHE_CHECK([whether your system supports extended signal handlers],
973 <  ac_cv_have_extended_signals, [
971 > dnl Check if Mach exceptions supported.
972 > AC_CACHE_CHECK([whether your system supports Mach exceptions],
973 >  ac_cv_have_mach_exceptions, [
974 >  AC_LANG_SAVE
975 >  AC_LANG_CPLUSPLUS
976 >  AC_TRY_RUN([
977 >    #define HAVE_MACH_EXCEPTIONS 1
978 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
979 >    #include "vm_alloc.cpp"
980 >    #include "sigsegv.cpp"
981 >  ], [
982 >  sigsegv_recovery=mach
983 >  ac_cv_have_mach_exceptions=yes
984 >  ],
985 >  ac_cv_have_mach_exceptions=no,
986 >  dnl When cross-compiling, do not assume anything.
987 >  ac_cv_have_mach_exceptions=no
988 >  )
989 >  AC_LANG_RESTORE
990 >  ]
991 > )
992 > AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
993 >  [Define if your system supports Mach exceptions.])
994 >
995 > dnl Check if Windows exceptions are supported.
996 > AC_CACHE_CHECK([whether your system supports Windows exceptions],
997 >  ac_cv_have_win32_exceptions, [
998    AC_LANG_SAVE
999    AC_LANG_CPLUSPLUS
1000    AC_TRY_RUN([
1001 <    #define HAVE_SIGINFO_T 1
1001 >    #define HAVE_WIN32_EXCEPTIONS 1
1002      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
1003      #include "vm_alloc.cpp"
1004      #include "sigsegv.cpp"
1005 <  ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
1005 >  ], [
1006 >  sigsegv_recovery=win32
1007 >  ac_cv_have_win32_exceptions=yes
1008 >  ],
1009 >  ac_cv_have_win32_exceptions=no,
1010    dnl When cross-compiling, do not assume anything.
1011 <  ac_cv_have_extended_signals=no
1011 >  ac_cv_have_win32_exceptions=no
1012    )
1013    AC_LANG_RESTORE
1014    ]
1015   )
1016 < AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
1017 <  [Define if your system support extended signals.])
1016 > AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
1017 >  [Define if your system supports Windows exceptions.])
1018 >
1019 > dnl Otherwise, check if extended signals are supported.
1020 > if [[ -z "$sigsegv_recovery" ]]; then
1021 >  AC_CACHE_CHECK([whether your system supports extended signal handlers],
1022 >    ac_cv_have_extended_signals, [
1023 >    AC_LANG_SAVE
1024 >    AC_LANG_CPLUSPLUS
1025 >    AC_TRY_RUN([
1026 >      #define HAVE_SIGINFO_T 1
1027 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
1028 >      #include "vm_alloc.cpp"
1029 >      #include "sigsegv.cpp"
1030 >    ], [
1031 >    sigsegv_recovery=siginfo
1032 >    ac_cv_have_extended_signals=yes
1033 >    ],
1034 >    ac_cv_have_extended_signals=no,
1035 >    dnl When cross-compiling, do not assume anything.
1036 >    ac_cv_have_extended_signals=no
1037 >    )
1038 >    AC_LANG_RESTORE
1039 >    ]
1040 >  )
1041 >  AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
1042 >    [Define if your system support extended signals.])
1043 > fi
1044  
1045   dnl Otherwise, check for subterfuges.
1046 < if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
1046 > if [[ -z "$sigsegv_recovery" ]]; then
1047    AC_CACHE_CHECK([whether we then have a subterfuge for your system],
1048    ac_cv_have_sigcontext_hack, [
1049      AC_LANG_SAVE
# Line 665 | Line 1053 | if [[ "x$ac_cv_have_extended_signals" =
1053        #define CONFIGURE_TEST_SIGSEGV_RECOVERY
1054        #include "vm_alloc.cpp"
1055        #include "sigsegv.cpp"
1056 <    ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
1056 >    ], [
1057 >    sigsegv_recovery=sigcontext
1058 >    ac_cv_have_sigcontext_hack=yes
1059 >    ],
1060 >    ac_cv_have_sigcontext_hack=no,
1061      dnl When cross-compiling, do not assume anything.
1062      ac_cv_have_sigcontext_hack=no
1063      )
# Line 697 | Line 1089 | AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_IN
1089  
1090   dnl Can we do Video on SEGV Signals ?
1091   CAN_VOSF=no
1092 < if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
1092 > if [[ -n "$sigsegv_recovery" ]]; then
1093    CAN_VOSF=yes
1094   fi
1095  
1096 + dnl A dummy program that returns always true
1097 + AC_PATH_PROG([BLESS], "true")
1098 +
1099   dnl Determine the addressing mode to use
1100   if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
1101    ADDRESSING_MODE="real"
# Line 711 | Line 1106 | else
1106      case $am in
1107      real)
1108        dnl Requires ability to mmap() Low Memory globals
1109 <      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
1109 >      if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
1110          continue
1111        fi
1112 <          dnl Requires VOSF screen updates
1112 >      dnl Requires VOSF screen updates
1113        if [[ "x$CAN_VOSF" = "xno" ]]; then
1114          continue
1115        fi
# Line 722 | Line 1117 | else
1117        ADDRESSING_MODE="real"
1118        WANT_VOSF=yes dnl we can use VOSF and we need it actually
1119        DEFINES="$DEFINES -DREAL_ADDRESSING"
1120 +      if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
1121 +        BLESS=Darwin/lowmem
1122 +        LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
1123 +      fi
1124        break
1125        ;;
1126      direct)
# Line 774 | Line 1173 | AC_MSG_RESULT($HAVE_GAS)
1173   dnl Check for GCC 2.7 or higher.
1174   HAVE_GCC27=no
1175   AC_MSG_CHECKING(for GCC 2.7 or higher)
1176 < AC_EGREP_CPP(xyes,
1177 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1178 <  xyes
1179 < #endif
1180 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1176 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1177 >                                     # error gcc < 2.7
1178 >                                     #endif
1179 >                                   ]])],
1180 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1181 >                  [AC_MSG_RESULT(no)])
1182  
1183   dnl Check for GCC 3.0 or higher.
1184   HAVE_GCC30=no
1185   AC_MSG_CHECKING(for GCC 3.0 or higher)
1186 < AC_EGREP_CPP(xyes,
1187 < [#if __GNUC__ >= 3
1188 <  xyes
1189 < #endif
1190 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1186 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1187 >                                     # error gcc < 3
1188 >                                     #endif
1189 >                                   ]])],
1190 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1191 >                  [AC_MSG_RESULT(no)])
1192 >
1193 > dnl Check for ICC.
1194 > AC_MSG_CHECKING(for ICC)
1195 > HAVE_ICC=no
1196 > if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
1197 >  HAVE_ICC=yes
1198 > fi
1199 > AC_MSG_RESULT($HAVE_ICC)
1200  
1201   dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
1202   dnl Also set "-fno-exceptions" for C++ because exception handling requires
# Line 802 | Line 1211 | dnl As of 2001/08/02, this affects the f
1211   dnl Official: probably gcc-3.1 (mainline CVS)
1212   dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
1213   dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
1214 < if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1214 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1215    SAVED_CXXFLAGS="$CXXFLAGS"
1216    CXXFLAGS="$CXXFLAGS -fno-merge-constants"
1217    AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
# Line 816 | Line 1225 | if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1225    fi
1226   fi
1227  
1228 + dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4
1229 + dnl However, there are some corner cases exposed on x86-64
1230 + if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1231 +  SAVED_CXXFLAGS="$CXXFLAGS"
1232 +  CXXFLAGS="$CXXFLAGS -fno-gcse-sm"
1233 +  AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [
1234 +    AC_LANG_SAVE
1235 +    AC_LANG_CPLUSPLUS
1236 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_store_motion=yes],[ac_cv_gcc_store_motion=no])
1237 +    AC_LANG_RESTORE
1238 +  ])
1239 +  if [[ "x$ac_cv_gcc_store_motion" != "xyes" ]]; then
1240 +    CXXFLAGS="$SAVED_CXXFLAGS"
1241 +  fi
1242 + fi
1243 +
1244 + dnl Add -fno-strict-aliasing for slirp sources
1245 + if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1246 +  SAVED_CFLAGS="$CFLAGS"
1247 +  CFLAGS="$CFLAGS -fno-strict-aliasing"
1248 +  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1249 +    ac_cv_gcc_no_strict_aliasing, [
1250 +    AC_TRY_COMPILE([],[],
1251 +      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1252 +      [ac_cv_gcc_no_strict_aliasing=no])
1253 +  ])
1254 +  CFLAGS="$SAVED_CFLAGS"
1255 + fi
1256 +
1257 + dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1258 + if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1259 +  SAVED_CFLAGS="$CFLAGS"
1260 +  CFLAGS="$CFLAGS -mdynamic-no-pic"
1261 +  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1262 +    ac_cv_gcc_mdynamic_no_pic, [
1263 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1264 +  ])
1265 +  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1266 +    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1267 +  else
1268 +    CFLAGS="$SAVED_CFLAGS"
1269 +  fi
1270 + fi
1271 +
1272   dnl Select appropriate CPU source and REGPARAM define.
1273   ASM_OPTIMIZATIONS=none
1274   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
# Line 840 | Line 1293 | elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HA
1293    if [[ "x$HAVE_GAS" = "xyes" ]]; then
1294      ASM_OPTIMIZATIONS="x86-64"
1295      DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
1296 +    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"
1297 +    CAN_JIT=yes
1298 +    WANT_33BIT_ADDRESSING=yes
1299    fi
1300   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
1301    dnl SPARC CPU
# Line 896 | Line 1352 | else
1352    JITSRCS=""
1353   fi
1354  
1355 + dnl Use 33-bit memory addressing?
1356 + if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then
1357 +  use_33bit_addressing=yes
1358 + fi
1359 + AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing",
1360 +  [Define to use 33-bit memory addressing on 64-bit JIT capable systems.])
1361 +
1362   dnl Utility macro used by next two tests.
1363   dnl AC_EXAMINE_OBJECT(C source code,
1364   dnl     commands examining object file,
# Line 1093 | Line 1556 | fi
1556  
1557   dnl Remove the "-g" option if set for GCC.
1558   if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1559 <  CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
1560 <  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1559 >  CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'`
1560 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
1561   fi
1562  
1563   dnl Or if we have -IPA (MIPSPro compilers)
# Line 1110 | Line 1573 | AC_SUBST(DEFINES)
1573   AC_SUBST(SYSSRCS)
1574   AC_SUBST(CPUINCLUDES)
1575   AC_SUBST(CPUSRCS)
1576 + AC_SUBST(BLESS)
1577 + AC_SUBST(KEYCODES)
1578   AC_CONFIG_FILES([Makefile])
1579   AC_OUTPUT
1580  
# Line 1117 | Line 1582 | dnl Print summary.
1582   echo
1583   echo Basilisk II configuration summary:
1584   echo
1585 + echo SDL support ............................ : $SDL_SUPPORT
1586   echo XFree86 DGA support .................... : $WANT_XF86_DGA
1587   echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
1588   echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
# Line 1130 | Line 1596 | echo JIT debug mode ....................
1596   echo Floating-Point emulation core .......... : $FPE_CORE
1597   echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
1598   echo Addressing mode ........................ : $ADDRESSING_MODE
1599 + echo Bad memory access recovery type ........ : $sigsegv_recovery
1600   echo
1601   echo "Configuration done. Now type \"make\" (or \"gmake\")."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines