~ubuntu-branches/ubuntu/maverick/zapping/maverick

« back to all changes in this revision

Viewing changes to autogen.sh

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-03-08 23:19:08 UTC
  • mfrom: (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050308231908-oip7rfv6lcmo8c0e
Tags: 0.9.2-2ubuntu1
Rebuilt for Python transition (2.3 -> 2.4)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
# Run this to generate all the initial makefiles, etc.
3
3
 
 
4
REQUIRED_AUTOCONF_VERSION=${REQUIRED_AUTOCONF_VERSION:-2.58}
 
5
REQUIRED_AUTOMAKE_VERSION=${REQUIRED_AUTOMAKE_VERSION:-1.7}
 
6
 
4
7
srcdir=`dirname $0`
5
8
test -z "$srcdir" && srcdir=.
6
9
 
7
 
PACKAGE=zapping
8
 
GETTEXTIZE_FLAGS="--copy --intl --no-changelog"
 
10
PKG_NAME="zapping"
9
11
 
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"
13
15
    exit 1
14
16
}
15
17
 
16
 
. $srcdir/macros/autogen.sh
 
18
if which gnome-autogen.sh >/dev/null 2>&1; then
 
19
  USE_GNOME2_MACROS=1 . gnome-autogen.sh
 
20
else
 
21
 
 
22
# Plan B. Copied from gnome-common to eliminate a Gnome CVS
 
23
# dependency on distros without gnome-common package.
 
24
# Version 2004-08-16.
 
25
 
 
26
#!/bin/sh
 
27
# Run this to generate all the initial makefiles, etc.
 
28
 
 
29
#name of package
 
30
PKG_NAME=${PKG_NAME:-Package}
 
31
srcdir=${srcdir:-.}
 
32
 
 
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}
 
43
 
 
44
# a list of required m4 macros.  Package can set an initial value
 
45
REQUIRED_M4MACROS=${REQUIRED_M4MACROS:-}
 
46
FORBIDDEN_M4MACROS=${FORBIDDEN_M4MACROS:-}
 
47
 
 
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
 
51
  *c*,-n*) ECHO_N= ;;
 
52
  *c*,*  ) ECHO_N=-n ;;
 
53
  *)       ECHO_N= ;;
 
54
esac
 
55
 
 
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"
 
66
    export PATH
 
67
    export LD_LIBRARY_PATH
 
68
else
 
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"
 
73
        export PATH
 
74
        export LD_LIBRARY_PATH
 
75
    fi
 
76
fi
 
77
 
 
78
# some terminal codes ...
 
79
boldface="`tput bold 2>/dev/null`"
 
80
normal="`tput sgr0 2>/dev/null`"
 
81
printbold() {
 
82
    echo $ECHO_N "$boldface"
 
83
    echo "$@"
 
84
    echo $ECHO_N "$normal"
 
85
}    
 
86
printerr() {
 
87
    echo "$@" >&2
 
88
}
 
89
 
 
90
# Usage:
 
91
#     compare_versions MIN_VERSION ACTUAL_VERSION
 
92
# returns true if ACTUAL_VERSION >= MIN_VERSION
 
93
compare_versions() {
 
94
    ch_min_version=$1
 
95
    ch_actual_version=$2
 
96
    ch_status=0
 
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
 
105
    done
 
106
    IFS="$ch_save_IFS"
 
107
    return $ch_status
 
108
}
 
109
 
 
110
# Usage:
 
111
#     version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE
 
112
# checks to see if the package is available
 
113
version_check() {
 
114
    vc_package=$1
 
115
    vc_variable=$2
 
116
    vc_checkprogs=$3
 
117
    vc_min_version=$4
 
118
    vc_source=$5
 
119
    vc_status=1
 
120
 
 
121
    vc_checkprog=`eval echo "\\$$vc_variable"`
 
122
    if [ -n "$vc_checkprog" ]; then
 
123
        printbold "using $vc_checkprog for $vc_package"
 
124
        return 0
 
125
    fi
 
126
 
 
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"
 
135
                # set variable
 
136
                eval "$vc_variable=$vc_checkprog"
 
137
                vc_status=0
 
138
                break
 
139
            else
 
140
                echo "too old (found version $vc_actual_version)"
 
141
            fi
 
142
        else
 
143
            echo "not found."
 
144
        fi
 
145
    done
 
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"
 
151
        printerr
 
152
    fi
 
153
    return $vc_status
 
154
}
 
