[File] [PATCH] Fix implicit function declarations in configure with Clang 15
Sam James
sam at gentoo.org
Sun Sep 11 16:15:52 UTC 2022
configure gives the following warnings with Clang 15
(which makes implicit function declaraitons errors
by default):
```
-warning: implicit declaration of function 'atoi' is invalid in C99 [-Wimplicit-function-declaration]
+error: call to undeclared function 'atoi'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
atoi(daylight);
```
Include <stdlib.h> to avoid the error.
---
acinclude.m4 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/acinclude.m4 b/acinclude.m4
index 77b63ff5..edcafed3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -38,7 +38,8 @@ fi
AC_CHECK_DECLS([daylight], , , [#include <time.h>])
AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
[AC_LINK_IFELSE(
-[AC_LANG_PROGRAM([#include <time.h>],
+[AC_LANG_PROGRAM([#include <time.h>
+#include <stdlib.h>],
[#if !HAVE_DECL_DAYLIGHT
extern int daylight;
#endif
--
2.37.3
More information about the File
mailing list