working on the autoconf magic (see next email) I noticed that the configure and prepare-source tools do not always rebuild configure.sh when configure.ac is changed. Also, a bad configure.sh could be left, leading to a failing configure run with pretty meaningless error messages.

>From 73bb870a6a71344d7aaac199e6b72a24a883de7b Mon Sep 17 00:00:00 2001
From: Nils Goroll <[email protected]>
Date: Tue, 20 Aug 2013 11:39:30 +0200
Subject: [PATCH] improve configure auto-magic

- Makefile and prepare-source.mak should not keep a configure.sh output from a 
failed
  autoconf run
- the configure wrapper tool should always call prepare-source to rebuild 
configure.sh
  when required
- Makefile and prepare-source.mak should rebuild aclocal.m4 when configure.ac 
changes
---
 Makefile.in        |    5 ++++-
 configure          |   14 +++++++-------
 prepare-source.mak |    5 ++++-
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 2cb50bc..7c94c10 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -143,10 +143,13 @@ gensend: gen
 conf:
        cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
 
+aclocal.m4: configure.ac
+       aclocal -I m4
+
 configure.sh config.h.in: configure.ac aclocal.m4
        @if test -f configure.sh; then cp -p configure.sh configure.sh.old; 
else touch configure.sh.old; fi
        @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else 
touch config.h.in.old; fi
-       autoconf -o configure.sh
+       autoconf -o configure.sh || ( rm configure.sh ; false )
        autoheader && touch config.h.in
        @if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
            echo "configure.sh is unchanged."; \
diff --git a/configure b/configure
index 32cc3b5..24efc5e 100755
--- a/configure
+++ b/configure
@@ -15,13 +15,13 @@ if test ! -f "$realconfigure"; then
     else
        actions='build'
     fi
-    if "$dir/prepare-source" $actions; then
-       :
-    else
-       echo 'Failed to build configure.sh and/or config.h.in -- giving up.' >&2
-       rm -f "$realconfigure"
-       exit 1
-    fi
+fi
+if "$dir/prepare-source" $actions; then
+    :
+else
+    echo 'Failed to build configure.sh and/or config.h.in -- giving up.' >&2
+    rm -f "$realconfigure"
+    exit 1
 fi
 
 exec "$realconfigure" "${@}"
diff --git a/prepare-source.mak b/prepare-source.mak
index 054bab7..7d088fd 100644
--- a/prepare-source.mak
+++ b/prepare-source.mak
@@ -1,7 +1,10 @@
 conf: configure.sh config.h.in
 
+aclocal.m4: configure.ac
+       aclocal -I m4
+
 configure.sh: configure.ac aclocal.m4
-       autoconf -o configure.sh
+       autoconf -o configure.sh || ( rm configure.sh ; false )
 
 config.h.in: configure.ac aclocal.m4
        autoheader && touch config.h.in
-- 
1.5.6.5

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to