Code

Added autogen.sh script that rebuilds using autotools and runs configure
[nagiosplug.git] / autogen.sh
1 #!/bin/sh
2 #
3 # autogen.sh glue for CMU Cyrus IMAP
4 # $Id$
5 #
6 # Requires: automake, autoconf, dpkg-dev
7 # set -e
9 MAKE=$(which gnumake)
10 if test ! -x "$MAKE" ; then MAKE=$(which gmake) ; fi
11 if test ! -x "$MAKE" ; then MAKE=$(which make) ; fi
12 HAVE_GNU_MAKE=$($MAKE --version|grep -c "Free Software Foundation")
14 if test "$HAVE_GNU_MAKE" != "1"; then 
15         echo Could not find GNU make on this system, can not proceed with build.
16         exit 1
17 else
18         echo Found GNU Make at $MAKE ... good.
19 fi
21 # Refresh GNU autotools toolchain.
22 for i in config.guess config.sub missing install-sh mkinstalldirs ; do
23         test -r /usr/share/automake/${i} && {
24                 rm -f ${i}
25                 cp /usr/share/automake/${i} .
26         }
27         chmod 755 ${i}
28 done
30 aclocal -I lib
31 autoheader
32 automake -c -a
33 autoconf
35 # For the Debian build
36 test -d debian && {
37         # Kill executable list first
38         rm -f debian/executable.files
40         # Make sure our executable and removable lists won't be screwed up
41         debclean && echo Cleaned buildtree just in case...
43         # refresh list of executable scripts, to avoid possible breakage if
44         # upstream tarball does not include the file or if it is mispackaged
45         # for whatever reason.
46         echo Generating list of executable files...
47         rm -f debian/executable.files
48         find -type f -perm +111 ! -name '.*' -fprint debian/executable.files
50         # link these in Debian builds
51         rm -f config.sub config.guess
52         ln -s /usr/share/misc/config.sub .
53         ln -s /usr/share/misc/config.guess .
54 }
56 ./configure $*
58 exit 0