[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Checking default headers
From: |
Zack Weinberg |
Subject: |
Re: Checking default headers |
Date: |
Fri, 6 Sep 2013 22:42:00 -0400 |
On Tue, Sep 3, 2013 at 1:42 PM, Ross Lagerwall <address@hidden> wrote:
>> Probably means that AC_TYPE_UINT32_T is missing a prereq on the standard
>> headers; would you mind posting a reproducible test case, and we can
>> work on fixing the bug?
>
> The following reproduces it:
> """
> AC_INIT([test], [dev])
> AC_PROG_CC
>
> if false; then
> AC_CHECK_HEADERS([pthread.h], [], [have_pthreads=no])
> fi
>
> AC_TYPE_UINT16_T
> AC_OUTPUT
> """
It looks like AC_TYPE_INT<n>_T are correct. The problem is that if
the very first AC_CHECK_HEADER[S] in the file is inside a shell
conditional, _AC_INCLUDES_DEFAULT_REQUIREMENTS gets expanded inside
the conditional, and so only executes if the shell conditional is
true. This is (one of) the problems AS_IF addresses:
AC_INIT([test], [dev])
AC_PROG_CC
AS_IF([false], [AC_CHECK_HEADERS([pthread.h])])
AC_TYPE_UINT16_T
AC_OUTPUT
does the right thing (because the conditional is now visible on the M4
expansion stack, so _AC_INCLUDES_DEFAULT_REQUIREMENTS gets placed just
before it instead of inside it).
I don't think there's anything we can reasonably do in Autoconf to
make this less troublesome.
zw