2 # @(#) $Id: autogen.sh,v 1.9 2004/11/17 18:11:49 yeti Exp $
3 # Run this to generate all the initial makefiles, etc.
4 # Tweaked by David Necas (Yeti) <yeti@physics.muni.cz> from various other
5 # autogen.sh's. This file is in public domain.
12 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
14 echo "**ERROR**: You must have \`autoconf' installed to re-generate"
15 echo "all the $PROJECT Makefiles."
16 echo "Download the appropriate package for your distribution,"
17 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/."
22 (grep "^AM_PROG_LIBTOOL" ./configure.ac >/dev/null) && {
23 (libtool --version) < /dev/null > /dev/null 2>&1 || {
25 echo "**Error**: You must have \`libtool' installed."
26 echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz"
27 echo "(or a newer version if it is available)"
33 (automake --version) < /dev/null > /dev/null 2>&1 || {
35 echo "**ERROR**: You must have \`automake' installed to re-generate"
36 echo "all the $PROJECT Makefiles."
37 echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.8.3.tar.gz"
38 echo "(or a newer version if it is available) and read README.devel."
44 if [ "x$1" = "x" ] ; then
45 echo "INTERNAL ERROR: version_check was not provided a minimum version"
49 if [ "x$2" = "x" ] ; then
50 echo "INTERNAL ERROR: version check was not provided a comparison version"
55 # needed to handle versions like 1.10 and 1.4-p6
56 _min="`echo ${_min}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`"
57 _cur="`echo ${_cur}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`"
59 _min_major="`echo $_min | cut -d. -f1`"
60 _min_minor="`echo $_min | cut -d. -f2`"
61 _min_patch="`echo $_min | cut -d. -f3`"
63 _cur_major="`echo $_cur | cut -d. -f1`"
64 _cur_minor="`echo $_cur | cut -d. -f2`"
65 _cur_patch="`echo $_cur | cut -d. -f3`"
67 if [ "x$_min_major" = "x" ] ; then
70 if [ "x$_min_minor" = "x" ] ; then
73 if [ "x$_min_patch" = "x" ] ; then
76 if [ "x$_cur_minor" = "x" ] ; then
79 if [ "x$_cur_minor" = "x" ] ; then
82 if [ "x$_cur_patch" = "x" ] ; then
86 if [ $_min_major -lt $_cur_major ] ; then
88 elif [ $_min_major -eq $_cur_major ] ; then
89 if [ $_min_minor -lt $_cur_minor ] ; then
91 elif [ $_min_minor -eq $_cur_minor ] ; then
92 if [ $_min_patch -lt $_cur_patch ] ; then
94 elif [ $_min_patch -eq $_cur_patch ] ; then
103 # The world is cruel.
104 if test -z "$NO_AUTOCONF"; then
105 AC_VERSION=`autoconf --version | sed -e '2,$ d' -e 's/ *([^()]*)$//' -e 's/.* \(.*\)/\1/' -e 's/-p[0-9]\+//'`
106 if ! version_check "2.52" "$AC_VERSION" ; then
108 echo "**ERROR**: You need at least autoconf-2.52 installed to re-generate"
109 echo "all the $PROJECT Makefiles."
110 echo "Download the appropriate package for your distribution,"
111 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/."
114 echo "Autoconf $AC_VERSION: OK"
118 if test -z "$NO_AUTOMAKE"; then
119 AM_VERSION=`automake --version | sed -e '2,$ d' -e 's/ *([^()]*)$//' -e 's/.* \(.*\)/\1/' -e 's/-p[0-9]\+//'`
120 if ! version_check "1.8" "$AM_VERSION" ; then
122 echo "**ERROR**: You need at least automake-1.8 installed to re-generate"
123 echo "all the $PROJECT Makefiles."
124 echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.8.3.tar.gz"
125 echo "(or a newer version if it is available) and read README.devel."
128 echo "Automake $AM_VERSION: OK"
132 # if no automake, don't bother testing for aclocal
133 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
135 echo "**ERROR**: Missing \`aclocal'. The version of \`automake'"
136 echo "installed doesn't appear recent enough."
137 echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.8.3.tar.gz"
138 echo "(or a newer version if it is available) and read README.devel."
142 if test -z "$NO_LIBTOOL"; then
143 LT_VERSION=`libtool --version | sed -e '2,$ d' -e 's/ *([^()]*)$//' -e 's/.* \(.*\)/\1/' -e 's/-p[0-9]\+//'`
144 if ! version_check "1.4" "$LT_VERSION" ; then
146 echo "**ERROR**: You need at least libtool-1.4 installed to re-generate"
147 echo "all the $PROJECT Makefiles."
148 echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz"
149 echo "(or a newer version if it is available) and read README.devel."
152 echo "Libtool $LT_VERSION: OK"
156 if test "$DIE" -eq 1; then
161 *xlc | *xlc\ * | *lcc | *lcc\ * )
162 am_opt=--include-deps;;
168 libtoolize --force --copy && \
169 aclocal $ACLOCAL_FLAGS && \
171 automake --add-missing $am_opt && \
173 echo "**ERROR**: Re-generating failed. You are allowed to shoot $PROJECT maintainer."
174 echo "(BTW, why are you re-generating everything? Have you read README.devel?)"
178 if test -z "$*"; then
179 echo "**Warning**: I am going to run \`configure' with no arguments."
180 echo "If you wish to pass any to it, please specify them on the"
181 echo "\`$0' command line."