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.21 by gbeauche, 2003-10-12T15:56:00Z vs.
Revision 1.35 by gbeauche, 2004-11-10T07:33:15Z

# 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.
# Line 20 | 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-video,     [  --enable-sdl-video      use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no])
25 + AC_ARG_ENABLE(sdl-audio,     [  --enable-sdl-audio      use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no])
26 +
27   dnl JIT compiler options.
28   AC_ARG_ENABLE(jit-compiler,  [  --enable-jit-compiler   enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
29   AC_ARG_ENABLE(jit-debug,     [  --enable-jit-debug      activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
# Line 122 | Line 126 | fi
126   dnl Checks for libraries.
127   AC_CHECK_LIB(posix4, sem_init)
128   AC_CHECK_LIB(rt, timer_create)
129 + AC_CHECK_LIB(rt, shm_open)
130 +
131 + dnl Do we need SDL?
132 + WANT_SDL=no
133 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
134 +  WANT_SDL=yes
135 +  WANT_XF86_DGA=no
136 +  WANT_XF86_VIDMODE=no
137 +  WANT_FBDEV_DGA=no
138 +  SDL_SUPPORT="$SDL_SUPPORT video"
139 + fi
140 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
141 +  WANT_SDL=yes
142 +  SDL_SUPPORT="$SDL_SUPPORT audio"
143 + fi
144 + if [[ "x$WANT_SDL" = "xyes" ]]; then
145 +  AC_PATH_PROG(sdl_config, "sdl-config")
146 +  if [[ -n "$sdl_config" ]]; then
147 +    sdl_cflags=`$sdl_config --cflags`
148 +    sdl_libs=`$sdl_config --libs`
149 +    CFLAGS="$CFLAGS $sdl_cflags"
150 +    CXXFLAGS="$CXXFLAGS $sdl_cflags"
151 +    LIBS="$LIBS $sdl_libs"
152 +  else
153 +    WANT_SDL=no
154 +  fi
155 +  SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
156 + else
157 +  SDL_SUPPORT="none"
158 + fi
159  
160 < dnl We need X11.
161 < AC_PATH_XTRA
162 < if [[ "x$no_x" = "xyes" ]]; then
163 <  AC_MSG_ERROR([You need X11 to run Basilisk II.])
164 < fi
165 < CFLAGS="$CFLAGS $X_CFLAGS"
166 < CXXFLAGS="$CXXFLAGS $X_CFLAGS"
167 < LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
160 > dnl We need X11, if not using SDL.
161 > if [[ "x$WANT_SDL" = "xno" ]]; then
162 >  AC_PATH_XTRA
163 >  if [[ "x$no_x" = "xyes" ]]; then
164 >    AC_MSG_ERROR([You need X11 to run Basilisk II.])
165 >  fi
166 >  CFLAGS="$CFLAGS $X_CFLAGS"
167 >  CXXFLAGS="$CXXFLAGS $X_CFLAGS"
168 >  LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
169 > fi
170  
171   dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
172   HAVE_PTHREADS=yes
# Line 227 | Line 263 | AC_SYS_LARGEFILE
263  
264   dnl Checks for header files.
265   AC_HEADER_STDC
266 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h mach/mach.h)
266 > AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h)
267   AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
268 + AC_CHECK_HEADERS(sys/socket.h)
269 + AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
270 + #ifdef HAVE_SYS_SOCKET_H
271 + #include <sys/socket.h>
272 + #endif
273 + ])
274 + AC_CHECK_HEADERS(AvailabilityMacros.h)
275  
276   dnl Checks for typedefs, structures, and compiler characteristics.
277   AC_C_BIGENDIAN
# Line 243 | Line 286 | AC_CHECK_SIZEOF(double, 8)
286   AC_CHECK_SIZEOF(long double, 12)
287   AC_CHECK_SIZEOF(void *, 4)
288   AC_TYPE_OFF_T
289 < AC_CHECK_TYPE(loff_t, off_t)
290 < AC_CHECK_TYPE(caddr_t, [char *])
289 > AC_CHECK_TYPES(loff_t)
290 > AC_CHECK_TYPES(caddr_t)
291   AC_TYPE_SIZE_T
292   AC_TYPE_SIGNAL
293   AC_HEADER_TIME
# Line 321 | Line 364 | AC_CHECK_FILE([/dev/ptc],
364   dnl (end of code from openssh-3.2.2p1 configure.ac)
365  
366  
367 + dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
368 + AC_DEFUN(AC_CHECK_FRAMEWORK, [
369 +  AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
370 +  AC_CACHE_CHECK([whether compiler supports framework $1],
371 +    ac_Framework, [
372 +    saved_LIBS="$LIBS"
373 +    LIBS="$LIBS -framework $1"
374 +    AC_TRY_LINK(
375 +      [$2], [int main(void) { return 0; }],
376 +      [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
377 +    )
378 +  ])
379 +  AS_IF([test AS_VAR_GET(ac_Framework) = yes],
380 +    [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
381 +  )
382 +  AS_VAR_POPDEF([ac_Framework])dnl
383 + ])
384 +
385 + dnl Check for some MacOS X frameworks
386 + AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
387 + AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
388 +
389   dnl Select system-dependant source files.
390   SERIALSRC=serial_unix.cpp
391   ETHERSRC=../dummy/ether_dummy.cpp
# Line 381 | Line 446 | irix*)
446    dnl Do a test compile of an empty function
447    AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
448    CFLAGS="$ocflags"
449 <
449 >  ;;
450 > darwin*)
451 >  if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then
452 >    EXTRASYSSRCS="../MacOSX/sys_darwin.cpp"
453 >  fi
454    ;;
455   esac
456 + dnl SDL overrides
457 + if [[ "x$WANT_SDL" = "xyes" ]]; then
458 +  AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
459 + fi
460 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
461 +  AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
462 +  VIDEOSRCS="../SDL/video_sdl.cpp"
463 +  KEYCODES="../SDL/keycodes"
464 +  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
465 +    EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
466 +  else
467 +    EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
468 +  fi
469 + else
470 +  VIDEOSRCS="video_x.cpp"
471 +  KEYCODES="keycodes"
472 +  EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp"
473 + fi
474 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
475 +  AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
476 +  AUDIOSRC="../SDL/audio_sdl.cpp"
477 + fi
478  
479   dnl Use 68k CPU natively?
480   WANT_NATIVE_M68K=no
# Line 399 | Line 490 | if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
490    ETHERSRC=../dummy/ether_dummy.cpp
491    AUDIOSRC=../dummy/audio_dummy.cpp
492   fi
493 < SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
493 > SYSSRCS="$VIDEOSRCS $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
494  
495   dnl Define a macro that translates a yesno-variable into a C macro definition
496   dnl to be put into the config.h file
# Line 412 | Line 503 | AC_DEFUN(AC_TRANSLATE_DEFINE, [
503      fi
504   ])
505  
506 + dnl Check that the host supports TUN/TAP devices
507 + AC_CACHE_CHECK([whether TUN/TAP is supported],
508 +  ac_cv_tun_tap_support, [
509 +  AC_TRY_COMPILE([
510 +    #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
511 +    #include <linux/if.h>
512 +    #include <linux/if_tun.h>
513 +    #endif
514 +    #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
515 +    #include <net/if.h>
516 +    #include <net/if_tun.h>
517 +    #endif
518 +  ], [
519 +    struct ifreq ifr;
520 +    memset(&ifr, 0, sizeof(ifr));
521 +    ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
522 +  ],
523 +  ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
524 +  )
525 + ])
526 + AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
527 +  [Define if your system supports TUN/TAP devices.])
528 +
529   dnl Various checks if the system supports vm_allocate() and the like functions.
530   have_mach_vm=no
531   if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
# Line 558 | Line 672 | AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_
672  
673   fi dnl HAVE_MMAP_VM
674  
675 + dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
676 + AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
677 +  ac_cv_pagezero_hack, [
678 +  ac_cv_pagezero_hack=no
679 +  if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
680 +    ac_cv_pagezero_hack=yes
681 +    dnl might as well skip the test for mmap-able low memory
682 +    ac_cv_can_map_lm=no
683 +  fi
684 + ])
685 + AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
686 +  [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
687 +
688   dnl Check if we can mmap 0x2000 bytes from 0x0000
689   AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
690    ac_cv_can_map_lm, [
# Line 581 | Line 708 | AC_CACHE_CHECK([whether we can map Low M
708    ]
709   )
710  
711 + dnl Check if we have POSIX shared memory support
712 + AC_CACHE_CHECK([whether POSIX shared memory is working],
713 +  ac_cv_have_posix_shm, [
714 +  AC_LANG_SAVE
715 +  AC_LANG_CPLUSPLUS
716 +  AC_TRY_RUN([
717 +    #define HAVE_POSIX_SHM
718 +    #include "vm_alloc.cpp"
719 +    int main(void) { /* returns 0 if we have working POSIX shm */
720 +      if (vm_init() < 0) exit(2);
721 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
722 +      if (m1 == VM_MAP_FAILED) exit(3);
723 +      vm_exit(); exit(0);
724 +    }
725 +  ], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no,
726 +  dnl When cross-compiling, do not assume anything.
727 +  ac_cv_have_posix_shm="guessing no"
728 +  )
729 +  AC_LANG_RESTORE
730 +  ]
731 + )
732 + AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm",
733 +  [Define if your system supports POSIX shared memory.])
734 +
735 + dnl Check if we have working 33-bit memory addressing
736 + AC_CACHE_CHECK([whether 33-bit memory addressing is working],
737 +  ac_cv_have_33bit_addressing, [
738 +  AC_LANG_SAVE
739 +  AC_LANG_CPLUSPLUS
740 +  AC_TRY_RUN([
741 +    #define USE_33BIT_ADDRESSING 1
742 +    #include "vm_alloc.cpp"
743 +    int main(void) { /* returns 0 if we have working 33-bit addressing */
744 +      if (sizeof(void *) < 8) exit(1);
745 +      if (vm_init() < 0) exit(2);
746 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
747 +      if (m1 == VM_MAP_FAILED) exit(3);
748 +      char *m2 = m1 + (1L << 32);
749 +      m1[0] = 0x12; if (m2[0] != 0x12) exit(4);
750 +      m2[0] = 0x34; if (m1[0] != 0x34) exit(5);
751 +      vm_exit(); exit(0);
752 +    }
753 +  ], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no,
754 +  dnl When cross-compiling, do not assume anything.
755 +  ac_cv_have_33bit_addressing="guessing no"
756 +  )
757 +  AC_LANG_RESTORE
758 +  ]
759 + )
760 +
761   dnl Check signal handlers need to be reinstalled
762   AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
763    ac_cv_signal_need_reinstall, [
# Line 743 | Line 920 | if [[ -n "$sigsegv_recovery" ]]; then
920    CAN_VOSF=yes
921   fi
922  
923 + dnl A dummy program that returns always true
924 + AC_PATH_PROG([BLESS], "true")
925 +
926   dnl Determine the addressing mode to use
927   if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
928    ADDRESSING_MODE="real"
# Line 753 | Line 933 | else
933      case $am in
934      real)
935        dnl Requires ability to mmap() Low Memory globals
936 <      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
936 >      if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
937          continue
938        fi
939 <          dnl Requires VOSF screen updates
939 >      dnl Requires VOSF screen updates
940        if [[ "x$CAN_VOSF" = "xno" ]]; then
941          continue
942        fi
# Line 764 | Line 944 | else
944        ADDRESSING_MODE="real"
945        WANT_VOSF=yes dnl we can use VOSF and we need it actually
946        DEFINES="$DEFINES -DREAL_ADDRESSING"
947 +      if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
948 +        BLESS=Darwin/lowmem
949 +        LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
950 +      fi
951        break
952        ;;
953      direct)
# Line 858 | Line 1042 | if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1042    fi
1043   fi
1044  
1045 + dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4
1046 + dnl However, there are some corner cases exposed on x86-64
1047 + if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1048 +  SAVED_CXXFLAGS="$CXXFLAGS"
1049 +  CXXFLAGS="$CXXFLAGS -fno-gcse-sm"
1050 +  AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [
1051 +    AC_LANG_SAVE
1052 +    AC_LANG_CPLUSPLUS
1053 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_store_motion=yes],[ac_cv_gcc_store_motion=no])
1054 +    AC_LANG_RESTORE
1055 +  ])
1056 +  if [[ "x$ac_cv_gcc_store_motion" != "xyes" ]]; then
1057 +    CXXFLAGS="$SAVED_CXXFLAGS"
1058 +  fi
1059 + fi
1060 +
1061   dnl Select appropriate CPU source and REGPARAM define.
1062   ASM_OPTIMIZATIONS=none
1063   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
# Line 882 | Line 1082 | elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HA
1082    if [[ "x$HAVE_GAS" = "xyes" ]]; then
1083      ASM_OPTIMIZATIONS="x86-64"
1084      DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
1085 +    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"
1086 +    CAN_JIT=yes
1087 +    WANT_33BIT_ADDRESSING=yes
1088    fi
1089   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
1090    dnl SPARC CPU
# Line 938 | Line 1141 | else
1141    JITSRCS=""
1142   fi
1143  
1144 + dnl Use 33-bit memory addressing?
1145 + if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then
1146 +  use_33bit_addressing=yes
1147 + fi
1148 + AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing",
1149 +  [Define to use 33-bit memory addressing on 64-bit JIT capable systems.])
1150 +
1151   dnl Utility macro used by next two tests.
1152   dnl AC_EXAMINE_OBJECT(C source code,
1153   dnl     commands examining object file,
# Line 1135 | Line 1345 | fi
1345  
1346   dnl Remove the "-g" option if set for GCC.
1347   if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1348 <  CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
1349 <  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1348 >  CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'`
1349 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
1350   fi
1351  
1352   dnl Or if we have -IPA (MIPSPro compilers)
# Line 1152 | Line 1362 | AC_SUBST(DEFINES)
1362   AC_SUBST(SYSSRCS)
1363   AC_SUBST(CPUINCLUDES)
1364   AC_SUBST(CPUSRCS)
1365 + AC_SUBST(BLESS)
1366 + AC_SUBST(KEYCODES)
1367   AC_CONFIG_FILES([Makefile])
1368   AC_OUTPUT
1369  
# Line 1159 | Line 1371 | dnl Print summary.
1371   echo
1372   echo Basilisk II configuration summary:
1373   echo
1374 + echo SDL support ............................ : $SDL_SUPPORT
1375   echo XFree86 DGA support .................... : $WANT_XF86_DGA
1376   echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
1377   echo fbdev DGA support ...................... : $WANT_FBDEV_DGA

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines