]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/programs.m4 (AC_PROG_SED): New macro to test for a
authorGary V. Vaughan <gary@gnu.org>
Fri, 23 Jan 2004 08:21:51 +0000 (08:21 +0000)
committerGary V. Vaughan <gary@gnu.org>
Fri, 23 Jan 2004 08:21:51 +0000 (08:21 +0000)
non-truncating sed or gsed program in PATH.
* tests/acprograms.at: Add it.
* doc/autoconf.texi (Particular Programs): Document it.
* NEWS: Updated.

ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/programs.m4
tests/acprograms.at

index b5cfbff329725d68a202a56ed9ef18759264dd5a..4b025c069055053af0a2534407289c6a2a459e8c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-01-23  Gary V. Vaugan  <gary@gnu.org>
+
+       * lib/autoconf/programs.m4 (AC_PROG_SED):  New macro to test for a
+       non-truncating sed or gsed program in PATH.
+       * tests/acprograms.at: Add it.
+       * doc/autoconf.texi (Particular Programs): Document it.
+       * NEWS: Updated.
+
 2004-01-15  Paul Eggert  <eggert@twinsun.com>
 
        * lib/autoconf/c.m4 (_AC_PROG_CC_STDC): Try -std, not -std1, since
diff --git a/NEWS b/NEWS
index a9df1eb49e583c4f5d8d3fc70b4f231bb9b12e29..8a5d61f95c9dffabe5989e1aa903c5370675a9dc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,9 @@
 * Major changes in Autoconf 2.59a
 
+** AC_PROG_SED
+  New macro that tests for a sed program that truncates as few characters
+  as possible.
+
 * Major changes in Autoconf 2.59
 
   Released 2003-11-04, by Akim Demaille
index dc4b23a9b848a63a7866b0de51ed2244f3d76bcb..b567a576be4a71aa18a419e3b0be27770cc7e9ec 100644 (file)
@@ -3366,6 +3366,14 @@ Set output variable @code{RANLIB} to @samp{ranlib} if @code{ranlib}
 is found, and otherwise to @samp{:} (do nothing).
 @end defmac
 
+@defmac AC_PROG_SED
+@acindex {PROG_SED}
+@ovindex SED
+Set output variable @code{SED} to a @code{sed} on @samp{PATH} that
+truncates as few characters as possible.  If @sc{GNU} Sed is found,
+use that instead.
+@end defmac
+
 @defmac AC_PROG_YACC
 @acindex{PROG_YACC}
 @ovindex YACC
index 121fdb28a0756af6fc9c633210921a0b145e882a..6b82890d892b81a5c84bb913a2a00ea4b6fe2380 100644 (file)
@@ -1,6 +1,6 @@
 # This file is part of Autoconf.                       -*- Autoconf -*-
 # Checking for programs.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -501,6 +501,63 @@ AU_DEFUN([AC_RSH],
 Remove this warning when you adjust the code.])])
 
 
+# AC_PROG_SED
+# -----------
+# Check for a fully functional sed program that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+if test -z "$SED"; then
+AC_CACHE_VAL(ac_cv_path_sed,
+[AS_TMPDIR([sed])
+ac_max=0
+# Loop through the user's path and test for sed and gsed.
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with a /bin/sed that truncates output.
+_AS_PATH_WALK([$PATH:/usr/xpg4/bin],
+[ac_fini=false
+for ac_prog in sed gsed; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_sed="$as_dir/$ac_prog$ac_exec_ext"
+    if test -f "$ac_sed" && AS_EXECUTABLE_P(["$ac_sed"]); then
+      # Check for GNU sed and select it if it is found.
+      if "$ac_sed" --version 2>&1 < /dev/null | grep 'GNU' >/dev/null; then
+        ac_cv_path_sed="$ac_sed"
+       ac_fini=:
+        break
+      fi
+
+      ac_count=0
+      echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+      while :
+      do
+        cat conftest.in conftest.in >conftest.tmp
+        mv conftest.tmp conftest.in
+        cp conftest.in conftest.nl
+        echo '' >> conftest.nl
+        "$ac_sed" -e 's/a$//' < conftest.nl >conftest.out || break
+        cmp conftest.out conftest.nl >/dev/null 2>&1 || break
+        ac_count=`expr $ac_count + 1`
+        if test $ac_count -gt $ac_max; then
+          ac_max=$ac_count
+          ac_cv_path_sed="$ac_sed"
+        fi
+        # 10*(2^10) chars as input seems more than enough
+        test $ac_count -gt 10 && break
+      done
+    fi
+  done
+  $ac_fini && break
+done])
+rm -rf "$tmp"
+])
+fi
+SED="$ac_cv_path_sed"
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])
+
+
 # AC_PROG_YACC
 # ------------
 AN_MAKEVAR([BISON],  [AC_PROG_YACC])
index d21a4759bbd196f30148a7e6ffc52ef6ccd2d5ac..9ca5480ecef159c8285fe24c42a8aa1b8c7b1e5f 100644 (file)
@@ -4,7 +4,7 @@
 ## Do not edit by hand.  ##
 ## --------------------- ##
 
-# Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
 
 AT_BANNER([Testing autoconf/programs macros.])
 
@@ -16,6 +16,7 @@ AT_CHECK_MACRO([AC_PROG_LEX])
 AT_CHECK_MACRO([AC_PROG_LN_S])
 AT_CHECK_MACRO([AC_PROG_MAKE_SET])
 AT_CHECK_MACRO([AC_PROG_RANLIB])
+AT_CHECK_MACRO([AC_PROG_SED])
 AT_CHECK_MACRO([AC_PROG_YACC])
 
 # Obsolete macros.