]> git.ipfire.org Git - thirdparty/util-linux.git/blame - autogen.sh
build-sys: use gettext 0.18.3 if possible
[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
91c520bc
RM
16autopoint_fun ()
17{
18 # we have to deal with set -e ...
19 rm -f configure.ac.autogenbak
20 ret="0"
21 GT_VER_MIN="0.18"
22 GT_VER_DEF=$(sed -n 's/AM_GNU_GETTEXT_VERSION(\[\(.*\)\])/\1/p' configure.ac)
23 GT_VER_HAVE="$(gettext --version | head -n 1 | sed 's/.* //g')"
24
25 tmp=$(echo -e "$GT_VER_MIN\n$GT_VER_HAVE" | sort -V | tail -n1)
26 tmp=$(echo -e "$GT_VER_DEF\n$tmp" | sort -V | head -n1)
27
28 if [ "$tmp" != "$GT_VER_DEF" ]; then
29 echo "warning, force autopoint to use old gettext $tmp"
30 sed -i.autogenbak configure.ac \
31 -e "s/\(AM_GNU_GETTEXT_VERSION\).*/\1([$tmp])/"
32 fi
33
34 autopoint "$@" || ret=$?
35 ret=$?
36
37 if [ "$tmp" != "$GT_VER_DEF" ]; then
38 mv configure.ac.autogenbak configure.ac
39 fi
40
41 return $ret
42}
43
d2feb47f 44test -f sys-utils/mount.c || {
93e0319d
KZ
45 echo
46 echo "You must run this script in the top-level util-linux directory"
47 echo
48 DIE=1
49}
50
8eeb575c
KZ
51(autopoint --version) < /dev/null > /dev/null 2>&1 || {
52 echo
93e0319d
KZ
53 echo "You must have autopoint installed to generate util-linux build system."
54 echo "The autopoint command is part of the GNU gettext package."
55 echo
8eeb575c
KZ
56 DIE=1
57}
58(autoconf --version) < /dev/null > /dev/null 2>&1 || {
59 echo
601d12fb 60 echo "You must have autoconf installed to generate util-linux build system."
8eeb575c 61 echo
8eeb575c
KZ
62 DIE=1
63}
93e0319d
KZ
64(autoheader --version) < /dev/null > /dev/null 2>&1 || {
65 echo
66 echo "You must have autoheader installed to generate util-linux build system."
67 echo "The autoheader command is part of the GNU autoconf package."
68 echo
69 DIE=1
70}
4b2ede3e
KZ
71(libtool --version) < /dev/null > /dev/null 2>&1 || {
72 echo
73 echo "You must have libtool-2 installed to generate util-linux build system."
74 echo
75 DIE=1
76}
8eeb575c
KZ
77(automake --version) < /dev/null > /dev/null 2>&1 || {
78 echo
601d12fb 79 echo "You must have automake installed to generate util-linux build system."
8eeb575c 80 echo
8eeb575c
KZ
81 DIE=1
82}
8eeb575c 83
4b2ede3e 84ltver=$(libtoolize --version | awk '/^libtoolize/ { print $4 }')
13ba1df8 85ltver=${ltver:-"none"}
aada54e0 86test ${ltver##2.} = "$ltver" && {
4b2ede3e
KZ
87 echo "You must have libtool version >= 2.x.x, but you have $ltver."
88 DIE=1
89}
b12991dd 90
93e0319d
KZ
91if test "$DIE" -eq 1; then
92 exit 1
93fi
94
952a06cf
KZ
95echo
96echo "Generate build-system by:"
91c520bc 97
952a06cf
KZ
98echo " autopoint: $(autopoint --version | head -1)"
99echo " aclocal: $(aclocal --version | head -1)"
100echo " autoconf: $(autoconf --version | head -1)"
101echo " autoheader: $(autoheader --version | head -1)"
102echo " automake: $(automake --version | head -1)"
4b2ede3e 103echo " libtoolize: $(libtoolize --version | head -1)"
952a06cf 104
38c75b59
SK
105rm -rf autom4te.cache
106
f2c166ff 107set -e
7c2ee1d2 108po/update-potfiles
91c520bc 109autopoint_fun --force $AP_OPTS
cc3c3fdd
SK
110if ! grep -q datarootdir po/Makefile.in.in; then
111 echo autopoint does not honor dataroot variable, patching.
112 sed -i -e 's/^datadir *=\(.*\)/datarootdir = @datarootdir@\
113datadir = @datadir@/g' po/Makefile.in.in
114fi
4b2ede3e 115libtoolize --force $LT_OPTS
1eca726f
KZ
116aclocal -I m4 $AL_OPTS
117autoconf $AC_OPTS
118autoheader $AH_OPTS
1e018c15 119
1eca726f 120automake --add-missing $AM_OPTS
8eeb575c
KZ
121
122cd $THEDIR
123
952a06cf 124echo
e1bc6da9 125echo "Now type '$srcdir/configure' and 'make' to compile."
952a06cf 126echo
8eeb575c
KZ
127
128