]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - autogen.sh
Correct maintscript syntax
[mirror_smartmontools-debian.git] / autogen.sh
1 #!/bin/sh
2 # $Id: autogen.sh 3917 2014-06-20 19:57:41Z 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
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 typep()
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
41 test -x "$AUTOMAKE" ||
42 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 {
48 echo
49 echo "You must have at least GNU Automake 1.7 (up to 1.14) installed"
50 echo "in order to bootstrap smartmontools from SVN. Download the"
51 echo "appropriate package for your distribution, or the source tarball"
52 echo "from ftp://ftp.gnu.org/gnu/automake/ ."
53 echo
54 echo "Also note that support for new Automake series (anything newer"
55 echo "than 1.14) is only added after extensive tests. If you live in"
56 echo "the bleeding edge, you should know what you're doing, mainly how"
57 echo "to test it before the developers. Be patient."
58 exit 1;
59 }
60
61 test -x "$ACLOCAL" || ACLOCAL="aclocal`echo "$AUTOMAKE" | sed 's/.*automake//'`" && ACLOCAL=`typep "$ACLOCAL"` ||
62 {
63 echo
64 echo "autogen.sh found automake-1.X, but not the respective aclocal-1.X."
65 echo "Your installation of GNU Automake is broken or incomplete."
66 exit 2;
67 }
68
69 # Detect Automake version
70 case "$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:-?.?.?}"
78 esac
79
80 # Warn if Automake version was not tested or does not support filesystem
81 amwarnings=$warnings
82 case "$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)
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."
109 esac
110
111 # Install pkg-config macros
112 # (Don't use 'aclocal -I m4 --install' to keep support for automake < 1.10)
113 test -d m4 || mkdir m4 || exit 1
114 test -z "$force" || rm -f m4/pkg.m4
115 test -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 }
121 test -f m4/pkg.m4 ||
122 echo "Warning: cannot install m4/pkg.m4, 'make dist' and systemd detection will not work."
123
124 set -e # stops on error status
125
126 test -z "$warnings" || set -x
127
128 ${ACLOCAL} -I m4 $force $warnings
129 autoheader $force $warnings
130 ${AUTOMAKE} --add-missing --copy ${force:+--force-missing} $amwarnings
131 autoconf $force $warnings