155
 
 
156
# Usage:
 
157
#     require_m4macro filename.m4
 
158
# adds filename.m4 to the list of required macros
 
159
require_m4macro() {
 
160
    case "$REQUIRED_M4MACROS" in
 
161
        $1\ * | *\ $1\ * | *\ $1) ;;
 
162
        *) REQUIRED_M4MACROS="$REQUIRED_M4MACROS $1" ;;
 
163
    esac
 
164
}
 
165
 
 
166
forbid_m4macro() {
 
167
    case "$FORBIDDEN_M4MACROS" in
 
168
        $1\ * | *\ $1\ * | *\ $1) ;;
 
169
        *) FORBIDDEN_M4MACROS="$FORBIDDEN_M4MACROS $1" ;;
 
170
    esac
 
171
}
 
172
 
 
173
# Usage:
 
174
#     check_m4macros
 
175
# Checks that all the requested macro files are in the aclocal macro path
 
176
# Uses REQUIRED_M4MACROS and ACLOCAL variables.
 
177
check_m4macros() {
 
178
    # construct list of macro directories
 
179
    cm_macrodirs="`$ACLOCAL --print-ac-dir`"
 
180
    set - $ACLOCAL_FLAGS
 
181
    while [ $# -gt 0 ]; do
 
182
        if [ "$1" = "-I" ]; then
 
183
            cm_macrodirs="$cm_macrodirs $2"
 
184
            shift
 
185
        fi
 
186
        shift
 
187
    done
 
188
 
 
189
    cm_status=0
 
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
 
194
            cm_macrofound=false
 
195
            for cm_dir in $cm_macrodirs; do
 
196
                if [ -f "$cm_dir/$cm_macro" ]; then
 
197
                    cm_macrofound=true
 
198
                    break
 
199
                fi
 
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
 
205
                            cm_macrofound=true
 
206
                            break
 
207
                        fi
 
208
                    done
 
209
                fi
 
210
            done
 
211
            if $cm_macrofound; then
 
212
                :
 
213
            else
 
214
                printerr "  $cm_macro not found"
 
215
                cm_status=1
 
216
            fi
 
217
        done
 
218
    fi
 
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
 
223
            cm_macrofound=false
 
224
            for cm_dir in $cm_macrodirs; do
 
225
                if [ -f "$cm_dir/$cm_macro" ]; then
 
226
                    cm_macrofound=true
 
227
                    break
 
228
                fi
 
229
            done
 
230
            if $cm_macrofound; then
 
231
                printerr "  $cm_macro found (should be cleared from macros dir)"
 
232
                cm_status=1
 
233
            fi
 
234
        done
 
235
    fi
 
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?"
 
241
        printerr
 
242
    fi
 
243
    return $cm_status
 
244
}
 
245
 
 
246
# try to catch the case where the macros2/ directory hasn't been cleared out.
 
247
forbid_m4macro gnome-cxx-check.m4
 
248
 
 
249
want_libtool=false
 
250
want_gettext=false
 
251
want_glib_gettext=false
 
252
want_intltool=false
 
253
want_pkg_config=false
 
254
want_gtk_doc=false
 
255
 
 
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
 
259
        want_libtool=true
 
260
    fi
 
261
    if grep "^AM_GNU_GETTEXT" $configure_ac >/dev/null; then
 
262
        want_gettext=true
 
263
    fi
 
264
    if grep "^AM_GLIB_GNU_GETTEXT" $configure_ac >/dev/null; then
 
265
        want_glib_gettext=true
 
266
    fi
 
267
    if grep "^AC_PROG_INTLTOOL" $configure_ac >/dev/null; then
 
268
        want_intltool=true
 
269
    fi
 
270
    if grep "^PKG_CHECK_MODULES" $configure_ac >/dev/null; then
 
271
        want_pkg_config=true
 
272
    fi
 
273
    if grep "^GTK_DOC_CHECK" $configure_ac >/dev/null; then
 
274
        want_gtk_doc=true
 
275
    fi
 
276
done
 
277
 
 
278
DIE=0
 
279
 
 
280
#tell Mandrake autoconf wrapper we want autoconf 2.5x, not 2.13
 
281
WANT_AUTOCONF_2_5=1
 
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/`
 
286
 
 
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" ;;
 
294
esac
 
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/`
 
298
 
 
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/`
 
303
 
 
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
 
308
fi
 
309
 
 
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
 
314
fi
 
315
 
 
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
 
320
fi
 
321
 
 
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
 
326
fi
 
327
 
 
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
 
332
fi
 
333
 
 
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
 
338
fi
 
339
 
 
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
 
343
fi
 
344
 
 
345
check_m4macros || DIE=1
 
346
 
 
347
if [ "$DIE" -eq 1 ]; then
 
348
  exit 1
 
349
fi
 
350
 
 
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."
 
355
  printerr
 
356
fi
 
357
 
 
358
topdir=`pwd`
 
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
 
364
    else
 
365
        printbold "Processing $configure_ac"
 
366
        cd $dirname
 
367
 
 
368
        # Note that the order these tools are called should match what
 
369
        # autoconf's "autoupdate" package does.  See bug 138584 for
 
370
        # details.
 
371
 
 
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
 
376
        fi
 
377
 
 
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
 
385
            fi
 
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
 
390
           else
 
391
                printbold "Running $GETTEXTIZE... Ignore non-fatal messages."
 
392
                echo "no" | $GETTEXTIZE --force --copy || exit 1
 
393
           fi
 
394
        fi
 
395
 
 
396
        if grep "^AC_PROG_INTLTOOL" $basename >/dev/null; then
 
397
            printbold "Running $INTLTOOLIZE..."
 
398
            $INTLTOOLIZE --force --automake || exit 1
 
399
        fi
 
400
        if grep "^GTK_DOC_CHECK" $basename >/dev/null; then
 
401
            printbold "Running $GTKDOCIZE..."
 
402
            $GTKDOCIZE || exit 1
 
403
        fi
 
404
 
 
405
        if [ "x$USE_COMMON_DOC_BUILD" = "xyes" ]; then
 
406
            printbold "Running gnome-doc-common..."
 
407
            gnome-doc-common --copy || exit 1
 
408
        fi
 
409
 
 
410
        # Now run aclocal to pull in any additional macros needed
 
411
        aclocalinclude="$ACLOCAL_FLAGS"
 
412
        printbold "Running $ACLOCAL..."
 
413
        $ACLOCAL $aclocalinclude || exit 1
 
414
 
 
415
        if grep "GNOME_AUTOGEN_OBSOLETE" aclocal.m4 >/dev/null; then
 
416
            printerr "*** obsolete gnome macros were used in $configure_ac"
 
417
        fi
 
418
 
 
419
        # Now that all the macros are sorted, run autoconf and autoheader ...
 
420
        printbold "Running $AUTOCONF..."
 
421
        $AUTOCONF || exit 1
 
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
 
427
            # change.
 
428
            test -f config.h.in && touch config.h.in
 
429
        fi
 
430
 
 
431
        # Finally, run automake to create the makefiles ...
 
432
        printbold "Running $AUTOMAKE..."
 
433
        $AUTOMAKE --gnu --add-missing || exit 1
 
434
 
 
435
        cd "$topdir"
 
436
    fi
 
437
done
 
438
 
 
439
conf_flags="--enable-maintainer-mode"
 
440
 
 
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
 
445
else
 
446
    echo Skipping configure process.
 
447
fi
 
448
 
 
449
# End of Plan B copied from gnome-common
 
450
 
 
451
fi