--- SheepShaver/src/Unix/configure.ac 2005/11/30 00:02:25 1.40 +++ SheepShaver/src/Unix/configure.ac 2006/01/27 23:48:08 1.48 @@ -125,6 +125,7 @@ AC_SUBST(MONSRCS) dnl Checks for libraries. AC_CHECK_LIB(posix4, sem_init) +AC_CHECK_LIB(m, cos) dnl Do we need SDL? WANT_SDL=no @@ -431,6 +432,60 @@ AC_CHECK_FILE([/dev/ptc], ) dnl (end of code from openssh-3.2.2p1 configure.ac) +dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK) +dnl doesn't work or is unimplemented. On these systems (mostly older +dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4] +AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O], + ac_cv_nonblocking_io, [ + case "$host" in + *-*-osf*) + ac_cv_nonblocking_io=FIONBIO + ;; + *-*-sunos4*) + ac_cv_nonblocking_io=FIONBIO + ;; + *-*-ultrix*) + ac_cv_nonblocking_io=FIONBIO + ;; + *) + ac_cv_nonblocking_io=O_NONBLOCK + ;; + esac +]) +if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then + AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used]) +fi + +dnl Check whether compiler supports byte bit-fields +AC_CACHE_CHECK([whether compiler supports byte bit-fields], + ac_cv_have_byte_bitfields, [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_RUN([ + struct A { + unsigned char b1:4; + unsigned char b2:4; + unsigned char c; + unsigned short s; + unsigned char a[4]; + }; + + int main(void) { + A a; + return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1)); + }], + [ac_cv_have_byte_bitfields=yes], + [ac_cv_have_byte_bitfields=no], + dnl When cross-compiling, assume only GCC supports this + [if [[ "$GCC" = "yes" ]]; then + ac_cv_have_byte_bitfields="guessing yes" + else + ac_cv_have_byte_bitfields="guessing no" + fi] + ) + AC_LANG_RESTORE +]) + dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES) AC_DEFUN(AC_CHECK_FRAMEWORK, [ AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl @@ -439,7 +494,7 @@ AC_DEFUN(AC_CHECK_FRAMEWORK, [ saved_LIBS="$LIBS" LIBS="$LIBS -framework $1" AC_TRY_LINK( - [$2], [int main(void) { return 0; }], + [$2], [], [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"] ) ]) @@ -491,10 +546,32 @@ darwin*) EXTFSSRC=../MacOSX/extfs_macosx.mm fi ;; +irix*) + AUDIOSRC=Irix/audio_irix.cpp + LIBS="$LIBS -laudio" + WANT_ESD=no + + dnl Check if our compiler supports -IPA (MIPSPro) + HAVE_IPA=no + ocflags="$CFLAGS" + CFLAGS=`echo " $CFLAGS -IPA" | sed -e "s/ -g //g"` + AC_MSG_CHECKING(if "-IPA" works) + dnl Do a test compile of an empty function + AC_TRY_COMPILE([#if defined __GNUC__ + # error GCC does not support IPA yet + #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) + CFLAGS="$ocflags" + ;; esac dnl Is the slirp library supported? -if [[ "x$ETHERSRC" = "xether_unix.cpp" ]]; then +case "$ac_cv_have_byte_bitfields" in +yes|"guessing yes") + CAN_SLIRP=yes + ETHERSRC=ether_unix.cpp + ;; +esac +if [[ -n "$CAN_SLIRP" ]]; then AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported]) SLIRP_SRCS="\ ../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \ @@ -1178,6 +1255,7 @@ HAVE_GCC27=no AC_MSG_CHECKING(for GCC 2.7 or higher) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5) # error gcc < 2.7 + typedef syntax error; #endif ]])], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], @@ -1188,6 +1266,7 @@ HAVE_GCC30=no AC_MSG_CHECKING(for GCC 3.0 or higher) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3) # error gcc < 3 + typedef syntax error; #endif ]])], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], @@ -1275,9 +1354,15 @@ if [[ "x$EMULATED_PPC" = "xyes" ]]; then i?86:elf) ac_cv_use_dyngen=yes ;; + mips:elf) + ac_cv_use_dyngen=yes + ;; powerpc:mach) ac_cv_use_dyngen=yes ;; + i?86:mach) + ac_cv_use_dyngen=yes + ;; *:*) ac_cv_use_dyngen=no ;; @@ -1287,7 +1372,7 @@ if [[ "x$EMULATED_PPC" = "xyes" ]]; then if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then DYNGEN_CC=$CXX else - for p in /usr/bin /usr/local/bin; do + for p in /usr/bin /usr/local/bin /usr/freeware/bin; do gxx="$p/g++" if [[ -x "$gxx" ]]; then DYNGEN_CC="$gxx" @@ -1302,7 +1387,10 @@ if [[ "x$EMULATED_PPC" = "xyes" ]]; then if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then case $host_cpu in i?86) - DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2" + DYNGEN_OP_FLAGS="-fomit-frame-pointer" + ;; + mips) + DYNGEN_OP_FLAGS="-fno-delayed-branch -mno-abicalls" ;; powerpc) if [[ "x$ac_cv_object_format" = "xmach" ]]; then @@ -1310,15 +1398,27 @@ if [[ "x$EMULATED_PPC" = "xyes" ]]; then fi ;; esac - if [[ "x$HAVE_GCC30" = "xyes" ]]; then + have_dyngen_gcc3=no + case "x`$DYNGEN_CC -dumpversion`" in + x[12].*) ;; + x*) have_dyngen_gcc3=yes ;; + esac + if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0" else DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0" fi DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-functions -finline-limit=10000 -fno-exceptions -g0" - if [[ "x$HAVE_GCC30" = "xyes" ]]; then + if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls" fi + if [[ "x$DYNGEN_CC" != "x$CXX" ]]; then + DYNGEN_CFLAGS="-O2 $CFLAGS" + DYNGEN_CXXFLAGS="-O2 $CXXFLAGS" + else + DYNGEN_CFLAGS="\$(CFLAGS)" + DYNGEN_CXXFLAGS="\$(CXXFLAGS)" + fi else WANT_JIT=no fi @@ -1367,11 +1467,21 @@ if [[ "x$WANT_JIT" = "xyes" ]]; then CPPFLAGS="$CPPFLAGS -DUSE_JIT" fi +dnl Higher level optimizations with MIPSPro compilers are possible +if [[ "x$HAVE_IPA" = "xyes" ]]; then + CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" + CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" + CXXFLAGS="-LANG:std $CXXFLAGS" + LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA" +fi + dnl Generate Makefile. AC_SUBST(PERL) AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen]) AC_SUBST(DYNGENSRCS) AC_SUBST(DYNGEN_CC) +AC_SUBST(DYNGEN_CFLAGS) +AC_SUBST(DYNGEN_CXXFLAGS) AC_SUBST(DYNGEN_OP_FLAGS) AC_SUBST(SYSSRCS) AC_SUBST(CPUSRCS)