4 # Helps generate autoconf/automake stuff, when code is checked out from SCM.
6 # Copyright (C) 2006-2010 - Karel Zak <kzak@redhat.com>
10 test -z "$srcdir" && srcdir
=.
35 # provide simple gettext backward compatibility
38 # we have to deal with set -e ...
41 # check against this hardcoded set of alternative gettext versions
42 gt_ver
=`gettext --version |\
43 sed -n -e 's/.* \(0\.17\|0\.18\|0\.18\.[1-2]\)$/\1/p'`
45 if [ -n "$gt_ver" ]; then
46 warn_mesg
"warning: forcing autopoint to use old gettext $gt_ver"
47 rm -f configure.ac.autogenbak
48 sed -i.autogenbak configure.ac \
49 -e "s/\(AM_GNU_GETTEXT_VERSION\).*/\1([$gt_ver])/"
52 autopoint
"$@" || ret
=$?
54 if [ -n "$gt_ver" ]; then
55 mv configure.ac.autogenbak configure.ac
61 test -f sys-utils
/mount.c ||
62 error_mesg
"You must run this script in the top-level util-linux directory."
64 (autopoint
--version) < /dev
/null
> /dev
/null
2>&1 ||
65 error_mesg
"You must have autopoint installed to generate the util-linux build system." "The autopoint command is part of the GNU gettext package."
67 (autoconf
--version) < /dev
/null
> /dev
/null
2>&1 ||
68 error_mesg
"You must have autoconf installed to generate the util-linux build system."
70 (autoheader
--version) < /dev
/null
> /dev
/null
2>&1 ||
71 error_mesg
"You must have autoheader installed to generate the util-linux build system." "The autoheader command is part of the GNU autoconf package."
73 [ -x "$(command -v gettext)" -o -x "$(command -v xgettext)" ] ||
74 warn_mesg
"You need have [x]gettext binary installed to update po/ stuff."
76 if ! (bison
--version) < /dev
/null
> /dev
/null
2>&1; then
77 error_mesg
"You must have bison installed to build the util-linux."
79 lexver
=$
(bison
--version |
awk '/^bison \(GNU [Bb]ison\)/ { print $4 }')
84 error_mesg
"You must have bison version >= 2.x, but you have $lexver."
90 case `uname` in Darwin
*) LIBTOOLIZE
=glibtoolize
;; esac
91 if ! ($LIBTOOLIZE --version) < /dev
/null
> /dev
/null
2>&1; then
92 error_mesg
"You must have libtool-2 installed to generate the util-linux build system."
94 ltver
=$
($LIBTOOLIZE --version |
awk '/^[g]*libtoolize/ { print $4 }')
95 ltver
=${ltver:-"none"}
96 test ${ltver##2.} = "$ltver" &&
97 error_mesg
"You must have libtool version >= 2.x.x, but you have $ltver."
100 (automake
--version) < /dev
/null
> /dev
/null
2>&1 ||
101 error_mesg
"You must have automake installed to generate the util-linux build system."
103 if test "$DIE" -eq 1; then
108 echo "Generating build-system with:"
109 echo " autopoint: $(autopoint --version | head -1)"
110 echo " aclocal: $(aclocal --version | head -1)"
111 echo " autoconf: $(autoconf --version | head -1)"
112 echo " autoheader: $(autoheader --version | head -1)"
113 echo " automake: $(automake --version | head -1)"
114 echo " libtoolize: $($LIBTOOLIZE --version | head -1)"
115 echo " bison: $(bison --version | head -1)"
118 rm -rf autom4te.cache
122 autopoint_fun
--force $AP_OPTS
123 if ! grep -q datarootdir po
/Makefile.
in.
in; then
124 echo "INFO: autopoint does not honor dataroot variable, patching."
125 sed -i -e 's/^datadir *=\(.*\)/datarootdir = @datarootdir@\
126 datadir = @datadir@/g' po
/Makefile.
in.
in
128 $LIBTOOLIZE --force $LT_OPTS
131 if test -f tools
/libtool.
m4.
patch; then
132 if test -L m
4/libtool.
m4; then
133 cp m
4/libtool.
m4 m
4/libtool.
m4.org
135 mv m
4/libtool.
m4.org m
4/libtool.
m4
138 patch --batch --dry -p1 < tools
/libtool.
m4.
patch > /dev
/null
2>&1
139 if [ "$?" -eq 0 ]; then
140 patch -p1 --batch < tools
/libtool.
m4.
patch
145 aclocal
-I m4 $AL_OPTS
149 automake
--add-missing $AM_OPTS
155 echo "Now type '$srcdir/configure' and 'make' to compile."