From d4210ef902a2e6bbe43dfec9e52b683d4f46c0d3 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Fri, 27 Jan 2006 23:48:08 +0000 Subject: [PATCH] Check whether compiler supports byte bit-fields. If so, we can enable slirp emulation code since it pure C+sockets code. --- SheepShaver/src/Unix/configure.ac | 39 +++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/SheepShaver/src/Unix/configure.ac b/SheepShaver/src/Unix/configure.ac index 4714e933..5a4f5c7a 100644 --- a/SheepShaver/src/Unix/configure.ac +++ b/SheepShaver/src/Unix/configure.ac @@ -456,6 +456,36 @@ 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 @@ -517,7 +547,6 @@ darwin*) fi ;; irix*) - ETHERSRC=ether_unix.cpp AUDIOSRC=Irix/audio_irix.cpp LIBS="$LIBS -laudio" WANT_ESD=no @@ -536,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 \