From 52adbbf2c17fe0a3c48e43b4da447627517c531b Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 11 Aug 2006 17:28:59 +0000 Subject: [PATCH] Restore the old COPYING and INSTALL files after they are overwritten by autoreconf -i -f. --- autogen.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index 3b1fdfc6..0fc93302 100755 --- a/autogen.sh +++ b/autogen.sh @@ -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 $* -- 2.26.2