]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - autogen.sh
db212b852c069999ad0f863db6c4d6ea1d241ea0
[mirror_smartmontools-debian.git] / autogen.sh
1 #!/bin/sh
2 # $Id: autogen.sh 4434 2017-09-14 18:05:12Z samm2 $
3 #
4 # Generate ./configure from configure.ac and Makefile.in from Makefile.am.
5 # This also adds files like missing,depcomp,install-sh to the source
6 # directory. To update these files at a later date use:
7 # autoreconf -f -i -v
8
9 force=; warnings=
10 while [ $# -gt 0 ]; do case $1 in
11 --force) force=$1; shift ;;
12 --warnings=?*) warnings="${warnings} $1"; shift ;;
13 *) echo "Usage: $0 [--force] [--warnings=CATEGORY ...]"; exit 1 ;;
14 esac; done
15
16 # Cygwin?
17 test -x /usr/bin/uname && /usr/bin/uname | grep -i CYGWIN >/dev/null &&
18 {
19 # Check for Unix text file type
20 echo > dostest.tmp
21 test "`wc -c < dostest.tmp`" -eq 1 ||
22 echo "Warning: DOS text file type set, 'make dist' and related targets will not work."
23 rm -f dostest.tmp
24 }
25
26 # Find automake
27 if [ -n "$AUTOMAKE" ]; then
28 ver=$("$AUTOMAKE" --version) || exit 1
29 else
30 maxver=
31 for v in 1.15 1.14 1.13 1.12 1.11 1.10; do
32 minver=$v; test -n "$maxver" || maxver=$v
33 ver=$(automake-$v --version 2>/dev/null) || continue
34 AUTOMAKE="automake-$v"
35 break
36 done
37 if [ -z "$AUTOMAKE" ]; then
38 echo "GNU Automake $minver (up to $maxver) is required to bootstrap smartmontools from SVN."
39 exit 1;
40 fi
41 fi
42
43 ver=$(echo "$ver" | sed -n '1s,^.*[^.0-9]\([12]\.[0-9][-.0-9pl]*\).*$,\1,p')
44 if [ -z "$ver" ]; then
45 echo "$AUTOMAKE: Unable to determine automake version."
46 exit 1
47 fi
48
49 # Check aclocal
50 if [ -z "$ACLOCAL" ]; then
51 ACLOCAL="aclocal$(echo "$AUTOMAKE" | sed -n 's,^.*automake\(-[.0-9]*\),\1,p')"
52 fi
53
54 "$ACLOCAL" --version >/dev/null || exit 1
55
56 # Warn if Automake version was not tested
57 amwarnings=$warnings
58 case "$ver" in
59 1.10|1.10.[123]|1.11|1.11.[1-6]|1.12.[2-6]|1.13.[34])
60 # OK
61 ;;
62
63 1.14|1.14.1|1.15|1.15.1)
64 # TODO: Enable 'subdir-objects' in configure.ac
65 # For now, suppress 'subdir-objects' forward-incompatibility warning
66 test -n "$warnings" || amwarnings="--warnings=no-unsupported"
67 ;;
68
69 *)
70 echo "Note: GNU Automake version ${ver} was not tested by the developers."
71 echo "Please report success/failure to the smartmontools-support mailing list."
72 esac
73
74 # required for aclocal-1.10 --install
75 test -d m4 || mkdir m4 || exit 1
76
77 set -e # stops on error status
78
79 test -z "$warnings" || set -x
80
81 ${ACLOCAL} -I m4 --install $force $warnings
82 autoheader $force $warnings
83 ${AUTOMAKE} --add-missing --copy ${force:+--force-missing} $amwarnings
84 autoconf $force $warnings