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.20 by gbeauche, 2003-08-17T11:58:00Z vs.
Revision 1.56 by gbeauche, 2005-12-04T15:45:09Z

# Line 7 | Line 7 | AC_PREREQ(2.52)
7   AC_CONFIG_HEADER(config.h)
8  
9   dnl Aliases for PACKAGE and VERSION macros.
10 < AC_DEFINE(PACKAGE, PACKAGE_NAME, [Alias to PACKAGE for i18n.])
11 < AC_DEFINE(VERSION, PACKAGE_VERSION, [Alias to VERSION for i18n.])
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])
# Line 16 | Line 20 | AC_ARG_ENABLE(xf86-vidmode,  [  --enable
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 51 | 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 90 | 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 118 | 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 140 | 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 184 | 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 223 | 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 239 | 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 264 | 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 295 | 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 317 | Line 422 | AC_CHECK_FILE([/dev/ptc],
422   dnl (end of code from openssh-3.2.2p1 configure.ac)
423  
424  
425 + dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
426 + AC_DEFUN([AC_CHECK_FRAMEWORK], [
427 +  AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
428 +  AC_CACHE_CHECK([whether compiler supports framework $1],
429 +    ac_Framework, [
430 +    saved_LIBS="$LIBS"
431 +    LIBS="$LIBS -framework $1"
432 +    AC_TRY_LINK(
433 +      [$2], [int main(void) { return 0; }],
434 +      [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
435 +    )
436 +  ])
437 +  AS_IF([test AS_VAR_GET(ac_Framework) = yes],
438 +    [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
439 +  )
440 +  AS_VAR_POPDEF([ac_Framework])dnl
441 + ])
442 +
443 + dnl Check for some MacOS X frameworks
444 + AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
445 + AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
446 + AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
447 +
448   dnl Select system-dependant source files.
449   SERIALSRC=serial_unix.cpp
450   ETHERSRC=../dummy/ether_dummy.cpp
451   SCSISRC=../dummy/scsi_dummy.cpp
452   AUDIOSRC=../dummy/audio_dummy.cpp
453 + EXTFSSRC=extfs_unix.cpp
454   EXTRASYSSRCS=
455   CAN_NATIVE_M68K=no
456   case "$target_os" in
# Line 355 | Line 484 | freebsd*)
484    ;;
485   netbsd*)
486    CAN_NATIVE_M68K=yes
487 +  ETHERSRC=ether_unix.cpp
488    ;;
489   solaris*)
490    AUDIOSRC=Solaris/audio_solaris.cpp
# Line 364 | Line 494 | irix*)
494    ETHERSRC=ether_unix.cpp
495    AUDIOSRC=Irix/audio_irix.cpp
496    EXTRASYSSRCS=Irix/unaligned.c
367  dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
368  DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
497    LIBS="$LIBS -laudio"
498    WANT_ESD=no
499  
# Line 375 | Line 503 | irix*)
503    CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"`
504    AC_MSG_CHECKING(if "-IPA" works)
505    dnl Do a test compile of an empty function
506 <  AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
506 >  AC_TRY_COMPILE([#if defined __GNUC__
507 >                  # error GCC does not support IPA yet
508 >                  #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
509    CFLAGS="$ocflags"
510 <
510 >  ;;
511 > darwin*)
512 >  ETHERSRC=ether_unix.cpp
513 >  if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
514 >    EXTRASYSSRCS="../MacOSX/sys_darwin.cpp"
515 >  fi
516 >  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
517 >    EXTFSSRC=../MacOSX/extfs_macosx.mm
518 >  fi
519 >  ;;
520 > cygwin*)
521 >  SERIALSRC="../dummy/serial_dummy.cpp"
522 >  EXTRASYSSRCS="../Windows/BasiliskII.rc"
523    ;;
524   esac
525  
526 + dnl Is the slirp library supported?
527 + if [[ "x$ETHERSRC" = "xether_unix.cpp" ]]; then
528 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
529 +  SLIRP_SRCS="\
530 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
531 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
532 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
533 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
534 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
535 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
536 + fi
537 + AC_SUBST(SLIRP_SRCS)
538 +
539 + dnl SDL overrides
540 + if [[ "x$WANT_SDL" = "xyes" ]]; then
541 +  AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
542 + fi
543 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
544 +  AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
545 +  VIDEOSRCS="../SDL/video_sdl.cpp"
546 +  KEYCODES="../SDL/keycodes"
547 +  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
548 +    EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
549 +  else
550 +    case "$target_os" in
551 +    cygwin*)
552 +      EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
553 +      ;;
554 +    *)
555 +      EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
556 +      ;;
557 +    esac
558 +  fi
559 + else
560 +  VIDEOSRCS="video_x.cpp"
561 +  KEYCODES="keycodes"
562 +  EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp"
563 + fi
564 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
565 +  AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
566 +  AUDIOSRC="../SDL/audio_sdl.cpp"
567 + fi
568 +
569   dnl Use 68k CPU natively?
570   WANT_NATIVE_M68K=no
571   if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
# Line 395 | Line 580 | if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
580    ETHERSRC=../dummy/ether_dummy.cpp
581    AUDIOSRC=../dummy/audio_dummy.cpp
582   fi
583 < SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
583 > SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
584  
585   dnl Define a macro that translates a yesno-variable into a C macro definition
586   dnl to be put into the config.h file
587   dnl $1 -- the macro to define
588   dnl $2 -- the value to translate
589   dnl $3 -- template name
590 < AC_DEFUN(AC_TRANSLATE_DEFINE, [
590 > AC_DEFUN([AC_TRANSLATE_DEFINE], [
591      if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
592          AC_DEFINE($1, 1, $3)
593      fi
594   ])
595  
596 + dnl Check that the host supports TUN/TAP devices
597 + AC_CACHE_CHECK([whether TUN/TAP is supported],
598 +  ac_cv_tun_tap_support, [
599 +  AC_TRY_COMPILE([
600 +    #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
601 +    #include <linux/if.h>
602 +    #include <linux/if_tun.h>
603 +    #endif
604 +    #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
605 +    #include <net/if.h>
606 +    #include <net/if_tun.h>
607 +    #endif
608 +  ], [
609 +    struct ifreq ifr;
610 +    memset(&ifr, 0, sizeof(ifr));
611 +    ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
612 +  ],
613 +  ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
614 +  )
615 + ])
616 + AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
617 +  [Define if your system supports TUN/TAP devices.])
618 +
619   dnl Various checks if the system supports vm_allocate() and the like functions.
620   have_mach_vm=no
621   if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
# Line 554 | Line 762 | AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_
762  
763   fi dnl HAVE_MMAP_VM
764  
765 + dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
766 + AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
767 +  ac_cv_pagezero_hack, [
768 +  ac_cv_pagezero_hack=no
769 +  if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
770 +    ac_cv_pagezero_hack=yes
771 +    dnl might as well skip the test for mmap-able low memory
772 +    ac_cv_can_map_lm=no
773 +  fi
774 + ])
775 + AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
776 +  [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
777 +
778   dnl Check if we can mmap 0x2000 bytes from 0x0000
779   AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
780    ac_cv_can_map_lm, [
# Line 577 | Line 798 | AC_CACHE_CHECK([whether we can map Low M
798    ]
799   )
800  
801 + dnl Check if we have POSIX shared memory support
802 + AC_CACHE_CHECK([whether POSIX shared memory is working],
803 +  ac_cv_have_posix_shm, [
804 +  AC_LANG_SAVE
805 +  AC_LANG_CPLUSPLUS
806 +  AC_TRY_RUN([
807 +    #define HAVE_POSIX_SHM
808 +    #include "vm_alloc.cpp"
809 +    int main(void) { /* returns 0 if we have working POSIX shm */
810 +      if (vm_init() < 0) exit(2);
811 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
812 +      if (m1 == VM_MAP_FAILED) exit(3);
813 +      vm_exit(); exit(0);
814 +    }
815 +  ], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no,
816 +  dnl When cross-compiling, do not assume anything.
817 +  ac_cv_have_posix_shm="guessing no"
818 +  )
819 +  AC_LANG_RESTORE
820 +  ]
821 + )
822 + AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm",
823 +  [Define if your system supports POSIX shared memory.])
824 +
825 + dnl Check if we have working 33-bit memory addressing
826 + AC_CACHE_CHECK([whether 33-bit memory addressing is working],
827 +  ac_cv_have_33bit_addressing, [
828 +  AC_LANG_SAVE
829 +  AC_LANG_CPLUSPLUS
830 +  AC_TRY_RUN([
831 +    #define USE_33BIT_ADDRESSING 1
832 +    #include "vm_alloc.cpp"
833 +    int main(void) { /* returns 0 if we have working 33-bit addressing */
834 +      if (sizeof(void *) < 8) exit(1);
835 +      if (vm_init() < 0) exit(2);
836 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
837 +      if (m1 == VM_MAP_FAILED) exit(3);
838 +      char *m2 = m1 + (1L << 32);
839 +      m1[0] = 0x12; if (m2[0] != 0x12) exit(4);
840 +      m2[0] = 0x34; if (m1[0] != 0x34) exit(5);
841 +      vm_exit(); exit(0);
842 +    }
843 +  ], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no,
844 +  dnl When cross-compiling, do not assume anything.
845 +  ac_cv_have_33bit_addressing="guessing no"
846 +  )
847 +  AC_LANG_RESTORE
848 +  ]
849 + )
850 +
851   dnl Check signal handlers need to be reinstalled
852   AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
853    ac_cv_signal_need_reinstall, [
# Line 638 | Line 909 | AC_CACHE_CHECK([whether sigaction handle
909   AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
910    [Define if your system requires sigactions to be reinstalled.])
911  
912 < dnl Check if extended signals are supported.
913 < AC_CACHE_CHECK([whether your system supports extended signal handlers],
914 <  ac_cv_have_extended_signals, [
912 > dnl Check if Mach exceptions supported.
913 > AC_CACHE_CHECK([whether your system supports Mach exceptions],
914 >  ac_cv_have_mach_exceptions, [
915    AC_LANG_SAVE
916    AC_LANG_CPLUSPLUS
917    AC_TRY_RUN([
918 <    #define HAVE_SIGINFO_T 1
918 >    #define HAVE_MACH_EXCEPTIONS 1
919      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
920      #include "vm_alloc.cpp"
921      #include "sigsegv.cpp"
922 <  ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
922 >  ], [
923 >  sigsegv_recovery=mach
924 >  ac_cv_have_mach_exceptions=yes
925 >  ],
926 >  ac_cv_have_mach_exceptions=no,
927    dnl When cross-compiling, do not assume anything.
928 <  ac_cv_have_extended_signals=no
928 >  ac_cv_have_mach_exceptions=no
929    )
930    AC_LANG_RESTORE
931    ]
932   )
933 < AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
934 <  [Define if your system support extended signals.])
933 > AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
934 >  [Define if your system supports Mach exceptions.])
935 >
936 > dnl Check if Windows exceptions are supported.
937 > AC_CACHE_CHECK([whether your system supports Windows exceptions],
938 >  ac_cv_have_win32_exceptions, [
939 >  AC_LANG_SAVE
940 >  AC_LANG_CPLUSPLUS
941 >  AC_TRY_RUN([
942 >    #define HAVE_WIN32_EXCEPTIONS 1
943 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
944 >    #include "vm_alloc.cpp"
945 >    #include "sigsegv.cpp"
946 >  ], [
947 >  sigsegv_recovery=win32
948 >  ac_cv_have_win32_exceptions=yes
949 >  ],
950 >  ac_cv_have_win32_exceptions=no,
951 >  dnl When cross-compiling, do not assume anything.
952 >  ac_cv_have_win32_exceptions=no
953 >  )
954 >  AC_LANG_RESTORE
955 >  ]
956 > )
957 > AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
958 >  [Define if your system supports Windows exceptions.])
959 >
960 > dnl Otherwise, check if extended signals are supported.
961 > if [[ -z "$sigsegv_recovery" ]]; then
962 >  AC_CACHE_CHECK([whether your system supports extended signal handlers],
963 >    ac_cv_have_extended_signals, [
964 >    AC_LANG_SAVE
965 >    AC_LANG_CPLUSPLUS
966 >    AC_TRY_RUN([
967 >      #define HAVE_SIGINFO_T 1
968 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
969 >      #include "vm_alloc.cpp"
970 >      #include "sigsegv.cpp"
971 >    ], [
972 >    sigsegv_recovery=siginfo
973 >    ac_cv_have_extended_signals=yes
974 >    ],
975 >    ac_cv_have_extended_signals=no,
976 >    dnl When cross-compiling, do not assume anything.
977 >    ac_cv_have_extended_signals=no
978 >    )
979 >    AC_LANG_RESTORE
980 >    ]
981 >  )
982 >  AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
983 >    [Define if your system support extended signals.])
984 > fi
985  
986   dnl Otherwise, check for subterfuges.
987 < if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
987 > if [[ -z "$sigsegv_recovery" ]]; then
988    AC_CACHE_CHECK([whether we then have a subterfuge for your system],
989    ac_cv_have_sigcontext_hack, [
990      AC_LANG_SAVE
# Line 669 | Line 994 | if [[ "x$ac_cv_have_extended_signals" =
994        #define CONFIGURE_TEST_SIGSEGV_RECOVERY
995        #include "vm_alloc.cpp"
996        #include "sigsegv.cpp"
997 <    ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
997 >    ], [
998 >    sigsegv_recovery=sigcontext
999 >    ac_cv_have_sigcontext_hack=yes
1000 >    ],
1001 >    ac_cv_have_sigcontext_hack=no,
1002      dnl When cross-compiling, do not assume anything.
1003      ac_cv_have_sigcontext_hack=no
1004      )
# Line 701 | Line 1030 | AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_IN
1030  
1031   dnl Can we do Video on SEGV Signals ?
1032   CAN_VOSF=no
1033 < if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
1033 > if [[ -n "$sigsegv_recovery" ]]; then
1034    CAN_VOSF=yes
1035   fi
1036  
1037 + dnl A dummy program that returns always true
1038 + AC_PATH_PROG([BLESS], "true")
1039 +
1040   dnl Determine the addressing mode to use
1041   if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
1042    ADDRESSING_MODE="real"
# Line 715 | Line 1047 | else
1047      case $am in
1048      real)
1049        dnl Requires ability to mmap() Low Memory globals
1050 <      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
1050 >      if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
1051          continue
1052        fi
1053 <          dnl Requires VOSF screen updates
1053 >      dnl Requires VOSF screen updates
1054        if [[ "x$CAN_VOSF" = "xno" ]]; then
1055          continue
1056        fi
# Line 726 | Line 1058 | else
1058        ADDRESSING_MODE="real"
1059        WANT_VOSF=yes dnl we can use VOSF and we need it actually
1060        DEFINES="$DEFINES -DREAL_ADDRESSING"
1061 +      if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
1062 +        BLESS=Darwin/lowmem
1063 +        LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
1064 +      fi
1065        break
1066        ;;
1067      direct)
# Line 778 | Line 1114 | AC_MSG_RESULT($HAVE_GAS)
1114   dnl Check for GCC 2.7 or higher.
1115   HAVE_GCC27=no
1116   AC_MSG_CHECKING(for GCC 2.7 or higher)
1117 < AC_EGREP_CPP(xyes,
1118 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1119 <  xyes
1120 < #endif
1121 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1117 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1118 >                                     # error gcc < 2.7
1119 >                                     #endif
1120 >                                   ]])],
1121 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1122 >                  [AC_MSG_RESULT(no)])
1123  
1124   dnl Check for GCC 3.0 or higher.
1125   HAVE_GCC30=no
1126   AC_MSG_CHECKING(for GCC 3.0 or higher)
1127 < AC_EGREP_CPP(xyes,
1128 < [#if __GNUC__ >= 3
1129 <  xyes
1130 < #endif
1131 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1127 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1128 >                                     # error gcc < 3
1129 >                                     #endif
1130 >                                   ]])],
1131 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1132 >                  [AC_MSG_RESULT(no)])
1133 >
1134 > dnl Check for ICC.
1135 > AC_MSG_CHECKING(for ICC)
1136 > HAVE_ICC=no
1137 > if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
1138 >  HAVE_ICC=yes
1139 > fi
1140 > AC_MSG_RESULT($HAVE_ICC)
1141  
1142   dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
1143   dnl Also set "-fno-exceptions" for C++ because exception handling requires
# Line 806 | Line 1152 | dnl As of 2001/08/02, this affects the f
1152   dnl Official: probably gcc-3.1 (mainline CVS)
1153   dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
1154   dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
1155 < if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1155 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1156    SAVED_CXXFLAGS="$CXXFLAGS"
1157    CXXFLAGS="$CXXFLAGS -fno-merge-constants"
1158    AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
# Line 820 | Line 1166 | if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1166    fi
1167   fi
1168  
1169 + dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4
1170 + dnl However, there are some corner cases exposed on x86-64
1171 + if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1172 +  SAVED_CXXFLAGS="$CXXFLAGS"
1173 +  CXXFLAGS="$CXXFLAGS -fno-gcse-sm"
1174 +  AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [
1175 +    AC_LANG_SAVE
1176 +    AC_LANG_CPLUSPLUS
1177 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_store_motion=yes],[ac_cv_gcc_store_motion=no])
1178 +    AC_LANG_RESTORE
1179 +  ])
1180 +  if [[ "x$ac_cv_gcc_store_motion" != "xyes" ]]; then
1181 +    CXXFLAGS="$SAVED_CXXFLAGS"
1182 +  fi
1183 + fi
1184 +
1185 + dnl Add -fno-strict-aliasing for slirp sources
1186 + if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1187 +  SAVED_CFLAGS="$CFLAGS"
1188 +  CFLAGS="$CFLAGS -fno-strict-aliasing"
1189 +  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1190 +    ac_cv_gcc_no_strict_aliasing, [
1191 +    AC_TRY_COMPILE([],[],
1192 +      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1193 +      [ac_cv_gcc_no_strict_aliasing=no])
1194 +  ])
1195 +  CFLAGS="$SAVED_CFLAGS"
1196 + fi
1197 +
1198 + dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1199 + if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1200 +  SAVED_CFLAGS="$CFLAGS"
1201 +  CFLAGS="$CFLAGS -mdynamic-no-pic"
1202 +  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1203 +    ac_cv_gcc_mdynamic_no_pic, [
1204 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1205 +  ])
1206 +  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1207 +    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1208 +  else
1209 +    CFLAGS="$SAVED_CFLAGS"
1210 +  fi
1211 + fi
1212 +
1213   dnl Select appropriate CPU source and REGPARAM define.
1214   ASM_OPTIMIZATIONS=none
1215   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
# Line 844 | Line 1234 | elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HA
1234    if [[ "x$HAVE_GAS" = "xyes" ]]; then
1235      ASM_OPTIMIZATIONS="x86-64"
1236      DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
1237 +    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"
1238 +    CAN_JIT=yes
1239 +    WANT_33BIT_ADDRESSING=yes
1240    fi
1241   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
1242    dnl SPARC CPU
# Line 900 | Line 1293 | else
1293    JITSRCS=""
1294   fi
1295  
1296 + dnl Use 33-bit memory addressing?
1297 + if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then
1298 +  use_33bit_addressing=yes
1299 + fi
1300 + AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing",
1301 +  [Define to use 33-bit memory addressing on 64-bit JIT capable systems.])
1302 +
1303   dnl Utility macro used by next two tests.
1304   dnl AC_EXAMINE_OBJECT(C source code,
1305   dnl     commands examining object file,
# Line 1097 | Line 1497 | fi
1497  
1498   dnl Remove the "-g" option if set for GCC.
1499   if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1500 <  CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
1501 <  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1500 >  CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'`
1501 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
1502   fi
1503  
1504   dnl Or if we have -IPA (MIPSPro compilers)
# Line 1114 | Line 1514 | AC_SUBST(DEFINES)
1514   AC_SUBST(SYSSRCS)
1515   AC_SUBST(CPUINCLUDES)
1516   AC_SUBST(CPUSRCS)
1517 + AC_SUBST(BLESS)
1518 + AC_SUBST(KEYCODES)
1519   AC_CONFIG_FILES([Makefile])
1520   AC_OUTPUT
1521  
# Line 1121 | Line 1523 | dnl Print summary.
1523   echo
1524   echo Basilisk II configuration summary:
1525   echo
1526 + echo SDL support ............................ : $SDL_SUPPORT
1527   echo XFree86 DGA support .................... : $WANT_XF86_DGA
1528   echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
1529   echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
# Line 1134 | Line 1537 | echo JIT debug mode ....................
1537   echo Floating-Point emulation core .......... : $FPE_CORE
1538   echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
1539   echo Addressing mode ........................ : $ADDRESSING_MODE
1540 + echo Bad memory access recovery type ........ : $sigsegv_recovery
1541   echo
1542   echo "Configuration done. Now type \"make\" (or \"gmake\")."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines