From 9161a4eb2b8d2b85e171a8734535dd85a0355c4a Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Sat, 9 Jan 2010 13:29:28 +0100 Subject: [PATCH] Solaris 8 and Sun Studio support --- CHANGES | 3 +++ Makefile.in | 4 ++-- configure.in | 22 ++++++++++++++++------ sycls.c | 3 ++- test.sh | 21 ++++++++++++++++++++- 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index 53b8bff..8ad513c 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,9 @@ porting: contain -Wall failed (esp.RedHat). Thanks to Paul Wouters for reporting this problem and to Simon Matter for providing the patch + support for Solaris 8 and Sun Studio support (thanks to Sebastian + Kayser for providing the patches) + ####################### V 1.7.1.1: corrections: diff --git a/Makefile.in b/Makefile.in index 5eaab88..75430ab 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,5 @@ # source: Makefile.in -# Copyright Gerhard Rieger 2001-2008 +# Copyright Gerhard Rieger 2001-2009 # Published under the GNU General Public License V.2, see file COPYING # note: @...@ forms are filled in by configure script @@ -22,7 +22,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ CC = @CC@ -CCOPTS = $(CCOPT) -Wall -Wno-parentheses +CCOPTS = $(CCOPT) SYSDEFS = @SYSDEFS@ CPPFLAGS = -I. @CPPFLAGS@ diff --git a/configure.in b/configure.in index fc22379..b28e4ac 100644 --- a/configure.in +++ b/configure.in @@ -42,7 +42,11 @@ AC_CHECK_PROG(AR, ar, ar, gar) AC_LANG_COMPILER_REQUIRE() if test "$GCC" = yes; then - CFLAGS="$CFLAGS -D_GNU_SOURCE" + CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -Wno-parentheses" + ERRONWARN="-Werror -O0" +else + # Sun Studio? + ERRONWARN="-errwarn" fi export CFLAGS @@ -53,9 +57,15 @@ AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/param.h sys/ioctl.h sys/time.h syslog.h unistd.h) AC_CHECK_HEADERS(pwd.h grp.h stdint.h sys/types.h sys/poll.h sys/socket.h sys/uio.h sys/stat.h netdb.h sys/un.h) AC_CHECK_HEADERS(pty.h) -AC_CHECK_HEADERS(netinet/in.h netinet/in_systm.h netinet/ip.h netinet/tcp.h) +AC_CHECK_HEADERS(netinet/in.h netinet/in_systm.h) +AC_CHECK_HEADERS(netinet/ip.h, [], [], [AC_INCLUDES_DEFAULT + #if HAVE_NETINET_IN_H && HAVE_NETINET_IN_SYSTM_H + #include + #include + #endif]) # Solaris prerequisites for netinet/ip.h +AC_CHECK_HEADERS(netinet/tcp.h) AC_CHECK_HEADERS(netinet6/in6.h) # found on OpenBSD, used for IPV6_* -AC_CHECK_HEADERS(net/if.h, [], [], [AC_INCLUDES_DEFAULT +AC_CHECK_HEADER(net/if.h, [], [], [AC_INCLUDES_DEFAULT #if HAVE_SYS_SOCKET_H #include #endif]) # Mac OS X requires including sys/socket.h @@ -84,7 +94,7 @@ AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) dnl Check for hstrerror prototype AC_MSG_CHECKING(for hstrerror prototype) AC_CACHE_VAL(sc_cv_have_prototype_hstrerror, -[CFLAGS1="$CFLAGS"; CFLAGS="-Werror -O0 $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')"; +[CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')"; AC_TRY_COMPILE([#include ],[hstrerror();], [sc_cv_have_prototype_hstrerror=no], [sc_cv_have_prototype_hstrerror=yes]); @@ -1296,7 +1306,7 @@ dnl output values: 1..short, 2..unsigned short, 3..int, 4..u-int, dnl 5..long, 6..u-long; others not yet supported define(AC_BASIC_TYPE,[ AC_CACHE_CHECK(for equivalent simple type of $2, $4, -[CFLAGS1="$CFLAGS"; CFLAGS="-Werror -O0 $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')" +[CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')" AC_TRY_COMPILE([$1],[$2 u; short v; &u==&v;], [$4="1 /* short */"], [AC_TRY_COMPILE([$1],[$2 u; unsigned short v; &u==&v;], @@ -1328,7 +1338,7 @@ dnl arg4: output variable, values see AC_BASIC_TYPE dnl arg5: cache variable (might be constructed automatically) define(AC_TYPEOF_COMPONENT,[ AC_CACHE_CHECK(for basic type of $2.$3, $5, -[CFLAGS1="$CFLAGS"; CFLAGS="-Werror -O0 $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')" +[CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')" AC_TRY_COMPILE([$1],[$2 u;short v; &u.$3==&v;], [$5="1 /* short */"], [AC_TRY_COMPILE([$1],[$2 u; unsigned short v; &u.$3==&v;], diff --git a/sycls.c b/sycls.c index fa9f1f9..b2baa96 100644 --- a/sycls.c +++ b/sycls.c @@ -1,5 +1,5 @@ /* source: sycls.c */ -/* Copyright Gerhard Rieger 2001-2008 */ +/* Copyright Gerhard Rieger 2001-2009 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* explicit system call and C library trace function, for those who miss strace @@ -18,6 +18,7 @@ #include "error.h" #include "filan.h" +#include "utils.h" #include "sysutils.h" #include "sycls.h" diff --git a/test.sh b/test.sh index 6233520..377a10e 100755 --- a/test.sh +++ b/test.sh @@ -97,6 +97,11 @@ HP-UX|OSF1) chmod a+x cat.sh CAT=./cat.sh ;; +SunOS) + # /usr/bin/tr doesn't handle the a-z range syntax (needs [a-z]), use + # /usr/xpg4/bin/tr instead + alias tr=/usr/xpg4/bin/tr + ;; *) CAT=cat ;; @@ -9059,6 +9064,9 @@ if ! eval $NUMCOND; then :; elif [ "$ROOT" = root -a $(id -u) -ne 0 -a "$withroot" -eq 0 ]; then $PRINTF "test $F_n $TEST... ${YELLOW}must be root${NORMAL}\n" $N numCANT=$((numCANT+1)) +elif [ "$PF" = "IP6" ] && ( ! feat=$(testaddrs ip6) || ! runsip6 >/dev/null ); then + $PRINTF "test $F_n $TEST... ${YELLOW}IP6 not available${NORMAL}\n" $N + numCANT=$((numCANT+1)) else tf="$td/test$N.stdout" te="$td/test$N.stderr" @@ -9179,6 +9187,10 @@ if ! eval $NUMCOND; then :; elif ! feat=$(testaddrs $FEAT); then $PRINTF "test $F_n $TEST... ${YELLOW}$(echo "$feat" |tr a-z A-Z) not available${NORMAL}\n" $N numCANT=$((numCANT+1)) +elif [ "$KEYW" = "TCP6" -o "$KEYW" = "UDP6" -o "$KEYW" = "SCTP6" ] && \ + ! runsip6 >/dev/null; then + $PRINTF "test $F_n $TEST... ${YELLOW}IP6 not available${NORMAL}\n" $N + numCANT=$((numCANT+1)) else tf="$td/test$N.stdout" te="$td/test$N.stderr" @@ -9274,6 +9286,9 @@ if ! eval $NUMCOND; then :; elif [ "$ROOT" = root -a $(id -u) -ne 0 -a "$withroot" -eq 0 ]; then $PRINTF "test $F_n $TEST... ${YELLOW}must be root${NORMAL}\n" $N numCANT=$((numCANT+1)) +elif [ "$PF" = "IP6" ] && ( ! feat=$(testaddrs ip6) || ! runsip6 ) >/dev/null; then + $PRINTF "test $F_n $TEST... ${YELLOW}IP6 not available${NORMAL}\n" $N + numCANT=$((numCANT+1)) else tf="$td/test$N.stdout" te="$td/test$N.stderr" @@ -9427,7 +9442,11 @@ NAME=SOCKET_CONNECT_TCP6 case "$TESTS" in *%functions%*|*%generic%*|*%tcp6%*|*%socket%*|*%$NAME%*) TEST="$NAME: socket connect with TCP/IPv6" -if ! eval $NUMCOND; then :; else +if ! eval $NUMCOND; then :; +elif ! testaddrs tcp ip6 >/dev/null || ! runsip6 >/dev/null; then + $PRINTF "test $F_n $TEST... ${YELLOW}TCP6 not available${NORMAL}\n" $N + numCANT=$((numCANT+1)) +else # start a TCP6-LISTEN process that echoes data, and send test data using # SOCKET-CONNECT, selecting TCP/IPv6. The sent data should be returned. tf="$td/test$N.stdout"