-ACLOCAL=aclocal
-AUTOHEADER=autoheader
-AUTOMAKE="automake -a -c --foreign"
-AUTOCONF=autoconf
-GNUM4=
-
-echo -n "Locating GNU m4... "
-for prog in $M4 gm4 gnum4 m4 ; do
- case `$prog --version 2>&1` in
- *GNU*) ok=yes
- GNUM4=$prog
- echo "found: $GNUM4"
- break ;;
- *) ;;
- esac
-done
-if test x$ok = xno ; then
- echo "not found."
-fi
+ACLOCAL="aclocal -I m4 -I config"
+AUTOHEADER="autoheader"
+AUTOMAKE="automake --add-missing --copy --foreign"
+AUTOCONF="autoconf"
+
+# Discover what version of automake we are using.
+automake_version=`$AUTOMAKE --version 2>/dev/null | head -n 1`
+
+test "$automake_version" != "" && {
+ echo "Using $automake_version"
+} || {
+ echo "LyX requires automake >= 1.5"
+ exit 1
+}
+
+case $automake_version in
+ *' '1.[5-9]*|*' '1.10*)
+ ;;
+ *)
+
+ echo "This automake version is not supported by LyX."
+ echo "LyX only supports automake 1.5 to 1.10."
+ exit 1
+ ;;
+esac
+
+# Discover what version of autoconf we are using.
+autoversion=`$AUTOCONF --version 2>/dev/null | head -n 1`