-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."
+# Discover what version of automake we are using.
+automake_version=$($AUTOMAKE --version 2>/dev/null | head -n 1)
+
+if test "$automake_version" != ""; then
+ echo "Using $automake_version"
+else
+ echo "LyX requires automake >= 1.14"
+ exit 1
+fi
+
+case $automake_version in
+ *' '1.1[456]*)
+ ;;
+ *)
+ echo "This automake version is not supported by LyX."
+ echo "LyX only supports automake 1.14 through 1.16."
+ exit 1
+ ;;
+esac
+
+# Discover what version of autoconf we are using.
+autoversion=$($AUTOCONF --version 2>/dev/null | head -n 1)
+
+if test "$autoversion" != ""; then
+ echo "Using $autoversion"
+else
+ echo "LyX requires autoconf >= 2.65"
+ exit 1