apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Foad <julianf...@btopenworld.com>
Subject [PATCH] 'apr.h' was always touched by 'configure', causing re-build
Date Tue, 18 Jan 2005 00:45:12 GMT
APR's 'configure.in' was changed in r60000 to preserve the time stamp of apr.h
if its content was unchanged, to try to avoid re-builds.  This was done by
renaming the file to "*.save" and then allowing it to be recreated and then
moving the saved version back if they are identical:

> -AC_OUTPUT($MAKEFILE1 $MAKEFILE2 $MAKEFILE3 include/apr.h)
> +SAVE_FILES="include/apr.h include/apr_private.h"
> +
> +for i in $SAVE_FILES; do
> +  test -r $i && mv $i $i.save
> +done
> +
> +AC_OUTPUT($MAKEFILE1 $MAKEFILE2 $MAKEFILE3 include/apr.h,[
> +
> +SAVE_FILES="include/apr.h include/apr_private.h"
> +
> +for i in $SAVE_FILES; do
> +  if cmp -s $i $i.save 2>/dev/null; then
> +    mv $i.save $i
> +    AC_MSG_RESULT($i is unchanged)
> +  fi
> +  rm -f $i.save
> +done
> +
> +])

Then, in r61037, the second "SAVE_FILES=..." line was removed, presumably
because it looked like it was redundant.

This isn't now working for me.  When it comes to move the saved files back, it
finds that "$SAVE_FILES" expands to nothing.  Thus, those header files have new 
time stamps which leads to very many files getting re-compiled.  Has anyone 
else noticed this?

I have two alternative fixes: replace that redundant-looking line, or export
the variable after it is defined:

>  SAVE_FILES="include/apr.h include/arch/unix/apr_private.h"
> +export SAVE_FILES

I don't know whether that "export" would be a portable way to do it.  Probably
safer to restore the duplicate "SAVE_FILES=..." line.  There may be other
possible solutions.  I don't know whether it works properly as it is on some
systems - maybe autoconf used to pass on the environment variables and it no
longer does, for instance.

I am using autoconf v2.59 and Bash 2.05b.0(1)-release.

With either of these fixes, that part works properly for me.  (It still doesn't
avoid a re-build overall, because 'build-outputs.mk' gets touched as well. and
possibly other reasons.)

May I request re-insertion of the duplicate "SAVE_FILES=..." line and an
explanatory comment, as below?  I don't like duplication, so
alternatives are welcome, but this is the best solution I can see at present.

[[[
Prevent installed header files from getting new time stamps when their content
has not changed.  This seems to have been broken by r61037.

* configure.in
   Set the variable 'SAVE_FILES' again because its previous setting is not
   visible within an AC_OUTPUT block.
]]]

Index: configure.in
===================================================================
--- configure.in        (revision 106354)
+++ configure.in        (working copy)
@@ -2036,6 +2036,10 @@
         apr-$APR_MAJOR_VERSION-config:apr-config.in
          apr.pc
  ],[
+# This line is a duplicate because the outer 'SAVE_FILES' variable is
+# not visible here.
+SAVE_FILES="include/apr.h include/arch/unix/apr_private.h"
+
  for i in $SAVE_FILES; do
    if cmp -s $i $i.save 2>/dev/null; then
      mv $i.save $i


- Julian


Mime
View raw message