bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sr #110660] AC_LANG_INT_SAVE (used by AC_CHECK_SIZEOF) includes stdlib.


From: Alain Knaff
Subject: [sr #110660] AC_LANG_INT_SAVE (used by AC_CHECK_SIZEOF) includes stdlib.h without checking whether it actually exists
Date: Tue, 17 May 2022 14:15:03 -0400 (EDT)

URL:
  <https://savannah.gnu.org/support/?110660>

                 Summary: AC_LANG_INT_SAVE (used by AC_CHECK_SIZEOF) includes
stdlib.h without checking whether it actually exists
                 Project: Autoconf
            Submitted by: alainknaff
            Submitted on: Tue 17 May 2022 08:15:00 PM CEST
                Category: None
                Priority: 5 - Normal
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None

    _______________________________________________________

Details:

if stdlib.h doesn't exist, AC_CHECK_SIZEOF(size_t) fails with 

conftest.c:80: stdlib.h: No such file or directory
configure:5433: error: cannot compute sizeof (size_t)



Code quoted in config.log includes the following:

...
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| static long int longval () { return (long int) (sizeof (size_t)); }
| static unsigned long int ulongval () { return (long int) (sizeof (size_t));
}
| #include <stdio.h>
| #include <stdlib.h>
| int
| main ()
| {
| 
|   FILE *f = fopen ("conftest.val", "w");
|   if (! f)
|     return 1;
|   if (((long int) (sizeof (size_t))) < 0)
|     {
|       long int i = longval ();
|       if (i != ((long int) (sizeof (size_t))))
|       return 1;
|       fprintf (f, "%ld", i);
|     }
|   else
|     {
|       unsigned long int i = ulongval ();
|       if (i != ((long int) (sizeof (size_t))))
|       return 1;
|       fprintf (f, "%lu", i);
|     }
|   /* Do not output a trailing newline, as this causes \r\n confusion
|      on some platforms.  */
|   return ferror (f) || fclose (f) != 0;
...

As you see, most includes are correctly protected by #ifdef HAVE_*, except
stdio.h and stdlib.h

This fails if stdlib.h doesn't actually exist. Most other tests until then run
fine (AC_CHECK_LIB, AC_CHECK_HEADERS, AC_CHECK_TYPES).

N.B. I _do_ have AC_CHECK_HEADERS(stdlib.h) early in my configure.in, it
correctly determines that stdlib.h doesn't exist, but that result is not used
by AC_LANG_INT_SAVE





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?110660>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]