Restore the old COPYING and INSTALL files after they are overwritten by
authorIan Abbott <abbotti@mev.co.uk>
Fri, 11 Aug 2006 17:28:59 +0000 (17:28 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Fri, 11 Aug 2006 17:28:59 +0000 (17:28 +0000)
autoreconf -i -f.

autogen.sh

index 3b1fdfc69f7f3bc0e11e540669506a02078ba516..0fc93302c8e52332043cd9986789d84c15d429b5 100755 (executable)
@@ -1,5 +1,31 @@
 #!/bin/sh
 
-autoreconf -i -f &&
-./configure --enable-maintainer-mode $*
+# function saves 'COPYING' and 'INSTALL' as they get clobbered.
+save () {
+       COPYING_ok=false
+       INSTALL_ok=false
+       cp COPYING COPYING.save && COPYING_ok=true
+       cp INSTALL INSTALL.save && INSTALL_ok=true
+}
+
+# function restores 'COPYING' and 'INSTALL' which have probably been clobbered.
+restore () {
+       $COPYING_ok && mv COPYING.save COPYING
+       $INSTALL_ok && mv INSTALL.save INSTALL
+}
+
+# save the files before they get clobbered.
+save
+trap "restore; exit 130" 1 2 15
+
+# run autoreconf. The -i and -f flags causes files to be overwritten.
+autoreconf_ok=false
+autoreconf -i -f && autoreconf_ok=true
+
+# unclobber the overwritten files.
+restore
+trap - 1 2 15
+
+# re-run configure script if autoreconf was successful.
+$autoreconf_ok && ./configure --enable-maintainer-mode $*