summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-11-03 01:21:36 +0000
committerSam James <sam@gentoo.org>2022-11-03 01:23:35 +0000
commitc305a45884a8f01838d6e032f469d7f9423154e1 (patch)
treedf4406378b04e176352e5730575db3665b6f10a6 /sys-devel/autoconf
parentdev-python/yamlpath: add 3.6.8 (diff)
downloadgentoo-c305a45884a8f01838d6e032f469d7f9423154e1.tar.gz
gentoo-c305a45884a8f01838d6e032f469d7f9423154e1.tar.bz2
gentoo-c305a45884a8f01838d6e032f469d7f9423154e1.zip
sys-devel/autoconf: further Clang 16 patches for autoconf 2.13
Reported by matsl when building XEmacs 21.4 (21.5 - which is WIP - works with newer autoconf). A bunch of the built-in/provided tests from autoconf 2.13 suffered from -Wimplicit-int or -Wimplicit-function-declaration. We also disable the {get,set}pgrp tests (see the patch for details, but the gist is they're unfixable without some substantial effort on POSIX systems nowadays and there's no need anyway -- they're gone in newer autoconf and we never expect them to fail.) Bug: https://bugs.gentoo.org/874366 Reported-by: Mats Lidell <matsl@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-devel/autoconf')
-rw-r--r--sys-devel/autoconf/autoconf-2.13-r4.ebuild (renamed from sys-devel/autoconf/autoconf-2.13-r3.ebuild)1
-rw-r--r--sys-devel/autoconf/files/autoconf-2.13-Clang-16-fixes-for-various-tests.patch243
2 files changed, 244 insertions, 0 deletions
diff --git a/sys-devel/autoconf/autoconf-2.13-r3.ebuild b/sys-devel/autoconf/autoconf-2.13-r4.ebuild
index 45a43a49c6f8..3593b3e30269 100644
--- a/sys-devel/autoconf/autoconf-2.13-r3.ebuild
+++ b/sys-devel/autoconf/autoconf-2.13-r4.ebuild
@@ -32,6 +32,7 @@ PATCHES=(
"${FILESDIR}"/${P}-test-fixes.patch #146592
"${FILESDIR}"/${P}-perl-5.26.patch
"${FILESDIR}"/${P}-K-R-decls-clang.patch
+ "${FILESDIR}"/${P}-Clang-16-fixes-for-various-tests.patch
)
src_configure() {
diff --git a/sys-devel/autoconf/files/autoconf-2.13-Clang-16-fixes-for-various-tests.patch b/sys-devel/autoconf/files/autoconf-2.13-Clang-16-fixes-for-various-tests.patch
new file mode 100644
index 000000000000..b9319f0a4b71
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.13-Clang-16-fixes-for-various-tests.patch
@@ -0,0 +1,243 @@
+From de47e22d9b4f5fd5f1c9b9de798218a46ef94b98 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Thu, 3 Nov 2022 01:19:39 +0000
+Subject: [PATCH] Clang 16 fixes for various tests
+
+Fixes -Wimplicit-int and -Wimplicit-function-declaration
+issues in various built-in tests.
+
+Noticed when building XEmacs 21.4 (thanks to matsl for reporting).
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/acgeneral.m4
++++ b/acgeneral.m4
+@@ -1988,6 +1988,7 @@ changequote([, ])dnl
+ AC_MSG_CHECKING(size of $1)
+ AC_CACHE_VAL(AC_CV_NAME,
+ [AC_TRY_RUN([#include <stdio.h>
++#include <stdlib.h>
+ main(void)
+ {
+ FILE *f=fopen("conftestval", "w");
+--- a/acspecific.m4
++++ b/acspecific.m4
+@@ -706,6 +706,7 @@ fi
+ if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ AC_TRY_RUN([#include <ctype.h>
++#include <stdlib.h>
+ #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+ #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+ #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+@@ -819,6 +820,7 @@ esac
+
+ AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
+ [AC_TRY_RUN([#include <sys/types.h>
++#include <stdlib.h>
+ #include <$ac_header_dirent>
+ int closedir(...); int main(void) { exit(closedir(opendir(".")) != 0); }],
+ ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)])
+@@ -988,6 +990,7 @@ AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
+ [AC_REQUIRE([AC_HEADER_DIRENT])dnl
+ AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
+ [AC_TRY_RUN([#include <sys/types.h>
++#include <stdlib.h>
+ #include <$ac_header_dirent>
+ int closedir(...); int main(void) { exit(closedir(opendir(".")) != 0); }],
+ ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)])
+@@ -1038,6 +1041,7 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
+ #include <sys/types.h>
+ #include <fcntl.h>
+ #include <sys/mman.h>
++#include <stdlib.h>
+
+ /* This mess was copied from the GNU getpagesize.h. */
+ #ifndef HAVE_GETPAGESIZE
+@@ -1165,49 +1169,17 @@ AC_DEFUN(AC_FUNC_GETPGRP,
+ *
+ * Snarfed from Chet Ramey's bash pgrp.c test program
+ */
+-#include <stdio.h>
+-#include <sys/types.h>
+-
+-int pid;
+-int pg1, pg2, pg3, pg4;
+-int ng, np, s, child;
++#include <stdlib.h>
+
+ int main(void)
+ {
+- pid = getpid();
+- pg1 = getpgrp(0);
+- pg2 = getpgrp();
+- pg3 = getpgrp(pid);
+- pg4 = getpgrp(1);
+-
+- /*
+- * If all of these values are the same, it's pretty sure that
+- * we're on a system that ignores getpgrp's first argument.
+- */
+- if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3)
+- exit(0);
+-
+- child = fork();
+- if (child < 0)
+- exit(1);
+- else if (child == 0) {
+- np = getpid();
+- /*
+- * If this is Sys V, this will not work; pgrp will be
+- * set to np because setpgrp just changes a pgrp to be
+- * the same as the pid.
+- */
+- setpgrp(np, pg1);
+- ng = getpgrp(0); /* Same result for Sys V and BSD */
+- if (ng == pg1) {
+- exit(1);
+- } else {
+- exit(0);
+- }
+- } else {
+- wait(&s);
+- exit(s>>8);
+- }
++ /* XXX: Gentoo: This function used to check for
++ BSD vs POSIX getpgrp but the test fails to compile
++ on modern POSIX systems when not relying on implicit
++ function declarations. It has no value anyway on such
++ systems and it's been removed in newer autoconf.
++ */
++ exit(0);
+ }
+ ], ac_cv_func_getpgrp_void=yes, ac_cv_func_getpgrp_void=no,
+ AC_MSG_ERROR(cannot check getpgrp if cross compiling))
+@@ -1220,9 +1192,7 @@ fi
+ AC_DEFUN(AC_FUNC_SETPGRP,
+ [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
+ AC_TRY_RUN([
+-#ifdef HAVE_UNISTD_H
+-#include <unistd.h>
+-#endif
++#include <stdlib.h>
+
+ /*
+ * If this system has a BSD-style setpgrp, which takes arguments, exit
+@@ -1230,10 +1200,13 @@ AC_TRY_RUN([
+ */
+ int main(void)
+ {
+- if (setpgrp(1,1) == -1)
+- exit(0);
+- else
+- exit(1);
++ /* XXX: Gentoo: This function used to check for
++ BSD vs POSIX gsetpgrp but the test fails to compile
++ on modern POSIX systems when not relying on implicit
++ function declarations. It has no value anyway on such
++ systems and it's been removed in newer autoconf.
++ */
++ exit(1);
+ }
+ ], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
+ AC_MSG_ERROR(cannot check setpgrp if cross compiling))
+@@ -1255,9 +1228,11 @@ AC_DEFUN(AC_FUNC_VFORK,
+ AC_CHECK_HEADER(vfork.h, AC_DEFINE(HAVE_VFORK_H))
+ AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
+ [AC_TRY_RUN([/* Thanks to Paul Eggert for this test. */
++#include <stdlib.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <sys/wait.h>
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+@@ -1270,7 +1245,7 @@ AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
+ but some compilers (e.g. gcc -O) don't grok <vfork.h>.
+ Test for this by using a static variable whose address
+ is put into a register that is clobbered by the vfork. */
+-static
++static void
+ #ifdef __cplusplus
+ sparc_address_test (int arg)
+ #else
+@@ -1359,6 +1334,7 @@ AC_DEFUN(AC_FUNC_WAIT3,
+ #include <sys/time.h>
+ #include <sys/resource.h>
+ #include <stdio.h>
++#include <stdlib.h>
+ /* HP-UX has wait3 but does not fill in rusage at all. */
+ int main(void) {
+ struct rusage r;
+@@ -1582,6 +1558,7 @@ AC_DEFUN(AC_FUNC_UTIME_NULL,
+ # Sequent interprets utime(file, 0) to mean use start of epoch. Wrong.
+ AC_TRY_RUN([#include <sys/types.h>
+ #include <sys/stat.h>
++#include <stdlib.h>
+ int main(void) {
+ struct stat s, t;
+ exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0
+@@ -1598,6 +1575,7 @@ fi
+ AC_DEFUN(AC_FUNC_STRCOLL,
+ [AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,
+ [AC_TRY_RUN([#include <string.h>
++#include <stdlib.h>
+ int main (void)
+ {
+ exit (strcoll ("abc", "def") >= 0 ||
+@@ -1614,6 +1592,7 @@ AC_DEFUN(AC_FUNC_SETVBUF_REVERSED,
+ [AC_CACHE_CHECK(whether setvbuf arguments are reversed,
+ ac_cv_func_setvbuf_reversed,
+ [AC_TRY_RUN([#include <stdio.h>
++#include <stdlib.h>
+ /* If setvbuf has the reversed format, exit 0. */
+ int main (void) {
+ /* This call has the arguments reversed.
+@@ -1646,7 +1625,8 @@ LIBS="-lintl $LIBS"])])])
+
+ AC_DEFUN(AC_FUNC_MEMCMP,
+ [AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean,
+-[AC_TRY_RUN([
++[AC_TRY_RUN([#include <stdlib.h>
++#include <string.h>
+ int main(void)
+ {
+ char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+@@ -1805,6 +1785,7 @@ AC_TRY_RUN(
+ #if !defined(__STDC__) || __STDC__ != 1
+ #define volatile
+ #endif
++#include <stdlib.h>
+ int main(void) {
+ volatile char c = 255; exit(c < 0);
+ }], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)
+@@ -1819,7 +1800,8 @@ AC_DEFUN(AC_C_LONG_DOUBLE,
+ [if test "$GCC" = yes; then
+ ac_cv_c_long_double=yes
+ else
+-AC_TRY_RUN([int main(void) {
++AC_TRY_RUN([#include <stdlib.h>
++int main(void) {
+ /* The Stardent Vistra knows sizeof(long double), but does not support it. */
+ long double foo = 0.0;
+ /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
+@@ -1834,7 +1816,8 @@ fi
+ AC_DEFUN(AC_INT_16_BITS,
+ [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(int)])dnl
+ AC_MSG_CHECKING(whether int is 16 bits)
+-AC_TRY_RUN([int main(void) { exit(sizeof(int) != 2); }],
++AC_TRY_RUN([#include <stdlib.h>
++int main(void) { exit(sizeof(int) != 2); }],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE(INT_16_BITS)], AC_MSG_RESULT(no))
+ ])
+@@ -1842,7 +1825,8 @@ AC_TRY_RUN([int main(void) { exit(sizeof(int) != 2); }],
+ AC_DEFUN(AC_LONG_64_BITS,
+ [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(long)])dnl
+ AC_MSG_CHECKING(whether long int is 64 bits)
+-AC_TRY_RUN([int main(void) { exit(sizeof(long int) != 8); }],
++AC_TRY_RUN([#include <stdlib.h>
++int main(void) { exit(sizeof(long int) != 8); }],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE(LONG_64_BITS)], AC_MSG_RESULT(no))
+ ])