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 (flex
--version) < /dev
/null
> /dev
/null
2>&1 ||
77 error_mesg
"You must have flex installed to build the util-linux."
79 if ! (bison
--version) < /dev
/null
> /dev
/null
2>&1; then
80 error_mesg
"You must have bison installed to build the util-linux."
82 lexver
=$
(bison
--version |
awk '/^bison \(GNU [Bb]ison\)/ { print $4 }')
87 error_mesg
"You must have bison version >= 2.x, but you have $lexver."
94 case `uname` in Darwin
*) LIBTOOLIZE
=glibtoolize
;; esac
95 if ! ($LIBTOOLIZE --version) < /dev
/null
> /dev
/null
2>&1; then
96 error_mesg
"You must have libtool-2 installed to generate the util-linux build system."
98 ltver
=$
($LIBTOOLIZE --version |
awk '/^[g]*libtoolize/ { print $4 }')
99 ltver
=${ltver:-"none"}
100 test ${ltver##2.} = "$ltver" &&
101 error_mesg
"You must have libtool version >= 2.x.x, but you have $ltver."
104 (automake
--version) < /dev
/null
> /dev
/null
2>&1 ||
105 error_mesg
"You must have automake installed to generate the util-linux build system."
107 if test "$DIE" -eq 1; then
112 echo "Generating build-system with:"
113 echo " autopoint: $(autopoint --version | head -1)"
114 echo " aclocal: $(aclocal --version | head -1)"
115 echo " autoconf: $(autoconf --version | head -1)"
116 echo " autoheader: $(autoheader --version | head -1)"
117 echo " automake: $(automake --version | head -1)"
118 echo " libtoolize: $($LIBTOOLIZE --version | head -1)"
119 echo " flex: $(flex --version | head -1)"
120 echo " bison: $(bison --version | head -1)"
123 rm -rf autom4te.cache
127 autopoint_fun
--force $AP_OPTS
128 if ! grep -q datarootdir po
/Makefile.
in.
in; then
129 echo "INFO: autopoint does not honor dataroot variable, patching."
130 sed -i -e 's/^datadir *=\(.*\)/datarootdir = @datarootdir@\
131 datadir = @datadir@/g' po
/Makefile.
in.
in
133 $LIBTOOLIZE --force $LT_OPTS
136 if test -f tools
/libtool.
m4.
patch; then
137 if test -L m
4/libtool.
m4; then
138 cp m
4/libtool.
m4 m
4/libtool.
m4.org
140 mv m
4/libtool.
m4.org m
4/libtool.
m4
143 patch --batch --dry -p1 < tools
/libtool.
m4.
patch > /dev
/null
2>&1
144 if [ "$?" -eq 0 ]; then
145 patch -p1 --batch < tools
/libtool.
m4.
patch
150 aclocal
-I m4 $AL_OPTS
154 automake
--add-missing $AM_OPTS
160 echo "Now type '$srcdir/configure' and 'make' to compile."