autoconf-patches
[Top][All Lists]
Advanced

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

Problem with macros calling _AC_PATH_PROG_FEATURE_CHECK


From: Albert Chin
Subject: Problem with macros calling _AC_PATH_PROG_FEATURE_CHECK
Date: Wed, 29 Dec 2004 18:09:18 -0600
User-agent: Mutt/1.5.6i

As an example, AC_PROG_SED calls _AC_PATH_PROG_FEATURE_CHECK and then
sets SED to the value of the appropriate sed command:
  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$//'])], [$PATH:/usr/xpg4/bin])])
   SED="$ac_cv_path_SED"
   AC_SUBST([SED])
  ])# AC_PROG_SED

However, if SED is already defined before _AC_PATH_PROG_FEATURE_CHECK,
ac_cv_path_SED="" after it is called. We have the following code in
_AC_PATH_PROG_FEATURE_CHECK:
  m4_define([_AC_PATH_PROG_FEATURE_CHECK],
  [# Extract the first word of "$2" to use in msg output
  if test -z "$$1"; then
  ...
  fi
  ])

This affects AC_PROG_GREP, AC_PROG_FGREP, AC_PROG_GREP, and
AC_PROG_SED. The easiest thing seems to be to have
_AC_PATH_PROG_FEATURE_CHECK set ac_cv_path_$1. The patch below does
this. We could also remove lines like the following:
  FGREP="$ac_cv_path_FGREP"
and make other changes to support this. Dunno which is more correct
but the patch below is the patch with least impact.

-- 
albert chin (address@hidden)

-- snip snip
2004-12-29  Albert Chin-A-Young  <address@hidden>

        * lib/autoconf/programs.m4 (_AC_FEATURE_CHECK_LENGTH):
        If the variable to set is already set, set ac_cv_path_$1
        to the preset value so caller can assume ac_cv_path_$1
        is available.

Index: lib/autoconf/programs.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/programs.m4,v
retrieving revision 1.36
diff -u -3 -p -r1.36 programs.m4
--- lib/autoconf/programs.m4    15 Dec 2004 22:37:46 -0000      1.36
+++ lib/autoconf/programs.m4    30 Dec 2004 00:03:37 -0000
@@ -447,6 +447,8 @@ if test -z "$$1"; then
 m4_default([$4], [\$PATH])])
 fi
 AC_SUBST([$1])
+else
+  ac_cv_path_$1=$$1
 fi
 ])
 




reply via email to

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