You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2021/03/06 22:20:59 UTC

svn commit: r1887279 - /apr/apr/trunk/build/apr_common.m4

Author: ylavic
Date: Sat Mar  6 22:20:59 2021
New Revision: 1887279

URL: http://svn.apache.org/viewvc?rev=1887279&view=rev
Log:
build/apr_common.m4: avoid explicit inclusion of "confdefs.h"

The failure is observed on `autoconf-2.69d` (soon to be released
as `autoconf-2.70`). There `int64_t` detection fails as:

$ autoreconf && ./configure
checking whether int64_t and int use fmt %d... no
checking whether int64_t and long use fmt %ld... no
checking whether int64_t and long long use fmt %lld... no
configure: error: could not determine the string function for int64_t
```

This happens because `./configure` always stumbles on warning:

configure:3350: gcc -c -g -O2 -Werror  conftest.c >&5
In file included from conftest.c:31:
confdefs.h:22: error: "__STDC_WANT_IEC_60559_ATTRIBS_EXT__" redefined [-Werror]
   22 | #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
      |

It's triggered by double inclusion of `"confdefs.h"` contents:
explicitly in `APR_TRY_COMPILE_NO_WARNING` macro and implicitly
via `AC_LANG_SOURCE` use.

To fix it and avoid having to define `main()` declaration the change
uses `AC_LANG_PROGRAM` instead.

Tested on both `autoconf-2.69` and `autoconf-2.69d`.


Github: closes #25
Submitted by: Sergei Trofimovich <slyfox gentoo.org>
Reviewed by: ylavic

Modified:
    apr/apr/trunk/build/apr_common.m4

Modified: apr/apr/trunk/build/apr_common.m4
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/apr_common.m4?rev=1887279&r1=1887278&r2=1887279&view=diff
==============================================================================
--- apr/apr/trunk/build/apr_common.m4 (original)
+++ apr/apr/trunk/build/apr_common.m4 Sat Mar  6 22:20:59 2021
@@ -467,13 +467,9 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
    CFLAGS="$CFLAGS -Werror"
  fi
  AC_COMPILE_IFELSE(
-  [AC_LANG_SOURCE(
-   [#include "confdefs.h"
-   ]
-   [[$1]]
-   [int main(int argc, const char *const *argv) {]
+  [AC_LANG_PROGRAM(
+   [[$1]],
    [[$2]]
-   [   return 0; }]
   )], [CFLAGS=$apr_save_CFLAGS
 $3],  [CFLAGS=$apr_save_CFLAGS
 $4])



Re: svn commit: r1887279 - /apr/apr/trunk/build/apr_common.m4

Posted by Joe Orton <jo...@redhat.com>.
On Wed, Mar 24, 2021 at 04:07:32PM +0100, Yann Ylavic wrote:
> On Wed, Mar 24, 2021 at 3:40 PM Yann Ylavic <yl...@gmail.com> wrote:
> >
> > On Wed, Mar 24, 2021 at 3:24 PM Joe Orton <jo...@redhat.com> wrote:
> > >
> > > This now fails for me in exactly the same way when using ./configure
> > > --enable-maintainer-mode on autoconf 2.69, both in Fedora 33 and in
> > > Ubuntu: https://travis-ci.com/github/apache/apr/jobs/492824241
> >
> > How about the attached patch?
> > This almost restores the previous APR_TRY_COMPILE_NO_WARNING but
> > doesn't #include "confdefs.h" if AC_LANG_SOURCE did it already,
> > assuming PACKAGE_NAME is defined by "confdefs.h"..
> 
> Applied in r1888017 and backported to 1.7.x (r1888018).

Works for me, thanks a lot for the fast response.

Regards, Joe


Re: svn commit: r1887279 - /apr/apr/trunk/build/apr_common.m4

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Mar 24, 2021 at 3:40 PM Yann Ylavic <yl...@gmail.com> wrote:
>
> On Wed, Mar 24, 2021 at 3:24 PM Joe Orton <jo...@redhat.com> wrote:
> >
> > This now fails for me in exactly the same way when using ./configure
> > --enable-maintainer-mode on autoconf 2.69, both in Fedora 33 and in
> > Ubuntu: https://travis-ci.com/github/apache/apr/jobs/492824241
>
> How about the attached patch?
> This almost restores the previous APR_TRY_COMPILE_NO_WARNING but
> doesn't #include "confdefs.h" if AC_LANG_SOURCE did it already,
> assuming PACKAGE_NAME is defined by "confdefs.h"..

Applied in r1888017 and backported to 1.7.x (r1888018).

Re: svn commit: r1887279 - /apr/apr/trunk/build/apr_common.m4

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Mar 24, 2021 at 3:24 PM Joe Orton <jo...@redhat.com> wrote:
>
> This now fails for me in exactly the same way when using ./configure
> --enable-maintainer-mode on autoconf 2.69, both in Fedora 33 and in
> Ubuntu: https://travis-ci.com/github/apache/apr/jobs/492824241

How about the attached patch?
This almost restores the previous APR_TRY_COMPILE_NO_WARNING but
doesn't #include "confdefs.h" if AC_LANG_SOURCE did it already,
assuming PACKAGE_NAME is defined by "confdefs.h"..

Regards;
Yann.

Re: svn commit: r1887279 - /apr/apr/trunk/build/apr_common.m4

Posted by Joe Orton <jo...@redhat.com>.
On Sat, Mar 06, 2021 at 10:20:59PM -0000, ylavic@apache.org wrote:
> Author: ylavic
> Date: Sat Mar  6 22:20:59 2021
> New Revision: 1887279
> 
> URL: http://svn.apache.org/viewvc?rev=1887279&view=rev
> Log:
> build/apr_common.m4: avoid explicit inclusion of "confdefs.h"
> 
> The failure is observed on `autoconf-2.69d` (soon to be released
> as `autoconf-2.70`). There `int64_t` detection fails as:
> 
> $ autoreconf && ./configure
> checking whether int64_t and int use fmt %d... no
> checking whether int64_t and long use fmt %ld... no
> checking whether int64_t and long long use fmt %lld... no
> configure: error: could not determine the string function for int64_t
> ```

