diff options
author | Sam James <sam@gentoo.org> | 2022-09-19 04:01:26 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-09-19 17:26:40 +0100 |
commit | 0acd23de8af61e7b900c3ff2c0fcbfe0b0ddc3a3 (patch) | |
tree | 680b62b6ea0ef8d0380881b3f6ed6c1ff97b6ac5 /sys-devel/autoconf/files | |
parent | sys-libs/musl: drop libcrypt.a too for USE=-crypt (diff) | |
download | gentoo-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>
Diffstat (limited to 'sys-devel/autoconf/files')
3 files changed, 216 insertions, 0 deletions
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 |