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
=${LIBTOOLIZE-libtoolize}
18 LIBTOOLIZE_FLAGS
="--copy --force"
19 AUTOHEADER
=${AUTOHEADER-autoheader}
20 AUTOMAKE_FLAGS
="--add-missing --foreign"
21 AUTOCONF
=${AUTOCONF-autoconf}
24 test -f configure.
in && CONFIGURE_IN
=configure.
in
25 test -f configure.ac
&& CONFIGURE_IN
=configure.ac
27 if test "X$CONFIGURE_IN" = X
; then
28 echo "$ARGV0: ERROR: No $srcdir/configure.in or $srcdir/configure.ac found."
33 grep "^ *$1" $CONFIGURE_IN |
sed 's/.*(\[*\([^])]*\)]*).*/\1/'
36 autoconf_min_vers
=`extract_version AC_PREREQ`
37 automake_min_vers
=`extract_version AM_INIT_AUTOMAKE`
38 libtoolize_min_vers
=`extract_version AC_PROG_LIBTOOL`
39 aclocal_min_vers
=$automake_min_vers
42 # Not all echo versions allow -n, so we check what is possible. This test is
43 # based on the one in autoconf.
44 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
51 # some terminal codes ...
52 boldface
="`tput bold 2>/dev/null || true`"
53 normal
="`tput sgr0 2>/dev/null || true`"
55 echo $ECHO_N "$boldface"
57 echo $ECHO_N "$normal"
65 # compare_versions MIN_VERSION ACTUAL_VERSION
66 # returns true if ACTUAL_VERSION >= MIN_VERSION
71 IFS
="${IFS= }"; ch_save_IFS
="$IFS"; IFS
="."
72 set $ch_actual_version
73 for ch_min
in $ch_min_version; do
74 ch_cur
=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes
75 if [ -z "$ch_min" ]; then break; fi
76 if [ -z "$ch_cur" ]; then ch_status
=1; break; fi
77 if [ $ch_cur -gt $ch_min ]; then break; fi
78 if [ $ch_cur -lt $ch_min ]; then ch_status
=1; break; fi
85 # version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE
86 # checks to see if the package is available
95 vc_checkprog
=`eval echo "\\$$vc_variable"`
96 if [ -n "$vc_checkprog" ]; then
97 printbold
"using $vc_checkprog for $vc_package"
101 printbold
"checking for $vc_package >= $vc_min_version..."
102 for vc_checkprog
in $vc_checkprogs; do
103 echo $ECHO_N " testing $vc_checkprog... "
104 if $vc_checkprog --version < /dev
/null
> /dev
/null
2>&1; then
105 vc_actual_version
=`$vc_checkprog --version | head -n 1 | \
106 sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'`
107 if compare_versions
$vc_min_version $vc_actual_version; then
108 echo "found $vc_actual_version"
110 eval "$vc_variable=$vc_checkprog"
114 echo "too old (found version $vc_actual_version)"
120 if [ "$vc_status" != 0 ]; then
121 printerr
"***Error***: You must have $vc_package >= $vc_min_version installed"
122 printerr
" to build $PROJECT. Download the appropriate package for"
123 printerr
" from your distribution or get the source tarball at"
124 printerr
" $vc_source"
131 version_check autoconf AUTOCONF
$AUTOCONF $autoconf_min_vers \
132 "http://ftp.gnu.org/pub/gnu/autoconf/autoconf-${autoconf_min_vers}.tar.gz" || DIE
=1
135 # Hunt for an appropriate version of automake and aclocal; we can't
136 # assume that 'automake' is necessarily the most recent installed version
138 # We check automake first to allow it to be a newer version than we know about.
140 version_check automake AUTOMAKE
"$AUTOMAKE automake automake-1.10 automake-1.9 automake-1.8 automake-1.7" $automake_min_vers \
141 "http://ftp.gnu.org/pub/gnu/automake/automake-${automake_min_vers}.tar.gz" || DIE
=1
142 ACLOCAL
=`echo $AUTOMAKE | sed s/automake/aclocal/`
145 version_check libtool LIBTOOLIZE
$LIBTOOLIZE $libtoolize_min_vers \
146 "http://ftp.gnu.org/pub/gnu/libtool/libtool-${libtool_min_vers}.tar.gz" || DIE
=1
148 if test -z "$ACLOCAL_FLAGS"; then
149 acdir
=`$ACLOCAL --print-ac-dir`
150 if [ ! -f $acdir/pkg.
m4 ]; then
151 echo "$ARGV0: Error: Could not find pkg-config macros."
152 echo " (Looked in $acdir/pkg.m4)"
153 echo " If pkg.m4 is available in /another/directory, please set"
154 echo " ACLOCAL_FLAGS=\"-I /another/directory\""
155 echo " Otherwise, please install pkg-config."
157 echo "pkg-config is available from:"
158 echo "http://www.freedesktop.org/software/pkgconfig/"
163 if test "X$DIE" != X
; then
168 if test -z "$*"; then
169 echo "$ARGV0: Note: \`./configure' will be run with no arguments."
170 echo " If you wish to pass any to it, please specify them on the"
171 echo " \`$0' command line."
176 echo "$ARGV0: running \`$@'"
180 do_cmd
$LIBTOOLIZE $LIBTOOLIZE_FLAGS
182 do_cmd
$ACLOCAL $ACLOCAL_FLAGS
186 do_cmd
$AUTOMAKE $AUTOMAKE_FLAGS
190 cd $ORIGDIR ||
exit 1
194 do_cmd
$srcdir/configure \
195 --cache-file=config.cache \
198 --enable-test-surfaces \
199 ${1+"$@"} && echo "Now type \`make' to compile $PROJECT." ||
exit 1