From cd821f5f5f95cc4e143ae938e26faf5a78c4cc9c Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 29 May 2006 16:01:17 +0000 Subject: 22470: attempt to improve errno.h searching --- configure.ac | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'configure.ac') 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 -- cgit 1.4.1