2 # Run this to generate all the initial makefiles, etc.
7 # Allow invocation from a separate build directory; in that case, we change
8 # to the source directory to run the auto*, then change back before running configure
9 srcdir=`dirname $ARGV0`
10 test -z "$srcdir" && srcdir=.
17 LIBTOOLIZE_FLAGS="--copy --force --automake"
19 AUTOHEADER=${AUTOHEADER-autoheader}
20 GTKDOCIZE_FLAGS="--copy"
21 GTKDOCIZE=${GTKDOCIZE-gtkdocize}
22 AUTOMAKE_FLAGS="--add-missing --gnu -Wall"
23 AUTOCONF=${AUTOCONF-autoconf}
26 test -f configure.ac && CONFIGURE_AC=configure.ac
28 if test "X$CONFIGURE_AC" = X; then
29 echo "$ARGV0: ERROR: No $srcdir/configure.in or $srcdir/configure.ac found."
34 grep "^ *$1" "$CONFIGURE_AC" | sed 's/.*(\[*\([^])]*\)]*).*/\1/'
37 autoconf_min_vers=`extract_version AC_PREREQ`
38 automake_min_vers=`extract_version AM_INIT_AUTOMAKE`
39 libtoolize_min_vers=`extract_version AC_PROG_LIBTOOL`
40 aclocal_min_vers=$automake_min_vers
43 # Not all echo versions allow -n, so we check what is possible. This test is
44 # based on the one in autoconf.
45 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
52 # some terminal codes ...
53 boldface="`tput bold 2>/dev/null || true`"
54 normal="`tput sgr0 2>/dev/null || true`"
56 echo $ECHO_N "$boldface"
58 echo $ECHO_N "$normal"
66 # compare_versions MIN_VERSION ACTUAL_VERSION
67 # returns true if ACTUAL_VERSION >= MIN_VERSION
72 IFS="${IFS= }"; ch_save_IFS="$IFS"; IFS="."
73 set $ch_actual_version
74 for ch_min in $ch_min_version; do
75 ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes
76 if [ -z "$ch_min" ]; then break; fi
77 if [ -z "$ch_cur" ]; then ch_status=1; break; fi
78 if [ $ch_cur -gt $ch_min ]; then break; fi
79 if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi
86 # version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE
87 # checks to see if the package is available
96 vc_checkprog=`eval echo "\\$$vc_variable"`
97 if [ -n "$vc_checkprog" ]; then
98 printbold "using $vc_checkprog for $vc_package"
102 printbold "checking for $vc_package >= $vc_min_version..."
103 for vc_checkprog in $vc_checkprogs; do
104 echo $ECHO_N " testing $vc_checkprog... "
105 if $vc_checkprog --version < /dev/null > /dev/null 2>&1; then
106 vc_actual_version=`$vc_checkprog --version | head -n 1 | \
107 sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'`
108 if compare_versions $vc_min_version $vc_actual_version; then
109 echo "found $vc_actual_version"
111 eval "$vc_variable=$vc_checkprog"
115 echo "too old (found version $vc_actual_version)"
121 if [ "$vc_status" != 0 ]; then
122 printerr "***Error***: You must have $vc_package >= $vc_min_version installed"
123 printerr " to build $PROJECT. Download the appropriate package for"
124 printerr " from your distribution or get the source tarball at"
125 printerr " $vc_source"
132 version_check autoconf AUTOCONF $AUTOCONF $autoconf_min_vers \
133 "http://ftp.gnu.org/pub/gnu/autoconf/autoconf-${autoconf_min_vers}.tar.gz" || DIE=1
136 # Hunt for an appropriate version of automake and aclocal; we can't
137 # assume that 'automake' is necessarily the most recent installed version
139 # We check automake first to allow it to be a newer version than we know about.
141 version_check automake AUTOMAKE "$AUTOMAKE automake automake-1.10 automake-1.9 automake-1.8 automake-1.7" $automake_min_vers \
142 "http://ftp.gnu.org/pub/gnu/automake/automake-${automake_min_vers}.tar.gz" || DIE=1
143 ACLOCAL=`echo $AUTOMAKE | sed s/automake/aclocal/`
146 version_check libtool LIBTOOLIZE "$LIBTOOLIZE glibtoolize libtoolize" $libtoolize_min_vers \
147 "http://ftp.gnu.org/pub/gnu/libtool/libtool-${libtool_min_vers}.tar.gz" || DIE=1
149 if test -n "$DIE"; then
154 if test -z "$*"; then
155 echo "$ARGV0: Note: \`./configure' will be run with no arguments."
156 echo " If you wish to pass any to it, please specify them on the"
157 echo " \`$0' command line."
162 echo "$ARGV0: running \`$@'"
166 do_cmd $LIBTOOLIZE $LIBTOOLIZE_FLAGS
168 do_cmd $ACLOCAL $ACLOCAL_FLAGS
174 # We don't call gtkdocize right now. When we do, we should then modify
175 # the generated gtk-doc.make and move it to build/Makefile.am.gtk-doc.
176 # See that file for details.
177 #do_cmd $GTKDOCIZE $GTKDOCIZE_FLAGS
179 do_cmd $AUTOMAKE $AUTOMAKE_FLAGS
183 cd "$ORIGDIR" || exit 1
187 do_cmd $srcdir/configure \
188 ${1+"$@"} && echo "Now type \`make' to compile $PROJECT." || exit 1