Blob Blame History Raw
commit 6414681ae99d6a0f460f827648f114aa3cb2e419
Author: Sam James <sam@gentoo.org>
Date:   Wed Nov 16 23:10:45 2022 +0000

    configure: fix -Wimplicit-function-declaration, -Wstrict-prototypes

    Clang 16 makes -Wimplicit-function-declaration an error by default. Unfortunately,
    this can lead to misconfiguration or miscompilation of software as configure
    tests may then return the wrong result.

    For more information, see LWN.net [0] or LLVM's Discourse [1], the Gentoo wiki [2],
    or the (new) c-std-porting mailing list [3].

    [0] https://lwn.net/Articles/913505/
    [1] https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213
    [2] https://wiki.gentoo.org/wiki/Modern_C_porting
    [3] hosted at lists.linux.dev.

    Signed-off-by: Sam James <sam@gentoo.org>

diff --git a/configure b/configure
index 26824f98bfdf03dc..bf445048a8b00398 100755
--- a/configure
+++ b/configure
@@ -5021,12 +5021,13 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include<stdio.h>
-#include<libnet.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <libnet.h>
 #define HOPE_MAJOR  1
 #define HOPE_MEDIUM 1
 #define HOPE_MINOR  2
-int main()
+int main(void)
 {
   unsigned int major,medium,minor,current, desired;
   desired = HOPE_MAJOR*10000 + HOPE_MEDIUM*100 + HOPE_MINOR;
@@ -5607,9 +5608,9 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include <stdio.h>
+#include <stdlib.h>
 #include <features.h>
-int main()
+int main(void)
 {
 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 0
    exit(0);
@@ -6213,7 +6214,7 @@ $as_echo "Please note that some screen refreshs may fail" >&6; }
 $as_echo_n "checking for ncurses version... " >&6; }
 	ncurses_version=unknown
 cat > conftest.$ac_ext <<EOF
-#line 6204 "configure"
+#line 6205 "configure"
 #include "confdefs.h"
 #ifdef RENAMED_NCURSES
 #include <curses.h>
diff --git a/configure.in b/configure.in
index e796198df53021e7..2aaf671cd5dc26d6 100644
--- a/configure.in
+++ b/configure.in
@@ -218,12 +218,13 @@ dnl fi
 
 AC_MSG_CHECKING(if libnet is at least version 1.1.2)
 AC_TRY_RUN([
-#include<stdio.h>
-#include<libnet.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <libnet.h>
 #define HOPE_MAJOR  1
 #define HOPE_MEDIUM 1
 #define HOPE_MINOR  2
-int main()
+int main(void)
 {
   unsigned int major,medium,minor,current, desired;
   desired = HOPE_MAJOR*10000 + HOPE_MEDIUM*100 + HOPE_MINOR;
@@ -404,9 +405,9 @@ AC_CHECK_FUNCS(strerror_r, have_strerror_r=yes,have_strerror_r=no)
 if test $have_strerror_r = yes; then
 AC_MSG_CHECKING(if strerror_r is on glibc version >= 2.0)
 AC_TRY_RUN([
-#include <stdio.h>
+#include <stdlib.h>
 #include <features.h>
-int main()
+int main(void)
 {
 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 0
    exit(0);