aide/aide-configure-c99-3.patch

61 lines
2.0 KiB
Diff
Raw Normal View History

Mostly equivalent to this upstream commit:
commit 601113f8a57c8f195af09bb2f14123449fa6bded
Author: Sam James <sam@gentoo.org>
Date: Fri Nov 18 00:04:53 2022 +0000
Fix configure.ac compatibility with Clang 16
Clang 16 makes -Wimplicit-function-declaration and -Wimplicit-int errors by default.
Unfortunately, this can lead to misconfiguration or miscompilation of software as configure
tests may then return the wrong result.
We also fix -Wstrict-prototypes while here as it's easy to do and it prepares
us for C23.
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.
Bug: https://bugs.gentoo.org/881707
Signed-off-by: Sam James <sam@gentoo.org>
diff --git a/configure.ac b/configure.ac
index 144d55a9146548c0..e74911535ddd015f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -279,7 +279,10 @@ AC_CHECK_FUNCS(fcntl ftruncate posix_fadvise asprintf snprintf \
AC_CACHE_CHECK([for open/O_NOATIME], db_cv_open_o_noatime, [
echo "test for working open/O_NOATIME" > __o_noatime_file
AC_TRY_RUN([
+#include <stdlib.h>
#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include <fcntl.h>
#ifndef O_NOATIME
#if defined(__linux__) && (defined(__i386__) || defined(__PPC__))
@@ -288,12 +291,15 @@ AC_TRY_RUN([
#define O_NOATIME 0
#endif
#endif
-main() {
+int main() {
int c, fd = open("__o_noatime_file", O_RDONLY | O_NOATIME, 0);
exit ((!O_NOATIME) || (fd == -1) || (read(fd, &c, 1) != 1));
}], [db_cv_open_o_noatime=yes], [db_cv_open_o_noatime=no],
AC_TRY_LINK([
-#include <sys/types.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include <fcntl.h>
#ifndef O_NOATIME
#if defined(__linux__) && (defined(__i386__) || defined(__PPC__))