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 11:16:32PM +0100, Florian Weimer wrote:
> * Thomas Dickey:
> 
> >> 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?
> 
> Our configure says this at the top: “Generated by Autoconf
> 2.52.20210509.”  I don't think it uses AC_INCLUDES_DEFAULT yet, it
> seems:

I was actually talking about the "newer" version of autoconf.

But it's simple to add.
 
> | configure: failed program was:
> | #line 31629 "configure"
> | #include "confdefs.h"
> | /* Thanks to Mike Rendell for this test.  */
> | #include <sys/types.h>
> | #define NGID 256
> | #undef MAX
> | #define MAX(x, y) ((x) > (y) ? (x) : (y))
> | 
> | int
> | main (void)
> | {
> |   gid_t gidset[NGID];
> |   int i, n;
> |   union { gid_t gval; long lval; }  val;
> | 
> |   val.lval = -1;
> |   for (i = 0; i < NGID; i++)
> |     gidset[i] = val.gval;
> |   n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
> |                  gidset);
> |   /* Exit non-zero if getgroups seems to require an array of ints.  This
> |      happens when gid_t is short but getgroups modifies an array of ints.  */
> |   return ((n > 0 && gidset[n] != val.gval) ? 1 : 0);
> | }
> 
> Full build log is here:
> 
>   <https://gitlab.com/fweimer-rh/fedora-modernc-logs/-/blob/fbf287fbe1e977fad4ef23390174e6f6d584f5c7/logs/l/lynx.log>
> 
> >>  #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)
> 
> Okay, my mistake, but the first putchar change *is* needed:

sounds good.  Actually this report is like another which talks about tgoto
and arc4random (which I intended fixing).  I'll have some improvements
in this area for dev.11 (changing those requires testing in different
configurations -- unlike these).
 
> | configure: In function 'main':
> | configure:31133:1: error: implicit declaration of function 'putchar'
> | 31133 | {
> |       | ^      
> | configure:31143: $? = 1
> | configure: failed program was:
> | #line 31122 "configure"
> | #include "confdefs.h"
> | 
> | #if HAVE_TERMIO_H
> | #include <termio.h>
> | #endif
> | #if HAVE_TERMIOS_H
> | #include <termios.h>
> | #endif
> | int
> | main (void)
> | {
> | putchar (0x0a)
> |   ;
> |   return 0;
> | }
> 
> 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-----

iQGzBAABCgAdFiEEGYgtkt2kxADCLA1WzCr0RyFnvgMFAmOKowkACgkQzCr0RyFn
vgO4LwwAyXV2W3C3rNRIrb+t0NzqRe0AplISJhRoqZamKqVS9ceni4pEyjeRDcOw
+J+JVqXIryVm0CvI3jZQ5iQwM4lGqvxXVHH7JjZZY2lrUAkVWPj2SReHn8SpkGeV
0P1kptpwsMtzTQG01yRE5+f+A8HzN5bIeLVNQoUuAIasrao9xK8EJ6i5jJrAL4wL
bQBWM5nlUvtYggqcx8SRnYuL2SQJj7ldDLtbIxpiX5S68iUzVikcOtiyHpoScylM
I4lYp/Douz+oziMjIDuYC7rYlCIoVGp576ZcsEoeEEQfISuCBVGjQgAz4MB70igH
OyDsKWzn2QyCLTKH+06r/76LXEHdzaYTugQkRg73sydsxzSGWHQ2QOT6jBL11G8i
at05OXwIdyo2vvXD3w9KNKoKAs03qE+lIXGV1s9Sd8jIQLdd32GRBgVedzezClZ/
+B2/ZxdESqMzX9Gj5NwhtlS750hjN+kOJgu3f+2zd82zBwnz/6Zrwwy0XdSMaGFb
AcMhE+z3
=5H1f
-----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.