]> git.ipfire.org Git - thirdparty/util-linux.git/blame_incremental - autogen.sh
lsns: tolerate lsns_ioctl(fd, NS_GET_{PARENT,USERNS}) failing with ENOSYS
[thirdparty/util-linux.git] / autogen.sh
... / ...
CommitLineData
1#!/bin/sh
2
3#
4# Helps generate autoconf/automake stuff, when code is checked out from SCM.
5#
6# Copyright (C) 2006-2010 - Karel Zak <kzak@redhat.com>
7#
8
9srcdir=`dirname $0`
10test -z "$srcdir" && srcdir=.
11
12THEDIR=`pwd`
13cd $srcdir
14DIE=0
15
16warn_mesg ()
17{
18 echo
19 echo "WARNING: $1"
20 test -z "$2" ||
21 echo " $2"
22 echo
23}
24
25error_mesg ()
26{
27 echo
28 echo "ERROR: $1"
29 test -z "$2" ||
30 echo " $2"
31 echo
32 DIE=1
33}
34
35# provide simple gettext backward compatibility
36autopoint_fun ()
37{
38 # we have to deal with set -e ...
39 ret="0"
40
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'`
44
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])/"
50 fi
51
52 autopoint "$@" || ret=$?
53
54 if [ -n "$gt_ver" ]; then
55 mv configure.ac.autogenbak configure.ac
56 fi
57
58 return $ret
59}
60
61test -f sys-utils/mount.c ||
62 error_mesg "You must run this script in the top-level util-linux directory."
63
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."
66
67(autoconf --version) < /dev/null > /dev/null 2>&1 ||
68 error_mesg "You must have autoconf installed to generate the util-linux build system."
69
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."
72
73[ -x "$(command -v gettext)" -o -x "$(command -v xgettext)" ] ||
74 warn_mesg "You need have [x]gettext binary installed to update po/ stuff."
75
76(flex --version) < /dev/null > /dev/null 2>&1 ||
77 error_mesg "You must have flex installed to build the util-linux."
78
79if ! (bison --version) < /dev/null > /dev/null 2>&1; then
80 error_mesg "You must have bison installed to build the util-linux."
81else
82 lexver=$(bison --version | awk '/^bison \(GNU [Bb]ison\)/ { print $4 }')
83 case "$lexver" in
84 [2-9].*)
85 ;;
86 *)
87 error_mesg "You must have bison version >= 2.x, but you have $lexver."
88 ;;
89 esac
90fi
91
92
93LIBTOOLIZE=libtoolize
94case `uname` in Darwin*) LIBTOOLIZE=glibtoolize ;; esac
95if ! ($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."
97else
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."
102fi
103
104(automake --version) < /dev/null > /dev/null 2>&1 ||
105 error_mesg "You must have automake installed to generate the util-linux build system."
106
107if test "$DIE" -eq 1; then
108 exit 1
109fi
110
111echo
112echo "Generating build-system with:"
113echo " autopoint: $(autopoint --version | head -1)"
114echo " aclocal: $(aclocal --version | head -1)"
115echo " autoconf: $(autoconf --version | head -1)"
116echo " autoheader: $(autoheader --version | head -1)"
117echo " automake: $(automake --version | head -1)"
118echo " libtoolize: $($LIBTOOLIZE --version | head -1)"
119echo " flex: $(flex --version | head -1)"
120echo " bison: $(bison --version | head -1)"
121echo
122
123rm -rf autom4te.cache
124
125set -e
126po/update-potfiles
127autopoint_fun --force $AP_OPTS
128if ! 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@\
131datadir = @datadir@/g' po/Makefile.in.in
132fi
133$LIBTOOLIZE --force $LT_OPTS
134
135# patch libtool
136if test -f tools/libtool.m4.patch; then
137 if test -L m4/libtool.m4; then
138 cp m4/libtool.m4 m4/libtool.m4.org
139 rm m4/libtool.m4
140 mv m4/libtool.m4.org m4/libtool.m4
141 fi
142 set +e
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
146 fi
147 set -e
148fi
149
150aclocal -I m4 $AL_OPTS
151autoconf $AC_OPTS
152autoheader $AH_OPTS
153
154automake --add-missing $AM_OPTS
155
156
157cd "$THEDIR"
158
159echo
160echo "Now type '$srcdir/configure' and 'make' to compile."
161echo
162
163