summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-09-19 17:07:54 +0100
committerSam James <sam@gentoo.org>2022-09-19 17:26:40 +0100
commit79c0b97504177b9ee374e3d96af8b03349b86d12 (patch)
tree578ca3bb890d39d495f11ac72ddea0d824f34086 /sys-devel/autoconf
parentsys-devel/autoconf: backport K&R decls fix to 2.71 (diff)
downloadgentoo-79c0b97504177b9ee374e3d96af8b03349b86d12.tar.gz
gentoo-79c0b97504177b9ee374e3d96af8b03349b86d12.tar.bz2
gentoo-79c0b97504177b9ee374e3d96af8b03349b86d12.zip
sys-devel/autoconf: backport K&R decls fix to 2.69
Backport the K&R decls fix to 2.69 to avoid configure tests failing (often "silently", i.e. doesn't fail the build of the package overall, just leads to wrong results) with newer compilers like the upcoming Clang 16. A consequence of this whole fuss is that we're going to have to eautoreconf in a bunch of older packages, but as Ionen pointed out on IRC, this means we get some other stuff for free like Python 3.10 fixes, so it's not all bad. Undecided how to handle any packages with a generated configure from autoconfs not in tree. We may just patch the configure manually. Will see. See linked bug 870412 and the Discourse thread therein for details if unfamiliar. As I remarked on IRC, it's unfortunate to have to backport anything which will then infect generated configure, as it's somewhat a repeat of the --runstatedir situation, and it leads to confusion/hassle when sending patches upstream where a generated/bootstrapped configure is required. But this is different - it's a (serious) bug being fixed rather than a gratuitous (although) understandable given we weren't sure if we'd ever see another autoconf release backport of a new feature. Bug: https://bugs.gentoo.org/806376 Bug: https://bugs.gentoo.org/870412 Thanks-to: Arsen Arsenovic <arsen@aarsen.me> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-devel/autoconf')
-rw-r--r--sys-devel/autoconf/autoconf-2.69-r7.ebuild63
-rw-r--r--sys-devel/autoconf/files/autoconf-2.69-K-R-decls-clang.patch387
2 files changed, 450 insertions, 0 deletions
diff --git a/sys-devel/autoconf/autoconf-2.69-r7.ebuild b/sys-devel/autoconf/autoconf-2.69-r7.ebuild
new file mode 100644
index 000000000000..cb848359043b
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.69-r7.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+if [[ ${PV} == 9999 ]] ; then
+ EGIT_REPO_URI="https://git.savannah.gnu.org/git/autoconf.git"
+ inherit git-r3
+else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
+ ftp://alpha.gnu.org/pub/gnu/${PN}/${P}.tar.xz
+ https://dev.gentoo.org/~polynomial-c/dist/${P}-runstatedir_patches.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+inherit toolchain-autoconf
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="https://www.gnu.org/software/autoconf/autoconf.html"
+
+LICENSE="GPL-3"
+SLOT="${PV}"
+IUSE="emacs"
+
+BDEPEND="
+ >=sys-devel/m4-1.4.16
+ >=dev-lang/perl-5.6
+"
+RDEPEND="
+ ${BDEPEND}
+ >=sys-devel/autoconf-wrapper-13
+ !~sys-devel/${P}:2.5
+"
+
+[[ ${PV} == 9999 ]] && BDEPEND+=" >=sys-apps/texinfo-4.3"
+
+PDEPEND="emacs? ( app-emacs/autoconf-mode )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.69-perl-5.26.patch
+ "${FILESDIR}"/${P}-fix-libtool-test.patch
+ "${FILESDIR}"/${PN}-2.69-perl-5.26-2.patch
+ "${FILESDIR}"/${P}-make-tests-bash5-compatible.patch
+ "${FILESDIR}"/${P}-K-R-decls-clang.patch
+
+ "${WORKDIR}"/patches/${P}-texinfo.patch
+)
+
+src_prepare() {
+ # usr/bin/libtool is provided by binutils-apple, need gnu libtool
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ PATCHES+=( "${FILESDIR}"/${PN}-2.61-darwin.patch )
+ fi
+
+ # Save timestamp to avoid later makeinfo call
+ touch -r doc/{,old_}autoconf.texi || die
+
+ toolchain-autoconf_src_prepare
+
+ # Restore timestamp to avoid makeinfo call
+ # We already have an up to date autoconf.info page at this point.
+ touch -r doc/{old_,}autoconf.texi || die
+}
diff --git a/sys-devel/autoconf/files/autoconf-2.69-K-R-decls-clang.patch b/sys-devel/autoconf/files/autoconf-2.69-K-R-decls-clang.patch
new file mode 100644
index 000000000000..c0ae05540146
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.69-K-R-decls-clang.patch
@@ -0,0 +1,387 @@
+https://bugs.gentoo.org/870412
+https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=8b5e2016c7ed2d67f31b03a3d2e361858ff5299b
+
+Backport the K&R decls fix to 2.69 to avoid configure tests
+failing (often "silently", i.e. doesn't fail the build of
+the package overall, just leads to wrong results) with
+newer compilers like the upcoming Clang 16.
+
+From e6f401b94b58bb9bb58cd668a996e27663d3e6c7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= <arsen@aarsen.me>
+Date: Mon, 19 Sep 2022 12:11:24 +0200
+Subject: [PATCH] backport K&R decl fixes
+
+--- a/doc/autoconf.texi
++++ b/doc/autoconf.texi
+@@ -5201,9 +5201,7 @@ the @samp{#undef malloc}):
+ #include <config.h>
+ #undef malloc
+
+-#include <sys/types.h>
+-
+-void *malloc ();
++#include <stdlib.h>
+
+ /* Allocate an N-byte block of memory from the heap.
+ If N is zero, allocate a 1-byte block. */
+@@ -8057,7 +8055,7 @@ needed:
+ # ifdef __cplusplus
+ extern "C"
+ # endif
+- int F77_DUMMY_MAIN () @{ return 1; @}
++ int F77_DUMMY_MAIN (void) @{ return 1; @}
+ #endif
+ @end example
+
+--- a/lib/autoconf/c.m4
++++ b/lib/autoconf/c.m4
+@@ -97,7 +97,7 @@ m4_define([AC_LANG_PROGRAM(C)],
+ m4_ifdef([_AC_LANG_PROGRAM_C_F77_HOOKS], [_AC_LANG_PROGRAM_C_F77_HOOKS])[]dnl
+ m4_ifdef([_AC_LANG_PROGRAM_C_FC_HOOKS], [_AC_LANG_PROGRAM_C_FC_HOOKS])[]dnl
+ int
+-main ()
++main (void)
+ {
+ dnl Do *not* indent the following line: there may be CPP directives.
+ dnl Don't move the `;' right after for the same reason.
+@@ -130,7 +130,7 @@ m4_if([$2], [main], ,
+ #ifdef __cplusplus
+ extern "C"
+ #endif
+-char $2 ();])], [return $2 ();])])
++char $2 (void);])], [return $2 ();])])
+
+
+ # AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
+@@ -154,7 +154,7 @@ m4_define([AC_LANG_FUNC_LINK_TRY(C)],
+ #define $1 innocuous_$1
+
+ /* System header to define __stub macros and hopefully few prototypes,
+- which can conflict with char $1 (); below.
++ which can conflict with char $1 (void); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+@@ -172,7 +172,7 @@ m4_define([AC_LANG_FUNC_LINK_TRY(C)],
+ #ifdef __cplusplus
+ extern "C"
+ #endif
+-char $1 ();
++char $1 (void);
+ /* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+@@ -201,8 +201,8 @@ return test_array @<:@0@:>@;
+ # But we include them only after the EXPRESSION has been evaluated.
+ m4_define([AC_LANG_INT_SAVE(C)],
+ [AC_LANG_PROGRAM([$1
+-static long int longval () { return $2; }
+-static unsigned long int ulongval () { return $2; }
++static long int longval (void) { return $2; }
++static unsigned long int ulongval (void) { return $2; }
+ @%:@include <stdio.h>
+ @%:@include <stdlib.h>],
+ [
+@@ -1625,8 +1625,8 @@ for ac_kw in inline __inline__ __inline; do
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [#ifndef __cplusplus
+ typedef int foo_t;
+-static $ac_kw foo_t static_foo () {return 0; }
+-$ac_kw foo_t foo () {return 0; }
++static $ac_kw foo_t static_foo (void) {return 0; }
++$ac_kw foo_t foo (void) {return 0; }
+ #endif
+ ])],
+ [ac_cv_c_inline=$ac_kw])
+@@ -1949,7 +1949,7 @@ m4_define([_AC_LANG_OPENMP(C)],
+ choke me
+ #endif
+ #include <omp.h>
+-int main () { return omp_get_num_threads (); }
++int main (void) { return omp_get_num_threads (); }
+ ])
+
+ # _AC_LANG_OPENMP(C++)
+--- a/lib/autoconf/functions.m4
++++ b/lib/autoconf/functions.m4
+@@ -463,9 +463,6 @@ AC_CACHE_CHECK([whether closedir returns void],
+ [ac_cv_func_closedir_void],
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
+ #include <$ac_header_dirent>
+-#ifndef __cplusplus
+-int closedir ();
+-#endif
+ ],
+ [[return closedir (opendir (".")) != 0;]])],
+ [ac_cv_func_closedir_void=no],
+@@ -893,7 +890,7 @@ AC_CACHE_CHECK([for GNU libc compatible malloc], ac_cv_func_malloc_0_nonnull,
+ [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+ # include <stdlib.h>
+ #else
+-char *malloc ();
++char *malloc (long);
+ #endif
+ ]],
+ [return ! malloc (0);])],
+@@ -1029,7 +1026,7 @@ static const char *tz_strings[] = {
+ /* Return 0 if mktime fails to convert a date in the spring-forward gap.
+ Based on a problem report from Andreas Jaeger. */
+ static int
+-spring_forward_gap ()
++spring_forward_gap (void)
+ {
+ /* glibc (up to about 1998-10-07) failed this test. */
+ struct tm tm;
+@@ -1066,7 +1063,7 @@ mktime_test (time_t now)
+ }
+
+ static int
+-irix_6_4_bug ()
++irix_6_4_bug (void)
+ {
+ /* Based on code from Ariel Faigon. */
+ struct tm tm;
+@@ -1108,7 +1105,7 @@ bigtime_test (int j)
+ }
+
+ static int
+-year_2050_test ()
++year_2050_test (void)
+ {
+ /* The correct answer for 2050-02-01 00:00:00 in Pacific time,
+ ignoring leap seconds. */
+@@ -1138,7 +1135,7 @@ year_2050_test ()
+ }
+
+ int
+-main ()
++main (void)
+ {
+ time_t t, delta;
+ int i, j;
+@@ -1232,7 +1229,7 @@ AC_CACHE_CHECK([for working mmap], [ac_cv_func_mmap_fixed_mapped],
+ #include <sys/mman.h>
+
+ #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
+-char *malloc ();
++char *malloc (void *, long);
+ #endif
+
+ /* This mess was copied from the GNU getpagesize.h. */
+@@ -1268,7 +1265,7 @@ char *malloc ();
+ #endif /* no HAVE_GETPAGESIZE */
+
+ int
+-main ()
++main (void)
+ {
+ char *data, *data2, *data3;
+ const char *cdata2;
+@@ -1398,7 +1395,7 @@ AC_CACHE_CHECK([for GNU libc compatible realloc], ac_cv_func_realloc_0_nonnull,
+ [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+ # include <stdlib.h>
+ #else
+-char *realloc ();
++char *realloc (void *, long);
+ #endif
+ ]],
+ [return ! realloc (0, 0);])],
+@@ -1547,11 +1544,8 @@ AC_DEFUN([AC_FUNC_STRTOD],
+ AC_CACHE_CHECK(for working strtod, ac_cv_func_strtod,
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ ]AC_INCLUDES_DEFAULT[
+-#ifndef strtod
+-double strtod ();
+-#endif
+ int
+-main()
++main(void)
+ {
+ {
+ /* Some versions of Linux strtod mis-parse strings with leading '+'. */
+@@ -1645,8 +1639,7 @@ AC_CACHE_CHECK([whether strerror_r returns char *],
+ # former has a strerror_r that returns char*, while the latter
+ # has a strerror_r that returns `int'.
+ # This test should segfault on the DEC system.
+- AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
+- extern char *strerror_r ();],
++ AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+ [[char buf[100];
+ char x = *strerror_r (0, buf, sizeof buf);
+ return ! isalpha (x);]])],
+@@ -1879,7 +1872,7 @@ sparc_address_test (arg) int arg;
+ }
+
+ int
+-main ()
++main (void)
+ {
+ pid_t parent = getpid ();
+ pid_t child;
+@@ -1985,7 +1978,7 @@ AC_CACHE_CHECK([for wait3 that fills in rusage],
+ #include <sys/wait.h>
+ /* HP-UX has wait3 but does not fill in rusage at all. */
+ int
+-main ()
++main (void)
+ {
+ struct rusage r;
+ int i;
+--- a/lib/autoconf/headers.m4
++++ b/lib/autoconf/headers.m4
+@@ -712,7 +712,7 @@ if test $ac_cv_header_stdc = yes; then
+
+ #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+ int
+-main ()
++main (void)
+ {
+ int i;
+ for (i = 0; i < 256; i++)
+--- a/lib/autoconf/specific.m4
++++ b/lib/autoconf/specific.m4
+@@ -257,7 +257,7 @@ void ucatch (dummy) int dummy; { }
+ #endif
+
+ int
+-main ()
++main (void)
+ {
+ int i = fork (), status;
+
+--- a/lib/autoconf/types.m4
++++ b/lib/autoconf/types.m4
+@@ -267,7 +267,7 @@ AC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups,
+ #define MAX(x, y) ((x) > (y) ? (x) : (y))
+
+ int
+-main ()
++main (void)
+ {
+ gid_t gidset[NGID];
+ int i, n;
+--- a/tests/c.at
++++ b/tests/c.at
+@@ -354,7 +354,7 @@ AT_DATA([foo.c],
+ #endif
+ #include <stdio.h>
+
+-int main ()
++int main (void)
+ {
+ #ifdef _OPENMP
+ #pragma omp parallel
+@@ -404,7 +404,7 @@ foo.@OBJEXT@: foo.cpp
+ ]])
+
+ AT_DATA([foo.cpp],
+-[[int main ()
++[[int main (void)
+ {
+ return 0;
+ }
+--- a/tests/compile.at
++++ b/tests/compile.at
+@@ -124,7 +124,7 @@ AC_PROG_CC
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef PACKAGE_NAME
+ choke me
+ #endif
+-int main ()
++int main (void)
+ {
+ return 0;
+ }
+@@ -150,7 +150,7 @@ AC_LANG([C++])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef PACKAGE_NAME
+ choke me
+ #endif
+-int main ()
++int main (void)
+ {
+ return 0;
+ }
+@@ -249,7 +249,7 @@ AT_CHECK([sed -n 's/ *$//; /#define PACKAGE/,$p' stdout], [],
+
+ const char hw[] = "Hello, World\n";
+ int
+-main ()
++main (void)
+ {
+ fputs (hw, stdout);
+ ;
+@@ -269,7 +269,7 @@ AT_KEYWORDS([AC_LANG_DEFINES_PROVIDED])
+
+ AT_DATA([configure.ac],
+ [[AC_INIT
+-AC_COMPILE_IFELSE([int main () { return 0; }], [],
++AC_COMPILE_IFELSE([int main (void) { return 0; }], [],
+ [AC_MSG_ERROR([compiling trivial program failed])])
+ ]])
+
+@@ -280,7 +280,7 @@ AT_CHECK_CONFIGURE([-q])
+
+ AT_DATA([configure.ac],
+ [[AC_INIT
+-AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED()int main () { return 0; }], [],
++AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED()int main (void) { return 0; }], [],
+ [AC_MSG_ERROR([compiling trivial program failed])])
+ ]])
+
+@@ -324,7 +324,7 @@ test $estatus != 2 &&
+ AC_MSG_ERROR([did not get as 2 exit status: $estatus])])
+
+ # The old stinky one.
+-AC_TRY_RUN([int main () { return 3; }],
++AC_TRY_RUN([int main (void) { return 3; }],
+ [AC_MSG_ERROR([saw `return 3' as a success])],
+ [estatus=$?
+ test $estatus != 3 &&
+--- a/tests/fortran.at
++++ b/tests/fortran.at
+@@ -223,7 +223,7 @@ void FOOBAR_F77 (double *x, double *y);
+ # ifdef __cplusplus
+ extern "C"
+ # endif
+- int F77_DUMMY_MAIN () { return 1; }
++ int F77_DUMMY_MAIN (void) { return 1; }
+ #endif
+
+ int main(int argc, char *argv[])
+@@ -301,7 +301,7 @@ void FOOBAR_FC(double *x, double *y);
+ # ifdef __cplusplus
+ extern "C"
+ # endif
+- int FC_DUMMY_MAIN () { return 1; }
++ int FC_DUMMY_MAIN (void) { return 1; }
+ #endif
+
+ int main (int argc, char *argv[])
+@@ -533,7 +533,7 @@ void @foobar@ (int *x);
+ # ifdef __cplusplus
+ extern "C"
+ # endif
+- int F77_DUMMY_MAIN () { return 1; }
++ int F77_DUMMY_MAIN (void) { return 1; }
+ #endif
+
+ int main(int argc, char *argv[])
+@@ -607,7 +607,7 @@ void @foobar@ (int *x);
+ # ifdef __cplusplus
+ extern "C"
+ # endif
+- int FC_DUMMY_MAIN () { return 1; }
++ int FC_DUMMY_MAIN (void) { return 1; }
+ #endif
+
+ int main(int argc, char *argv[])
+--- a/tests/semantics.at
++++ b/tests/semantics.at
+@@ -107,7 +107,7 @@ AT_CHECK_MACRO([AC_CHECK_DECLS],
+ [[int yes = 1;
+ enum { myenum };
+ struct { int x[20]; } mystruct;
+- extern int myfunc();
++ extern int myfunc (void);
+ #define mymacro1(arg) arg
+ #define mymacro2]])
+ # The difference in space-before-open-paren is intentional.