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.53 by gbeauche, 2005-07-06T05:25:05Z

# 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 +
140 + dnl Do we need SDL?
141 + WANT_SDL=no
142 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
143 +  WANT_SDL=yes
144 +  WANT_XF86_DGA=no
145 +  WANT_XF86_VIDMODE=no
146 +  WANT_FBDEV_DGA=no
147 +  SDL_SUPPORT="$SDL_SUPPORT video"
148 + fi
149 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
150 +  WANT_SDL=yes
151 +  SDL_SUPPORT="$SDL_SUPPORT audio"
152 + fi
153 + if [[ "x$WANT_SDL" = "xyes" ]]; then
154 +  AC_PATH_PROG(sdl_config, "sdl-config")
155 +  if [[ -n "$sdl_config" ]]; then
156 +    case $target_os in
157 +    # Special treatment for Cygwin so that we can still use the POSIX layer
158 +    *cygwin*)
159 +      sdl_cflags="-I`$sdl_config --prefix`/include/SDL"
160 +      sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL"
161 +      ;;
162 +    *)
163 +      sdl_cflags=`$sdl_config --cflags`
164 +      if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
165 +        sdl_libs=`$sdl_config --static-libs`
166 +      else
167 +        sdl_libs=`$sdl_config --libs`
168 +      fi
169 +      ;;
170 +    esac
171 +    CFLAGS="$CFLAGS $sdl_cflags"
172 +    CXXFLAGS="$CXXFLAGS $sdl_cflags"
173 +    LIBS="$LIBS $sdl_libs"
174 +  else
175 +    WANT_SDL=no
176 +  fi
177 +  SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
178 + else
179 +  SDL_SUPPORT="none"
180 + fi
181  
182 < dnl We need X11.
183 < AC_PATH_XTRA
184 < if [[ "x$no_x" = "xyes" ]]; then
185 <  AC_MSG_ERROR([You need X11 to run Basilisk II.])
186 < fi
187 < CFLAGS="$CFLAGS $X_CFLAGS"
188 < CXXFLAGS="$CXXFLAGS $X_CFLAGS"
189 < LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
182 > dnl We need X11, if not using SDL.
183 > if [[ "x$WANT_SDL" = "xno" ]]; then
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"
191 > fi
192  
193   dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
194   HAVE_PTHREADS=yes
# Line 137 | Line 202 | AC_CHECK_LIB(pthread, pthread_create, ,
202   if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
203    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
204   fi
205 < AC_CHECK_FUNCS(pthread_cancel)
205 > AC_CHECK_FUNCS(pthread_cond_init)
206 > AC_CHECK_FUNCS(pthread_cancel pthread_testcancel)
207   AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
208   AC_CHECK_FUNCS(pthread_mutexattr_settype)
209   AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
# Line 181 | Line 247 | fi
247  
248   dnl We use GTK+ if possible.
249   UISRCS=../dummy/prefs_editor_dummy.cpp
250 < if [[ "x$WANT_GTK" = "xyes" ]]; then
250 > case "x$WANT_GTK" in
251 > xgtk2*)
252 >  AM_PATH_GTK_2_0(1.3.15, [
253 >    AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
254 >    CFLAGS="$CFLAGS $GTK_CFLAGS"
255 >    CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
256 >    LIBS="$LIBS $GTK_LIBS"
257 >    UISRCS=prefs_editor_gtk.cpp
258 >    WANT_GTK=gtk2
259 >  ], [
260 >    case "x${WANT_GTK}x" in
261 >    *gtkx)
262 >      AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
263 >      WANT_GTK=gtk
264 >      ;;
265 >    *)
266 >      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
267 >      WANT_GTK=no
268 >      ;;
269 >    esac
270 >  ])
271 >  ;;
272 > esac
273 > if [[ "x$WANT_GTK" = "xgtk" ]]; then
274    AM_PATH_GTK(1.2.0, [
275      AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
276      CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
# Line 220 | Line 309 | AC_SYS_LARGEFILE
309  
310   dnl Checks for header files.
311   AC_HEADER_STDC
312 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
312 > AC_CHECK_HEADERS(stdlib.h stdint.h)
313 > AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h)
314 > AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
315 > AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
316 > AC_CHECK_HEADERS(sys/poll.h sys/select.h)
317 > AC_CHECK_HEADERS(arpa/inet.h)
318 > AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
319 > #ifdef HAVE_SYS_TYPES_H
320 > #include <sys/types.h>
321 > #endif
322 > #ifdef HAVE_SYS_SOCKET_H
323 > #include <sys/socket.h>
324 > #endif
325 > ])
326 > AC_CHECK_HEADERS(AvailabilityMacros.h)
327 > AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
328  
329   dnl Checks for typedefs, structures, and compiler characteristics.
330   AC_C_BIGENDIAN
# Line 235 | Line 339 | AC_CHECK_SIZEOF(double, 8)
339   AC_CHECK_SIZEOF(long double, 12)
340   AC_CHECK_SIZEOF(void *, 4)
341   AC_TYPE_OFF_T
342 < AC_CHECK_TYPE(loff_t, off_t)
343 < AC_CHECK_TYPE(caddr_t, [char *])
342 > AC_CHECK_TYPES(loff_t)
343 > AC_CHECK_TYPES(caddr_t)
344   AC_TYPE_SIZE_T
345   AC_TYPE_SIGNAL
346   AC_HEADER_TIME
# Line 260 | Line 364 | if [[ "x$ac_cv_type_socklen_t" != "xyes"
364   fi
365  
366   dnl Checks for library functions.
367 < AC_CHECK_FUNCS(strdup cfmakeraw)
367 > AC_CHECK_FUNCS(strdup strerror cfmakeraw)
368   AC_CHECK_FUNCS(clock_gettime timer_create)
369   AC_CHECK_FUNCS(sigaction signal)
370   AC_CHECK_FUNCS(mmap mprotect munmap)
371   AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
372 + AC_CHECK_FUNCS(poll inet_aton)
373  
374   dnl Darwin seems to define mach_task_self() instead of task_self().
375   AC_CHECK_FUNCS(mach_task_self task_self)
# Line 291 | Line 396 | mips-sony-bsd|mips-sony-newsos4)
396   *-*-sco3.2v5*)
397          no_dev_ptmx=1
398          ;;
399 + *-*-cygwin*)
400 +        no_dev_ptmx=1
401 +        ;;
402   esac
403  
404   if test -z "$no_dev_ptmx" ; then
# Line 313 | Line 421 | AC_CHECK_FILE([/dev/ptc],
421   dnl (end of code from openssh-3.2.2p1 configure.ac)
422  
423  
424 + dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
425 + AC_DEFUN([AC_CHECK_FRAMEWORK], [
426 +  AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
427 +  AC_CACHE_CHECK([whether compiler supports framework $1],
428 +    ac_Framework, [
429 +    saved_LIBS="$LIBS"
430 +    LIBS="$LIBS -framework $1"
431 +    AC_TRY_LINK(
432 +      [$2], [int main(void) { return 0; }],
433 +      [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
434 +    )
435 +  ])
436 +  AS_IF([test AS_VAR_GET(ac_Framework) = yes],
437 +    [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
438 +  )
439 +  AS_VAR_POPDEF([ac_Framework])dnl
440 + ])
441 +
442 + dnl Check for some MacOS X frameworks
443 + AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
444 + AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
445 + AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
446 +
447   dnl Select system-dependant source files.
448   SERIALSRC=serial_unix.cpp
449   ETHERSRC=../dummy/ether_dummy.cpp
450   SCSISRC=../dummy/scsi_dummy.cpp
451   AUDIOSRC=../dummy/audio_dummy.cpp
452 + EXTFSSRC=extfs_unix.cpp
453   EXTRASYSSRCS=
454   CAN_NATIVE_M68K=no
455   case "$target_os" in
# Line 351 | Line 483 | freebsd*)
483    ;;
484   netbsd*)
485    CAN_NATIVE_M68K=yes
486 +  ETHERSRC=ether_unix.cpp
487    ;;
488   solaris*)
489    AUDIOSRC=Solaris/audio_solaris.cpp
# Line 373 | Line 506 | irix*)
506    dnl Do a test compile of an empty function
507    AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
508    CFLAGS="$ocflags"
509 <
509 >  ;;
510 > darwin*)
511 >  ETHERSRC=ether_unix.cpp
512 >  if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
513 >    EXTRASYSSRCS="../MacOSX/sys_darwin.cpp"
514 >  fi
515 >  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
516 >    EXTFSSRC=../MacOSX/extfs_macosx.mm
517 >  fi
518 >  ;;
519 > cygwin*)
520 >  SERIALSRC="../dummy/serial_dummy.cpp"
521 >  EXTRASYSSRCS="../Windows/BasiliskII.rc"
522    ;;
523   esac
524  
525 + dnl Is the slirp library supported?
526 + if [[ "x$ETHERSRC" = "xether_unix.cpp" ]]; then
527 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
528 +  SLIRP_SRCS="\
529 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
530 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
531 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
532 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
533 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
534 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
535 + fi
536 + AC_SUBST(SLIRP_SRCS)
537 +
538 + dnl SDL overrides
539 + if [[ "x$WANT_SDL" = "xyes" ]]; then
540 +  AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
541 + fi
542 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
543 +  AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
544 +  VIDEOSRCS="../SDL/video_sdl.cpp"
545 +  KEYCODES="../SDL/keycodes"
546 +  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
547 +    EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
548 +  else
549 +    case "$target_os" in
550 +    cygwin*)
551 +      EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
552 +      ;;
553 +    *)
554 +      EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
555 +      ;;
556 +    esac
557 +  fi
558 + else
559 +  VIDEOSRCS="video_x.cpp"
560 +  KEYCODES="keycodes"
561 +  EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp"
562 + fi
563 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
564 +  AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
565 +  AUDIOSRC="../SDL/audio_sdl.cpp"
566 + fi
567 +
568   dnl Use 68k CPU natively?
569   WANT_NATIVE_M68K=no
570   if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
# Line 391 | Line 579 | if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
579    ETHERSRC=../dummy/ether_dummy.cpp
580    AUDIOSRC=../dummy/audio_dummy.cpp
581   fi
582 < SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
582 > SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
583  
584   dnl Define a macro that translates a yesno-variable into a C macro definition
585   dnl to be put into the config.h file
586   dnl $1 -- the macro to define
587   dnl $2 -- the value to translate
588   dnl $3 -- template name
589 < AC_DEFUN(AC_TRANSLATE_DEFINE, [
589 > AC_DEFUN([AC_TRANSLATE_DEFINE], [
590      if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
591          AC_DEFINE($1, 1, $3)
592      fi
593   ])
594  
595 + dnl Check that the host supports TUN/TAP devices
596 + AC_CACHE_CHECK([whether TUN/TAP is supported],
597 +  ac_cv_tun_tap_support, [
598 +  AC_TRY_COMPILE([
599 +    #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
600 +    #include <linux/if.h>
601 +    #include <linux/if_tun.h>
602 +    #endif
603 +    #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
604 +    #include <net/if.h>
605 +    #include <net/if_tun.h>
606 +    #endif
607 +  ], [
608 +    struct ifreq ifr;
609 +    memset(&ifr, 0, sizeof(ifr));
610 +    ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
611 +  ],
612 +  ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
613 +  )
614 + ])
615 + AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
616 +  [Define if your system supports TUN/TAP devices.])
617 +
618   dnl Various checks if the system supports vm_allocate() and the like functions.
619   have_mach_vm=no
620   if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
# Line 550 | Line 761 | AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_
761  
762   fi dnl HAVE_MMAP_VM
763  
764 + dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
765 + AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
766 +  ac_cv_pagezero_hack, [
767 +  ac_cv_pagezero_hack=no
768 +  if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
769 +    ac_cv_pagezero_hack=yes
770 +    dnl might as well skip the test for mmap-able low memory
771 +    ac_cv_can_map_lm=no
772 +  fi
773 + ])
774 + AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
775 +  [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
776 +
777   dnl Check if we can mmap 0x2000 bytes from 0x0000
778   AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
779    ac_cv_can_map_lm, [
# Line 573 | Line 797 | AC_CACHE_CHECK([whether we can map Low M
797    ]
798   )
799  
800 + dnl Check if we have POSIX shared memory support
801 + AC_CACHE_CHECK([whether POSIX shared memory is working],
802 +  ac_cv_have_posix_shm, [
803 +  AC_LANG_SAVE
804 +  AC_LANG_CPLUSPLUS
805 +  AC_TRY_RUN([
806 +    #define HAVE_POSIX_SHM
807 +    #include "vm_alloc.cpp"
808 +    int main(void) { /* returns 0 if we have working POSIX shm */
809 +      if (vm_init() < 0) exit(2);
810 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
811 +      if (m1 == VM_MAP_FAILED) exit(3);
812 +      vm_exit(); exit(0);
813 +    }
814 +  ], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no,
815 +  dnl When cross-compiling, do not assume anything.
816 +  ac_cv_have_posix_shm="guessing no"
817 +  )
818 +  AC_LANG_RESTORE
819 +  ]
820 + )
821 + AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm",
822 +  [Define if your system supports POSIX shared memory.])
823 +
824 + dnl Check if we have working 33-bit memory addressing
825 + AC_CACHE_CHECK([whether 33-bit memory addressing is working],
826 +  ac_cv_have_33bit_addressing, [
827 +  AC_LANG_SAVE
828 +  AC_LANG_CPLUSPLUS
829 +  AC_TRY_RUN([
830 +    #define USE_33BIT_ADDRESSING 1
831 +    #include "vm_alloc.cpp"
832 +    int main(void) { /* returns 0 if we have working 33-bit addressing */
833 +      if (sizeof(void *) < 8) exit(1);
834 +      if (vm_init() < 0) exit(2);
835 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
836 +      if (m1 == VM_MAP_FAILED) exit(3);
837 +      char *m2 = m1 + (1L << 32);
838 +      m1[0] = 0x12; if (m2[0] != 0x12) exit(4);
839 +      m2[0] = 0x34; if (m1[0] != 0x34) exit(5);
840 +      vm_exit(); exit(0);
841 +    }
842 +  ], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no,
843 +  dnl When cross-compiling, do not assume anything.
844 +  ac_cv_have_33bit_addressing="guessing no"
845 +  )
846 +  AC_LANG_RESTORE
847 +  ]
848 + )
849 +
850   dnl Check signal handlers need to be reinstalled
851   AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
852    ac_cv_signal_need_reinstall, [
# Line 634 | Line 908 | AC_CACHE_CHECK([whether sigaction handle
908   AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
909    [Define if your system requires sigactions to be reinstalled.])
910  
911 < dnl Check if extended signals are supported.
912 < AC_CACHE_CHECK([whether your system supports extended signal handlers],
913 <  ac_cv_have_extended_signals, [
911 > dnl Check if Mach exceptions supported.
912 > AC_CACHE_CHECK([whether your system supports Mach exceptions],
913 >  ac_cv_have_mach_exceptions, [
914    AC_LANG_SAVE
915    AC_LANG_CPLUSPLUS
916    AC_TRY_RUN([
917 <    #define HAVE_SIGINFO_T 1
917 >    #define HAVE_MACH_EXCEPTIONS 1
918      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
919      #include "vm_alloc.cpp"
920      #include "sigsegv.cpp"
921 <  ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
921 >  ], [
922 >  sigsegv_recovery=mach
923 >  ac_cv_have_mach_exceptions=yes
924 >  ],
925 >  ac_cv_have_mach_exceptions=no,
926    dnl When cross-compiling, do not assume anything.
927 <  ac_cv_have_extended_signals=no
927 >  ac_cv_have_mach_exceptions=no
928    )
929    AC_LANG_RESTORE
930    ]
931   )
932 < AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
933 <  [Define if your system support extended signals.])
932 > AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
933 >  [Define if your system supports Mach exceptions.])
934 >
935 > dnl Check if Windows exceptions are supported.
936 > AC_CACHE_CHECK([whether your system supports Windows exceptions],
937 >  ac_cv_have_win32_exceptions, [
938 >  AC_LANG_SAVE
939 >  AC_LANG_CPLUSPLUS
940 >  AC_TRY_RUN([
941 >    #define HAVE_WIN32_EXCEPTIONS 1
942 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
943 >    #include "vm_alloc.cpp"
944 >    #include "sigsegv.cpp"
945 >  ], [
946 >  sigsegv_recovery=win32
947 >  ac_cv_have_win32_exceptions=yes
948 >  ],
949 >  ac_cv_have_win32_exceptions=no,
950 >  dnl When cross-compiling, do not assume anything.
951 >  ac_cv_have_win32_exceptions=no
952 >  )
953 >  AC_LANG_RESTORE
954 >  ]
955 > )
956 > AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
957 >  [Define if your system supports Windows exceptions.])
958 >
959 > dnl Otherwise, check if extended signals are supported.
960 > if [[ -z "$sigsegv_recovery" ]]; then
961 >  AC_CACHE_CHECK([whether your system supports extended signal handlers],
962 >    ac_cv_have_extended_signals, [
963 >    AC_LANG_SAVE
964 >    AC_LANG_CPLUSPLUS
965 >    AC_TRY_RUN([
966 >      #define HAVE_SIGINFO_T 1
967 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
968 >      #include "vm_alloc.cpp"
969 >      #include "sigsegv.cpp"
970 >    ], [
971 >    sigsegv_recovery=siginfo
972 >    ac_cv_have_extended_signals=yes
973 >    ],
974 >    ac_cv_have_extended_signals=no,
975 >    dnl When cross-compiling, do not assume anything.
976 >    ac_cv_have_extended_signals=no
977 >    )
978 >    AC_LANG_RESTORE
979 >    ]
980 >  )
981 >  AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
982 >    [Define if your system support extended signals.])
983 > fi
984  
985   dnl Otherwise, check for subterfuges.
986 < if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
986 > if [[ -z "$sigsegv_recovery" ]]; then
987    AC_CACHE_CHECK([whether we then have a subterfuge for your system],
988    ac_cv_have_sigcontext_hack, [
989      AC_LANG_SAVE
# Line 665 | Line 993 | if [[ "x$ac_cv_have_extended_signals" =
993        #define CONFIGURE_TEST_SIGSEGV_RECOVERY
994        #include "vm_alloc.cpp"
995        #include "sigsegv.cpp"
996 <    ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
996 >    ], [
997 >    sigsegv_recovery=sigcontext
998 >    ac_cv_have_sigcontext_hack=yes
999 >    ],
1000 >    ac_cv_have_sigcontext_hack=no,
1001      dnl When cross-compiling, do not assume anything.
1002      ac_cv_have_sigcontext_hack=no
1003      )
# Line 697 | Line 1029 | AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_IN
1029  
1030   dnl Can we do Video on SEGV Signals ?
1031   CAN_VOSF=no
1032 < if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
1032 > if [[ -n "$sigsegv_recovery" ]]; then
1033    CAN_VOSF=yes
1034   fi
1035  
1036 + dnl A dummy program that returns always true
1037 + AC_PATH_PROG([BLESS], "true")
1038 +
1039   dnl Determine the addressing mode to use
1040   if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
1041    ADDRESSING_MODE="real"
# Line 711 | Line 1046 | else
1046      case $am in
1047      real)
1048        dnl Requires ability to mmap() Low Memory globals
1049 <      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
1049 >      if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
1050          continue
1051        fi
1052 <          dnl Requires VOSF screen updates
1052 >      dnl Requires VOSF screen updates
1053        if [[ "x$CAN_VOSF" = "xno" ]]; then
1054          continue
1055        fi
# Line 722 | Line 1057 | else
1057        ADDRESSING_MODE="real"
1058        WANT_VOSF=yes dnl we can use VOSF and we need it actually
1059        DEFINES="$DEFINES -DREAL_ADDRESSING"
1060 +      if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
1061 +        BLESS=Darwin/lowmem
1062 +        LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
1063 +      fi
1064        break
1065        ;;
1066      direct)
# Line 774 | Line 1113 | AC_MSG_RESULT($HAVE_GAS)
1113   dnl Check for GCC 2.7 or higher.
1114   HAVE_GCC27=no
1115   AC_MSG_CHECKING(for GCC 2.7 or higher)
1116 < AC_EGREP_CPP(xyes,
1117 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1118 <  xyes
1119 < #endif
1120 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1116 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1117 >                                     # error gcc < 2.7
1118 >                                     #endif
1119 >                                   ]])],
1120 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1121 >                  [AC_MSG_RESULT(no)])
1122  
1123   dnl Check for GCC 3.0 or higher.
1124   HAVE_GCC30=no
1125   AC_MSG_CHECKING(for GCC 3.0 or higher)
1126 < AC_EGREP_CPP(xyes,
1127 < [#if __GNUC__ >= 3
1128 <  xyes
1129 < #endif
1130 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1126 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1127 >                                     # error gcc < 3
1128 >                                     #endif
1129 >                                   ]])],
1130 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1131 >                  [AC_MSG_RESULT(no)])
1132 >
1133 > dnl Check for ICC.
1134 > AC_MSG_CHECKING(for ICC)
1135 > HAVE_ICC=no
1136 > if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
1137 >  HAVE_ICC=yes
1138 > fi
1139 > AC_MSG_RESULT($HAVE_ICC)
1140  
1141   dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
1142   dnl Also set "-fno-exceptions" for C++ because exception handling requires
# Line 802 | Line 1151 | dnl As of 2001/08/02, this affects the f
1151   dnl Official: probably gcc-3.1 (mainline CVS)
1152   dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
1153   dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
1154 < if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1154 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1155    SAVED_CXXFLAGS="$CXXFLAGS"
1156    CXXFLAGS="$CXXFLAGS -fno-merge-constants"
1157    AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
# Line 816 | Line 1165 | if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1165    fi
1166   fi
1167  
1168 + dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4
1169 + dnl However, there are some corner cases exposed on x86-64
1170 + if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1171 +  SAVED_CXXFLAGS="$CXXFLAGS"
1172 +  CXXFLAGS="$CXXFLAGS -fno-gcse-sm"
1173 +  AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [
1174 +    AC_LANG_SAVE
1175 +    AC_LANG_CPLUSPLUS
1176 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_store_motion=yes],[ac_cv_gcc_store_motion=no])
1177 +    AC_LANG_RESTORE
1178 +  ])
1179 +  if [[ "x$ac_cv_gcc_store_motion" != "xyes" ]]; then
1180 +    CXXFLAGS="$SAVED_CXXFLAGS"
1181 +  fi
1182 + fi
1183 +
1184 + dnl Add -fno-strict-aliasing for slirp sources
1185 + if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1186 +  SAVED_CFLAGS="$CFLAGS"
1187 +  CFLAGS="$CFLAGS -fno-strict-aliasing"
1188 +  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1189 +    ac_cv_gcc_no_strict_aliasing, [
1190 +    AC_TRY_COMPILE([],[],
1191 +      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1192 +      [ac_cv_gcc_no_strict_aliasing=no])
1193 +  ])
1194 +  CFLAGS="$SAVED_CFLAGS"
1195 + fi
1196 +
1197 + dnl Add -mdynamic-no-pic for MacOS X
1198 + if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1199 +  SAVED_CFLAGS="$CFLAGS"
1200 +  CFLAGS="$CFLAGS -mdynamic-no-pic"
1201 +  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1202 +    ac_cv_gcc_mdynamic_no_pic, [
1203 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1204 +  ])
1205 +  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1206 +    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1207 +  else
1208 +    CFLAGS="$SAVED_CFLAGS"
1209 +  fi
1210 + fi
1211 +
1212   dnl Select appropriate CPU source and REGPARAM define.
1213   ASM_OPTIMIZATIONS=none
1214   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
# Line 840 | Line 1233 | elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HA
1233    if [[ "x$HAVE_GAS" = "xyes" ]]; then
1234      ASM_OPTIMIZATIONS="x86-64"
1235      DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
1236 +    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"
1237 +    CAN_JIT=yes
1238 +    WANT_33BIT_ADDRESSING=yes
1239    fi
1240   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
1241    dnl SPARC CPU
# Line 896 | Line 1292 | else
1292    JITSRCS=""
1293   fi
1294  
1295 + dnl Use 33-bit memory addressing?
1296 + if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then
1297 +  use_33bit_addressing=yes
1298 + fi
1299 + AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing",
1300 +  [Define to use 33-bit memory addressing on 64-bit JIT capable systems.])
1301 +
1302   dnl Utility macro used by next two tests.
1303   dnl AC_EXAMINE_OBJECT(C source code,
1304   dnl     commands examining object file,
# Line 1093 | Line 1496 | fi
1496  
1497   dnl Remove the "-g" option if set for GCC.
1498   if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1499 <  CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
1500 <  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1499 >  CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'`
1500 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
1501   fi
1502  
1503   dnl Or if we have -IPA (MIPSPro compilers)
# Line 1110 | Line 1513 | AC_SUBST(DEFINES)
1513   AC_SUBST(SYSSRCS)
1514   AC_SUBST(CPUINCLUDES)
1515   AC_SUBST(CPUSRCS)
1516 + AC_SUBST(BLESS)
1517 + AC_SUBST(KEYCODES)
1518   AC_CONFIG_FILES([Makefile])
1519   AC_OUTPUT
1520  
# Line 1117 | Line 1522 | dnl Print summary.
1522   echo
1523   echo Basilisk II configuration summary:
1524   echo
1525 + echo SDL support ............................ : $SDL_SUPPORT
1526   echo XFree86 DGA support .................... : $WANT_XF86_DGA
1527   echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
1528   echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
# Line 1130 | Line 1536 | echo JIT debug mode ....................
1536   echo Floating-Point emulation core .......... : $FPE_CORE
1537   echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
1538   echo Addressing mode ........................ : $ADDRESSING_MODE
1539 + echo Bad memory access recovery type ........ : $sigsegv_recovery
1540   echo
1541   echo "Configuration done. Now type \"make\" (or \"gmake\")."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines