2
# Run this to generate all the initial makefiles, etc.
8
# default version requirements ...
9
REQUIRED_AUTOCONF_VERSION=${REQUIRED_AUTOCONF_VERSION:-2.53}
10
REQUIRED_AUTOMAKE_VERSION=${REQUIRED_AUTOMAKE_VERSION:-1.5}
11
REQUIRED_LIBTOOL_VERSION=${REQUIRED_LIBTOOL_VERSION:-1.4.3}
12
REQUIRED_PKG_CONFIG_VERSION=${REQUIRED_PKG_CONFIG_VERSION:-0.14.0}
14
# a list of required m4 macros. Package can set an initial value
15
REQUIRED_M4MACROS=${REQUIRED_M4MACROS:-}
16
FORBIDDEN_M4MACROS=${FORBIDDEN_M4MACROS:-}
19
# some terminal codes ...
20
boldface="`tput bold 2>/dev/null`"
21
normal="`tput sgr0 2>/dev/null`"
32
# compare_versions MIN_VERSION ACTUAL_VERSION
33
# returns true if ACTUAL_VERSION >= MIN_VERSION
35
local min_version actual_version status save_IFS cur min
39
IFS="${IFS= }"; save_IFS="$IFS"; IFS="."
41
for min in $min_version; do
42
cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes
43
if [ -z "$min" ]; then break; fi
44
if [ -z "$cur" ]; then status=1; break; fi
45
if [ $cur -gt $min ]; then break; fi
46
if [ $cur -lt $min ]; then status=1; break; fi
53
# version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE
54
# checks to see if the package is available
56
local package variable checkprogs min_version source status checkprog actual_version
64
checkprog=`eval echo "\\$$variable"`
65
if [ -n "$checkprog" ]; then
66
printbold "using $checkprog for $package"
70
printbold "checking for $package >= $min_version..."
71
for checkprog in $checkprogs; do
72
echo -n " testing $checkprog... "
73
if $checkprog --version < /dev/null > /dev/null 2>&1; then
74
actual_version=`$checkprog --version | head -n 1 | \
75
sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'`
76
if compare_versions $min_version $actual_version; then
79
eval "$variable=$checkprog"
83
echo "too old (found version $actual_version)"
89
if [ "$status" != 0 ]; then
90
printerr "***Error***: You must have $package >= $min_version installed"
91
printerr " to build $PKG_NAME. Download the appropriate package for"
92
printerr " from your distribution or get the source tarball at"
100
# require_m4macro filename.m4
101
# adds filename.m4 to the list of required macros
103
case "$REQUIRED_M4MACROS" in
104
$1\ * | *\ $1\ * | *\ $1) ;;
105
*) REQUIRED_M4MACROS="$REQUIRED_M4MACROS $1" ;;
110
case "$FORBIDDEN_M4MACROS" in
111
$1\ * | *\ $1\ * | *\ $1) ;;
112
*) FORBIDDEN_M4MACROS="$FORBIDDEN_M4MACROS $1" ;;
118
# Checks that all the requested macro files are in the aclocal macro path
119
# Uses REQUIRED_M4MACROS and ACLOCAL variables.
121
local macrodirs status macro dir macrofound
123
# construct list of macro directories
124
macrodirs="`$ACLOCAL --print-ac-dir`"
126
while [ $# -gt 0 ]; do
127
if [ "$1" = "-I" ]; then
128
macrodirs="$macrodirs $2"
135
if [ -n "$REQUIRED_M4MACROS" ]; then
136
printbold "Checking for required M4 macros..."
137
# check that each macro file is in one of the macro dirs
138
for macro in $REQUIRED_M4MACROS; do
140
for dir in $macrodirs; do
141
if [ -f "$dir/$macro" ]; then
149
printerr " $macro not found"
154
if [ -n "$FORBIDDEN_M4MACROS" ]; then
155
printbold "Checking for forbidden M4 macros..."
156
# check that each macro file is in one of the macro dirs
157
for macro in $FORBIDDEN_M4MACROS; do
159
for dir in $macrodirs; do
160
if [ -f "$dir/$macro" ]; then
166
printerr " $macro found (should be cleared from macros dir)"
171
if [ "$status" != 0 ]; then
172
printerr "***Error***: some autoconf macros required to build $PKG_NAME"
173
printerr " were not found in your aclocal path, or some forbidden"
174
printerr " macros were found. Perhaps you need to adjust your"
175
printerr " ACLOCAL_PATH?"
181
# try to catch the case where the macros2/ directory hasn't been cleared out.
182
forbid_m4macro gnome-cxx-check.m4
186
want_glib_gettext=false
188
want_pkg_config=false
191
configure_files="`find $srcdir -name configure.ac -print -or -name configure.in -print`"
192
for configure_ac in $configure_files; do
193
if grep "^A[CM]_PROG_LIBTOOL" $configure_ac >/dev/null; then
196
if grep "^AM_GNU_GETTEXT" $configure_ac >/dev/null; then
199
if grep "^AC_PROG_INTLTOOL" $configure_ac >/dev/null; then
202
if grep "^PKG_CHECK_MODULES" $configure_ac >/dev/null; then
209
#tell Mandrake autoconf wrapper we want autoconf 2.5x, not 2.13
211
export WANT_AUTOCONF_2_5
212
version_check autoconf AUTOCONF 'autoconf2.50 autoconf autoconf-2.53' $REQUIRED_AUTOCONF_VERSION \
213
"http://ftp.gnu.org/pub/gnu/autoconf/autoconf-$REQUIRED_AUTOCONF_VERSION.tar.gz" || DIE=1
214
AUTOHEADER=`echo $AUTOCONF | sed s/autoconf/autoheader/`
216
case $REQUIRED_AUTOMAKE_VERSION in
217
1.4*) automake_progs="automake-1.4" ;;
218
1.5*) automake_progs="automake-1.7 automake-1.6 automake-1.5" ;;
219
1.6*) automake_progs="automake-1.8 automake-1.7 automake-1.6" ;;
220
1.7*) automake_progs="automake-1.8 automake-1.7" ;;
221
1.8*) automake_progs="automake-1.8" ;;
223
version_check automake AUTOMAKE "$automake_progs" $REQUIRED_AUTOMAKE_VERSION \
224
"http://ftp.gnu.org/pub/gnu/automake/automake-$REQUIRED_AUTOMAKE_VERSION.tar.gz" || DIE=1
225
ACLOCAL=`echo $AUTOMAKE | sed s/automake/aclocal/`
227
if $want_libtool; then
228
version_check libtool LIBTOOLIZE libtoolize $REQUIRED_LIBTOOL_VERSION \
229
"http://ftp.gnu.org/pub/gnu/libtool/libtool-$REQUIRED_LIBTOOL_VERSION.tar.gz" || DIE=1
230
require_m4macro libtool.m4
233
if $want_gettext; then
234
version_check gettext GETTEXTIZE gettextize $REQUIRED_GETTEXT_VERSION \
235
"http://ftp.gnu.org/pub/gnu/gettext/gettext-$REQUIRED_GETTEXT_VERSION.tar.gz" || DIE=1
236
require_m4macro gettext.m4
239
if $want_pkg_config; then
240
version_check pkg-config PKG_CONFIG pkg-config $REQUIRED_PKG_CONFIG_VERSION \
241
"'http://www.freedesktop.org/software/pkgconfig/releases/pkgconfig-$REQUIRED_PKG_CONFIG_VERSION.tar.gz" || DIE=1
242
require_m4macro pkg.m4
246
check_m4macros || DIE=1
248
if [ "$DIE" -eq 1 ]; then
252
if test -z "$*"; then
253
printerr "**Warning**: I am going to run \`configure' with no arguments."
254
printerr "If you wish to pass any to it, please specify them on the"
255
printerr \`$0\'" command line."
260
for configure_ac in $configure_files; do
261
dirname=`dirname $configure_ac`
262
basename=`basename $configure_ac`
263
if test -f $dirname/NO-AUTO-GEN; then
264
echo skipping $dirname -- flagged as no auto-gen
266
printbold "Processing $configure_ac"
268
aclocalinclude="$ACLOCAL_FLAGS"
269
printbold "Running $ACLOCAL..."
270
$ACLOCAL $aclocalinclude || exit 1
272
if grep "GNOME_AUTOGEN_OBSOLETE" aclocal.m4 >/dev/null; then
273
printerr "*** obsolete gnome macros were used in $configure_ac"
276
if grep "^A[CM]_PROG_LIBTOOL" $basename >/dev/null; then
277
printbold "Running $LIBTOOLIZE..."
278
$LIBTOOLIZE --force || exit 1
280
if grep "^AM_GLIB_GNU_GETTEXT" $basename >/dev/null; then
281
printbold "Running $GLIB_GETTEXTIZE... Ignore non-fatal messages."
282
echo "no" | $GLIB_GETTEXTIZE --force --copy || exit 1
283
elif grep "^AM_GNU_GETTEXT" $basename >/dev/null; then
284
if grep "^AM_GNU_GETTEXT_VERSION" $basename > /dev/null; then
285
printbold "Running autopoint..."
286
autopoint --force || exit 1
288
printbold "Running $GETTEXTIZE... Ignore non-fatal messages."
289
echo "no" | $GETTEXTIZE --force --copy || exit 1
292
if grep "^AC_PROG_INTLTOOL" $basename >/dev/null; then
293
printbold "Running $INTLTOOLIZE..."
294
$INTLTOOLIZE --force --automake || exit 1
296
if grep "^GTK_DOC_CHECK" $basename >/dev/null; then
297
printbold "Running $GTKDOCIZE..."
300
if grep "^A[CM]_CONFIG_HEADER" $basename >/dev/null; then
301
printbold "Running $AUTOHEADER..."
302
$AUTOHEADER || exit 1
305
printbold "Running $AUTOMAKE..."
306
$AUTOMAKE --gnu --add-missing || exit 1
308
printbold "Running $AUTOCONF..."
315
conf_flags="--enable-maintainer-mode --enable-compile-warnings"
317
if test x$NOCONFIGURE = x; then
318
printbold Running $srcdir/configure $conf_flags "$@" ...
319
$srcdir/configure $conf_flags "$@" \
320
&& echo Now type \`make\' to compile $PKG_NAME || exit 1
322
echo Skipping configure process.