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.7 by gbeauche, 2002-09-18T11:41:56Z vs.
Revision 1.45 by gbeauche, 2005-05-14T17:40:05Z

# Line 1 | Line 1
1   dnl Process this file with autoconf to produce a configure script.
2   dnl Written in 2002 by Christian Bauer et al.
3  
4 < AC_INIT(main_unix.cpp)
4 > AC_INIT([Basilisk II], 1.0, [Christian.Bauer@uni-mainz.de], BasiliskII)
5 > AC_CONFIG_SRCDIR(main_unix.cpp)
6   AC_PREREQ(2.52)
7   AC_CONFIG_HEADER(config.h)
8  
9 + dnl 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 69 | Line 83 | HAVE_I386=no
83   HAVE_M68K=no
84   HAVE_SPARC=no
85   HAVE_POWERPC=no
86 + HAVE_X86_64=no
87   case "$target_cpu" in
88 <  i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;;
89 <  m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;;
90 <  sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;;
91 <  powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;;
92 <  *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;;
88 >  i386* | i486* | i586* | i686* | i786* ) HAVE_I386=yes;;
89 >  m68k* ) HAVE_M68K=yes;;
90 >  sparc* ) HAVE_SPARC=yes;;
91 >  powerpc* ) HAVE_POWERPC=yes;;
92 >  x86_64* ) HAVE_X86_64=yes;;
93   esac
79 DEFINES="$DEFINES -DCPU_$CPU_TYPE"
94  
95   dnl Checks for programs.
96   AC_PROG_CC
# Line 85 | Line 99 | AC_PROG_CPP
99   AC_PROG_CXX
100   AC_PROG_MAKE_SET
101   AC_PROG_INSTALL
102 + AC_PROG_EGREP
103  
104   dnl We use mon if possible.
105   MONSRCS=
# Line 103 | Line 118 | if [[ "x$WANT_MON" = "xyes" ]]; then
118              AC_CHECK_LIB(Hcurses, tgetent, ,
119                AC_CHECK_LIB(curses, tgetent))))))
120      AC_CHECK_LIB(readline, readline)
106    AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
121    else
122      AC_MSG_RESULT(no)
123      AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
# Line 114 | Line 128 | fi
128   dnl Checks for libraries.
129   AC_CHECK_LIB(posix4, sem_init)
130   AC_CHECK_LIB(rt, timer_create)
131 + AC_CHECK_LIB(rt, shm_open)
132 +
133 + dnl Do we need SDL?
134 + WANT_SDL=no
135 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
136 +  WANT_SDL=yes
137 +  WANT_XF86_DGA=no
138 +  WANT_XF86_VIDMODE=no
139 +  WANT_FBDEV_DGA=no
140 +  SDL_SUPPORT="$SDL_SUPPORT video"
141 + fi
142 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
143 +  WANT_SDL=yes
144 +  SDL_SUPPORT="$SDL_SUPPORT audio"
145 + fi
146 + if [[ "x$WANT_SDL" = "xyes" ]]; then
147 +  AC_PATH_PROG(sdl_config, "sdl-config")
148 +  if [[ -n "$sdl_config" ]]; then
149 +    case $target_os in
150 +    # Special treatment for Cygwin so that we can still use the POSIX layer
151 +    *cygwin*)
152 +      sdl_cflags="-I`$sdl_config --prefix`/include/SDL"
153 +      sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL"
154 +      ;;
155 +    *)
156 +      sdl_cflags=`$sdl_config --cflags`
157 +      if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
158 +        sdl_libs=`$sdl_config --static-libs`
159 +      else
160 +        sdl_libs=`$sdl_config --libs`
161 +      fi
162 +      ;;
163 +    esac
164 +    CFLAGS="$CFLAGS $sdl_cflags"
165 +    CXXFLAGS="$CXXFLAGS $sdl_cflags"
166 +    LIBS="$LIBS $sdl_libs"
167 +  else
168 +    WANT_SDL=no
169 +  fi
170 +  SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
171 + else
172 +  SDL_SUPPORT="none"
173 + fi
174  
175 < dnl We need X11.
176 < AC_PATH_XTRA
177 < if [[ "x$no_x" = "xyes" ]]; then
178 <  AC_MSG_ERROR([You need X11 to run Basilisk II.])
179 < fi
180 < CFLAGS="$CFLAGS $X_CFLAGS"
181 < CXXFLAGS="$CXXFLAGS $X_CFLAGS"
182 < LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
175 > dnl We need X11, if not using SDL.
176 > if [[ "x$WANT_SDL" = "xno" ]]; then
177 >  AC_PATH_XTRA
178 >  if [[ "x$no_x" = "xyes" ]]; then
179 >    AC_MSG_ERROR([You need X11 to run Basilisk II.])
180 >  fi
181 >  CFLAGS="$CFLAGS $X_CFLAGS"
182 >  CXXFLAGS="$CXXFLAGS $X_CFLAGS"
183 >  LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
184 > fi
185  
186   dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
187   HAVE_PTHREADS=yes
# Line 186 | Line 245 | if [[ "x$WANT_GTK" = "xyes" ]]; then
245      CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
246      LIBS="$LIBS $GTK_LIBS"
247      UISRCS=prefs_editor_gtk.cpp
248 +    dnl somehow, <gnome-i18n.h> would redefine gettext() to nothing if
249 +    dnl ENABLE_NLS is not set, thusly conflicting with C++ <string> which
250 +    dnl includes <libintl.h>
251 +    AM_GNU_GETTEXT
252      B2_PATH_GNOMEUI([
253        AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.])
254        CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS"
# Line 215 | Line 278 | AC_SYS_LARGEFILE
278  
279   dnl Checks for header files.
280   AC_HEADER_STDC
281 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
281 > AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h)
282 > AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
283 > AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
284 > AC_CHECK_HEADERS(sys/poll.h sys/select.h)
285 > AC_CHECK_HEADERS(arpa/inet.h)
286 > AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
287 > #ifdef HAVE_SYS_TYPES_H
288 > #include <sys/types.h>
289 > #endif
290 > #ifdef HAVE_SYS_SOCKET_H
291 > #include <sys/socket.h>
292 > #endif
293 > ])
294 > AC_CHECK_HEADERS(AvailabilityMacros.h)
295  
296   dnl Checks for typedefs, structures, and compiler characteristics.
297   AC_C_BIGENDIAN
# Line 230 | Line 306 | AC_CHECK_SIZEOF(double, 8)
306   AC_CHECK_SIZEOF(long double, 12)
307   AC_CHECK_SIZEOF(void *, 4)
308   AC_TYPE_OFF_T
309 < AC_CHECK_TYPE(loff_t, off_t)
310 < AC_CHECK_TYPE(caddr_t, [char *])
309 > AC_CHECK_TYPES(loff_t)
310 > AC_CHECK_TYPES(caddr_t)
311   AC_TYPE_SIZE_T
312   AC_TYPE_SIGNAL
313   AC_HEADER_TIME
# Line 255 | Line 331 | if [[ "x$ac_cv_type_socklen_t" != "xyes"
331   fi
332  
333   dnl Checks for library functions.
334 < AC_CHECK_FUNCS(strdup cfmakeraw)
334 > AC_CHECK_FUNCS(strdup strerror cfmakeraw)
335   AC_CHECK_FUNCS(clock_gettime timer_create)
336   AC_CHECK_FUNCS(sigaction signal)
337   AC_CHECK_FUNCS(mmap mprotect munmap)
338   AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
339 + AC_CHECK_FUNCS(poll inet_aton)
340  
341   dnl Darwin seems to define mach_task_self() instead of task_self().
342   AC_CHECK_FUNCS(mach_task_self task_self)
# Line 286 | Line 363 | mips-sony-bsd|mips-sony-newsos4)
363   *-*-sco3.2v5*)
364          no_dev_ptmx=1
365          ;;
366 + *-*-cygwin*)
367 +        no_dev_ptmx=1
368 +        ;;
369   esac
370  
371   if test -z "$no_dev_ptmx" ; then
# Line 308 | Line 388 | AC_CHECK_FILE([/dev/ptc],
388   dnl (end of code from openssh-3.2.2p1 configure.ac)
389  
390  
391 + dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
392 + AC_DEFUN(AC_CHECK_FRAMEWORK, [
393 +  AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
394 +  AC_CACHE_CHECK([whether compiler supports framework $1],
395 +    ac_Framework, [
396 +    saved_LIBS="$LIBS"
397 +    LIBS="$LIBS -framework $1"
398 +    AC_TRY_LINK(
399 +      [$2], [int main(void) { return 0; }],
400 +      [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
401 +    )
402 +  ])
403 +  AS_IF([test AS_VAR_GET(ac_Framework) = yes],
404 +    [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
405 +  )
406 +  AS_VAR_POPDEF([ac_Framework])dnl
407 + ])
408 +
409 + dnl Check for some MacOS X frameworks
410 + AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
411 + AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
412 +
413   dnl Select system-dependant source files.
414   SERIALSRC=serial_unix.cpp
415   ETHERSRC=../dummy/ether_dummy.cpp
416   SCSISRC=../dummy/scsi_dummy.cpp
417   AUDIOSRC=../dummy/audio_dummy.cpp
418 + EXTFSSRC=extfs_unix.cpp
419   EXTRASYSSRCS=
420   CAN_NATIVE_M68K=no
421   case "$target_os" in
# Line 346 | Line 449 | freebsd*)
449    ;;
450   netbsd*)
451    CAN_NATIVE_M68K=yes
452 +  ETHERSRC=ether_unix.cpp
453    ;;
454   solaris*)
455    AUDIOSRC=Solaris/audio_solaris.cpp
# Line 360 | Line 464 | irix*)
464    LIBS="$LIBS -laudio"
465    WANT_ESD=no
466  
467 <  dnl Check if our compiler supports -Ofast (MIPSPro)
468 <  HAVE_OFAST=no
467 >  dnl Check if our compiler supports -IPA (MIPSPro)
468 >  HAVE_IPA=no
469    ocflags="$CFLAGS"
470 <  CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'`
471 <  AC_MSG_CHECKING(if "-Ofast" works)
470 >  CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"`
471 >  AC_MSG_CHECKING(if "-IPA" works)
472    dnl Do a test compile of an empty function
473 <  AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no))
473 >  AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
474    CFLAGS="$ocflags"
475 <
475 >  ;;
476 > darwin*)
477 >  ETHERSRC=ether_unix.cpp
478 >  if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then
479 >    EXTRASYSSRCS="../MacOSX/sys_darwin.cpp"
480 >  fi
481 >  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
482 >    EXTFSSRC=../MacOSX/extfs_macosx.mm
483 >  fi
484 >  ;;
485 > cygwin*)
486 >  SERIALSRC="../dummy/serial_dummy.cpp"
487 >  EXTRASYSSRCS="../Windows/BasiliskII.rc"
488    ;;
489   esac
490  
491 + dnl Is the slirp library supported?
492 + if [[ "x$ETHERSRC" = "xether_unix.cpp" ]]; then
493 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
494 +  SLIRP_SRCS="\
495 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
496 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
497 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
498 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
499 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
500 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
501 + fi
502 + AC_SUBST(SLIRP_SRCS)
503 +
504 + dnl SDL overrides
505 + if [[ "x$WANT_SDL" = "xyes" ]]; then
506 +  AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
507 + fi
508 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
509 +  AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
510 +  VIDEOSRCS="../SDL/video_sdl.cpp"
511 +  KEYCODES="../SDL/keycodes"
512 +  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
513 +    EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
514 +  else
515 +    case "$target_os" in
516 +    cygwin*)
517 +      EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
518 +      ;;
519 +    *)
520 +      EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
521 +      ;;
522 +    esac
523 +  fi
524 + else
525 +  VIDEOSRCS="video_x.cpp"
526 +  KEYCODES="keycodes"
527 +  EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp"
528 + fi
529 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
530 +  AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
531 +  AUDIOSRC="../SDL/audio_sdl.cpp"
532 + fi
533 +
534   dnl Use 68k CPU natively?
535   WANT_NATIVE_M68K=no
536   if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
# Line 386 | Line 545 | if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
545    ETHERSRC=../dummy/ether_dummy.cpp
546    AUDIOSRC=../dummy/audio_dummy.cpp
547   fi
548 < SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
548 > SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
549  
550   dnl Define a macro that translates a yesno-variable into a C macro definition
551   dnl to be put into the config.h file
# Line 399 | Line 558 | AC_DEFUN(AC_TRANSLATE_DEFINE, [
558      fi
559   ])
560  
561 + dnl Check that the host supports TUN/TAP devices
562 + AC_CACHE_CHECK([whether TUN/TAP is supported],
563 +  ac_cv_tun_tap_support, [
564 +  AC_TRY_COMPILE([
565 +    #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
566 +    #include <linux/if.h>
567 +    #include <linux/if_tun.h>
568 +    #endif
569 +    #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
570 +    #include <net/if.h>
571 +    #include <net/if_tun.h>
572 +    #endif
573 +  ], [
574 +    struct ifreq ifr;
575 +    memset(&ifr, 0, sizeof(ifr));
576 +    ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
577 +  ],
578 +  ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
579 +  )
580 + ])
581 + AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
582 +  [Define if your system supports TUN/TAP devices.])
583 +
584   dnl Various checks if the system supports vm_allocate() and the like functions.
585   have_mach_vm=no
586   if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
# Line 545 | Line 727 | AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_
727  
728   fi dnl HAVE_MMAP_VM
729  
730 + dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
731 + AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
732 +  ac_cv_pagezero_hack, [
733 +  ac_cv_pagezero_hack=no
734 +  if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
735 +    ac_cv_pagezero_hack=yes
736 +    dnl might as well skip the test for mmap-able low memory
737 +    ac_cv_can_map_lm=no
738 +  fi
739 + ])
740 + AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
741 +  [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
742 +
743   dnl Check if we can mmap 0x2000 bytes from 0x0000
744   AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
745    ac_cv_can_map_lm, [
# Line 553 | Line 748 | AC_CACHE_CHECK([whether we can map Low M
748    AC_TRY_RUN([
749      #include "vm_alloc.cpp"
750      int main(void) { /* returns 0 if we could map the lowmem globals */
751 <      volatile char * lm;
751 >      volatile char * lm = 0;
752        if (vm_init() < 0) exit(1);
753 <      if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1);
753 >      if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
754        lm[0] = 'z';
755        if (vm_release((char *)lm, 0x2000) < 0) exit(1);
756        vm_exit(); exit(0);
# Line 568 | Line 763 | AC_CACHE_CHECK([whether we can map Low M
763    ]
764   )
765  
766 + dnl Check if we have POSIX shared memory support
767 + AC_CACHE_CHECK([whether POSIX shared memory is working],
768 +  ac_cv_have_posix_shm, [
769 +  AC_LANG_SAVE
770 +  AC_LANG_CPLUSPLUS
771 +  AC_TRY_RUN([
772 +    #define HAVE_POSIX_SHM
773 +    #include "vm_alloc.cpp"
774 +    int main(void) { /* returns 0 if we have working POSIX shm */
775 +      if (vm_init() < 0) exit(2);
776 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
777 +      if (m1 == VM_MAP_FAILED) exit(3);
778 +      vm_exit(); exit(0);
779 +    }
780 +  ], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no,
781 +  dnl When cross-compiling, do not assume anything.
782 +  ac_cv_have_posix_shm="guessing no"
783 +  )
784 +  AC_LANG_RESTORE
785 +  ]
786 + )
787 + AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm",
788 +  [Define if your system supports POSIX shared memory.])
789 +
790 + dnl Check if we have working 33-bit memory addressing
791 + AC_CACHE_CHECK([whether 33-bit memory addressing is working],
792 +  ac_cv_have_33bit_addressing, [
793 +  AC_LANG_SAVE
794 +  AC_LANG_CPLUSPLUS
795 +  AC_TRY_RUN([
796 +    #define USE_33BIT_ADDRESSING 1
797 +    #include "vm_alloc.cpp"
798 +    int main(void) { /* returns 0 if we have working 33-bit addressing */
799 +      if (sizeof(void *) < 8) exit(1);
800 +      if (vm_init() < 0) exit(2);
801 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
802 +      if (m1 == VM_MAP_FAILED) exit(3);
803 +      char *m2 = m1 + (1L << 32);
804 +      m1[0] = 0x12; if (m2[0] != 0x12) exit(4);
805 +      m2[0] = 0x34; if (m1[0] != 0x34) exit(5);
806 +      vm_exit(); exit(0);
807 +    }
808 +  ], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no,
809 +  dnl When cross-compiling, do not assume anything.
810 +  ac_cv_have_33bit_addressing="guessing no"
811 +  )
812 +  AC_LANG_RESTORE
813 +  ]
814 + )
815 +
816   dnl Check signal handlers need to be reinstalled
817   AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
818    ac_cv_signal_need_reinstall, [
# Line 629 | Line 874 | AC_CACHE_CHECK([whether sigaction handle
874   AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
875    [Define if your system requires sigactions to be reinstalled.])
876  
877 < dnl Check if extended signals are supported.
878 < AC_CACHE_CHECK([whether your system supports extended signal handlers],
879 <  ac_cv_have_extended_signals, [
877 > dnl Check if Mach exceptions supported.
878 > AC_CACHE_CHECK([whether your system supports Mach exceptions],
879 >  ac_cv_have_mach_exceptions, [
880 >  AC_LANG_SAVE
881 >  AC_LANG_CPLUSPLUS
882 >  AC_TRY_RUN([
883 >    #define HAVE_MACH_EXCEPTIONS 1
884 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
885 >    #include "vm_alloc.cpp"
886 >    #include "sigsegv.cpp"
887 >  ], [
888 >  sigsegv_recovery=mach
889 >  ac_cv_have_mach_exceptions=yes
890 >  ],
891 >  ac_cv_have_mach_exceptions=no,
892 >  dnl When cross-compiling, do not assume anything.
893 >  ac_cv_have_mach_exceptions=no
894 >  )
895 >  AC_LANG_RESTORE
896 >  ]
897 > )
898 > AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
899 >  [Define if your system supports Mach exceptions.])
900 >
901 > dnl Check if Windows exceptions are supported.
902 > AC_CACHE_CHECK([whether your system supports Windows exceptions],
903 >  ac_cv_have_win32_exceptions, [
904    AC_LANG_SAVE
905    AC_LANG_CPLUSPLUS
906    AC_TRY_RUN([
907 <    #define HAVE_SIGINFO_T 1
907 >    #define HAVE_WIN32_EXCEPTIONS 1
908      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
909      #include "vm_alloc.cpp"
910      #include "sigsegv.cpp"
911 <  ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
911 >  ], [
912 >  sigsegv_recovery=win32
913 >  ac_cv_have_win32_exceptions=yes
914 >  ],
915 >  ac_cv_have_win32_exceptions=no,
916    dnl When cross-compiling, do not assume anything.
917 <  ac_cv_have_extended_signals=no
917 >  ac_cv_have_win32_exceptions=no
918    )
919    AC_LANG_RESTORE
920    ]
921   )
922 < AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
923 <  [Define if your system support extended signals.])
922 > AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
923 >  [Define if your system supports Windows exceptions.])
924 >
925 > dnl Otherwise, check if extended signals are supported.
926 > if [[ -z "$sigsegv_recovery" ]]; then
927 >  AC_CACHE_CHECK([whether your system supports extended signal handlers],
928 >    ac_cv_have_extended_signals, [
929 >    AC_LANG_SAVE
930 >    AC_LANG_CPLUSPLUS
931 >    AC_TRY_RUN([
932 >      #define HAVE_SIGINFO_T 1
933 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
934 >      #include "vm_alloc.cpp"
935 >      #include "sigsegv.cpp"
936 >    ], [
937 >    sigsegv_recovery=siginfo
938 >    ac_cv_have_extended_signals=yes
939 >    ],
940 >    ac_cv_have_extended_signals=no,
941 >    dnl When cross-compiling, do not assume anything.
942 >    ac_cv_have_extended_signals=no
943 >    )
944 >    AC_LANG_RESTORE
945 >    ]
946 >  )
947 >  AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
948 >    [Define if your system support extended signals.])
949 > fi
950  
951   dnl Otherwise, check for subterfuges.
952 < if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
952 > if [[ -z "$sigsegv_recovery" ]]; then
953    AC_CACHE_CHECK([whether we then have a subterfuge for your system],
954    ac_cv_have_sigcontext_hack, [
955      AC_LANG_SAVE
# Line 660 | Line 959 | if [[ "x$ac_cv_have_extended_signals" =
959        #define CONFIGURE_TEST_SIGSEGV_RECOVERY
960        #include "vm_alloc.cpp"
961        #include "sigsegv.cpp"
962 <    ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
962 >    ], [
963 >    sigsegv_recovery=sigcontext
964 >    ac_cv_have_sigcontext_hack=yes
965 >    ],
966 >    ac_cv_have_sigcontext_hack=no,
967      dnl When cross-compiling, do not assume anything.
968      ac_cv_have_sigcontext_hack=no
969      )
# Line 692 | Line 995 | AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_IN
995  
996   dnl Can we do Video on SEGV Signals ?
997   CAN_VOSF=no
998 < if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
998 > if [[ -n "$sigsegv_recovery" ]]; then
999    CAN_VOSF=yes
1000   fi
1001  
1002 + dnl A dummy program that returns always true
1003 + AC_PATH_PROG([BLESS], "true")
1004 +
1005   dnl Determine the addressing mode to use
1006   if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
1007    ADDRESSING_MODE="real"
# Line 706 | Line 1012 | else
1012      case $am in
1013      real)
1014        dnl Requires ability to mmap() Low Memory globals
1015 <      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
1015 >      if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
1016          continue
1017        fi
1018 <          dnl Requires VOSF screen updates
1018 >      dnl Requires VOSF screen updates
1019        if [[ "x$CAN_VOSF" = "xno" ]]; then
1020          continue
1021        fi
# Line 717 | Line 1023 | else
1023        ADDRESSING_MODE="real"
1024        WANT_VOSF=yes dnl we can use VOSF and we need it actually
1025        DEFINES="$DEFINES -DREAL_ADDRESSING"
1026 +      if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
1027 +        BLESS=Darwin/lowmem
1028 +        LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
1029 +      fi
1030        break
1031        ;;
1032      direct)
# Line 769 | Line 1079 | AC_MSG_RESULT($HAVE_GAS)
1079   dnl Check for GCC 2.7 or higher.
1080   HAVE_GCC27=no
1081   AC_MSG_CHECKING(for GCC 2.7 or higher)
1082 < AC_EGREP_CPP(yes,
1082 > AC_EGREP_CPP(xyes,
1083   [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1084 <  yes
1084 >  xyes
1085   #endif
1086   ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1087  
1088   dnl Check for GCC 3.0 or higher.
1089   HAVE_GCC30=no
1090   AC_MSG_CHECKING(for GCC 3.0 or higher)
1091 < AC_EGREP_CPP(yes,
1091 > AC_EGREP_CPP(xyes,
1092   [#if __GNUC__ >= 3
1093 <  yes
1093 >  xyes
1094   #endif
1095   ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1096  
1097 + dnl Check for ICC.
1098 + AC_MSG_CHECKING(for ICC)
1099 + HAVE_ICC=no
1100 + if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
1101 +  HAVE_ICC=yes
1102 + fi
1103 + AC_MSG_RESULT($HAVE_ICC)
1104 +
1105   dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
1106   dnl Also set "-fno-exceptions" for C++ because exception handling requires
1107   dnl the frame pointer.
# Line 797 | Line 1115 | dnl As of 2001/08/02, this affects the f
1115   dnl Official: probably gcc-3.1 (mainline CVS)
1116   dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
1117   dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
1118 < if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1118 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1119    SAVED_CXXFLAGS="$CXXFLAGS"
1120    CXXFLAGS="$CXXFLAGS -fno-merge-constants"
1121    AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
# Line 811 | Line 1129 | if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1129    fi
1130   fi
1131  
1132 + dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4
1133 + dnl However, there are some corner cases exposed on x86-64
1134 + if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1135 +  SAVED_CXXFLAGS="$CXXFLAGS"
1136 +  CXXFLAGS="$CXXFLAGS -fno-gcse-sm"
1137 +  AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [
1138 +    AC_LANG_SAVE
1139 +    AC_LANG_CPLUSPLUS
1140 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_store_motion=yes],[ac_cv_gcc_store_motion=no])
1141 +    AC_LANG_RESTORE
1142 +  ])
1143 +  if [[ "x$ac_cv_gcc_store_motion" != "xyes" ]]; then
1144 +    CXXFLAGS="$SAVED_CXXFLAGS"
1145 +  fi
1146 + fi
1147 +
1148 + dnl Add -fno-strict-aliasing for slirp sources
1149 + if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1150 +  SAVED_CFLAGS="$CFLAGS"
1151 +  CFLAGS="$CFLAGS -fno-strict-aliasing"
1152 +  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1153 +    ac_cv_gcc_no_strict_aliasing, [
1154 +    AC_TRY_COMPILE([],[],
1155 +      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "$CFLAGS")],
1156 +      [ac_cv_gcc_no_strict_aliasing=no])
1157 +  ])
1158 +  CFLAGS="$SAVED_CFLAGS"
1159 + fi
1160 +
1161   dnl Select appropriate CPU source and REGPARAM define.
1162   ASM_OPTIMIZATIONS=none
1163   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
# Line 820 | Line 1167 | dnl Other platforms should define their
1167   CAN_JIT=no
1168   JITSRCS="compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp"
1169  
1170 < if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then
1170 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
1171    dnl i386 CPU
1172    DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\""
1173    if [[ "x$HAVE_GAS" = "xyes" ]]; then
1174      ASM_OPTIMIZATIONS=i386
1175      DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE"
1176 <    CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
1177 <    JITSRCS="cpufast1_nf.s cpufast2_nf.s cpufast3_nf.s cpufast4_nf.s cpufast5_nf.s cpufast6_nf.s cpufast7_nf.s cpufast8_nf.s $JITSRCS"
1176 >    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"
1177 >    CAN_JIT=yes
1178 >  fi
1179 > elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then
1180 >  dnl x86-64 CPU
1181 >  DEFINES="$DEFINES -DUNALIGNED_PROFITABLE"
1182 >  if [[ "x$HAVE_GAS" = "xyes" ]]; then
1183 >    ASM_OPTIMIZATIONS="x86-64"
1184 >    DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
1185 >    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"
1186 >    CAN_JIT=yes
1187 >    WANT_33BIT_ADDRESSING=yes
1188    fi
832  CAN_JIT=yes
1189   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
1190    dnl SPARC CPU
1191    case "$target_os" in
# Line 872 | Line 1228 | if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JI
1228        WANT_JIT_DEBUG=no
1229      fi
1230    fi
1231 +
1232 +  dnl IEEE core is the only FPU emulator to use with the JIT compiler
1233 +  case $FPE_CORE_TEST_ORDER in
1234 +  ieee*) ;;
1235 +  *) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;;
1236 +  esac
1237 +  FPE_CORE_TEST_ORDER="ieee"
1238   else
1239    WANT_JIT=no
1240    WANT_JIT_DEBUG=no
1241    JITSRCS=""
1242   fi
1243  
1244 + dnl Use 33-bit memory addressing?
1245 + if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then
1246 +  use_33bit_addressing=yes
1247 + fi
1248 + AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing",
1249 +  [Define to use 33-bit memory addressing on 64-bit JIT capable systems.])
1250 +
1251   dnl Utility macro used by next two tests.
1252   dnl AC_EXAMINE_OBJECT(C source code,
1253   dnl     commands examining object file,
# Line 1075 | Line 1445 | fi
1445  
1446   dnl Remove the "-g" option if set for GCC.
1447   if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1448 <  CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
1449 <  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1448 >  CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'`
1449 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
1450   fi
1451  
1452 < dnl Or if we have -Ofast
1453 < if [[ "x$HAVE_OFAST" = "xyes" ]]; then
1454 <  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
1455 <  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
1452 > dnl Or if we have -IPA (MIPSPro compilers)
1453 > if [[ "x$HAVE_IPA" = "xyes" ]]; then
1454 >  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1455 >  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1456    CXXFLAGS="-LANG:std $CXXFLAGS"
1457 <  LDFLAGS="$LDFLAGS -ipa"
1457 >  LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
1458   fi
1459  
1460   dnl Generate Makefile.
# Line 1092 | Line 1462 | AC_SUBST(DEFINES)
1462   AC_SUBST(SYSSRCS)
1463   AC_SUBST(CPUINCLUDES)
1464   AC_SUBST(CPUSRCS)
1465 < AC_OUTPUT(Makefile)
1465 > AC_SUBST(BLESS)
1466 > AC_SUBST(KEYCODES)
1467 > AC_CONFIG_FILES([Makefile])
1468 > AC_OUTPUT
1469  
1470   dnl Print summary.
1471   echo
1472   echo Basilisk II configuration summary:
1473   echo
1474 + echo SDL support ............................ : $SDL_SUPPORT
1475   echo XFree86 DGA support .................... : $WANT_XF86_DGA
1476   echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
1477   echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
# Line 1111 | Line 1485 | echo JIT debug mode ....................
1485   echo Floating-Point emulation core .......... : $FPE_CORE
1486   echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
1487   echo Addressing mode ........................ : $ADDRESSING_MODE
1488 + echo Bad memory access recovery type ........ : $sigsegv_recovery
1489   echo
1490   echo "Configuration done. Now type \"make\" (or \"gmake\")."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines