1#!/bin/sh
2# Run this to generate all the initial makefiles, etc.
3test -n "$srcdir" || srcdir=$(dirname "$0")
4test -n "$srcdir" || srcdir=.
5
6olddir=$(pwd)
7
8cd $srcdir
9
10(test -f configure.ac) || {
11    echo "*** ERROR: Directory '$srcdir' does not look like the top-level project directory ***"
12    exit 1
13}
14
15# shellcheck disable=SC2016
16PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac)
17
18if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
19    echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
20    echo "*** If you wish to pass any to it, please specify them on the" >&2
21    echo "*** '$0' command line." >&2
22    echo "" >&2
23fi
24
25mkdir -p m4
26
27glib-gettextize --force --copy || exit 1
28gtkdocize --copy || exit 1
29intltoolize --force --copy --automake || exit 1
30autoreconf --verbose --force --install || exit 1
31
32cd "$olddir"
33if [ "$NOCONFIGURE" = "" ]; then
34    $srcdir/configure "$@" || exit 1
35
36    if [ "$1" = "--help" ]; then exit 0 else
37        echo "Now type 'make' to compile $PKG_NAME" || exit 1
38    fi
39else
40    echo "Skipping configure process."
41fi
42