* 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.
This commit is contained in:
Gary V. Vaughan 2004-01-23 08:21:51 +00:00
parent 989d244f81
commit f74f53b7c8
5 changed files with 80 additions and 2 deletions

View File

@ -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

4
NEWS
View File

@ -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

View 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

View 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])

View 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.