2
2
# Run this to generate all the initial makefiles, etc.
4
REQUIRED_AUTOCONF_VERSION=${REQUIRED_AUTOCONF_VERSION:-2.58}
5
REQUIRED_AUTOMAKE_VERSION=${REQUIRED_AUTOMAKE_VERSION:-1.7}
5
8
test -z "$srcdir" && srcdir=.
8
GETTEXTIZE_FLAGS="--copy --intl --no-changelog"
10
12
(test -f $srcdir/configure.in) || {
11
13
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
12
echo " top-level directory"
14
echo " top-level $PKG_NAME directory"
16
. $srcdir/macros/autogen.sh
18
if which gnome-autogen.sh >/dev/null 2>&1; then
19
USE_GNOME2_MACROS=1 . gnome-autogen.sh
22
# Plan B. Copied from gnome-common to eliminate a Gnome CVS
23
# dependency on distros without gnome-common package.
27
# Run this to generate all the initial makefiles, etc.
30
PKG_NAME=${PKG_NAME:-Package}
33
# default version requirements ...
34
REQUIRED_AUTOCONF_VERSION=${REQUIRED_AUTOCONF_VERSION:-2.53}
35
REQUIRED_AUTOMAKE_VERSION=${REQUIRED_AUTOMAKE_VERSION:-1.4}
36
REQUIRED_LIBTOOL_VERSION=${REQUIRED_LIBTOOL_VERSION:-1.4.3}
37
REQUIRED_GETTEXT_VERSION=${REQUIRED_GETTEXT_VERSION:-0.10.40}
38
REQUIRED_GLIB_GETTEXT_VERSION=${REQUIRED_GLIB_GETTEXT_VERSION:-2.2.0}
39
REQUIRED_INTLTOOL_VERSION=${REQUIRED_INTLTOOL_VERSION:-0.25}
40
REQUIRED_PKG_CONFIG_VERSION=${REQUIRED_PKG_CONFIG_VERSION:-0.14.0}
41
REQUIRED_GTK_DOC_VERSION=${REQUIRED_GTK_DOC_VERSION:-1.0}
42
REQUIRED_DOC_COMMON_VERSION=${REQUIRED_DOC_COMMON_VERSION:-2.3.0}
44
# a list of required m4 macros. Package can set an initial value
45
REQUIRED_M4MACROS=${REQUIRED_M4MACROS:-}
46
FORBIDDEN_M4MACROS=${FORBIDDEN_M4MACROS:-}
48
# Not all echo versions allow -n, so we check what is possible. This test is
49
# based on the one in autoconf.
50
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
56
# if GNOME2_DIR or GNOME2_PATH is set, modify ACLOCAL_FLAGS ...
57
# NOTE: GNOME2_DIR is deprecated (as of Jan 2004), but is left here for
58
# backwards-compatibility. You should be using GNOME2_PATH, since that is also
59
# understood by libraries such as libgnome.
60
if [ -n "$GNOME2_DIR" ]; then
61
echo "Using GNOME2_DIR is deprecated in gnome-common."
62
echo "Please use GNOME2_PATH instead (for compatibility with other GNOME pieces)."
63
ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS"
64
LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH"
65
PATH="$GNOME2_DIR/bin:$PATH"
67
export LD_LIBRARY_PATH
69
if [ -n "$GNOME2_PATH" ]; then
70
ACLOCAL_FLAGS="-I $GNOME2_PATH/share/aclocal $ACLOCAL_FLAGS"
71
LD_LIBRARY_PATH="$GNOME2_PATH/lib:$LD_LIBRARY_PATH"
72
PATH="$GNOME2_PATH/bin:$PATH"
74
export LD_LIBRARY_PATH
78
# some terminal codes ...
79
boldface="`tput bold 2>/dev/null`"
80
normal="`tput sgr0 2>/dev/null`"
82
echo $ECHO_N "$boldface"
84
echo $ECHO_N "$normal"
91
# compare_versions MIN_VERSION ACTUAL_VERSION
92
# returns true if ACTUAL_VERSION >= MIN_VERSION
97
IFS="${IFS= }"; ch_save_IFS="$IFS"; IFS="."
98
set $ch_actual_version
99
for ch_min in $ch_min_version; do
100
ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes
101
if [ -z "$ch_min" ]; then break; fi
102
if [ -z "$ch_cur" ]; then ch_status=1; break; fi
103
if [ $ch_cur -gt $ch_min ]; then break; fi
104
if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi
111
# version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE
112
# checks to see if the package is available
121
vc_checkprog=`eval echo "\\$$vc_variable"`
122
if [ -n "$vc_checkprog" ]; then
123
printbold "using $vc_checkprog for $vc_package"
127
printbold "checking for $vc_package >= $vc_min_version..."
128
for vc_checkprog in $vc_checkprogs; do
129
echo $ECHO_N " testing $vc_checkprog... "
130
if $vc_checkprog --version < /dev/null > /dev/null 2>&1; then
131
vc_actual_version=`$vc_checkprog --version | head -n 1 | \
132
sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'`
133
if compare_versions $vc_min_version $vc_actual_version; then
134
echo "found $vc_actual_version"
136
eval "$vc_variable=$vc_checkprog"
140
echo "too old (found version $vc_actual_version)"
146
if [ "$vc_status" != 0 ]; then
147
printerr "***Error***: You must have $vc_package >= $vc_min_version installed"
148
printerr " to build $PKG_NAME. Download the appropriate package for"
149
printerr " from your distribution or get the source tarball at"
150
printerr " $vc_source"
157
# require_m4macro filename.m4
158
# adds filename.m4 to the list of required macros
160
case "$REQUIRED_M4MACROS" in
161
$1\ * | *\ $1\ * | *\ $1) ;;
162
*) REQUIRED_M4MACROS="$REQUIRED_M4MACROS $1" ;;
167
case "$FORBIDDEN_M4MACROS" in
168
$1\ * | *\ $1\ * | *\ $1) ;;
169
*) FORBIDDEN_M4MACROS="$FORBIDDEN_M4MACROS $1" ;;
175
# Checks that all the requested macro files are in the aclocal macro path
176
# Uses REQUIRED_M4MACROS and ACLOCAL variables.
178
# construct list of macro directories
179
cm_macrodirs="`$ACLOCAL --print-ac-dir`"
181
while [ $# -gt 0 ]; do
182
if [ "$1" = "-I" ]; then
183
cm_macrodirs="$cm_macrodirs $2"
190
if [ -n "$REQUIRED_M4MACROS" ]; then
191
printbold "Checking for required M4 macros..."
192
# check that each macro file is in one of the macro dirs
193
for cm_macro in $REQUIRED_M4MACROS; do
195
for cm_dir in $cm_macrodirs; do
196
if [ -f "$cm_dir/$cm_macro" ]; then
200
# The macro dir in Cygwin environments may contain a file
201
# called dirlist containing other directories to look in.
202
if [ -f "$cm_dir/dirlist" ]; then
203
for cm_otherdir in `cat $cm_dir/dirlist`; do
204
if [ -f "$cm_otherdir/$cm_macro" ]; then
211
if $cm_macrofound; then
214
printerr " $cm_macro not found"
219
if [ -n "$FORBIDDEN_M4MACROS" ]; then
220
printbold "Checking for forbidden M4 macros..."
221
# check that each macro file is in one of the macro dirs
222
for cm_macro in $FORBIDDEN_M4MACROS; do
224
for cm_dir in $cm_macrodirs; do
225
if [ -f "$cm_dir/$cm_macro" ]; then
230
if $cm_macrofound; then
231
printerr " $cm_macro found (should be cleared from macros dir)"
236
if [ "$cm_status" != 0 ]; then
237
printerr "***Error***: some autoconf macros required to build $PKG_NAME"
238
printerr " were not found in your aclocal path, or some forbidden"
239
printerr " macros were found. Perhaps you need to adjust your"
240
printerr " ACLOCAL_PATH?"
246
# try to catch the case where the macros2/ directory hasn't been cleared out.
247
forbid_m4macro gnome-cxx-check.m4
251
want_glib_gettext=false
253
want_pkg_config=false
256
configure_files="`find $srcdir -name '{arch}' -prune -o -name configure.ac -print -o -name configure.in -print`"
257
for configure_ac in $configure_files; do
258
if grep "^A[CM]_PROG_LIBTOOL" $configure_ac >/dev/null; then
261
if grep "^AM_GNU_GETTEXT" $configure_ac >/dev/null; then
264
if grep "^AM_GLIB_GNU_GETTEXT" $configure_ac >/dev/null; then
265
want_glib_gettext=true
267
if grep "^AC_PROG_INTLTOOL" $configure_ac >/dev/null; then
270
if grep "^PKG_CHECK_MODULES" $configure_ac >/dev/null; then
273
if grep "^GTK_DOC_CHECK" $configure_ac >/dev/null; then
280
#tell Mandrake autoconf wrapper we want autoconf 2.5x, not 2.13
282
export WANT_AUTOCONF_2_5
283
version_check autoconf AUTOCONF 'autoconf2.50 autoconf autoconf-2.53' $REQUIRED_AUTOCONF_VERSION \
284
"http://ftp.gnu.org/pub/gnu/autoconf/autoconf-$REQUIRED_AUTOCONF_VERSION.tar.gz" || DIE=1
285
AUTOHEADER=`echo $AUTOCONF | sed s/autoconf/autoheader/`
287
case $REQUIRED_AUTOMAKE_VERSION in
288
1.4*) automake_progs="automake-1.4" ;;
289
1.5*) automake_progs="automake-1.5 automake-1.6 automake-1.7 automake-1.8 automake-1.9" ;;
290
1.6*) automake_progs="automake-1.6 automake-1.7 automake-1.8 automake-1.9" ;;
291
1.7*) automake_progs="automake-1.7 automake-1.8 automake-1.9" ;;
292
1.8*) automake_progs="automake-1.8 automake-1.9" ;;
293
1.9*) automake_progs="automake-1.9" ;;
295
version_check automake AUTOMAKE "$automake_progs" $REQUIRED_AUTOMAKE_VERSION \
296
"http://ftp.gnu.org/pub/gnu/automake/automake-$REQUIRED_AUTOMAKE_VERSION.tar.gz" || DIE=1
297
ACLOCAL=`echo $AUTOMAKE | sed s/automake/aclocal/`
299
# We need to do this for the craaaaaaazy mkinstalldirs usage of glib-gettext
300
AUTOMAKE_VERSION=`echo $AUTOMAKE | sed s/automake-//`
301
ACLOCAL_DIR=`$ACLOCAL --print-ac-dir`
302
AUTOMAKE_DIR=`echo $ACLOCAL_DIR | sed s/aclocal/automake-$AUTOMAKE_VERSION/`
304
if $want_libtool; then
305
version_check libtool LIBTOOLIZE libtoolize $REQUIRED_LIBTOOL_VERSION \
306
"http://ftp.gnu.org/pub/gnu/libtool/libtool-$REQUIRED_LIBTOOL_VERSION.tar.gz" || DIE=1
307
require_m4macro libtool.m4
310
if $want_gettext; then
311
version_check gettext GETTEXTIZE gettextize $REQUIRED_GETTEXT_VERSION \
312
"http://ftp.gnu.org/pub/gnu/gettext/gettext-$REQUIRED_GETTEXT_VERSION.tar.gz" || DIE=1
313
require_m4macro gettext.m4
316
if $want_glib_gettext; then
317
version_check glib-gettext GLIB_GETTEXTIZE glib-gettextize $REQUIRED_GLIB_GETTEXT_VERSION \
318
"ftp://ftp.gtk.org/pub/gtk/v2.2/glib-$REQUIRED_GLIB_GETTEXT_VERSION.tar.gz" || DIE=1
319
require_m4macro glib-gettext.m4
322
if $want_intltool; then
323
version_check intltool INTLTOOLIZE intltoolize $REQUIRED_INTLTOOL_VERSION \
324
"http://ftp.gnome.org/pub/GNOME/sources/intltool/" || DIE=1
325
require_m4macro intltool.m4
328
if $want_pkg_config; then
329
version_check pkg-config PKG_CONFIG pkg-config $REQUIRED_PKG_CONFIG_VERSION \
330
"'http://www.freedesktop.org/software/pkgconfig/releases/pkgconfig-$REQUIRED_PKG_CONFIG_VERSION.tar.gz" || DIE=1
331
require_m4macro pkg.m4
334
if $want_gtk_doc; then
335
version_check gtk-doc GTKDOCIZE gtkdocize $REQUIRED_GTK_DOC_VERSION \
336
"http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/" || DIE=1
337
require_m4macro gtk-doc.m4
340
if [ "x$USE_COMMON_DOC_BUILD" = "xyes" ]; then
341
version_check gnome-common DOC_COMMON gnome-doc-common \
342
$REQUIRED_DOC_COMMON_VERSION " " || DIE=1
345
check_m4macros || DIE=1
347
if [ "$DIE" -eq 1 ]; then
351
if test -z "$*"; then
352
printerr "**Warning**: I am going to run \`configure' with no arguments."
353
printerr "If you wish to pass any to it, please specify them on the"
354
printerr \`$0\'" command line."
359
for configure_ac in $configure_files; do
360
dirname=`dirname $configure_ac`
361
basename=`basename $configure_ac`
362
if test -f $dirname/NO-AUTO-GEN; then
363
echo skipping $dirname -- flagged as no auto-gen
365
printbold "Processing $configure_ac"
368
# Note that the order these tools are called should match what
369
# autoconf's "autoupdate" package does. See bug 138584 for
372
# programs that might install new macros get run before aclocal
373
if grep "^A[CM]_PROG_LIBTOOL" $basename >/dev/null; then
374
printbold "Running $LIBTOOLIZE..."
375
$LIBTOOLIZE --force || exit 1
378
if grep "^AM_GLIB_GNU_GETTEXT" $basename >/dev/null; then
379
printbold "Running $GLIB_GETTEXTIZE... Ignore non-fatal messages."
380
echo "no" | $GLIB_GETTEXTIZE --force --copy || exit 1
381
# This is to copy in mkinstalldirs for glib-gettext
382
if [ -x $AUTOMAKE_DIR/mkinstalldirs ]; then
383
echo " copying mkinstalldirs... "
384
cp -f $AUTOMAKE_DIR/mkinstalldirs $dirname
386
elif grep "^AM_GNU_GETTEXT" $basename >/dev/null; then
387
if grep "^AM_GNU_GETTEXT_VERSION" $basename > /dev/null; then
388
printbold "Running autopoint..."
389
autopoint --force || exit 1
391
printbold "Running $GETTEXTIZE... Ignore non-fatal messages."
392
echo "no" | $GETTEXTIZE --force --copy || exit 1
396
if grep "^AC_PROG_INTLTOOL" $basename >/dev/null; then
397
printbold "Running $INTLTOOLIZE..."
398
$INTLTOOLIZE --force --automake || exit 1
400
if grep "^GTK_DOC_CHECK" $basename >/dev/null; then
401
printbold "Running $GTKDOCIZE..."
405
if [ "x$USE_COMMON_DOC_BUILD" = "xyes" ]; then
406
printbold "Running gnome-doc-common..."
407
gnome-doc-common --copy || exit 1
410
# Now run aclocal to pull in any additional macros needed
411
aclocalinclude="$ACLOCAL_FLAGS"
412
printbold "Running $ACLOCAL..."
413
$ACLOCAL $aclocalinclude || exit 1
415
if grep "GNOME_AUTOGEN_OBSOLETE" aclocal.m4 >/dev/null; then
416
printerr "*** obsolete gnome macros were used in $configure_ac"
419
# Now that all the macros are sorted, run autoconf and autoheader ...
420
printbold "Running $AUTOCONF..."
422
if grep "^A[CM]_CONFIG_HEADER" $basename >/dev/null; then
423
printbold "Running $AUTOHEADER..."
424
$AUTOHEADER || exit 1
425
# this prevents automake from thinking config.h.in is out of
426
# date, since autoheader doesn't touch the file if it doesn't
428
test -f config.h.in && touch config.h.in
431
# Finally, run automake to create the makefiles ...
432
printbold "Running $AUTOMAKE..."
433
$AUTOMAKE --gnu --add-missing || exit 1
439
conf_flags="--enable-maintainer-mode"
441
if test x$NOCONFIGURE = x; then
442
printbold Running $srcdir/configure $conf_flags "$@" ...
443
$srcdir/configure $conf_flags "$@" \
444
&& echo Now type \`make\' to compile $PKG_NAME || exit 1
446
echo Skipping configure process.
449
# End of Plan B copied from gnome-common