Permalink
Browse files

Allow "versioned" names of the auto-tools to be used

Previously bootstrap required aclocal/automake to be available as
"aclocal" and "automake", but some platforms allows multiple versions
of these tools to be installed and makes them available as
"aclocal-<version>".

This patch extends the bootstrap script to try to search for various
names for the tools.

Change-Id: I504fcd131a25dcc775e67517dd51b474d86c600d
Reviewed-on: http://review.couchbase.org/8753
Reviewed-by: Jan Lehnardt <jan@apache.org>
Tested-by: Jan Lehnardt <jan@apache.org>
  • Loading branch information...
1 parent 528c634 commit 46d76555d11b77fd7a4322712f1f1b33d1c60849 @trondn trondn committed Aug 9, 2011
Showing with 35 additions and 9 deletions.
  1. +35 −9 bootstrap
View
@@ -48,16 +48,42 @@ fi
gunzip -c m4/ac_check_icu.m4.gz > m4/ac_check_icu.m4
gunzip -c m4/ac_check_curl.m4.gz > m4/ac_check_curl.m4
-if test -x "`which glibtoolize 2> /dev/null || true`"; then
- glibtoolize -f -c --automake
-else
- libtoolize -f -c --automake
-fi
+# Seach a list of names for the first occurence of a program.
+# Some systems may use aclocal-1.10, others may have aclocal etc.
+#
+# Exit with status code 0 if the program exists (and print the
+# path to stdout), exit with status code 1 if it can't be
+# located
+find_program() {
+ set +e
+ for f in "$@"
+ do
+ file=`which ${f} 2>/dev/null | grep -v '^no '`
+ if test -n "x${file}" -a -x "${file}"
+ then
+ echo ${file}
+ set -e
+ exit 0
+ fi
+ done
+
+ echo "Failed to locate required program:" 1>&2
+ echo "\t$@" 1>&2
+ set -e
+ exit 1
+}
+
+LIBTOOLIZE=`find_program glibtoolize libtoolize`
+ACLOCAL=`find_program aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal`
+AUTOHEADER=`find_program autoheader`
+AUTOMAKE=`find_program automake-1.11 automake-1.10 automake-1.9 automake`
+AUTOCONF=`find_program autoconf`
-aclocal -I m4
-autoheader -f
-automake -f -a 2>&1 | sed -e "/install/d"
-autoconf -f
+${LIBTOOLIZE} -f -c --automake
+${ACLOCAL} -I m4
+${AUTOHEADER} -f
+${AUTOMAKE} -f -a 2>&1 | sed -e "/install/d"
+${AUTOCONF} -f
ln -f -s "`dirname \`readlink build-aux/missing\``/INSTALL"

0 comments on commit 46d7655

Please sign in to comment.