about summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-05-29 16:01:17 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-05-29 16:01:17 +0000
commitcd821f5f5f95cc4e143ae938e26faf5a78c4cc9c (patch)
treeccc978e140824bba46bf394844a2986ee5617fbb /configure.ac
parent29ed6c7e3ab32da20f528aeba4bb76635f1a3b06 (diff)
downloadzsh-cd821f5f5f95cc4e143ae938e26faf5a78c4cc9c.tar.gz
zsh-cd821f5f5f95cc4e143ae938e26faf5a78c4cc9c.tar.xz
zsh-cd821f5f5f95cc4e143ae938e26faf5a78c4cc9c.zip
22470: attempt to improve errno.h searching
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac19
1 files changed, 14 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 77ba9a9f9..f4eb5c56e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1312,16 +1312,25 @@ sed 's/\\\\\\\\/\//g' |
 $AWK '{ if ($1 ~ /err/) files[[$1]] = $1 }
   END { for (var in files) print var }'`"
 rm -f nametmp.c
-for ERRNO_H in $errfile_list /dev/null
+lnerrs=0
+for ERRNO_TRY_H in $errfile_list /dev/null
 do
   dnl Try to make sure it doesn't get confused by files that don't
   dnl have real error definitions in.  Count definitions to make sure.
-  nerrs=`test -f $ERRNO_H && \
-  $EGREP '#[ 	]*define[ 	][ 	]*E[0-9A-Z]*[ 	]*(_HURD_ERRNO \()?[0-9]+\)?' $ERRNO_H | \
+  dnl Definitions of error numbers have become more and more general, so
+  dnl pick the file with the most matches, which must be at least 7.
+  dnl Careful with cut and paste in the pattern: the square brackets
+  dnl must contain a space and a tab.
+  nerrs=`test -f $ERRNO_TRY_H && \
+  $EGREP '#[ 	]*define[ 	][ 	]*E[0-9A-Z]*[ 	]*(_HURD_ERRNO )?\(?[_A-Z0-9]' $ERRNO_TRY_H | \
   wc -l | sed 's/[ 	]//g'`
-  test "x$nerrs" != x && test "$nerrs" -ge 7 && break
+  if test "x$nerrs" != x && test "$nerrs" -ge 7 && test "$nerrs" -gt "$lnerrs"
+  then
+    lnerrs=$nerrs
+    ERRNO_H=$ERRNO_TRY_H
+  fi
 done
-if test x$ERRNO_H = x"/dev/null"; then
+if test x$ERRNO_H = x; then
   AC_MSG_ERROR(ERROR MACROS NOT FOUND:  please report to developers)
 fi
 zsh_cv_path_errno_h=$ERRNO_H