Bug 628949 - Update visible region / glass regions after we paint. r=roc a=2.0.
[mozilla-central.git] / gfx / harfbuzz / autogen.sh
blobfb0148b92de22a49e53314e530932eb07e370db3
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=harfbuzz
17 LIBTOOLIZE_FLAGS="--copy --force --automake"
18 ACLOCAL_FLAGS=""
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 touch ChangeLog
174 #do_cmd $GTKDOCIZE $GTKDOCIZE_FLAGS
176 do_cmd $AUTOMAKE $AUTOMAKE_FLAGS
178 do_cmd $AUTOCONF
180 cd "$ORIGDIR" || exit 1
182 rm -f config.cache
184 do_cmd $srcdir/configure \
185 ${1+"$@"} && echo "Now type \`make' to compile $PROJECT." || exit 1