Ethereal-dev: [Ethereal-dev] Patch: sed check in configure.in

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Heikki Vatiainen <hessu@xxxxxxxxx>
Date: 02 Feb 2002 21:14:16 +0200
After not having compiled Ethereal in Solaris for some months, I today
did cvs update and got the FAQ problem 3.3 "Output line too
long". The problem is already addressed in CVS but maybe the patch
below adds a little more safequard.

This patch changes three things:
 1. Checks also for /bin/sed when compiling on Solaris

 2. Adds AC_ETHEREAL_GNU_SED_CHECK in acinclude.m4. This checks if GNU
    sed is the first sed found from PATH.  Sets HAVE_GNU_SED if so.

 3. Removes the Solaris sed check from LD_LIBRARY_PATH part in
    configure.in and makes an own place for the sed check. The sed is
    checked only if HAVE_GNU_SED is not set.

My problem was #1 in the above list since I'm silly enough to have
both /bin and /usr/bin in my PATH on Solaris. Just in case there are
others, I added /bin in the sed blacklist. The error message now also
mentions that GNU sed works too.

The motivation for #3 was to make room for sed checks on other
operating systems if that need arises.


Index: acinclude.m4
===================================================================
RCS file: /cvsroot/ethereal/acinclude.m4,v
retrieving revision 1.40
diff -u -r1.40 acinclude.m4
--- acinclude.m4	2002/01/30 08:46:27	1.40
+++ acinclude.m4	2002/02/02 18:45:09
@@ -519,3 +519,19 @@
 		fi
 	fi
 ])
+
+#
+# AC_ETHEREAL_GNU_SED_CHECK
+# Checks if GNU sed is the first sed in PATH.
+#
+AC_DEFUN([AC_ETHEREAL_GNU_SED_CHECK],
+[
+	AC_MSG_CHECKING(for GNU sed as first sed in PATH)
+	if  ( sh -c "sed --version" 2> /dev/null | grep "GNU sed" 2>&1 > /dev/null ) ;  then
+		AC_MSG_RESULT(yes)
+		HAVE_GNU_SED=yes
+	else
+		AC_MSG_RESULT(no)
+		HAVE_GNU_SED=no
+	fi
+])
Index: configure.in
===================================================================
RCS file: /cvsroot/ethereal/configure.in,v
retrieving revision 1.150
diff -u -r1.150 configure.in
--- configure.in	2002/01/30 23:48:51	1.150
+++ configure.in	2002/02/02 18:45:10
@@ -155,11 +155,6 @@
 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
 # link directory.
 #
-# Also, make sure that "sed" does *NOT* refer to "/usr/bin/sed" or
-# "/usr/ucb/sed", as, on Solaris, both of them are inadequate to
-# handle, in libtool, a list of object files as large as the list
-# in Ethereal.
-#
 case "$host_os" in
   solaris*)
     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
@@ -169,20 +164,42 @@
     else
       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
     fi
-    AC_MSG_CHECKING(whether one of /usr/bin/sed or /usr/ucb/sed will be used)
-    case `which sed` in
-      /usr/bin/sed|/usr/ucb/sed)
-        AC_MSG_RESULT(yes)
-        AC_MSG_ERROR([change your path to search /usr/xpg4/bin before /usr/bin (and /usr/ucb)])
-      ;;
-
-    *)
-      AC_MSG_RESULT(no)
-      ;;
-    esac
   ;;
 esac
 
+#
+# Make sure that "sed" does *NOT* refer to "/usr/bin/sed" or
+# "/usr/ucb/sed", as, on Solaris, both of them are inadequate to
+# handle, in libtool, a list of object files as large as the list
+# in Ethereal.
+#
+# On Solaris "/bin/sed" is also checked since some people
+# may have "/bin" in their search path even if "/bin" is just a symlink
+# to "/usr/bin".
+#
+
+AC_ETHEREAL_GNU_SED_CHECK
+if test "$HAVE_GNU_SED" = no ; then
+	case "$host_os" in
+	solaris*)
+		AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
+		case `which sed` in
+			/bin/sed|/usr/bin/sed|/usr/ucb/sed)
+			AC_MSG_RESULT(yes)		
+			AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
+			;;
+
+			*)
+			AC_MSG_RESULT(no)
+			;;
+		esac
+		;;
+
+	*)
+		:
+		;;
+	esac
+fi
 
 # Enable/disable tethereal
 


-- 
Heikki Vatiainen                  * hessu@xxxxxxxxx
Tampere University of Technology  * Tampere, Finland