$NetBSD: patch-ac,v 1.7 2006/10/02 16:20:04 dmcmahill Exp $

--- configure.orig	2005-11-10 19:17:39.000000000 -0500
+++ configure
@@ -1638,13 +1638,48 @@ set >&5
 echo "$as_me:$LINENO: result: done" >&5
 echo "${ECHO_T}done" >&6
 
-echo "$as_me:$LINENO: checking if tr works" >&5
-echo $ECHO_N "checking if tr works... $ECHO_C" >&6
+# Extract the first word of "tr", so it can be a program name with args.
+set dummy tr; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_TR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $TR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_TR="$TR" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_TR="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
 
-if test "X${TR}" = "X"; then
-  TR=tr
+  ;;
+esac
 fi
-TR_TEST="`echo Test | ${TR} 'a-z,' 'A-Z '`"
+TR=$ac_cv_path_TR
+
+if test -n "$TR"; then
+  echo "$as_me:$LINENO: result: $TR" >&5
+echo "${ECHO_T}$TR" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+echo "$as_me:$LINENO: checking if ${TR} works" >&5
+echo $ECHO_N "checking if ${TR} works... $ECHO_C" >&6
+TR_TEST="`echo Test | ${TR} [a-z], [A-Z]\ `"
 if test "X${TR_TEST}" != "XTEST"; then
   { { echo "$as_me:$LINENO: error: tr program doesn't work" >&5
 echo "$as_me: error: tr program doesn't work" >&2;}
@@ -8154,6 +8189,80 @@ fi
 
 if test "`uname`" = "SunOS" -o "`uname -sr`" = "HP-UX B.11.00"; then
 
+echo "$as_me:$LINENO: checking for socket in -lsocket" >&5
+echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6
+if test "${ac_cv_lib_socket_socket+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket  $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 socket ();
+int
+main ()
+{
+socket ();
+  ;
+  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_socket_socket=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_socket_socket=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_socket_socket" >&5
+echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6
+if test $ac_cv_lib_socket_socket = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSOCKET 1
+_ACEOF
+
+  LIBS="-lsocket $LIBS"
+
+fi
+
+
 echo "$as_me:$LINENO: checking for xdr_int in -lnsl" >&5
 echo $ECHO_N "checking for xdr_int in -lnsl... $ECHO_C" >&6
 if test "${ac_cv_lib_nsl_xdr_int+set}" = set; then
@@ -34749,7 +34858,7 @@ echo "${ECHO_T}$DEBUG_PKG" >&6
 esac
 
 if test -n "$DEBUG_PKG"; then
-  for pkg in `echo $DEBUG_PKG | ${TR} 'a-z,' 'A-Z '`; do
+  for pkg in `echo $DEBUG_PKG | ${TR} "[a-z]," "[A-Z] "`; do
     CPPFLAGS="$CPPFLAGS -DH5${pkg}_DEBUG"
   done
 fi
@@ -34923,7 +35032,7 @@ echo $ECHO_N "checking for mpirun... $EC
     if (echo $cmd | grep / >/dev/null); then
       path="`echo $cmd | sed 's/\(.*\)\/.*$/\1/'`"
     else
-      for path in `echo $PATH | ${TR} : ' '`; do
+      for path in `echo $PATH | ${TR} ":" " "`; do
         if test -x $path/$cmd; then
           break
         fi
@@ -34953,7 +35062,7 @@ echo $ECHO_N "checking for mpirun_lam or
     if (echo $cmd | grep / >/dev/null); then
       path="`echo $cmd | sed 's/\(.*\)\/.*$/\1/'`"
     else
-      for path in `echo $PATH | ${TR} : ' '`; do
+      for path in `echo $PATH | ${TR} ":" " "`; do
         if test -x $path/$cmd; then
           break
         fi
@@ -36485,7 +36594,7 @@ echo "${ECHO_T}$FILTERS" >&6
 esac
 
 if test -n "$FILTERS"; then
-  for filter in `echo $FILTERS | ${TR} 'a-z,' 'A-Z '`; do
+  for filter in `echo $FILTERS | ${TR} "[a-z]," "[A-Z] "`; do
                     if test $filter = "SHUFFLE"; then
 
 cat >>confdefs.h <<\_ACEOF
