autogen.sh: Sync behaviour with other GStreamer modules
authorEdward Hervey <edward@collabora.com>
Fri, 20 Sep 2013 14:47:56 +0000 (16:47 +0200)
committerEdward Hervey <edward@collabora.com>
Fri, 20 Sep 2013 14:47:56 +0000 (16:47 +0200)
Allows building from outside of tree amongst other things

autogen.sh

index 376fc9d..7bde014 100755 (executable)
@@ -1,6 +1,13 @@
 #!/bin/sh
 # Run this to generate all the initial makefiles, etc.
 
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+
+olddir=`pwd`
+cd "$srcdir"
+
 DIE=0
 package=gst-rtsp
 srcfile=gst/rtsp-server/rtsp-server.c
@@ -35,13 +42,13 @@ autogen_options $@
 
 printf "+ check for build tools"
 if test ! -z "$NOCHECK"; then echo ": skipped version checks"; else  echo; fi
-version_check "autoconf" "$AUTOCONF autoconf autoconf270 autoconf269 autoconf268 autoconf267 autoconf266 autoconf265 autoconf264 autoconf263 autoconf262" \
-              "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 62 || DIE=1
+version_check "autoconf" "$AUTOCONF autoconf autoconf270 autoconf269 autoconf268 " \
+              "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 68 || DIE=1
 version_check "automake" "$AUTOMAKE automake automake-1.11" \
               "ftp://ftp.gnu.org/pub/gnu/automake/" 1 11 || DIE=1
 version_check "autopoint" "autopoint" \
               "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 17 || DIE=1
-version_check "libtoolize" "libtoolize glibtoolize" \
+version_check "libtoolize" "$LIBTOOLIZE libtoolize glibtoolize" \
               "ftp://ftp.gnu.org/pub/gnu/libtool/" 2 2 6 || DIE=1
 version_check "pkg-config" "" \
               "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
@@ -54,7 +61,7 @@ autoheader_check || DIE=1
 die_check $DIE
 
 # if no arguments specified then this will be printed
-if test -z "$*"; then
+if test -z "$*" && test -z "$NOCONFIGURE"; then
   echo "+ checking for autogen.sh options"
   echo "  This autogen script will automatically run ./configure as:"
   echo "  ./configure $CONFIGURE_DEF_OPT"
@@ -90,21 +97,22 @@ debug "automake: $automake"
 tool_run "$automake" "--add-missing --copy"
 
 test -n "$NOCONFIGURE" && {
-  echo "skipping configure stage for package $package, as requested."
-  echo "autogen.sh done."
+  echo "skipping configure stage for package $package, as requested."
+  echo "autogen.sh done."
   exit 0
 }
 
+cd "$olddir"
+
 echo "+ running configure ... "
-test ! -z "$CONFIGURE_DEF_OPT" && echo "  ./configure default flags: $CONFIGURE_DEF_OPT"
-test ! -z "$CONFIGURE_EXT_OPT" && echo "  ./configure external flags: $CONFIGURE_EXT_OPT"
+test ! -z "$CONFIGURE_DEF_OPT" && echo "  default flags:  $CONFIGURE_DEF_OPT"
+test ! -z "$CONFIGURE_EXT_OPT" && echo "  external flags: $CONFIGURE_EXT_OPT"
 echo
 
-echo ./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT
-./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT || {
+echo "$srcdir/configure" $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT
+"$srcdir/configure" $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT || {
         echo "  configure failed"
         exit 1
 }
 
 echo "Now type 'make' to compile $package."
-