[autogen] always fail, if not in source root
authorMyhailo Danylenko <isbear@ukrpost.net>
Thu, 15 Nov 2012 21:03:52 +0200
changeset 637 f7b3628c8a5a
parent 636 ae3025b600fa
child 638 bdfa8e1da006
[autogen] always fail, if not in source root
autogen.sh
--- a/autogen.sh	Thu Nov 15 21:03:34 2012 +0200
+++ b/autogen.sh	Thu Nov 15 21:03:52 2012 +0200
@@ -4,6 +4,12 @@
 : ${AUTORECONF=autoreconf}
 : ${GTKDOCIZE=gtkdocize}
 
+if ! [ -f "./autogen.sh" ]; then
+	# Avoid creation of files in random directories
+	echo "Error: You have to run this script in the root of loudmouth sources."
+	exit 1
+fi
+
 if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ]; then
 	echo "./autogen.sh [-g]"
 	echo
@@ -15,19 +21,13 @@
 	# ensure, that gtk-doc.make exists and is readable
 	# otherwise automake will fail - it is included from
 	# doc/reference/Makefile.am
-	if [ -f "./autogen.sh" ]; then
-		if [ -h "./gtk-doc.make" ]; then
-			rm -f "./gtk-doc.make"
-		fi
-		if [ -n "./gtk-doc.make" ]; then
-			: > "./gtk-doc.make"
-		fi
-		GTKDOCIZE=":"
-	else
-		# Avoid creation of files in random directories
-		echo "Error: You have to run this script from the root of loudmouth sources."
-		exit 1
+	if [ -h "./gtk-doc.make" ]; then
+		rm -f "./gtk-doc.make"
 	fi
+	if [ -n "./gtk-doc.make" ]; then
+		: > "./gtk-doc.make"
+	fi
+	GTKDOCIZE=":"
 fi
 
 $GTKDOCIZE || exit 1