Permalink
Browse files

Harmonize autogen.sh within project.

This version should work on all supported platforms, opting to using
autoreconf if available.
  • Loading branch information...
1 parent a69b50c commit 5f1cc78e333f8346c4e4f55a80d1c5853bfbcc22 @erikogenvik erikogenvik committed Apr 21, 2013
Showing with 53 additions and 38 deletions.
  1. +51 −38 autogen.sh
  2. +2 −0 configure.ac
View
@@ -2,41 +2,54 @@
rm -f config.cache
-echo aclocal...
-(aclocal --version) < /dev/null > /dev/null 2>&1 || {
- echo aclocal not found
- exit 1
-}
-aclocal $ACLOCAL_FLAGS -I m4
-
-echo autoheader...
-(autoheader --version) < /dev/null > /dev/null 2>&1 || {
- echo autoheader not found
- exit 1
-}
-autoheader
-
-echo libtoolize...
-(libtoolize --version) < /dev/null > /dev/null 2>&1 || {
- echo libtoolize not found
- exit 1
-}
-libtoolize --automake --copy --force
-
-echo automake...
-(automake --version) < /dev/null > /dev/null 2>&1 || {
- echo automake not found
- exit 1
-}
-automake --add-missing --copy --gnu
-
-echo autoconf...
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
- echo autoconf not found
- exit 1
-}
-autoconf
-
-echo Ready to configure
-
-exit 0
+#Check if the autoreconf command is available, and use that if so.
+if command -v autoreconf >/dev/null 2>&1 ; then
+ echo autoreconf...
+ autoreconf --install
+else
+ if test -d /usr/local/share/aclocal ; then
+ ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I /usr/local/share/aclocal"
+ fi
+
+ (command -v aclocal) < /dev/null > /dev/null 2>&1 || {
+ echo aclocal not found
+ exit 1
+ }
+ echo aclocal...
+ aclocal -I m4 $ACLOCAL_FLAGS
+
+ #The GNU libtoolize is called 'glibtoolize' on Darwin.
+ if [ "`echo $OSTYPE | grep darwin`" != "" ] ; then
+ LIBTOOLIZE="glibtoolize"
+ else
+ LIBTOOLIZE="libtoolize"
+ fi
+
+ (command -v $LIBTOOLIZE) < /dev/null > /dev/null 2>&1 || {
+ echo $LIBTOOLIZE not found
+ exit 1
+ }
+ echo $LIBTOOLIZE...
+ $LIBTOOLIZE --force --copy
+
+ (command -v autoheader) < /dev/null > /dev/null 2>&1 || {
+ echo autoheader not found
+ exit 1
+ }
+ echo autoheader...
+ autoheader
+
+ (command -v automake) < /dev/null > /dev/null 2>&1 || {
+ echo automake not found
+ exit 1
+ }
+ echo automake...
+ automake --gnu --add-missing --copy
+
+ (command -v autoconf) < /dev/null > /dev/null 2>&1 || {
+ echo autoconf not found
+ exit 1
+ }
+ echo autoconf...
+ autoconf
+fi
View
@@ -5,6 +5,8 @@ AC_INIT([varconf], [1.0.0], [alriddoch@googlemail.com])
AC_CONFIG_SRCDIR([varconf/variable.cpp])
AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
dnl Detect the canonical host environment
AC_CANONICAL_HOST

0 comments on commit 5f1cc78

Please sign in to comment.