]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - autogen.sh
Enhance dh_clean to clean up better
[mirror_smartmontools-debian.git] / autogen.sh
CommitLineData
832b75ed 1#!/bin/sh
293b5ab8 2# $Id: autogen.sh 4053 2015-04-14 20:18:50Z chrfranke $
832b75ed
GG
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
a37e7145 6# directory. To update these files at a later date use:
832b75ed
GG
7# autoreconf -f -i -v
8
d2e702cf
GI
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
832b75ed
GG
15
16# Cygwin?
17test -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
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
d2e702cf 41test -x "$AUTOMAKE" ||
293b5ab8 42 AUTOMAKE=`typep automake-1.15` || AUTOMAKE=`typep automake-1.14` ||
d2e702cf 43 AUTOMAKE=`typep automake-1.13` || AUTOMAKE=`typep automake-1.12` ||
ee38a438 44 AUTOMAKE=`typep automake-1.11` || AUTOMAKE=`typep automake-1.10` ||
2127e193
GI
45 AUTOMAKE=`typep automake-1.9` || AUTOMAKE=`typep automake-1.8` ||
46 AUTOMAKE=`typep automake-1.7` || AUTOMAKE=`typep automake17` ||
832b75ed
GG
47{
48echo
293b5ab8 49echo "You must have at least GNU Automake 1.7 (up to 1.15) installed"
2127e193 50echo "in order to bootstrap smartmontools from SVN. Download the"
832b75ed
GG
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"
293b5ab8 55echo "than 1.15) is only added after extensive tests. If you live in"
832b75ed
GG
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
2127e193
GI
64echo "autogen.sh found automake-1.X, but not the respective aclocal-1.X."
65echo "Your installation of GNU Automake is broken or incomplete."
832b75ed
GG
66exit 2;
67}
68
2127e193 69# Detect Automake version
832b75ed 70case "$AUTOMAKE" in
2127e193
GI
71 *automake-1.7|*automake17)
72 ver=1.7 ;;
73 *automake-1.8)
74 ver=1.8 ;;
832b75ed 75 *)
a23d5117 76 ver="`$AUTOMAKE --version | sed -n '1s,^.*[^.0-9]\([12]\.[0-9][-.0-9pl]*\).*$,\1,p'`"
832b75ed 77 ver="${ver:-?.?.?}"
832b75ed
GG
78esac
79
2127e193 80# Warn if Automake version was not tested or does not support filesystem
d2e702cf 81amwarnings=$warnings
2127e193
GI
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
d2e702cf 96 1.9.[1-6]|1.10|1.10.[123]|1.11|1.11.[1-6]|1.12.[2-6]|1.13.[34])
2127e193
GI
97 # OK
98 ;;
99
293b5ab8 100 1.14|1.14.1|1.15)
d2e702cf
GI
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
2127e193
GI
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
832b75ed 110
293b5ab8
JD
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
d008864d
GI
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
d2e702cf 122test -z "$force" || rm -f m4/pkg.m4
d008864d
GI
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
832b75ed
GG
132set -e # stops on error status
133
d2e702cf
GI
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