]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - autogen.sh
Imported Upstream version 6.1+svn3812
[mirror_smartmontools-debian.git] / autogen.sh
1 #!/bin/sh
2 # $Id: autogen.sh 3748 2013-01-18 20:12:44Z 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
10 # Cygwin?
11 test -x /usr/bin/uname && /usr/bin/uname | grep -i CYGWIN >/dev/null &&
12 {
13 # Check for Unix text file type
14 echo > dostest.tmp
15 test "`wc -c < dostest.tmp`" -eq 1 ||
16 echo "Warning: DOS text file type set, 'make dist' and related targets will not work."
17 rm -f dostest.tmp
18 }
19
20 typep()
21 {
22 cmd=$1 ; TMP=$IFS ; IFS=: ; set $PATH
23 for dir
24 do
25 if [ -x "$dir/$cmd" ]; then
26 echo "$dir/$cmd"
27 IFS=$TMP
28 return 0
29 fi
30 done
31 IFS=$TMP
32 return 1
33 }
34
35 test -x "$AUTOMAKE" || AUTOMAKE=`typep automake-1.12` ||
36 AUTOMAKE=`typep automake-1.11` || AUTOMAKE=`typep automake-1.10` ||
37 AUTOMAKE=`typep automake-1.9` || AUTOMAKE=`typep automake-1.8` ||
38 AUTOMAKE=`typep automake-1.7` || AUTOMAKE=`typep automake17` ||
39 {
40 echo
41 echo "You must have at least GNU Automake 1.7 (up to 1.11) installed"
42 echo "in order to bootstrap smartmontools from SVN. Download the"
43 echo "appropriate package for your distribution, or the source tarball"
44 echo "from ftp://ftp.gnu.org/gnu/automake/ ."
45 echo
46 echo "Also note that support for new Automake series (anything newer"
47 echo "than 1.11) is only added after extensive tests. If you live in"
48 echo "the bleeding edge, you should know what you're doing, mainly how"
49 echo "to test it before the developers. Be patient."
50 exit 1;
51 }
52
53 test -x "$ACLOCAL" || ACLOCAL="aclocal`echo "$AUTOMAKE" | sed 's/.*automake//'`" && ACLOCAL=`typep "$ACLOCAL"` ||
54 {
55 echo
56 echo "autogen.sh found automake-1.X, but not the respective aclocal-1.X."
57 echo "Your installation of GNU Automake is broken or incomplete."
58 exit 2;
59 }
60
61 # Detect Automake version
62 case "$AUTOMAKE" in
63 *automake-1.7|*automake17)
64 ver=1.7 ;;
65 *automake-1.8)
66 ver=1.8 ;;
67 *)
68 ver="`$AUTOMAKE --version | sed -n '1s,^.*[^.0-9]\([12]\.[0-9][-.0-9pl]*\).*$,\1,p'`"
69 ver="${ver:-?.?.?}"
70 esac
71
72 # Warn if Automake version was not tested or does not support filesystem
73 case "$ver" in
74 1.[78]|1.[78].*)
75 # Check for case sensitive filesystem
76 # (to avoid e.g. "DIST_COMMON = ... ChangeLog ..." in Makefile.in on Cygwin)
77 rm -f CASETEST.TMP
78 echo > casetest.tmp
79 test -f CASETEST.TMP &&
80 {
81 echo "Warning: GNU Automake version ${ver} does not properly handle case"
82 echo "insensitive filesystems. Some make targets may not work."
83 }
84 rm -f casetest.tmp
85 ;;
86
87 1.9.[1-6]|1.10|1.10.[12]|1.11|1.11.[1-6]|1.12.[3-5])
88 # OK
89 ;;
90
91 *)
92 echo "Note: GNU Automake version ${ver} was not tested by the developers."
93 echo "Please report success/failure to the smartmontools-support mailing list."
94 esac
95
96 # Install pkg-config macros
97 # (Don't use 'aclocal -I m4 --install' to keep support for automake < 1.10)
98 test -d m4 || mkdir m4 || exit 1
99 test -f m4/pkg.m4 || acdir=`${ACLOCAL} --print-ac-dir` &&
100 test -n "$acdir" && test -f "$acdir/pkg.m4" &&
101 {
102 echo "$0: installing \`m4/pkg.m4' from \`$acdir/pkg.m4'"
103 cp "$acdir/pkg.m4" m4/pkg.m4
104 }
105 test -f m4/pkg.m4 ||
106 echo "Warning: cannot install m4/pkg.m4, 'make dist' and systemd detection will not work."
107
108 set -e # stops on error status
109
110 ${ACLOCAL} -I m4
111 autoheader
112 ${AUTOMAKE} --add-missing --copy
113 autoconf