autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_CACHE_CHECK and complex tests


From: Ralf Wildenhues
Subject: Re: AC_CACHE_CHECK and complex tests
Date: Sun, 5 Mar 2006 10:09:49 +0100
User-agent: Mutt/1.5.9i

Hi Paul,

* Paul Eggert wrote on Sat, Feb 25, 2006 at 09:03:50AM CET:
> Ralf Wildenhues <address@hidden> writes:
> 
> > The patch below adds an example of how such a test may be written
> > properly.  I'm a bit uncertain as to whether it should be applied:
> > we would constrain Autoconf in a way that we could not possibly know
> > the names of the other cache variables, by documenting this.
> 
> Yes, I tend to agree.  Let's not apply that part of the patch for now.
> (The quoting fixes are fine.)

OK.  I have applied the quoting fixes only, as below.
(And the AC_CHECK_ALIGNOF patch, FWIW.)

> If you want to recommend something, I suppose you could recommend
> several calls to AC_CACHE_CHECK, one for each variable; the first
> (slow) one sets the "main" cache variable and the others (which are
> fast) key off its value.

I don't think this is possible in each case, or at least it would become
quite cumbersome.  For example, what if the expensive test gives
multiline output, and we would like to seed cache variables with a line
each (because the caching code mistreats newlines)?

Cheers,
Ralf

        * doc/autoconf.texi (Caching Results): Fix the examples to use a
        recommended quoting style and discard unwanted output.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.955
diff -u -r1.955 autoconf.texi
--- doc/autoconf.texi   5 Mar 2006 08:29:50 -0000       1.955
+++ doc/autoconf.texi   5 Mar 2006 09:08:58 -0000
@@ -7585,8 +7585,8 @@
 AC_DEFUN([AC_SHELL_TRUE],
 [AC_CACHE_CHECK([whether true(1) works], [ac_cv_shell_true_works],
                 [ac_cv_shell_true_works=no
-                 true && ac_cv_shell_true_works=yes
-                 if test $ac_cv_shell_true_works = yes; then
+                 (true) 2>/dev/null && ac_cv_shell_true_works=yes
+                 if test "$ac_cv_shell_true_works" = yes; then
                    AC_DEFINE([TRUE_WORKS], [1],
                              [Define if `true(1)' works properly.])
                  fi])
@@ -7604,8 +7604,8 @@
 AC_DEFUN([AC_SHELL_TRUE],
 [AC_CACHE_CHECK([whether true(1) works], [ac_cv_shell_true_works],
                 [ac_cv_shell_true_works=no
-                 true && ac_cv_shell_true_works=yes])
- if test $ac_cv_shell_true_works = yes; then
+                 (true) 2>/dev/null && ac_cv_shell_true_works=yes])
+ if test "$ac_cv_shell_true_works" = yes; then
    AC_DEFINE([TRUE_WORKS], [1],
              [Define if `true(1)' works properly.])
  fi




reply via email to

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