From: patthoyts <patthoyts>
Date: Fri, 30 Mar 2007 21:22:54 +0000 (+0000)
Subject: Upgraded TEA to 3.6 and update the version to 1.0.9. Regenerated configure.
X-Git-Url: http://www.privyetmir.co.uk/gitweb?a=commitdiff_plain;h=85ff2070477ec981defe75da649514bb15482248;p=tcludp

Upgraded TEA to 3.6 and update the version to 1.0.9. Regenerated configure.
Improved the error reporting by making use of strerror() if present.
---

diff --git a/ChangeLog b/ChangeLog
index e950ae2..1674cab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 
 	* generic/udp_tcl.c: Added support for IP_MULTICAST_LOOP for
 	Konstantin Khomoutov to control multicast loopback transmission.
+	Improved the error reporting by using strerror if available.
+	* Makefile.in: Fix 'make shell' to load the built library.
+	* configure.in: Incremented version and use TEA 3.6
+	* tclconfig/*: Upgraded to TEA 3.6
+	* aclocal.m4: Check for strerror presence.
 
 2007-01-31  Pat Thoyts  <patthoyts@users.sourceforge.net>
 
diff --git a/Makefile.in b/Makefile.in
index 33246d7..9ec6714 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -235,7 +235,7 @@ test: binaries libraries
 	$(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)
 
 shell: binaries libraries
-	@$(TCLSH) $(SCRIPT)
+	echo "load $(PKG_LIB_FILE);set argv $(SCRIPT)" | $(TCLSH)
 
 gdb:
 	$(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT)
diff --git a/aclocal.m4 b/aclocal.m4
index 55df735..83a84ab 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -86,6 +86,23 @@ AC_DEFUN(TCLUDP_CHECK_CLOEXEC, [
     fi
 ])
 
+#-------------------------------------------------------------------------
+# TCLUDP_CHECK_STRERROR
+#
+#	Do we have strerror()
+#
+# Results
+#	Sets HAVE_STRERROR
+#
+#-------------------------------------------------------------------------
+
+AC_DEFUN(TCLUDP_CHECK_STRERROR, [
+    AC_CHECK_LIB(c,strerror,[tcludp_strerror_ok=yes],[tcludp_strerror_ok=no])
+    if test "$tcludp_strerror_ok" = "yes"; then
+        TEA_ADD_CFLAGS([-DHAVE_STRERROR])
+    fi
+])
+
 #-------------------------------------------------------------------------
 # TCLUDP_CONFIG
 #
@@ -98,4 +115,5 @@ AC_DEFUN(TCLUDP_CHECK_CLOEXEC, [
 
 AC_DEFUN(TCLUDP_CONFIG, [
     TCLUDP_CHECK_CLOEXEC
+    TCLUDP_CHECK_STRERROR
 ])
diff --git a/configure b/configure
index 11ebb8e..1bca3ce 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for udp 1.0.8.
+# Generated by GNU Autoconf 2.59 for udp 1.0.9.
 #
 # Copyright (C) 2003 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
@@ -267,8 +267,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='udp'
 PACKAGE_TARNAME='udp'
-PACKAGE_VERSION='1.0.8'
-PACKAGE_STRING='udp 1.0.8'
+PACKAGE_VERSION='1.0.9'
+PACKAGE_STRING='udp 1.0.9'
 PACKAGE_BUGREPORT=''
 
 # Factoring default headers for most tests.
@@ -777,7 +777,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures udp 1.0.8 to adapt to many kinds of systems.
+\`configure' configures udp 1.0.9 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -834,7 +834,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of udp 1.0.8:";;
+     short | recursive ) echo "Configuration of udp 1.0.9:";;
    esac
   cat <<\_ACEOF
 
@@ -965,7 +965,7 @@ fi
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-udp configure 1.0.8
+udp configure 1.0.9
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -979,7 +979,7 @@ cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by udp $as_me 1.0.8, which was
+It was created by udp $as_me 1.0.9, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1325,7 +1325,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
     # TEA extensions pass this us the version of TEA they think they
     # are compatible with.
-    TEA_VERSION="3.5"
+    TEA_VERSION="3.6"
 
     echo "$as_me:$LINENO: checking for correct TEA configuration" >&5
 echo $ECHO_N "checking for correct TEA configuration... $ECHO_C" >&6
@@ -1336,15 +1336,15 @@ echo "$as_me: error:
 The PACKAGE_NAME variable must be defined by your TEA configure.in" >&2;}
    { (exit 1); exit 1; }; }
     fi
-    if test x"3.5" = x ; then
+    if test x"3.6" = x ; then
 	{ { echo "$as_me:$LINENO: error:
 TEA version not specified." >&5
 echo "$as_me: error:
 TEA version not specified." >&2;}
    { (exit 1); exit 1; }; }
-    elif test "3.5" != "${TEA_VERSION}" ; then
-	echo "$as_me:$LINENO: result: warning: requested TEA version \"3.5\", have \"${TEA_VERSION}\"" >&5
-echo "${ECHO_T}warning: requested TEA version \"3.5\", have \"${TEA_VERSION}\"" >&6
+    elif test "3.6" != "${TEA_VERSION}" ; then
+	echo "$as_me:$LINENO: result: warning: requested TEA version \"3.6\", have \"${TEA_VERSION}\"" >&5
+echo "${ECHO_T}warning: requested TEA version \"3.6\", have \"${TEA_VERSION}\"" >&6
     else
 	echo "$as_me:$LINENO: result: ok (TEA ${TEA_VERSION})" >&5
 echo "${ECHO_T}ok (TEA ${TEA_VERSION})" >&6
@@ -3360,9 +3360,12 @@ done
     if test -z "$no_pipe" -a -n "$GCC"; then
 	echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5
 echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6
-	OLDCC="$CC"
-	CC="$CC -pipe"
-	cat >conftest.$ac_ext <<_ACEOF
+if test "${tcl_cv_cc_pipe+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+	    hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
+	    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3399,17 +3402,21 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+  tcl_cv_cc_pipe=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-CC="$OLDCC"
-	    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+tcl_cv_cc_pipe=no
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+	    CFLAGS=$hold_cflags
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_cc_pipe" >&5
+echo "${ECHO_T}$tcl_cv_cc_pipe" >&6
+	if test $tcl_cv_cc_pipe = yes; then
+	    CFLAGS="$CFLAGS -pipe"
+	fi
     fi
 
     #--------------------------------------------------------------------
@@ -7443,7 +7450,6 @@ fi
     TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
     ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
     TCL_LIB_VERSIONS_OK=ok
-    CFLAGS="${CPPFLAGS} ${CFLAGS}"
     CFLAGS_DEBUG=-g
     CFLAGS_OPTIMIZE=-O
     if test "$GCC" = "yes" ; then
@@ -8060,7 +8066,11 @@ _ACEOF
 	    #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
 	    #LIBS="$LIBS -lxnet"               # Use the XOPEN network library
 
-	    SHLIB_SUFFIX=".sl"
+	    if test "`uname -m`" = "ia64" ; then
+		SHLIB_SUFFIX=".so"
+	    else
+		SHLIB_SUFFIX=".sl"
+	    fi
 	    echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
 if test "${ac_cv_lib_dld_shl_load+set}" = set; then
@@ -8600,11 +8610,14 @@ echo "${ECHO_T}$tcl_cv_ld_elf" >&6
 	    CFLAGS_OPTIMIZE="-Os"
 	    SHLIB_CFLAGS="-fno-common"
 	    # To avoid discrepancies between what headers configure sees during
-	    # preprocessing tests and compiling tests, add any -isysroot and
-	    # -mmacosx-version-min flags present in CFLAGS to CPPFLAGS:
+	    # preprocessing tests and compiling tests, move any -isysroot and
+	    # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
 	    CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
-		awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=1;i<=NF;i++) \
+		awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
 		if ($i~/^(isysroot|mmacosx-version-min)/) print "-"$i}'`"
+	    CFLAGS="`echo " ${CFLAGS}" | \
+		awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
+		if (!($i~/^(isysroot|mmacosx-version-min)/)) print "-"$i}'`"
 	    if test $do64bit = yes; then
 		case `arch` in
 		    ppc)
@@ -8812,7 +8825,7 @@ echo "${ECHO_T}$tcl_cv_ld_single_module" >&6
 	    DL_LIBS=""
 	    # Don't use -prebind when building for Mac OS X 10.4 or later only:
 	    test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \
-		"`echo "${CFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4 && \
+		"`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4 && \
 		LDFLAGS="$LDFLAGS -prebind"
 	    LDFLAGS="$LDFLAGS -headerpad_max_install_names"
 	    echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5
@@ -9227,6 +9240,8 @@ echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6
 echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;}
     fi
 
+
+
     # Step 4: disable dynamic loading if requested via a command-line switch.
 
     # Check whether --enable-load or --disable-load was given.
@@ -10358,6 +10373,84 @@ _ACEOF
     fi
 
 
+    echo "$as_me:$LINENO: checking for strerror in -lc" >&5
+echo $ECHO_N "checking for strerror in -lc... $ECHO_C" >&6
+if test "${ac_cv_lib_c_strerror+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char strerror ();
+int
+main ()
+{
+strerror ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_c_strerror=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_c_strerror=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_c_strerror" >&5
+echo "${ECHO_T}$ac_cv_lib_c_strerror" >&6
+if test $ac_cv_lib_c_strerror = yes; then
+  tcludp_strerror_ok=yes
+else
+  tcludp_strerror_ok=no
+fi
+
+    if test "$tcludp_strerror_ok" = "yes"; then
+
+    PKG_CFLAGS="$PKG_CFLAGS -DHAVE_STRERROR"
+
+
+    fi
+
+
 
 #--------------------------------------------------------------------
 # This macro generates a line to use when building a library.  It
@@ -10707,6 +10800,7 @@ LIBOBJS=$ac_libobjs
 LTLIBOBJS=$ac_ltlibobjs
 
 
+CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""
 
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
@@ -10978,7 +11072,7 @@ _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by udp $as_me 1.0.8, which was
+This file was extended by udp $as_me 1.0.9, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -11033,7 +11127,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-udp config.status 1.0.8
+udp config.status 1.0.9
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/configure.in b/configure.in
index 3cba1e1..8292034 100644
--- a/configure.in
+++ b/configure.in
@@ -19,7 +19,7 @@ dnl	to configure the system for the local environment.
 # so you can encode the package version directly into the source files.
 #-----------------------------------------------------------------------
 
-AC_INIT([udp], [1.0.8])
+AC_INIT([udp], [1.0.9])
 
 #--------------------------------------------------------------------
 # Call TEA_INIT as the first TEA_ macro to set up initial vars.
@@ -27,7 +27,7 @@ AC_INIT([udp], [1.0.8])
 # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
 #--------------------------------------------------------------------
 
-TEA_INIT([3.5])
+TEA_INIT([3.6])
 
 AC_CONFIG_AUX_DIR(tclconfig)
 
diff --git a/generic/udp_tcl.c b/generic/udp_tcl.c
index 51fac95..1a04aee 100644
--- a/generic/udp_tcl.c
+++ b/generic/udp_tcl.c
@@ -110,6 +110,7 @@ static int UdpSockGetPort(Tcl_Interp *interp, const char *s,
 static void udpTrace(const char *format, ...);
 static int  udpGetService(Tcl_Interp *interp, const char *service,
                           unsigned short *servicePort);
+static Tcl_Obj *ErrorToObj(const char * prefix);
 
 
 /*
@@ -1189,7 +1190,7 @@ UdpMulticast(ClientData instanceData, Tcl_Interp *interp,
     mreq.imr_interface.s_addr = INADDR_ANY;
     if (setsockopt(statePtr->sock, IPPROTO_IP, action,
                    (const char*)&mreq, sizeof(mreq)) < 0) {
-       Tcl_SetResult(interp, "error changing multicast group", TCL_STATIC);
+       Tcl_SetObjResult(interp, ErrorToObj("error changing multicast group"));
         return TCL_ERROR;
     }
 
@@ -1233,7 +1234,7 @@ udpGetOption(ClientData instanceData, Tcl_Interp *interp,
              CONST84 char *optionName, Tcl_DString *optionValue)
 {
     UdpState *statePtr = (UdpState *)instanceData;
-    CONST84 char * options[] = { "myport", "remote", "peer", "mcastgroups", "mcastloopback", "broadcast", "ttl", NULL};
+    CONST84 char * options[] = { "myport", "remote", "peer", "mcastgroups", "mcastloop", "broadcast", "ttl", NULL};
     int r = TCL_OK;
 
     if (optionName == NULL) {
@@ -1293,22 +1294,20 @@ udpGetOption(ClientData instanceData, Tcl_Interp *interp,
             socklen_t optlen = sizeof(int);
             if (getsockopt(statePtr->sock, SOL_SOCKET, SO_BROADCAST, 
                            (char *)&tmp, &optlen)) {
-                UDPTRACE("UDP error - getsockopt\n");
-                Tcl_SetResult(interp, "error in getsockopt", TCL_STATIC);
+		Tcl_SetObjResult(interp, ErrorToObj("error reading -broadcast"));
                 r = TCL_ERROR;
             } else {
                 Tcl_DStringSetLength(&ds, TCL_INTEGER_SPACE);
                 sprintf(Tcl_DStringValue(&ds), "%d", tmp);
             }
 
-	} else if (!strcmp("-mcastloopback", optionName)) {
+	} else if (!strcmp("-mcastloop", optionName)) {
 
             unsigned char tmp = 0;
             socklen_t optlen = sizeof(unsigned char);
             if (getsockopt(statePtr->sock, IPPROTO_IP, IP_MULTICAST_LOOP, 
                            (char *)&tmp, &optlen)) {
-                UDPTRACE("UDP error - getsockopt\n");
-                Tcl_SetResult(interp, "error in getsockopt", TCL_STATIC);
+		Tcl_SetObjResult(interp, ErrorToObj("error reading -mcastloop"));
                 r = TCL_ERROR;
             } else {
                 Tcl_DStringSetLength(&ds, TCL_INTEGER_SPACE);
@@ -1324,8 +1323,7 @@ udpGetOption(ClientData instanceData, Tcl_Interp *interp,
 		cmd = IP_MULTICAST_TTL;
             if (getsockopt(statePtr->sock, IPPROTO_IP, cmd,
 		(char *)&tmp, &optlen)) {
-                UDPTRACE("UDP error - getsockopt");
-                Tcl_SetResult(interp, "error in getsockopt", TCL_STATIC);
+		Tcl_SetObjResult(interp, ErrorToObj("error reading -ttl"));
                 r = TCL_ERROR;
             } else {
                 Tcl_DStringSetLength(&ds, TCL_INTEGER_SPACE);
@@ -1365,7 +1363,7 @@ udpSetOption(ClientData instanceData, Tcl_Interp *interp,
              CONST84 char *optionName, CONST84 char *newValue)
 {
     UdpState *statePtr = (UdpState *)instanceData;
-    CONST84 char * options = "remote mcastadd mcastdrop mcastloopback broadcast ttl";
+    CONST84 char * options = "remote mcastadd mcastdrop mcastloop broadcast ttl";
     int r = TCL_OK;
 
     if (!strcmp("-remote", optionName)) {
@@ -1410,15 +1408,13 @@ udpSetOption(ClientData instanceData, Tcl_Interp *interp,
         if (r == TCL_OK) {
             if (setsockopt(statePtr->sock, SOL_SOCKET, SO_BROADCAST, 
                            (const char *)&tmp, sizeof(int))) {
-                sprintf(errBuf, "%s", "udp - setsockopt");
-                UDPTRACE("UDP error - setsockopt\n");
-                Tcl_SetObjResult(interp, Tcl_NewStringObj(errBuf, -1));
+                Tcl_SetObjResult(interp, ErrorToObj("error setting -broadcast"));
                 r = TCL_ERROR;
             } else {
                 Tcl_SetObjResult(interp, Tcl_NewIntObj(tmp));
             }
         }
-    } else if (!strcmp("-mcastloopback", optionName)) {
+    } else if (!strcmp("-mcastloop", optionName)) {
 
         int tmp = 1;
         r = Tcl_GetInt(interp, newValue, &tmp);
@@ -1426,9 +1422,7 @@ udpSetOption(ClientData instanceData, Tcl_Interp *interp,
 	    unsigned char ctmp = (unsigned char)tmp;
             if (setsockopt(statePtr->sock, IPPROTO_IP, IP_MULTICAST_LOOP,
                            (const char *)&ctmp, sizeof(unsigned char))) {
-                sprintf(errBuf, "%s", "udp - setsockopt");
-                UDPTRACE("UDP error - setsockopt\n");
-                Tcl_SetObjResult(interp, Tcl_NewStringObj(errBuf, -1));
+                Tcl_SetObjResult(interp, ErrorToObj("error setting -mcastloop"));
                 r = TCL_ERROR;
             } else {
                 Tcl_SetObjResult(interp, Tcl_NewIntObj(tmp));
@@ -1445,9 +1439,7 @@ udpSetOption(ClientData instanceData, Tcl_Interp *interp,
         if (r == TCL_OK) {
             if (setsockopt(statePtr->sock, IPPROTO_IP, cmd,
                            (const char *)&tmp, sizeof(unsigned int))) {
-                sprintf(errBuf, "udp - setsockopt ttl");
-                UDPTRACE("UDP error - setsockopt\n");
-                Tcl_SetObjResult(interp, Tcl_NewStringObj(errBuf, -1));
+                Tcl_SetObjResult(interp, ErrorToObj("error setting -ttl"));
                 r = TCL_ERROR;
             } else {
                 Tcl_SetObjResult(interp, Tcl_NewIntObj(tmp));
@@ -1463,6 +1455,17 @@ udpSetOption(ClientData instanceData, Tcl_Interp *interp,
     return r;
 }
 
+static Tcl_Obj *
+ErrorToObj(const char * prefix)
+{
+    extern int errno;
+    Tcl_Obj *errObj = Tcl_NewStringObj(prefix, -1);
+#ifdef HAVE_STRERROR
+    Tcl_AppendStringsToObj(errObj, ": ", strerror(errno), NULL);
+#endif
+    return errObj;
+}
+
 /*
  * ----------------------------------------------------------------------
  * udpTrace --
diff --git a/tclconfig/tcl.m4 b/tclconfig/tcl.m4
index c3acbae..5a03112 100644
--- a/tclconfig/tcl.m4
+++ b/tclconfig/tcl.m4
@@ -11,11 +11,11 @@
 #
 # RCS: @(#) $Id$
 
-AC_PREREQ(2.50)
+AC_PREREQ(2.57)
 
 dnl TEA extensions pass us the version of TEA they think they
 dnl are compatible with (must be set in TEA_INIT below)
-dnl TEA_VERSION="3.5"
+dnl TEA_VERSION="3.6"
 
 # Possible values for key variables defined:
 #
@@ -980,7 +980,6 @@ AC_DEFUN([TEA_CONFIG_CFLAGS], [
     TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
     ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
     TCL_LIB_VERSIONS_OK=ok
-    CFLAGS="${CPPFLAGS} ${CFLAGS}"
     CFLAGS_DEBUG=-g
     CFLAGS_OPTIMIZE=-O
     if test "$GCC" = "yes" ; then
@@ -1318,7 +1317,11 @@ dnl AC_CHECK_TOOL(AR, ar)
 	    #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
 	    #LIBS="$LIBS -lxnet"               # Use the XOPEN network library
 
-	    SHLIB_SUFFIX=".sl"
+	    if test "`uname -m`" = "ia64" ; then
+		SHLIB_SUFFIX=".so"
+	    else
+		SHLIB_SUFFIX=".sl"
+	    fi
 	    AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
 	    if test "$tcl_ok" = yes; then
 		SHLIB_CFLAGS="+z"
@@ -1619,11 +1622,14 @@ dnl AC_CHECK_TOOL(AR, ar)
 	    CFLAGS_OPTIMIZE="-Os"
 	    SHLIB_CFLAGS="-fno-common"
 	    # To avoid discrepancies between what headers configure sees during
-	    # preprocessing tests and compiling tests, add any -isysroot and
-	    # -mmacosx-version-min flags present in CFLAGS to CPPFLAGS:
+	    # preprocessing tests and compiling tests, move any -isysroot and
+	    # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
 	    CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
-		awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=1;i<=NF;i++) \
+		awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
 		if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
+	    CFLAGS="`echo " ${CFLAGS}" | \
+		awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
+		if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
 	    if test $do64bit = yes; then
 		case `arch` in
 		    ppc)
@@ -1675,7 +1681,7 @@ dnl AC_CHECK_TOOL(AR, ar)
 	    DL_LIBS=""
 	    # Don't use -prebind when building for Mac OS X 10.4 or later only:
 	    test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
-		"`echo "${CFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \
+		"`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \
 		LDFLAGS="$LDFLAGS -prebind"
 	    LDFLAGS="$LDFLAGS -headerpad_max_install_names"
 	    AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
@@ -1963,6 +1969,12 @@ dnl AC_CHECK_TOOL(AR, ar)
 	AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
     fi
 
+dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
+dnl # until the end of configure, as configure's compile and link tests use
+dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
+dnl # preprocessing tests use only CPPFLAGS.
+    AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
+
     # Step 4: disable dynamic loading if requested via a command-line switch.
 
     AC_ARG_ENABLE(load,
@@ -2771,7 +2783,7 @@ AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
 AC_DEFUN([TEA_INIT], [
     # TEA extensions pass this us the version of TEA they think they
     # are compatible with.
-    TEA_VERSION="3.5"
+    TEA_VERSION="3.6"
 
     AC_MSG_CHECKING([for correct TEA configuration])
     if test x"${PACKAGE_NAME}" = x ; then
@@ -3147,11 +3159,14 @@ AC_DEFUN([TEA_SETUP_COMPILER], [
     #------------------------------------------------------------------------
 
     if test -z "$no_pipe" -a -n "$GCC"; then
-	AC_MSG_CHECKING([if the compiler understands -pipe])
-	OLDCC="$CC"
-	CC="$CC -pipe"
-	AC_TRY_COMPILE(,, AC_MSG_RESULT([yes]), CC="$OLDCC"
-	    AC_MSG_RESULT([no]))
+	AC_CACHE_CHECK([if the compiler understands -pipe],
+	    tcl_cv_cc_pipe, [
+	    hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
+	    AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no)
+	    CFLAGS=$hold_cflags])
+	if test $tcl_cv_cc_pipe = yes; then
+	    CFLAGS="$CFLAGS -pipe"
+	fi
     fi
 
     #--------------------------------------------------------------------
@@ -3391,8 +3406,13 @@ AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
 	        TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"; fi
 	        ;;
 	esac
+    else
+	if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then
+	    AC_MSG_ERROR([Cannot find private header tclInt.h in ${TCL_SRC_DIR}])
+	fi
     fi
 
+
     AC_SUBST(TCL_TOP_DIR_NATIVE)
     AC_SUBST(TCL_GENERIC_DIR_NATIVE)
     AC_SUBST(TCL_UNIX_DIR_NATIVE)
@@ -3547,6 +3567,10 @@ AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
 	        TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"; fi
 	        ;;
 	esac
+    else
+	if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then
+	    AC_MSG_ERROR([Cannot find private header tkInt.h in ${TK_SRC_DIR}])
+	fi
     fi
 
     AC_SUBST(TK_TOP_DIR_NATIVE)
diff --git a/tests/udp-srv.test b/tests/udp-srv.test
index de58ba5..6079cb2 100644
--- a/tests/udp-srv.test
+++ b/tests/udp-srv.test
@@ -11,10 +11,10 @@ package require udp
 # Some tests are marked as slow as they can take 30s to test a volume of packets.
 # We generally just test for correctness and these do not significantly contribute
 # in testing correctness.
-::tcltest::testConstraint slow 0
+::tcltest::testConstraint slow 1
 
 # Enable printing timing information during some tests.
-::tcltest::testConstraint timestamp 0
+::tcltest::testConstraint timestamp 1
 
 set scriptName [makeFile {} udptest2.tcl]
 set script {