]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - autogen.sh
Closes #831504
[mirror_smartmontools-debian.git] / autogen.sh
index 249f47e2ab834145908468e44ea4cc4903c29627..f73610bf706599e327d348812090df5e1cf8a3fe 100755 (executable)
@@ -1,19 +1,21 @@
 #!/bin/sh
-# $Id: autogen.sh,v 1.18 2008/01/29 18:36:20 chrfranke Exp $
+# $Id: autogen.sh 4115 2015-07-15 20:52:26Z chrfranke $
 #
-# Generate ./configure from config.in and Makefile.in from Makefile.am.
+# Generate ./configure from configure.ac and Makefile.in from Makefile.am.
 # This also adds files like missing,depcomp,install-sh to the source
 # directory. To update these files at a later date use:
 #      autoreconf -f -i -v
 
+force=; warnings=
+while [ $# -gt 0 ]; do case $1 in
+  --force) force=$1; shift ;;
+  --warnings=?*) warnings="${warnings} $1"; shift ;;
+  *) echo "Usage: $0 [--force] [--warnings=CATEGORY ...]"; exit 1 ;;
+esac; done
 
 # Cygwin?
 test -x /usr/bin/uname && /usr/bin/uname | grep -i CYGWIN >/dev/null &&
 {
-    # Enable strict case checking
-    # (to avoid e.g. "DIST_COMMON = ... ChangeLog ..." in Makefile.in)
-    export CYGWIN="${CYGWIN}${CYGWIN:+ }check_case:strict"
-
     # Check for Unix text file type
     echo > dostest.tmp
     test "`wc -c < dostest.tmp`" -eq 1 ||
@@ -21,69 +23,62 @@ test -x /usr/bin/uname && /usr/bin/uname | grep -i CYGWIN >/dev/null &&
     rm -f dostest.tmp
 }
 
-typep()
-{
-    cmd=$1 ; TMP=$IFS ; IFS=: ; set $PATH
-    for dir
-    do
-       if [ -x "$dir/$cmd" ]; then
-           echo "$dir/$cmd"
-           IFS=$TMP
-           return 0
-        fi
-    done
-    IFS=$TMP
-    return 1
-}
+# Find automake
+if [ -n "$AUTOMAKE" ]; then
+  ver=$("$AUTOMAKE" --version) || exit 1
+else
+  maxver=
+  for v in 1.15 1.14 1.13 1.12 1.11 1.10; do
+    minver=$v; test -n "$maxver" || maxver=$v
+    ver=$(automake-$v --version 2>/dev/null) || continue
+    AUTOMAKE="automake-$v"
+    break
+  done
+  if [ -z "$AUTOMAKE" ]; then
+    echo "GNU Automake $minver (up to $maxver) is required to bootstrap smartmontools from SVN."
+    exit 1;
+  fi
+fi
 
-test -x "$AUTOMAKE" || AUTOMAKE=`typep automake-1.10` || AUTOMAKE=`typep automake-1.9` ||
-    AUTOMAKE=`typep automake-1.8` || AUTOMAKE=`typep automake-1.7` || AUTOMAKE=`typep automake17` ||
-{
-echo
-echo "You must have at least GNU Automake 1.7 (up to 1.9.x) installed"
-echo "in order to bootstrap smartmontools from CVS. Download the"
-echo "appropriate package for your distribution, or the source tarball"
-echo "from ftp://ftp.gnu.org/gnu/automake/ ."
-echo
-echo "Also note that support for new Automake series (anything newer"
-echo "than 1.9.x) is only added after extensive tests. If you live in"
-echo "the bleeding edge, you should know what you're doing, mainly how"
-echo "to test it before the developers. Be patient."
-exit 1;
-}
+ver=$(echo "$ver" | sed -n '1s,^.*[^.0-9]\([12]\.[0-9][-.0-9pl]*\).*$,\1,p')
+if [ -z "$ver" ]; then
+  echo "$AUTOMAKE: Unable to determine automake version."
+  exit 1
+fi
 
-test -x "$ACLOCAL" || ACLOCAL="aclocal`echo "$AUTOMAKE" | sed 's/.*automake//'`" && ACLOCAL=`typep "$ACLOCAL"` ||
-{
-echo
-echo "autogen.sh found automake-1.7, automake-1.8, or automake-1.9 in"
-echo "your PATH, but not the respective aclocal-1.7, aclocal-1.8, or"
-echo "aclocal-1.9. Your installation of GNU Automake is broken or"
-echo "incomplete."
-exit 2;
-}
+# Check aclocal
+if [ -z "$ACLOCAL" ]; then
+  ACLOCAL="aclocal$(echo "$AUTOMAKE" | sed -n 's,^.*automake\(-[.0-9]*\),\1,p')"
+fi
 
-# Warn if Automake version is unknown
-ver=
-case "$AUTOMAKE" in
-  *automake-1.[78]|*automake17)
+"$ACLOCAL" --version >/dev/null || exit 1
+
+# Warn if Automake version was not tested
+amwarnings=$warnings
+case "$ver" in
+  1.10|1.10.[123]|1.11|1.11.[1-6]|1.12.[2-6]|1.13.[34])
+    # OK
+    ;;
+
+  1.14|1.14.1|1.15)
+    # TODO: Enable 'subdir-objects' in configure.ac
+    # For now, suppress 'subdir-objects' forward-incompatibility warning
+    test -n "$warnings" || amwarnings="--warnings=no-unsupported"
     ;;
+
   *)
-    ver="`$AUTOMAKE --version | sed -n '1s,^.*\([12]\.[.0-9]*[-pl0-9]*\).*$,\1,p'`"
-    ver="${ver:-?.?.?}"
-    case "$ver" in
-      1.[78]*|1.9.[1-6]|1.10) ver= ;;
-    esac ;;
+    echo "Note: GNU Automake version ${ver} was not tested by the developers."
+    echo "Please report success/failure to the smartmontools-support mailing list."
 esac
 
-test -z "$ver" ||
-{
-echo "Note: GNU Automake version ${ver} was not tested by the developers."
-echo "Please report success/failure to the smartmontools-support mailing list."
-}
+# required for aclocal-1.10 --install
+test -d m4 || mkdir m4 || exit 1
 
 set -e # stops on error status
 
-${ACLOCAL}
-autoheader
-${AUTOMAKE} --add-missing --copy --foreign
-autoconf
+test -z "$warnings" || set -x
+
+${ACLOCAL} -I m4 --install $force $warnings
+autoheader $force $warnings
+${AUTOMAKE} --add-missing --copy ${force:+--force-missing} $amwarnings
+autoconf $force $warnings