1#!/bin/sh
2# Run this to generate all the initial makefiles, etc.
3
4srcdir=`dirname $0`
5test -z "$srcdir" && srcdir=.
6
7ORIGDIR=`pwd`
8cd $srcdir
9PROJECT=GLib
10TEST_TYPE=-f
11FILE=glib/glib.h
12
13DIE=0
14
15have_libtool=false
16if libtoolize --version < /dev/null > /dev/null 2>&1 ; then
17	libtool_version=`libtoolize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
18	case $libtool_version in
19	    1.4*|1.5*|2.2*)
20		have_libtool=true
21		;;
22	esac
23fi
24if $have_libtool ; then : ; else
25	echo
26	echo "You must have libtool 1.4 installed to compile $PROJECT."
27	echo "Install the appropriate package for your distribution,"
28	echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/"
29	DIE=1
30fi
31
32(gtkdocize --version) < /dev/null > /dev/null 2>&1 || {
33	echo
34	echo "You must have gtk-doc installed to compile $PROJECT."
35	echo "Install the appropriate package for your distribution,"
36	echo "or get the source tarball at ftp://ftp.gnome.org/pub/GNOME/sources/gtk-doc/"
37	DIE=1
38}
39
40(autoconf --version) < /dev/null > /dev/null 2>&1 || {
41	echo
42	echo "You must have autoconf installed to compile $PROJECT."
43	echo "Install the appropriate package for your distribution,"
44	echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
45	DIE=1
46}
47
48if automake-1.10 --version < /dev/null > /dev/null 2>&1 ; then
49    AUTOMAKE=automake-1.10
50    ACLOCAL=aclocal-1.10
51else if automake-1.9 --version < /dev/null > /dev/null 2>&1 ; then
52    AUTOMAKE=automake-1.9
53    ACLOCAL=aclocal-1.9
54else 
55	echo
56	echo "You must have automake 1.9.x or 1.10.x installed to compile $PROJECT."
57	echo "Install the appropriate package for your distribution,"
58	echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
59	DIE=1
60fi
61fi
62
63if test "$DIE" -eq 1; then
64	exit 1
65fi
66
67test $TEST_TYPE $FILE || {
68	echo "You must run this script in the top-level $PROJECT directory"
69	exit 1
70}
71
72if test -z "$AUTOGEN_SUBDIR_MODE"; then
73        if test -z "$*"; then
74                echo "I am going to run ./configure with no arguments - if you wish "
75                echo "to pass any to it, please specify them on the $0 command line."
76        fi
77fi
78
79rm -rf autom4te.cache
80
81# README and INSTALL are required by automake, but may be deleted by clean
82# up rules. to get automake to work, simply touch these here, they will be
83# regenerated from their corresponding *.in files by ./configure anyway.
84touch README INSTALL
85
86if [ ! -d build ]; then
87  if [ -x "`which svn`" ]; then
88    echo
89    echo "=============================================================="
90    echo "  your checkout doesn't contain build/."
91    echo "      fetching it from http://svn.gnome.org/svn/build/trunk/"
92    echo "=============================================================="
93    echo
94
95    svn checkout http://svn.gnome.org/svn/build/trunk/ build
96  else
97    echo
98    echo 'warning: build/ directory is missing and no "svn" to fetch it!'
99    echo
100  fi
101fi
102
103$ACLOCAL $ACLOCAL_FLAGS || exit $?
104
105libtoolize --force || exit $?
106gtkdocize || exit $?
107
108autoheader || exit $?
109
110$AUTOMAKE --add-missing || exit $?
111autoconf || exit $?
112cd $ORIGDIR || exit $?
113
114if test -z "$AUTOGEN_SUBDIR_MODE"; then
115        $srcdir/configure --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@" || exit $?
116
117        echo 
118        echo "Now type 'make' to compile $PROJECT."
119fi
120