Apply changes towards a project wide common "autogen.sh" file
diff --git a/autogen.sh b/autogen.sh
index 3292973..5a0ec43 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,15 +1,26 @@
 #!/bin/sh
-gprefix=`which glibtoolize 2>&1 >/dev/null`
-if [ $? -eq 0 ]; then 
-  glibtoolize --force
-else
-  libtoolize --force
-fi
-aclocal -I m4
-autoheader
-automake --add-missing
-autoconf
+
+olddir=`pwd`
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+(
+  cd "$srcdir"
+
+  gprefix=`which glibtoolize 2>&1 >/dev/null`
+  if [ $? -eq 0 ]; then
+    glibtoolize --force
+  else
+    libtoolize --force
+  fi
+  aclocal -I m4
+  autoheader
+  automake --add-missing
+  autoconf
+
+  cd "$olddir"
+)
 
 if [ -z "$NOCONFIGURE" ]; then
-    ./configure "$@"
+  $srcdir/configure "$@"
 fi