This now fails for me in exactly the same way when using ./configure 
--enable-maintainer-mode on autoconf 2.69, both in Fedora 33 and in 
Ubuntu: https://travis-ci.com/github/apache/apr/jobs/492824241

config.log says the program it tries is:

| int
| main ()
| {
| 
...
|   return 0;
| }

which always fails because of the maintainer-mode args:

configure:25300: gcc -c -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread  -Werror -DLINUX -D_REENTRANT -D_GNU_SOURCE -DAPR_POOL_DEBUG=1 -DAPR_THREAD_DEBUG=1 conftest.c >&5
conftest.c:166:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
  166 | main ()
      | ^~~~

I can fix that by adjusting NOTEST_CFLAGS, as in:

https://github.com/apache/apr/commit/74ce8717319e28a9f5d52602b75258bdebf91708.patch

which seems probably right, except it maybe will affect what is exported 
in the apr-N-config script (etc)?

Regards, Joe


> 
> This happens because `./configure` always stumbles on warning:
> 
> configure:3350: gcc -c -g -O2 -Werror  conftest.c >&5
> In file included from conftest.c:31:
> confdefs.h:22: error: "__STDC_WANT_IEC_60559_ATTRIBS_EXT__" redefined [-Werror]
>    22 | #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
>       |
> 
> It's triggered by double inclusion of `"confdefs.h"` contents:
> explicitly in `APR_TRY_COMPILE_NO_WARNING` macro and implicitly
> via `AC_LANG_SOURCE` use.
> 
> To fix it and avoid having to define `main()` declaration the change
> uses `AC_LANG_PROGRAM` instead.
> 
> Tested on both `autoconf-2.69` and `autoconf-2.69d`.
> 
> 
> Github: closes #25
> Submitted by: Sergei Trofimovich <slyfox gentoo.org>
> Reviewed by: ylavic
> 
> Modified:
>     apr/apr/trunk/build/apr_common.m4
> 
> Modified: apr/apr/trunk/build/apr_common.m4
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/apr_common.m4?rev=1887279&r1=1887278&r2=1887279&view=diff
> ==============================================================================
> --- apr/apr/trunk/build/apr_common.m4 (original)
> +++ apr/apr/trunk/build/apr_common.m4 Sat Mar  6 22:20:59 2021
> @@ -467,13 +467,9 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
>     CFLAGS="$CFLAGS -Werror"
>   fi
>   AC_COMPILE_IFELSE(
> -  [AC_LANG_SOURCE(
> -   [#include "confdefs.h"
> -   ]
> -   [[$1]]
> -   [int main(int argc, const char *const *argv) {]
> +  [AC_LANG_PROGRAM(
> +   [[$1]],
>     [[$2]]
> -   [   return 0; }]
>    )], [CFLAGS=$apr_save_CFLAGS
>  $3],  [CFLAGS=$apr_save_CFLAGS
>  $4])
> 
>