autoconf-patches
[Top][All Lists]
Advanced

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

Re: (no) over-writing generated files


From: Paolo Bonzini
Subject: Re: (no) over-writing generated files
Date: Tue, 3 Dec 2002 10:48:24 +0100
User-agent: Mutt/1.4i

> [generating header files with AC_OUTPUT causes full recompile]

Replicating in _AC_OUTPUT_FILES the same behavior of
_AC_OUTPUT_HEADERS would break Makefile dependencies and,
given the run-time of autoconf and automake :->, surely make
your compilation time longer...

This conservative solution might be an option.  Patch vs. 2.56.

Note however that if you're using automake, you should provide
timestamping manually.  For this reason, I'm myself against installing
this patch into autoconf, and suggest you to use AC_CONFIG_HEADERS
for your version.h file as well.

2002-12-03  Paolo Bonzini  <address@hidden>

        * lib/autoconf/status.m4 (_AC_OUTPUT_FILES): Don't
        blindly copy .h files if unchanged.

Paolo



diff -rNU3 autoconf-2.56-save/lib/autoconf/status.m4 
autoconf-2.56/lib/autoconf/status.m4
--- autoconf-2.56-save/lib/autoconf/status.m4   Tue Dec  3 10:30:09 2002
+++ autoconf-2.56/lib/autoconf/status.m4        Tue Dec  3 10:42:04 2002
@@ -1018,15 +1018,17 @@
 dnl The parens around the eval prevent an "illegal io" in Ultrix sh.
 " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
   rm -f $tmp/stdin
-dnl This would break Makefile dependencies.
-dnl  if diff $ac_file $tmp/out >/dev/null 2>&1; then
-dnl    echo "$ac_file is unchanged"
-dnl   else
-dnl     rm -f $ac_file
-dnl    mv $tmp/out $ac_file
-dnl  fi
   if test x"$ac_file" != x-; then
-    mv $tmp/out $ac_file
+    dnl Doing this unconditionally would break Makefile dependencies.
+    dnl Use as_expr, in case it is set to false we only do a little
+    dnl more work.
+    if $as_expr x"$ac_file" : '.*\.h$' && diff $ac_file $tmp/out >/dev/null 
2>&1; then
+      echo "$ac_file is unchanged"
+      rm -f $tmp/out
+    else
+      rm -f $ac_file
+      mv $tmp/out $ac_file
+    fi
   else
     cat $tmp/out
     rm -f $tmp/out




reply via email to

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