]>
Commit | Line | Data |
---|---|---|
832b75ed | 1 | #!/bin/sh |
f9e10201 | 2 | # $Id: autogen.sh 4434 2017-09-14 18:05:12Z samm2 $ |
832b75ed | 3 | # |
a86ec89e | 4 | # Generate ./configure from configure.ac and Makefile.in from Makefile.am. |
832b75ed | 5 | # This also adds files like missing,depcomp,install-sh to the source |
a37e7145 | 6 | # directory. To update these files at a later date use: |
832b75ed GG |
7 | # autoreconf -f -i -v |
8 | ||
d2e702cf GI |
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 | |
832b75ed GG |
15 | |
16 | # Cygwin? | |
17 | test -x /usr/bin/uname && /usr/bin/uname | grep -i CYGWIN >/dev/null && | |
18 | { | |
832b75ed GG |
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 | ||
a86ec89e GI |
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 | |
832b75ed | 42 | |
a86ec89e GI |
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 | |
832b75ed | 48 | |
a86ec89e GI |
49 | # Check aclocal |
50 | if [ -z "$ACLOCAL" ]; then | |
51 | ACLOCAL="aclocal$(echo "$AUTOMAKE" | sed -n 's,^.*automake\(-[.0-9]*\),\1,p')" | |
52 | fi | |
832b75ed | 53 | |
a86ec89e | 54 | "$ACLOCAL" --version >/dev/null || exit 1 |
832b75ed | 55 | |
a86ec89e | 56 | # Warn if Automake version was not tested |
d2e702cf | 57 | amwarnings=$warnings |
2127e193 | 58 | case "$ver" in |
a86ec89e | 59 | 1.10|1.10.[123]|1.11|1.11.[1-6]|1.12.[2-6]|1.13.[34]) |
2127e193 GI |
60 | # OK |
61 | ;; | |
62 | ||
f9e10201 | 63 | 1.14|1.14.1|1.15|1.15.1) |
d2e702cf GI |
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 | ||
2127e193 GI |
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 | |
832b75ed | 73 | |
a86ec89e | 74 | # required for aclocal-1.10 --install |
d008864d | 75 | test -d m4 || mkdir m4 || exit 1 |
d008864d | 76 | |
832b75ed GG |
77 | set -e # stops on error status |
78 | ||
d2e702cf GI |
79 | test -z "$warnings" || set -x |
80 | ||
a86ec89e | 81 | ${ACLOCAL} -I m4 --install $force $warnings |
d2e702cf GI |
82 | autoheader $force $warnings |
83 | ${AUTOMAKE} --add-missing --copy ${force:+--force-missing} $amwarnings | |
84 | autoconf $force $warnings |