]> git.ipfire.org Git - thirdparty/util-linux.git/blame - autogen.sh
libmount: fix comment referring to passno field
[thirdparty/util-linux.git] / autogen.sh
CommitLineData
8eeb575c
KZ
1#!/bin/sh
2
3#
4# Helps generate autoconf/automake stuff, when code is checked out from SCM.
5#
93e0319d 6# Copyright (C) 2006-2010 - Karel Zak <kzak@redhat.com>
8eeb575c
KZ
7#
8
9srcdir=`dirname $0`
b12991dd 10test -z "$srcdir" && srcdir=.
8eeb575c
KZ
11
12THEDIR=`pwd`
13cd $srcdir
14DIE=0
15
f8d75a66 16# provide simple gettext backward compatibility
91c520bc
RM
17autopoint_fun ()
18{
19 # we have to deal with set -e ...
91c520bc 20 ret="0"
91c520bc 21
f8d75a66
RM
22 # check against this hardcoded set of alternative gettext versions
23 gt_ver=`gettext --version |\
e46a7f8e 24 sed -n -e 's/.* \(0\.17\|0\.18\|0\.18\.[1-2]\)$/\1/p'`
91c520bc 25
f8d75a66 26 if [ -n "$gt_ver" ]; then
a0aee0a9 27 echo "warning: forcing autopoint to use old gettext $gt_ver"
f8d75a66 28 rm -f configure.ac.autogenbak
91c520bc 29 sed -i.autogenbak configure.ac \
f8d75a66 30 -e "s/\(AM_GNU_GETTEXT_VERSION\).*/\1([$gt_ver])/"
91c520bc
RM
31 fi
32
33 autopoint "$@" || ret=$?
91c520bc 34
f8d75a66 35 if [ -n "$gt_ver" ]; then
91c520bc
RM
36 mv configure.ac.autogenbak configure.ac
37 fi
38
39 return $ret
40}
41
d2feb47f 42test -f sys-utils/mount.c || {
93e0319d 43 echo
a0aee0a9 44 echo "You must run this script in the top-level util-linux directory."
93e0319d
KZ
45 echo
46 DIE=1
47}
48
8eeb575c
KZ
49(autopoint --version) < /dev/null > /dev/null 2>&1 || {
50 echo
a0aee0a9 51 echo "You must have autopoint installed to generate the util-linux build system."
93e0319d
KZ
52 echo "The autopoint command is part of the GNU gettext package."
53 echo
8eeb575c
KZ
54 DIE=1
55}
56(autoconf --version) < /dev/null > /dev/null 2>&1 || {
57 echo
a0aee0a9 58 echo "You must have autoconf installed to generate the util-linux build system."
8eeb575c 59 echo
8eeb575c
KZ
60 DIE=1
61}
93e0319d
KZ
62(autoheader --version) < /dev/null > /dev/null 2>&1 || {
63 echo
a0aee0a9 64 echo "You must have autoheader installed to generate the util-linux build system."
93e0319d
KZ
65 echo "The autoheader command is part of the GNU autoconf package."
66 echo
67 DIE=1
68}
0024583c 69
30d7f61f
KZ
70if ! (bison --version) < /dev/null > /dev/null 2>&1; then
71 echo
72 echo "You must have bison installed to build the util-linux."
73 echo
74 DIE=1
75else
5ff48b5f 76 lexver=$(bison --version | awk '/^bison \(GNU [Bb]ison\)/ { print $4 }')
30d7f61f
KZ
77 case "$lexver" in
78 [2-9].*)
79 ;;
80 *)
81 echo
82 echo "You must have bison version >= 2.x, but you have $lexver."
83 echo
84 DIE=1
85 ;;
86 esac
87fi
88
0024583c
RM
89LIBTOOLIZE=libtoolize
90case `uname` in Darwin*) LIBTOOLIZE=glibtoolize ;; esac
91if ! ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1; then
4b2ede3e 92 echo
a0aee0a9 93 echo "You must have libtool-2 installed to generate the util-linux build system."
4b2ede3e
KZ
94 echo
95 DIE=1
0024583c 96else
6b5cad00 97 ltver=$($LIBTOOLIZE --version | awk '/^[g]*libtoolize/ { print $4 }')
0024583c
RM
98 ltver=${ltver:-"none"}
99 test ${ltver##2.} = "$ltver" && {
100 echo
101 echo "You must have libtool version >= 2.x.x, but you have $ltver."
102 echo
103 DIE=1
104 }
105fi
106
8eeb575c
KZ
107(automake --version) < /dev/null > /dev/null 2>&1 || {
108 echo
a0aee0a9
BS
109 echo "You must have automake installed to generate the util-linux build system."
110 echo
8eeb575c
KZ
111 DIE=1
112}
8eeb575c 113
93e0319d
KZ
114if test "$DIE" -eq 1; then
115 exit 1
116fi
117
952a06cf 118echo
a0aee0a9 119echo "Generating build-system with:"
952a06cf
KZ
120echo " autopoint: $(autopoint --version | head -1)"
121echo " aclocal: $(aclocal --version | head -1)"
122echo " autoconf: $(autoconf --version | head -1)"
123echo " autoheader: $(autoheader --version | head -1)"
124echo " automake: $(automake --version | head -1)"
0024583c 125echo " libtoolize: $($LIBTOOLIZE --version | head -1)"
30d7f61f 126echo " bison: $(bison --version | head -1)"
952a06cf 127
38c75b59
SK
128rm -rf autom4te.cache
129
f2c166ff 130set -e
7c2ee1d2 131po/update-potfiles
91c520bc 132autopoint_fun --force $AP_OPTS
cc3c3fdd
SK
133if ! grep -q datarootdir po/Makefile.in.in; then
134 echo autopoint does not honor dataroot variable, patching.
135 sed -i -e 's/^datadir *=\(.*\)/datarootdir = @datarootdir@\
136datadir = @datadir@/g' po/Makefile.in.in
137fi
0024583c 138$LIBTOOLIZE --force $LT_OPTS
1eca726f
KZ
139aclocal -I m4 $AL_OPTS
140autoconf $AC_OPTS
141autoheader $AH_OPTS
1e018c15 142
1eca726f 143automake --add-missing $AM_OPTS
8eeb575c 144
9583461d 145cd "$THEDIR"
8eeb575c 146
952a06cf 147echo
e1bc6da9 148echo "Now type '$srcdir/configure' and 'make' to compile."
952a06cf 149echo
8eeb575c
KZ
150
151