summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-09-19 04:01:26 +0100
committerSam James <sam@gentoo.org>2022-09-19 17:26:40 +0100
commit0acd23de8af61e7b900c3ff2c0fcbfe0b0ddc3a3 (patch)
tree680b62b6ea0ef8d0380881b3f6ed6c1ff97b6ac5
parentsys-libs/musl: drop libcrypt.a too for USE=-crypt (diff)
downloadgentoo-0acd23de8af61e7b900c3ff2c0fcbfe0b0ddc3a3.tar.gz
gentoo-0acd23de8af61e7b900c3ff2c0fcbfe0b0ddc3a3.tar.bz2
gentoo-0acd23de8af61e7b900c3ff2c0fcbfe0b0ddc3a3.zip
sys-devel/autoconf: backport K&R decls fix to 2.71
Backport the K&R decls fix to 2.71 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. Patches: - AC_C_BIGENDIAN-lto.patch ("Port AC_C_BIGENDIAN to cross gcc -std=c11 -flto") - AC_LANG_CALL_C_cxx.patch ("Port AC_LANG_CALL(C) to C++") - K-R-decls-clang.patch ("Port to compilers that moan about K&R func decls") The first two are included to make the latter apply cleanly, but they're also both harmless and desirable. 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. Backports to 2.69 & 2.13 to follow. 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>
-rw-r--r--sys-devel/autoconf/autoconf-2.71-r3.ebuild87
-rw-r--r--sys-devel/autoconf/files/autoconf-2.71-AC_C_BIGENDIAN-lto.patch50
-rw-r--r--sys-devel/autoconf/files/autoconf-2.71-AC_LANG_CALL_C_cxx.patch30
-rw-r--r--sys-devel/autoconf/files/autoconf-2.71-K-R-decls-clang.patch136
4 files changed, 303 insertions, 0 deletions
diff --git a/sys-devel/autoconf/autoconf-2.71-r3.ebuild b/sys-devel/autoconf/autoconf-2.71-r3.ebuild
new file mode 100644
index 000000000000..5077d33753e4
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.71-r3.ebuild
@@ -0,0 +1,87 @@
+# 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
+ # For _beta handling replace with real version number
+ MY_PV="${PV}"
+ MY_P="${PN}-${MY_PV}"
+ #PATCH_TARBALL_NAME="${PN}-2.70-patches-01"
+ SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
+ https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz"
+ #SRC_URI+=" https://dev.gentoo.org/~polynomial-c/${PATCH_TARBALL_NAME}.tar.xz"
+
+ if ! [[ ${PV} == *_beta* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~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
+ S="${WORKDIR}"/${MY_P}
+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"
+
+# for 2.71, our Perl time resolution patch changes our min Perl from 5.6
+# (vanilla upstream for 2.71) to 5.8.
+BDEPEND=">=sys-devel/m4-1.4.16
+ >=dev-lang/perl-5.8"
+RDEPEND="${BDEPEND}
+ >=sys-devel/autoconf-wrapper-15
+ sys-devel/gnuconfig
+ !~sys-devel/${P}:2.5"
+[[ ${PV} == 9999 ]] && BDEPEND+=" >=sys-apps/texinfo-4.3"
+PDEPEND="emacs? ( app-emacs/autoconf-mode )"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-AC_LANG_CALL_C_cxx.patch
+ "${FILESDIR}"/${P}-time.patch
+ "${FILESDIR}"/${P}-AC_C_BIGENDIAN-lto.patch
+ "${FILESDIR}"/${P}-K-R-decls-clang.patch
+ "${FILESDIR}"/${P}-make-4.4.patch
+)
+
+src_prepare() {
+ # usr/bin/libtool is provided by binutils-apple, need gnu libtool
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ PATCHES+=( "${FILESDIR}"/${PN}-2.71-darwin.patch )
+ fi
+
+ # Save timestamp to avoid later makeinfo call
+ touch -r doc/{,old_}autoconf.texi || die
+
+ local pdir
+ for pdir in "${WORKDIR}"/{upstream_,}patches ; do
+ if [[ -d "${pdir}" ]] ; then
+ eapply ${pdir}
+ fi
+ done
+
+ 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
+}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ toolchain-autoconf_src_install
+
+ local f
+ for f in config.{guess,sub} ; do
+ ln -fs ../../gnuconfig/${f} \
+ "${ED}"/usr/share/autoconf-*/build-aux/${f} || die
+ done
+}
diff --git a/sys-devel/autoconf/files/autoconf-2.71-AC_C_BIGENDIAN-lto.patch b/sys-devel/autoconf/files/autoconf-2.71-AC_C_BIGENDIAN-lto.patch
new file mode 100644
index 000000000000..48fbdc6f544b
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.71-AC_C_BIGENDIAN-lto.patch
@@ -0,0 +1,50 @@
+https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=234fc6c86613ed3f366dd1d88996e4d5d85ee222
+
+From 234fc6c86613ed3f366dd1d88996e4d5d85ee222 Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Wed, 27 Jul 2022 08:53:35 -0700
+Subject: Port AC_C_BIGENDIAN to cross gcc -std=c11 -flto
+
+* lib/autoconf/c.m4 (AC_C_BIGENDIAN): Improve the
+inherently-unportable grep trick well enough to survive gcc
+-std=c11 -flto when cross-compiling (sr#110687).
+--- a/lib/autoconf/c.m4
++++ b/lib/autoconf/c.m4
+@@ -1838,8 +1838,8 @@ AC_DEFUN([AC_C_BIGENDIAN],
+ [ac_cv_c_bigendian=no],
+ [ac_cv_c_bigendian=yes],
+ [# Try to guess by grepping values from an object file.
+- AC_COMPILE_IFELSE(
+- [AC_LANG_PROGRAM(
++ AC_LINK_IFELSE(
++ [AC_LANG_SOURCE(
+ [[unsigned short int ascii_mm[] =
+ { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+ unsigned short int ascii_ii[] =
+@@ -1854,13 +1854,20 @@ AC_DEFUN([AC_C_BIGENDIAN],
+ int use_ebcdic (int i) {
+ return ebcdic_mm[i] + ebcdic_ii[i];
+ }
+- extern int foo;
+- ]],
+- [[return use_ascii (foo) == use_ebcdic (foo);]])],
+- [if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
++ int
++ main (int argc, char **argv)
++ {
++ /* Intimidate the compiler so that it does not
++ optimize the arrays away. */
++ char *p = argv[0];
++ ascii_mm[1] = *p++; ebcdic_mm[1] = *p++;
++ ascii_ii[1] = *p++; ebcdic_ii[1] = *p++;
++ return use_ascii (argc) == use_ebcdic (*p);
++ }]])],
++ [if grep BIGenDianSyS conftest$ac_exeext >/dev/null; then
+ ac_cv_c_bigendian=yes
+ fi
+- if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
++ if grep LiTTleEnDian conftest$ac_exeext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+cgit v1.1
diff --git a/sys-devel/autoconf/files/autoconf-2.71-AC_LANG_CALL_C_cxx.patch b/sys-devel/autoconf/files/autoconf-2.71-AC_LANG_CALL_C_cxx.patch
new file mode 100644
index 000000000000..c997c52e57d8
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.71-AC_LANG_CALL_C_cxx.patch
@@ -0,0 +1,30 @@
+https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=b27bc3e230bb12fdd9a813e38e82bc4c3e22b4cc
+
+From b27bc3e230bb12fdd9a813e38e82bc4c3e22b4cc Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue, 31 Aug 2021 16:30:46 -0700
+Subject: Port AC_LANG_CALL(C) to C++
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+* lib/autoconf/c.m4 (AC_LANG_CALL(C)): Add an extern "C" if C++.
+Problem reported by Vincent Lefèvre (sr #110532).
+--- a/lib/autoconf/c.m4
++++ b/lib/autoconf/c.m4
+@@ -126,7 +126,13 @@ m4_define([AC_LANG_CALL(C)],
+ m4_if([$2], [main], ,
+ [/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+- builtin and then its argument prototype would still apply. */
++ builtin and then its argument prototype would still apply.
++ The 'extern "C"' is for builds by C++ compilers;
++ although this is not generally supported in C code, supporting it here
++ has little cost and some practical benefit (sr 110532). */
++#ifdef __cplusplus
++extern "C"
++#endif
+ char $2 ();])], [return $2 ();])])
+
+
+cgit v1.1
diff --git a/sys-devel/autoconf/files/autoconf-2.71-K-R-decls-clang.patch b/sys-devel/autoconf/files/autoconf-2.71-K-R-decls-clang.patch
new file mode 100644
index 000000000000..098d3b9c6033
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.71-K-R-decls-clang.patch
@@ -0,0 +1,136 @@
+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 8b5e2016c7ed2d67f31b03a3d2e361858ff5299b Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Thu, 1 Sep 2022 16:19:50 -0500
+Subject: Port to compilers that moan about K&R func decls
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+* lib/autoconf/c.m4 (AC_LANG_CALL, AC_LANG_FUNC_LINK_TRY):
+Use '(void)' rather than '()' in function prototypes, as the latter
+provokes fatal errors in some compilers nowadays.
+* lib/autoconf/functions.m4 (AC_FUNC_STRTOD):
+* tests/fortran.at (AC_F77_DUMMY_MAIN usage):
+* tests/semantics.at (AC_CHECK_DECLS):
+Don’t use () in a function decl.
+--- a/doc/autoconf.texi
++++ b/doc/autoconf.texi
+@@ -5460,9 +5460,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. */
+@@ -8297,7 +8295,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
+@@ -133,7 +133,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)
+@@ -157,7 +157,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. */
+
+ #include <limits.h>
+ #undef $1
+@@ -168,7 +168,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. */
+--- a/lib/autoconf/functions.m4
++++ b/lib/autoconf/functions.m4
+@@ -1613,9 +1613,6 @@ 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 (void)
+ {
+--- a/tests/fortran.at
++++ b/tests/fortran.at
+@@ -233,7 +233,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[])
+@@ -315,7 +315,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[])
+@@ -561,7 +561,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[])
+@@ -637,7 +637,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
+@@ -207,7 +207,7 @@ AT_CHECK_MACRO([AC_CHECK_DECLS],
+ [[extern int yes;
+ enum { myenum };
+ extern struct mystruct_s { int x[20]; } mystruct;
+- extern int myfunc();
++ extern int myfunc (int);
+ #define mymacro1(arg) arg
+ #define mymacro2]])
+ # Ensure we can detect missing declarations of functions whose
+cgit v1.1