]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - autogen.sh
Correct maintscript syntax
[mirror_smartmontools-debian.git] / autogen.sh
CommitLineData
832b75ed 1#!/bin/sh
d2e702cf 2# $Id: autogen.sh 3917 2014-06-20 19:57:41Z 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
GI
41test -x "$AUTOMAKE" ||
42 AUTOMAKE=`typep automake-1.14` ||
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
d2e702cf 49echo "You must have at least GNU Automake 1.7 (up to 1.14) 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"
d2e702cf 55echo "than 1.14) 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
d2e702cf
GI
100 1.14|1.14.1)
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
d008864d
GI
111# Install pkg-config macros
112# (Don't use 'aclocal -I m4 --install' to keep support for automake < 1.10)
113test -d m4 || mkdir m4 || exit 1
d2e702cf 114test -z "$force" || rm -f m4/pkg.m4
d008864d
GI
115test -f m4/pkg.m4 || acdir=`${ACLOCAL} --print-ac-dir` &&
116 test -n "$acdir" && test -f "$acdir/pkg.m4" &&
117{
118 echo "$0: installing \`m4/pkg.m4' from \`$acdir/pkg.m4'"
119 cp "$acdir/pkg.m4" m4/pkg.m4
120}
121test -f m4/pkg.m4 ||
122 echo "Warning: cannot install m4/pkg.m4, 'make dist' and systemd detection will not work."
123
832b75ed
GG
124set -e # stops on error status
125
d2e702cf
GI
126test -z "$warnings" || set -x
127
128${ACLOCAL} -I m4 $force $warnings
129autoheader $force $warnings
130${AUTOMAKE} --add-missing --copy ${force:+--force-missing} $amwarnings
131autoconf $force $warnings