]> git.ipfire.org Git - thirdparty/util-linux.git/blob - autogen.sh
script: document SIGUSR1
[thirdparty/util-linux.git] / autogen.sh
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
9 srcdir=`dirname $0`
10 test -z "$srcdir" && srcdir=.
11
12 THEDIR=`pwd`
13 cd $srcdir
14 DIE=0
15
16 # provide simple gettext backward compatibility
17 autopoint_fun ()
18 {
19 # we have to deal with set -e ...
20 ret="0"
21
22 # check against this hardcoded set of alternative gettext versions
23 gt_ver=`gettext --version |\
24 sed -n -e 's/.* \(0\.17\|0\.18\|0\.18\.[1-2]\)$/\1/p'`
25
26 if [ -n "$gt_ver" ]; then
27 echo "warning: forcing autopoint to use old gettext $gt_ver"
28 rm -f configure.ac.autogenbak
29 sed -i.autogenbak configure.ac \
30 -e "s/\(AM_GNU_GETTEXT_VERSION\).*/\1([$gt_ver])/"
31 fi
32
33 autopoint "$@" || ret=$?
34
35 if [ -n "$gt_ver" ]; then
36 mv configure.ac.autogenbak configure.ac
37 fi
38
39 return $ret
40 }
41
42 test -f sys-utils/mount.c || {
43 echo
44 echo "You must run this script in the top-level util-linux directory."
45 echo
46 DIE=1
47 }
48
49 (autopoint --version) < /dev/null > /dev/null 2>&1 || {
50 echo
51 echo "You must have autopoint installed to generate the util-linux build system."
52 echo "The autopoint command is part of the GNU gettext package."
53 echo
54 DIE=1
55 }
56 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
57 echo
58 echo "You must have autoconf installed to generate the util-linux build system."
59 echo
60 DIE=1
61 }
62 (autoheader --version) < /dev/null > /dev/null 2>&1 || {
63 echo
64 echo "You must have autoheader installed to generate the util-linux build system."
65 echo "The autoheader command is part of the GNU autoconf package."
66 echo
67 DIE=1
68 }
69
70 if ! (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
75 else
76 lexver=$(bison --version | awk '/^bison \(GNU [Bb]ison\)/ { print $4 }')
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
87 fi
88
89 LIBTOOLIZE=libtoolize
90 case `uname` in Darwin*) LIBTOOLIZE=glibtoolize ;; esac
91 if ! ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1; then
92 echo
93 echo "You must have libtool-2 installed to generate the util-linux build system."
94 echo
95 DIE=1
96 else
97 ltver=$($LIBTOOLIZE --version | awk '/^[g]*libtoolize/ { print $4 }')
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 }
105 fi
106
107 (automake --version) < /dev/null > /dev/null 2>&1 || {
108 echo
109 echo "You must have automake installed to generate the util-linux build system."
110 echo
111 DIE=1
112 }
113
114 if test "$DIE" -eq 1; then
115 exit 1
116 fi
117
118 echo
119 echo "Generating build-system with:"
120 echo " autopoint: $(autopoint --version | head -1)"
121 echo " aclocal: $(aclocal --version | head -1)"
122 echo " autoconf: $(autoconf --version | head -1)"
123 echo " autoheader: $(autoheader --version | head -1)"
124 echo " automake: $(automake --version | head -1)"
125 echo " libtoolize: $($LIBTOOLIZE --version | head -1)"
126 echo " bison: $(bison --version | head -1)"
127
128 rm -rf autom4te.cache
129
130 set -e
131 po/update-potfiles
132 autopoint_fun --force $AP_OPTS
133 if ! 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@\
136 datadir = @datadir@/g' po/Makefile.in.in
137 fi
138 $LIBTOOLIZE --force $LT_OPTS
139 aclocal -I m4 $AL_OPTS
140 autoconf $AC_OPTS
141 autoheader $AH_OPTS
142
143 automake --add-missing $AM_OPTS
144
145 cd "$THEDIR"
146
147 echo
148 echo "Now type '$srcdir/configure' and 'make' to compile."
149 echo
150
151