diff --git a/ChangeLog b/ChangeLog
index 13568d51bbe67a9939a5b46168159ed633662c5a..9899cc7457ad45485625dabc40ec36b44589638a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Apr 14 11:33:51 1998  Krister Walfridsson <cato@df.lth.se>
+
+	* configure: Define DEFAULT_M4 by searching PATH.
+	* Makfile.in: Use DEFAULT_M4.
+
 Sun Apr 12 20:58:46 1998  Jeffrey A Law  (law@cygnus.com)
 
 	* Makefile.in (INSTALL_MODULES): Remove texinfo.
diff --git a/configure b/configure
index ed54cedbde385ec914ae39d3e68ec2965340f6e2..8b4e510d0bf779d15038276683cb6112a1840ba7 100755
--- a/configure
+++ b/configure
@@ -762,6 +762,25 @@ do
   test -n "$DEFAULT_YACC" && break
 done
 
+# Generate a default definition for M4.  This is used if the makefile can't
+# locate m4 in objdir.
+
+for prog in gm4 gnum4 m4
+do
+  set dummy $prog; tmp=$2
+  IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$tmp; then
+      DEFAULT_M4="$prog"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  test -n "$DEFAULT_M4" && break
+done
+
 # Generate a default definition for LEX.  This is used if the makefile can't
 # locate flex in objdir.
 
@@ -1259,6 +1278,7 @@ EOF
                     -e "s|^tooldir[ 	]*=.*$|tooldir = ${tooldir}|" \
 		    -e "s:^DEFAULT_YACC[	 ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
 		    -e "s:^DEFAULT_LEX[	 ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
+		    -e "s:^DEFAULT_M4[  ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
                     ${subdir}/Makefile.tem >> ${Makefile}
 
 	    # If this is a Canadian Cross, preset the values of many more