Re: Porting the configure script to C99

Thomas Dickey <[email protected]>
Newsgroups gmane.comp.web.lynx.devel
Message-ID <[email protected]>
On Fri, Dec 02, 2022 at 04:04:32PM +0100, Florian Weimer wrote:
> We're trying to build Fedora with a strict(er) C99 compiler:
> 
>   <https://fedoraproject.org/wiki/Changes/PortingToModernC>
>   <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
> 
> Testing I dentified a couple of issues in the lynx configure script
> (version 2.9.0dev.10 I believe):
> 
> diff --git a/aclocal.m4 b/aclocal.m4
> index 70cde243d2129cc0..bf2cbff661de2fe1 100644
> --- a/aclocal.m4
> +++ b/aclocal.m4
> @@ -6435,6 +6435,7 @@ AC_CACHE_CHECK(if we can include termio.h with curses,cf_cv_termio_and_curses,[
>      CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -I. -I${srcdir:-.} -I${srcdir:-.}/src -I${srcdir:-.}/WWW/Library/Implementation"
>      touch lynx_cfg.h
>      AC_TRY_COMPILE([
> +#include <stdio.h>

thanks.

>  #include <$1>
>  #include <termio.h>],
>      [putchar(0x0a)],
> @@ -6455,6 +6456,7 @@ AC_DEFUN([CF_TERMIO_AND_TERMIOS],
>  AC_MSG_CHECKING([termio.h and termios.h])
>  AC_CACHE_VAL(cf_cv_termio_and_termios,[
>      AC_TRY_COMPILE([
> +#include <stdio.h>

ok.

>  #if HAVE_TERMIO_H
>  #include <termio.h>
>  #endif
> diff --git a/configure b/configure
> index 97f6d1d5646d05c5..6db52b514b3b9a3c 100755
> --- a/configure
> +++ b/configure
> @@ -31122,6 +31122,7 @@ else
>  #line 31122 "configure"
>  #include "confdefs.h"
>  
> +#include <stdio.h>
>  #if HAVE_TERMIO_H
>  #include <termio.h>
>  #endif
> @@ -31629,6 +31630,9 @@ else
>  #line 31629 "configure"
>  #include "confdefs.h"
>  /* Thanks to Mike Rendell for this test.  */
> +#if HAVE_UNISTD_H
> +# include <unistd.h>
> +#endif

"middle chunk" is referring to this, I suppose.

AC_INCLUDES_DEFAULT includes a lot of headers, not just this one.

what problem does that #include solve?

>  #include <sys/types.h>
>  #define NGID 256
>  #undef MAX
> @@ -47492,6 +47496,7 @@ else
>  #line 47492 "configure"
>  #include "confdefs.h"
>  
> +#include <stdio.h>

...shouldn't be needed, since both curses.h and slang.h include stdio.h
(LYCurses.h includes one or the other, as well as HTUtils.h)

>  #include <LYCurses.h>
>  #include <termio.h>
>  int
> 
> The middle hunk in the configure patch is fixed in later autoconf
> releases, it's not something that comes from aclocal.m4 or configure.in.
> 
> I'm sharing this here for the benefit of other distributions working on
> similar projects.
> 
> Thanks,
> Florian
> 
> 

-- 
Thomas E. Dickey <[email protected]>
https://invisible-island.net
ftp://ftp.invisible-island.net
signature.asc (application/pgp-signature, 659 B)
-----BEGIN PGP SIGNATURE-----

iQGzBAABCgAdFiEEGYgtkt2kxADCLA1WzCr0RyFnvgMFAmOKcesACgkQzCr0RyFn
vgMXfgv8DywdqjgLKMPaqKPwoedHsiB1ZNry8c/0Lbcc9QWZSn4hWgRJ7+L7iNI9
KX+IjovG4/benoKTjB+F/S9/crNDqjJnjWAmRI3H0eWztF/t3e4W8pscFCiSiCDZ
6jk80dRo6nZHZ7xuulKGZtSEy2RePiHrUs9MkOlzvnm93PZD8wompyYiyJjB6qOe
a0n7ZZxrTuBv1e3g44eRGXqpt0hVzpsayXxWjZnggtHs8ZjSLk67e5hNtOTwEj8U
zWAze8Eso3fm24UG3uLV/WlZkTahcA0HV4jYhflVm+DiaqLVJzLv0v1AnYBObl2M
Xe+Pdl5x3rHTv+cF+aDiWyw8St3nLTIcRO7ZniNtHEMi8zPu16/y8QuODBcijJut
vxTLxud+1Ckfw2UwJADl3uO6FEb18leEvXABHuS89XhMqHYFDwaZQ2RYTouBpdGg
M+DCL2zK9Cz7VHY8v/NwSUusOjCTZvxFKg2r/XxmK+xWayfEiencKSN9avVB3p47
0K/cUouC
=zrFt
-----END PGP SIGNATURE-----
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.