autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

make CVS bootstrappable with 2.59


From: Ralf Wildenhues
Subject: make CVS bootstrappable with 2.59
Date: Mon, 12 Dec 2005 09:57:24 +0100
User-agent: Mutt/1.5.11

The patch below allows CVS Autoconf to be bootstrapped with 2.59.
This is rather a FYI than an `OK to commit?' because I guess it
can't be expected to work (but may come in handy at times).

Anyway, this issue came up on libtool-patches -- for the web spiders:
the bug shows up like this:

| autoreconf: running: /usr/bin/autoconf
| configure.ac:155: error: possibly undefined macro: AC_PROG_GREP
|       If this token and others are legitimate, please use m4_pattern_allow.
|       See the Autoconf documentation.
| configure.ac:157: error: possibly undefined macro: AC_PROG_SED
| autoreconf: /usr/bin/autoconf failed with exit status: 1

Luckily these macros can easily be extracted from program.m4.
(And no, I have no idea whether the copyright years are denoted
correctly.)

Cheers,
Ralf

        * config/grep.m4: New file, with..
        (AC_PROG_GREP, _AC_PROG_GREP, _AC_PATH_PROG_FEATURE_CHECK)
        (_AC_FEATURE_CHECK_LENGTH, _AC_PATH_PROG_FLAVOR_GNU)
        (AC_PROG_SED): Extracted from programs.m4, to allow bootstrap
        with Autoconf-2.59.
        Reported by Bob Friesenhahn <address@hidden>.

--- /dev/null   2000-01-01 00:00:00.000000000 +0200
+++ config/grep.m4      2005-12-09 13:41:33.000000000 +0100
@@ -0,0 +1,148 @@
+# Copyright 2005 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+
+# AC_PROG_GREP
+# ------------
+# Check for a fully functional grep program that handles
+# the longest lines possible and which respects multiple -e options.
+# Prefer GNU grep if found.
+AC_DEFUN([AC_PROG_GREP],
+[AC_CACHE_CHECK([for grep that handles long lines and -e], ac_cv_path_GREP,
+   [_$0(GREP, [grep ggrep], [-e 'GREP$' -e '-(cannot match)-'])])
+ GREP="$ac_cv_path_GREP"
+ AC_SUBST([GREP])
+])
+
+
+# _AC_PROG_GREP(VARIABLE, PROGNAME-LIST, PROG-ARGUMENTS)
+# ------------------------------------------------------
+# Solaris 9 /usr/xpg4/bin/*grep is suitable, but /usr/bin/*grep lacks -e.
+# AIX silently truncates long lines before matching.
+# NeXT understands only one -e and truncates long lines.
+m4_define([_AC_PROG_GREP],
+[_AC_PATH_PROG_FEATURE_CHECK([$1], [$2],
+       [_AC_FEATURE_CHECK_LENGTH([ac_path_$1], [ac_cv_path_$1],
+               ["$ac_path_$1" $3], [$1])], [$PATH:/usr/xpg4/bin])
+])
+
+
+# _AC_PATH_PROG_FEATURE_CHECK(VARIABLE, PROGNAME-LIST, FEATURE-TEST, [PATH])
+# --------------------------------------------------------------------------
+# FEATURE-TEST is called repeatedly with $ac_path_VARIABLE set to the
+# name of a program in PROGNAME-LIST found in PATH.  FEATURE-TEST must set
+# $ac_cv_path_VARIABLE to the path of an acceptable program, or else
+# _AC_PATH_PROG_FEATURE_CHECK will report that no acceptable program
+# was found, and abort.  If a suitable $ac_path_VARIABLE is found in the
+# FEATURE-TEST macro, it can set $ac_path_VARIABLE_found=':' to accept
+# that value without any further checks.
+m4_define([_AC_PATH_PROG_FEATURE_CHECK],
+[# Extract the first word of "$2" to use in msg output
+if test -z "$$1"; then
+set dummy $2; ac_prog_name=$[2]
+AC_CACHE_VAL([ac_cv_path_$1],
+[ac_path_$1_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+_AS_PATH_WALK([$4],
+[for ac_prog in $2; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_$1="$as_dir/$ac_prog$ac_exec_ext"
+    AS_EXECUTABLE_P(["$ac_path_$1"]) || continue
+    $3
+    $ac_path_$1_found && break 3
+  done
+done
+])
+])
+$1="$ac_cv_path_$1"
+if test -z "$$1"; then
+  AC_MSG_ERROR([no acceptable $ac_prog_name could be found in dnl
+m4_default([$4], [\$PATH])])
+fi
+AC_SUBST([$1])
+else
+  ac_cv_path_$1=$$1
+fi
+])
+
+
+# _AC_FEATURE_CHECK_LENGTH(PROGPATH, CACHE-VAR, CHECK-CMD, [MATCH-STRING])
+# ------------------------------------------------------------------------
+# For use as the FEATURE-TEST argument to _AC_PATH_PROG_FEATURE_TEST.
+# On each iteration run CHECK-CMD on an input file, storing the value
+# of PROGPATH in CACHE-VAR if the CHECK-CMD succeeds.  The input file
+# is always one line, starting with only 10 characters, and doubling
+# in length at each iteration until approx 10000 characters or the
+# feature check succeeds.  The feature check is called at each
+# iteration by appending (optionally, MATCH-STRING and) a newline
+# to the file, and using the result as input to CHECK-CMD.
+m4_define([_AC_FEATURE_CHECK_LENGTH],
+[# Check for GNU $1 and select it if it is found.
+  _AC_PATH_PROG_FLAVOR_GNU([$$1],
+    [$2="$$1" $1_found=:],
+  [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 '$4' >> "conftest.nl"
+    $3 < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${$1_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      $2="$$1"
+dnl   # Using $1_max so that each tool feature checked gets its
+dnl   # own variable.  Don't reset it otherwise the implied search
+dnl   # for best performing tool in a list breaks down.
+      $1_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.*])
+])
+
+
+# _AC_PATH_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
+# ----------------------------------------------------------------
+m4_define([_AC_PATH_PROG_FLAVOR_GNU],
+[# Check for GNU $1
+case `"$1" --version 2>&1` in
+*GNU*)
+  $2;;
+m4_ifval([$3],
+[*)
+  $3;;
+])esac
+])# _AC_PATH_PROG_FLAVOR_GNU
+
+
+# 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_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED,
+    [_AC_PATH_PROG_FEATURE_CHECK(SED, [sed gsed],
+       [_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED],
+               ["$ac_path_SED" -e 's/a$//'])])])
+ SED="$ac_cv_path_SED"
+ AC_SUBST([SED])
+])# AC_PROG_SED




reply via email to

[Prev in Thread] Current Thread [Next in Thread]