2009-12-03 Jeffrey Stedfast <fejj@novell.com>
[moon.git] / cairo / autogen.sh
blobe9b921cc681fcabfcad55a9e5a520e68d2f2d4da
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3 set -e
5 ARGV0=$0
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=.
12 ORIGDIR=`pwd`
13 cd $srcdir
15 PACKAGE=cairo
17 LIBTOOLIZE_FLAGS="--copy --force --automake"
18 ACLOCAL_FLAGS="-I build"
19 AUTOHEADER=${AUTOHEADER-autoheader}
20 GTKDOCIZE_FLAGS="--copy"
21 GTKDOCIZE=${GTKDOCIZE-gtkdocize}
22 AUTOMAKE_FLAGS="--add-missing --gnu -Wall"
23 AUTOCONF=${AUTOCONF-autoconf}
25 CONFIGURE_AC=
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."
30 exit 1
33 extract_version() {
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
46 *c*,-n*) ECHO_N= ;;
47 *c*,* ) ECHO_N=-n ;;
48 *) ECHO_N= ;;
49 esac
52 # some terminal codes ...
53 boldface="`tput bold 2>/dev/null || true`"
54 normal="`tput sgr0 2>/dev/null || true`"
55 printbold() {
56 echo $ECHO_N "$boldface"
57 echo "$@"
58 echo $ECHO_N "$normal"
60 printerr() {
61 echo "$@" >&2
65 # Usage:
66 # compare_versions MIN_VERSION ACTUAL_VERSION
67 # returns true if ACTUAL_VERSION >= MIN_VERSION
68 compare_versions() {
69 ch_min_version=$1
70 ch_actual_version=$2
71 ch_status=0
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
80 done
81 IFS="$ch_save_IFS"
82 return $ch_status
85 # Usage:
86 # version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE
87 # checks to see if the package is available
88 version_check() {
89 vc_package=$1
90 vc_variable=$2
91 vc_checkprogs=$3
92 vc_min_version=$4
93 vc_source=$5
94 vc_status=1
96 vc_checkprog=`eval echo "\\$$vc_variable"`
97 if [ -n "$vc_checkprog" ]; then
98 printbold "using $vc_checkprog for $vc_package"
99 return 0
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"
110 # set variable
111 eval "$vc_variable=$vc_checkprog"
112 vc_status=0
113 break
114 else
115 echo "too old (found version $vc_actual_version)"
117 else
118 echo "not found."
120 done
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"
126 printerr
128 return $vc_status
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
150 exit 1
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."
158 echo
161 do_cmd() {
162 echo "$ARGV0: running \`$@'"
166 do_cmd $LIBTOOLIZE $LIBTOOLIZE_FLAGS
168 do_cmd $ACLOCAL $ACLOCAL_FLAGS
170 do_cmd $AUTOHEADER
172 # create dummy */Makefile.am.features and ChangeLog to make automake happy
173 > boilerplate/Makefile.am.features
174 > src/Makefile.am.features
175 touch ChangeLog
177 # We don't call gtkdocize right now. When we do, we should then modify
178 # the generated gtk-doc.make and move it to build/Makefile.am.gtk-doc.
179 # See that file for details.
180 #do_cmd $GTKDOCIZE $GTKDOCIZE_FLAGS
182 do_cmd $AUTOMAKE $AUTOMAKE_FLAGS
184 do_cmd $AUTOCONF
186 cd "$ORIGDIR" || exit 1
188 rm -f config.cache
190 do_cmd $srcdir/configure \
191 --cache-file=config.cache \
192 --disable-static \
193 --enable-test-surfaces \
194 ${1+"$@"} && echo "Now type \`make' to compile $PROJECT." || exit 1
195 #!/bin/sh
196 # Run this to generate all the initial makefiles, etc.
197 set -e
199 ARGV0=$0
201 # Allow invocation from a separate build directory; in that case, we change
202 # to the source directory to run the auto*, then change back before running configure
203 srcdir=`dirname $ARGV0`
204 test -z "$srcdir" && srcdir=.
206 ORIGDIR=`pwd`
207 cd $srcdir
209 PACKAGE=cairo
211 LIBTOOLIZE=${LIBTOOLIZE-libtoolize}
212 LIBTOOLIZE_FLAGS="--copy --force"
213 AUTOHEADER=${AUTOHEADER-autoheader}
214 AUTOMAKE_FLAGS="--add-missing --foreign"
215 AUTOCONF=${AUTOCONF-autoconf}
217 CONFIGURE_IN=
218 test -f configure.in && CONFIGURE_IN=configure.in
219 test -f configure.ac && CONFIGURE_IN=configure.ac
221 if test "X$CONFIGURE_IN" = X; then
222 echo "$ARGV0: ERROR: No $srcdir/configure.in or $srcdir/configure.ac found."
223 exit 1
226 extract_version() {
227 grep "^ *$1" $CONFIGURE_IN | sed 's/.*(\[*\([^])]*\)]*).*/\1/'
230 autoconf_min_vers=`extract_version AC_PREREQ`
231 automake_min_vers=`extract_version AM_INIT_AUTOMAKE`
232 libtoolize_min_vers=`extract_version AC_PROG_LIBTOOL`
233 aclocal_min_vers=$automake_min_vers
236 # Not all echo versions allow -n, so we check what is possible. This test is
237 # based on the one in autoconf.
238 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
239 *c*,-n*) ECHO_N= ;;
240 *c*,* ) ECHO_N=-n ;;
241 *) ECHO_N= ;;
242 esac
245 # some terminal codes ...
246 boldface="`tput bold 2>/dev/null || true`"
247 normal="`tput sgr0 2>/dev/null || true`"
248 printbold() {
249 echo $ECHO_N "$boldface"
250 echo "$@"
251 echo $ECHO_N "$normal"
253 printerr() {
254 echo "$@" >&2
258 # Usage:
259 # compare_versions MIN_VERSION ACTUAL_VERSION
260 # returns true if ACTUAL_VERSION >= MIN_VERSION
261 compare_versions() {
262 ch_min_version=$1
263 ch_actual_version=$2
264 ch_status=0
265 IFS="${IFS= }"; ch_save_IFS="$IFS"; IFS="."
266 set $ch_actual_version
267 for ch_min in $ch_min_version; do
268 ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes
269 if [ -z "$ch_min" ]; then break; fi
270 if [ -z "$ch_cur" ]; then ch_status=1; break; fi
271 if [ $ch_cur -gt $ch_min ]; then break; fi
272 if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi
273 done
274 IFS="$ch_save_IFS"
275 return $ch_status
278 # Usage:
279 # version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE
280 # checks to see if the package is available
281 version_check() {
282 vc_package=$1
283 vc_variable=$2
284 vc_checkprogs=$3
285 vc_min_version=$4
286 vc_source=$5
287 vc_status=1
289 vc_checkprog=`eval echo "\\$$vc_variable"`
290 if [ -n "$vc_checkprog" ]; then
291 printbold "using $vc_checkprog for $vc_package"
292 return 0
295 printbold "checking for $vc_package >= $vc_min_version..."
296 for vc_checkprog in $vc_checkprogs; do
297 echo $ECHO_N " testing $vc_checkprog... "
298 if $vc_checkprog --version < /dev/null > /dev/null 2>&1; then
299 vc_actual_version=`$vc_checkprog --version | head -n 1 | \
300 sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'`
301 if compare_versions $vc_min_version $vc_actual_version; then
302 echo "found $vc_actual_version"
303 # set variable
304 eval "$vc_variable=$vc_checkprog"
305 vc_status=0
306 break
307 else
308 echo "too old (found version $vc_actual_version)"
310 else
311 echo "not found."
313 done
314 if [ "$vc_status" != 0 ]; then
315 printerr "***Error***: You must have $vc_package >= $vc_min_version installed"
316 printerr " to build $PROJECT. Download the appropriate package for"
317 printerr " from your distribution or get the source tarball at"
318 printerr " $vc_source"
319 printerr
321 return $vc_status
325 version_check autoconf AUTOCONF $AUTOCONF $autoconf_min_vers \
326 "http://ftp.gnu.org/pub/gnu/autoconf/autoconf-${autoconf_min_vers}.tar.gz" || DIE=1
329 # Hunt for an appropriate version of automake and aclocal; we can't
330 # assume that 'automake' is necessarily the most recent installed version
332 # We check automake first to allow it to be a newer version than we know about.
334 version_check automake AUTOMAKE "$AUTOMAKE automake automake-1.10 automake-1.9 automake-1.8 automake-1.7" $automake_min_vers \
335 "http://ftp.gnu.org/pub/gnu/automake/automake-${automake_min_vers}.tar.gz" || DIE=1
336 ACLOCAL=`echo $AUTOMAKE | sed s/automake/aclocal/`
339 version_check libtool LIBTOOLIZE $LIBTOOLIZE $libtoolize_min_vers \
340 "http://ftp.gnu.org/pub/gnu/libtool/libtool-${libtool_min_vers}.tar.gz" || DIE=1
342 if test -z "$ACLOCAL_FLAGS"; then
343 acdir=`$ACLOCAL --print-ac-dir`
344 if [ ! -f $acdir/pkg.m4 ]; then
345 echo "$ARGV0: Error: Could not find pkg-config macros."
346 echo " (Looked in $acdir/pkg.m4)"
347 echo " If pkg.m4 is available in /another/directory, please set"
348 echo " ACLOCAL_FLAGS=\"-I /another/directory\""
349 echo " Otherwise, please install pkg-config."
350 echo ""
351 echo "pkg-config is available from:"
352 echo "http://www.freedesktop.org/software/pkgconfig/"
353 DIE=yes
357 if test "X$DIE" != X; then
358 exit 1
362 if test -z "$*"; then
363 echo "$ARGV0: Note: \`./configure' will be run with no arguments."
364 echo " If you wish to pass any to it, please specify them on the"
365 echo " \`$0' command line."
366 echo
369 do_cmd() {
370 echo "$ARGV0: running \`$@'"
374 do_cmd $LIBTOOLIZE $LIBTOOLIZE_FLAGS
376 do_cmd $ACLOCAL $ACLOCAL_FLAGS
378 do_cmd $AUTOHEADER
380 do_cmd $AUTOMAKE $AUTOMAKE_FLAGS
382 do_cmd $AUTOCONF
384 cd $ORIGDIR || exit 1
386 rm -f config.cache
388 #do_cmd $srcdir/configure \
389 # --cache-file=config.cache \
390 # --disable-static \
391 # --enable-gtk-doc \
392 # --enable-test-surfaces \
393 # ${1+"$@"} && echo "Now type \`make' to compile $PROJECT." || exit 1