--- SheepShaver/src/Unix/configure.ac 2005/12/11 18:15:05 1.43 +++ SheepShaver/src/Unix/configure.ac 2006/04/06 22:36:43 1.49 @@ -432,15 +432,69 @@ 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, [ +AC_DEFUN([AC_CHECK_FRAMEWORK], [ AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl AC_CACHE_CHECK([whether compiler supports framework $1], ac_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"] ) ]) @@ -493,7 +547,6 @@ darwin*) fi ;; irix*) - ETHERSRC=ether_unix.cpp AUDIOSRC=Irix/audio_irix.cpp LIBS="$LIBS -laudio" WANT_ESD=no @@ -512,7 +565,13 @@ irix*) 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 \ @@ -554,7 +613,7 @@ dnl to be put into the config.h file dnl $1 -- the macro to define dnl $2 -- the value to translate dnl $3 -- template name -AC_DEFUN(AC_TRANSLATE_DEFINE, [ +AC_DEFUN([AC_TRANSLATE_DEFINE], [ if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then AC_DEFINE($1, 1, $3) fi @@ -1196,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], @@ -1206,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], @@ -1311,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" @@ -1326,7 +1387,7 @@ 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" @@ -1337,13 +1398,18 @@ 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