Re: [sr #110215] AC_EGREP_HEADER appears to be broken in master

Ross Burton <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <CAAnfSTu7J2DMR-U2cqngX=HJe4xNhyqy9v9PzhfXuRN1uYKS2Q@mail.gmail.com>
On Mon, 23 Mar 2020 at 23:20, Nick Bowler <[email protected]> wrote:
> Can you expand more on what is failing for you?  I just copy+pasted the
> above code into the following configure script:

I did a bit more digging.  At no point is autoconf looking for egrep
for some reason with master.  Specifically these lines are missing
when ran with autoconf master:

checking for grep that handles long lines and -e... /scratch/poky/hosttools/grep
checking for egrep... /scratch/poky/hosttools/grep -E

And echoing $EGREP before the test shows that it isn't set.

This is odd because AC_EGREP_CPP which is actually doing the work
should be searching for it:

AC_DEFUN([AC_EGREP_CPP],
[AC_LANG_PREPROC_REQUIRE()dnl
AC_REQUIRE([AC_PROG_EGREP])dnl
...

Looking at the generated configure, some code isn't being executed in
the right place.  The first instance of the AC_EGREP* calls are
earlier in the configure.ac, like this:

AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes])
dnl Arg, linux and bsd put their statfs function in different places
if test x"$HAVE_STATVFS" != x"yes"; then
   AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_VFS_H)],[
   AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_MOUNT_H)],[AC_MSG_ERROR(failed:
Need statvfs)])
   ])
fi
(and later looks for h_errno then fails)

And the generated code does this:

if test x"$HAVE_STATVFS" != x"yes"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that
handles long lines and
-e" >&5
printf %s "checking for grep that handles long lines and -e... " >&6; }
...

So the search for egrep only happens if statvfs isn't found by
AC_CHECK_FUNC.  My understanding is that this isn't how AC_REQUIRE
should be working, right?

Ross
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.