On 2020-03-23, Ross Burton <invalid.nore...@gnu.org> wrote:
> apt 1.2.31 builds fine with autoconf 2.69.  With git master:
>
> | checking for h_errno... configure: error: "not found."
>
> That code is:
>
> dnl HP-UX needs -d_XOPEN_SOURCE_EXTENDED for h_errno
> AC_MSG_CHECKING(for h_errno)
> AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(normal)],
>    [CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
>     AC_EGREP_HEADER(h_errno, netdb.h,
>        [AC_MSG_RESULT(needs _XOPEN_SOURCE_EXTENDED)],
>        [AC_MSG_ERROR("not found.")])
>    ])
>
> Obviously this is horrible, but it's out there.

Can you expand more on what is failing for you?  I just copy+pasted the
above code into the following configure script:

  % cat >configure.ac <<'EOF'
AC_INIT([test], [0])

dnl HP-UX needs -d_XOPEN_SOURCE_EXTENDED for h_errno
AC_MSG_CHECKING(for h_errno)
AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(normal)],
    [CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
     AC_EGREP_HEADER(h_errno, netdb.h,
        [AC_MSG_RESULT(needs _XOPEN_SOURCE_EXTENDED)],
        [AC_MSG_ERROR("not found.")])
    ])

AC_OUTPUT
EOF

This seems to work perfectly fine with current autoconf master (ignoring
the slightly mangled output due to the example being a bit contrived):

  % autoconf --version
  autoconf (GNU Autoconf) 2.69.209-8a09
  [...]

  % autoconf

  % cat >netdb.h <<'EOF'
#if GATE && _XOPEN_SOURCE_EXTENDED
int h_errno;
#endif
EOF

  % ./configure CPPFLAGS='-I.'
  [...]
  configure: error: "not found."

  % ./configure CPPFLAGS='-I. -DGATE'
  [...]
  needs _XOPEN_SOURCE_EXTENDED

  % ./configure CPPFLAGS='-I. -DGATE -D_XOPEN_SOURCE_EXTENDED'
  [...]
  normal

Which appears to be exactly as expected for this configure test.

Cheers,
  Nick

Reply via email to