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