]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame_incremental - autogen.sh
Enhance dh_clean to clean up better
[mirror_smartmontools-debian.git] / autogen.sh
... / ...
CommitLineData
1#!/bin/sh
2# $Id: autogen.sh 4053 2015-04-14 20:18:50Z chrfranke $
3#
4# Generate ./configure from config.in 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
9force=; warnings=
10while [ $# -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 ;;
14esac; done
15
16# Cygwin?
17test -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
26typep()
27{
28 cmd=$1 ; TMP=$IFS ; IFS=: ; set $PATH
29 for dir
30 do
31 if [ -x "$dir/$cmd" ]; then
32 echo "$dir/$cmd"
33 IFS=$TMP
34 return 0
35 fi
36 done
37 IFS=$TMP
38 return 1
39}
40
41test -x "$AUTOMAKE" ||
42 AUTOMAKE=`typep automake-1.15` || AUTOMAKE=`typep automake-1.14` ||
43 AUTOMAKE=`typep automake-1.13` || AUTOMAKE=`typep automake-1.12` ||
44 AUTOMAKE=`typep automake-1.11` || AUTOMAKE=`typep automake-1.10` ||
45 AUTOMAKE=`typep automake-1.9` || AUTOMAKE=`typep automake-1.8` ||
46 AUTOMAKE=`typep automake-1.7` || AUTOMAKE=`typep automake17` ||
47{
48echo
49echo "You must have at least GNU Automake 1.7 (up to 1.15) installed"
50echo "in order to bootstrap smartmontools from SVN. Download the"
51echo "appropriate package for your distribution, or the source tarball"
52echo "from ftp://ftp.gnu.org/gnu/automake/ ."
53echo
54echo "Also note that support for new Automake series (anything newer"
55echo "than 1.15) is only added after extensive tests. If you live in"
56echo "the bleeding edge, you should know what you're doing, mainly how"
57echo "to test it before the developers. Be patient."
58exit 1;
59}
60
61test -x "$ACLOCAL" || ACLOCAL="aclocal`echo "$AUTOMAKE" | sed 's/.*automake//'`" && ACLOCAL=`typep "$ACLOCAL"` ||
62{
63echo
64echo "autogen.sh found automake-1.X, but not the respective aclocal-1.X."
65echo "Your installation of GNU Automake is broken or incomplete."
66exit 2;
67}
68
69# Detect Automake version
70case "$AUTOMAKE" in
71 *automake-1.7|*automake17)
72 ver=1.7 ;;
73 *automake-1.8)
74 ver=1.8 ;;
75 *)
76 ver="`$AUTOMAKE --version | sed -n '1s,^.*[^.0-9]\([12]\.[0-9][-.0-9pl]*\).*$,\1,p'`"
77 ver="${ver:-?.?.?}"
78esac
79
80# Warn if Automake version was not tested or does not support filesystem
81amwarnings=$warnings
82case "$ver" in
83 1.[78]|1.[78].*)
84 # Check for case sensitive filesystem
85 # (to avoid e.g. "DIST_COMMON = ... ChangeLog ..." in Makefile.in on Cygwin)
86 rm -f CASETEST.TMP
87 echo > casetest.tmp
88 test -f CASETEST.TMP &&
89 {
90 echo "Warning: GNU Automake version ${ver} does not properly handle case"
91 echo "insensitive filesystems. Some make targets may not work."
92 }
93 rm -f casetest.tmp
94 ;;
95
96 1.9.[1-6]|1.10|1.10.[123]|1.11|1.11.[1-6]|1.12.[2-6]|1.13.[34])
97 # OK
98 ;;
99
100 1.14|1.14.1|1.15)
101 # TODO: Enable 'subdir-objects' in configure.ac
102 # For now, suppress 'subdir-objects' forward-incompatibility warning
103 test -n "$warnings" || amwarnings="--warnings=no-unsupported"
104 ;;
105
106 *)
107 echo "Note: GNU Automake version ${ver} was not tested by the developers."
108 echo "Please report success/failure to the smartmontools-support mailing list."
109esac
110
111# Warn if Automake version is too old
112case "$ver" in
113 1.[789]|1.[789].*)
114 echo "WARNING:"
115 echo "The use of GNU Automake version $ver is deprecated. Support for Automake"
116 echo "versions 1.7 - 1.9.x will be removed in a future release of smartmontools."
117esac
118
119# Install pkg-config macros
120# (Don't use 'aclocal -I m4 --install' to keep support for automake < 1.10)
121test -d m4 || mkdir m4 || exit 1
122test -z "$force" || rm -f m4/pkg.m4
123test -f m4/pkg.m4 || acdir=`${ACLOCAL} --print-ac-dir` &&
124 test -n "$acdir" && test -f "$acdir/pkg.m4" &&
125{
126 echo "$0: installing \`m4/pkg.m4' from \`$acdir/pkg.m4'"
127 cp "$acdir/pkg.m4" m4/pkg.m4
128}
129test -f m4/pkg.m4 ||
130 echo "Warning: cannot install m4/pkg.m4, 'make dist' and systemd detection will not work."
131
132set -e # stops on error status
133
134test -z "$warnings" || set -x
135
136${ACLOCAL} -I m4 $force $warnings
137autoheader $force $warnings
138${AUTOMAKE} --add-missing --copy ${force:+--force-missing} $amwarnings
139autoconf $force $warnings