From 2d018e83a8b4540367ce64479eaffb3dc22342ed Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Mon, 20 Mar 2023 13:26:55 +0100 Subject: [PATCH] autoconf2.71: import gentoo patches so we get clang v16 compat --- autoconf2.71/PKGBUILD | 34 ++++-- .../autoconf-2.71-AC_C_BIGENDIAN-lto.patch | 50 ++++++++ .../autoconf-2.71-AC_LANG_CALL_C_cxx.patch | 35 ++++++ .../autoconf-2.71-K-R-decls-clang-deux.patch | 94 +++++++++++++++ .../autoconf-2.71-K-R-decls-clang.patch | 114 ++++++++++++++++++ autoconf2.71/autoconf-2.71-make-4.4.patch | 25 ++++ 6 files changed, 345 insertions(+), 7 deletions(-) create mode 100644 autoconf2.71/autoconf-2.71-AC_C_BIGENDIAN-lto.patch create mode 100644 autoconf2.71/autoconf-2.71-AC_LANG_CALL_C_cxx.patch create mode 100644 autoconf2.71/autoconf-2.71-K-R-decls-clang-deux.patch create mode 100644 autoconf2.71/autoconf-2.71-K-R-decls-clang.patch create mode 100644 autoconf2.71/autoconf-2.71-make-4.4.patch diff --git a/autoconf2.71/PKGBUILD b/autoconf2.71/PKGBUILD index 7d60ab8b..1e676cd1 100644 --- a/autoconf2.71/PKGBUILD +++ b/autoconf2.71/PKGBUILD @@ -4,40 +4,60 @@ _realname=autoconf pkgname=${_realname}2.71 pkgver=2.71 -pkgrel=1 +pkgrel=2 pkgdesc="A GNU tool for automatically configuring source code" arch=('any') license=('GPL2' 'GPL3' 'custom') url="https://www.gnu.org/software/autoconf" depends=('awk' 'm4' 'diffutils' 'bash' 'perl' 'sed') -# for test-suite -makedepends=('gcc-fortran' 'make') +makedepends=('make') +checkdepends=('gcc-fortran') source=(https://ftp.gnu.org/pub/gnu/${_realname}/${_realname}-${pkgver}.tar.xz 0001-autoconf-2.70-MSYS2-specifics-AC_CYGWIN.patch 0002-autoconf-2.70-MSYS2-Autotest-Unify-EOLs-By-Default.patch 0003-autoconf-2.70-MSYS2-specifics-config.guess.patch - 0005-package.patch) + 0005-package.patch + autoconf-2.71-AC_C_BIGENDIAN-lto.patch + autoconf-2.71-AC_LANG_CALL_C_cxx.patch + autoconf-2.71-K-R-decls-clang-deux.patch + autoconf-2.71-K-R-decls-clang.patch + autoconf-2.71-make-4.4.patch) sha256sums=('f14c83cfebcc9427f2c3cea7258bd90df972d92eb26752da4ddad81c87a0faa4' '3a5337e2269407405ee4c7feb12dbe2ae711610c3144c07cd085272676005db6' 'c4e4952cc63a2ddaf7bf539f6e59353c4fadbf04cd48c3cfa789f8b175d0bd27' 'a7671bef559a5f3edbd811a7cf9b557f216f1d3e9502dc046fd3a0ea665da7da' - '01894e38f901629373ff8ca6c55571b14450eacc625e717cd0da0ca65860f5e5') + '01894e38f901629373ff8ca6c55571b14450eacc625e717cd0da0ca65860f5e5' + '1499271fa3004079bc2ce9db2697a7f4bd29666b2dfd7e1c39ad8fa397a4c08e' + 'befc2e2ae932e2247eee7fdd17d17e6b3065a741a47e0154670a009907d0860b' + 'c0e2215f983763587521c3925e6ebb73c6e2e8cd9ac1e5d649720252a26cca78' + '65f2b02e96db437fc8fa974ba4b9db76eb9d053ceebcaf309c19f87eae3f8158' + '402350041cbfb092321a5998f6abec6b0c59d3d03ae63735120e96a5a4a09d47') prepare() { cd ${srcdir}/${_realname}-${pkgver} + # MSYS2 patch -p1 -i ${srcdir}/0001-autoconf-2.70-MSYS2-specifics-AC_CYGWIN.patch patch -p1 -i ${srcdir}/0002-autoconf-2.70-MSYS2-Autotest-Unify-EOLs-By-Default.patch patch -p1 -i ${srcdir}/0003-autoconf-2.70-MSYS2-specifics-config.guess.patch patch -p1 -i ${srcdir}/0005-package.patch - # NB: Do not run auto(re)conf and friends to avoid any self-dependency of the package. + # from gentoo: https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-devel/autoconf/files + patch -p1 -i ${srcdir}/autoconf-2.71-AC_LANG_CALL_C_cxx.patch + patch -p1 -i ${srcdir}/autoconf-2.71-AC_C_BIGENDIAN-lto.patch + patch -p1 -i ${srcdir}/autoconf-2.71-K-R-decls-clang.patch + patch -p1 -i ${srcdir}/autoconf-2.71-make-4.4.patch + patch -p1 -i ${srcdir}/autoconf-2.71-K-R-decls-clang-deux.patch } build() { mkdir -p build-${_realname}-${pkgver} cd build-${_realname}-${pkgver} - ../${_realname}-${pkgver}/configure --prefix=/usr --program-suffix=-2.71 + + ../${_realname}-${pkgver}/configure \ + --prefix=/usr \ + --program-suffix=-2.71 + make } diff --git a/autoconf2.71/autoconf-2.71-AC_C_BIGENDIAN-lto.patch b/autoconf2.71/autoconf-2.71-AC_C_BIGENDIAN-lto.patch new file mode 100644 index 00000000..48fbdc6f --- /dev/null +++ b/autoconf2.71/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 +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/autoconf2.71/autoconf-2.71-AC_LANG_CALL_C_cxx.patch b/autoconf2.71/autoconf-2.71-AC_LANG_CALL_C_cxx.patch new file mode 100644 index 00000000..5b53d171 --- /dev/null +++ b/autoconf2.71/autoconf-2.71-AC_LANG_CALL_C_cxx.patch @@ -0,0 +1,35 @@ +https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=b27bc3e230bb12fdd9a813e38e82bc4c3e22b4cc + +Note: we drop the comma from the comment because some packages +have bad quoting, and while that will need to be sorted when/if +autoconf 2.72 is released, we've got our hands full with the +Clang situation right now (bug #871753). + +From b27bc3e230bb12fdd9a813e38e82bc4c3e22b4cc Mon Sep 17 00:00:00 2001 +From: Paul Eggert +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/autoconf2.71/autoconf-2.71-K-R-decls-clang-deux.patch b/autoconf2.71/autoconf-2.71-K-R-decls-clang-deux.patch new file mode 100644 index 00000000..6a3d6580 --- /dev/null +++ b/autoconf2.71/autoconf-2.71-K-R-decls-clang-deux.patch @@ -0,0 +1,94 @@ +https://bugs.gentoo.org/870412 +https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=bf5a75953b6d504f0405b1ca33b039b8dd39eef4 + +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. + +From bf5a75953b6d504f0405b1ca33b039b8dd39eef4 Mon Sep 17 00:00:00 2001 +From: Zack Weinberg +Date: Thu, 10 Nov 2022 12:05:30 -0500 +Subject: More fixes for compilers that reject K&R function definitions. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes all of the remaining failures exposed by running the +testsuite with GCC 12 and +CC='cc -Wimplicit-function-declaration -Wold-style-definition + -Wimplicit-int -Werror' +. + +* lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS): Don’t use K&R function + definitions. +* lib/autoconf/specific.m4 (AC_SYS_RESTARTABLE_SYSCALLS): Likewise. + (AC_FUNC_MKTIME): Declare functions taking no arguments as ‘fn (void)’ + not ‘fn ()’. +* lib/autoconf/c.m4 (_AC_C_C99_TEST_GLOBALS): Declare free(). +--- a/lib/autoconf/c.m4 ++++ b/lib/autoconf/c.m4 +@@ -1153,9 +1153,7 @@ struct stat; + /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ + struct buf { int x; }; + struct buf * (*rcsopen) (struct buf *, struct stat *, int); +-static char *e (p, i) +- char **p; +- int i; ++static char *e (char **p, int i) + { + return p[i]; + } +@@ -1212,6 +1210,7 @@ extern int puts (const char *); + extern int printf (const char *, ...); + extern int dprintf (int, const char *, ...); + extern void *malloc (size_t); ++extern void free (void *); + + // Check varargs macros. These examples are taken from C99 6.10.3.5. + // dprintf is used instead of fprintf to avoid needing to declare +--- a/lib/autoconf/functions.m4 ++++ b/lib/autoconf/functions.m4 +@@ -1091,7 +1091,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; +@@ -1128,7 +1128,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; +@@ -1170,7 +1170,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. */ +--- a/lib/autoconf/specific.m4 ++++ b/lib/autoconf/specific.m4 +@@ -361,10 +361,9 @@ AC_INCLUDES_DEFAULT + /* Some platforms explicitly require an extern "C" signal handler + when using C++. */ + #ifdef __cplusplus +-extern "C" void ucatch (int dummy) { } +-#else +-void ucatch (dummy) int dummy; { } ++extern "C" + #endif ++void ucatch (int dummy) { } + + int + main (void) +cgit v1.1 diff --git a/autoconf2.71/autoconf-2.71-K-R-decls-clang.patch b/autoconf2.71/autoconf-2.71-K-R-decls-clang.patch new file mode 100644 index 00000000..e2e451e8 --- /dev/null +++ b/autoconf2.71/autoconf-2.71-K-R-decls-clang.patch @@ -0,0 +1,114 @@ +https://bugs.gentoo.org/870412 +https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=8b5e2016c7ed2d67f31b03a3d2e361858ff5299b + +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. + +From 8b5e2016c7ed2d67f31b03a3d2e361858ff5299b Mon Sep 17 00:00:00 2001 +From: Paul Eggert +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/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 + #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 diff --git a/autoconf2.71/autoconf-2.71-make-4.4.patch b/autoconf2.71/autoconf-2.71-make-4.4.patch new file mode 100644 index 00000000..4dcf0599 --- /dev/null +++ b/autoconf2.71/autoconf-2.71-make-4.4.patch @@ -0,0 +1,25 @@ +https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=31f673434ee402258b45e958c88acc8725d82b1a +https://savannah.gnu.org/bugs/?63040 +https://bugs.gentoo.org/869257 + +From 31f673434ee402258b45e958c88acc8725d82b1a Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Fri, 9 Sep 2022 16:54:11 -0500 +Subject: Port to GNU make 4.4 + +* cfg.mk (PATH): Assign eagerly, and simplify shell use, avoiding +use of the shell entirely if PWD is set, as it should be. +Problem reported by Sergei Trofimovich in: +https://lists.gnu.org/r/autoconf-patches/2022-09/msg00007.html +--- a/cfg.mk ++++ b/cfg.mk +@@ -18,7 +18,7 @@ + # This file is '-include'd into GNUmakefile. + + # Build with our own versions of these tools, when possible. +-export PATH = $(shell echo "`pwd`/tests:$$PATH") ++export PATH := $(or $(PWD),$(shell pwd))/tests:$(PATH) + + # Remove the autoreconf-provided INSTALL, so that we regenerate it. + _autoreconf = autoreconf -i -v && rm -f INSTALL +cgit v1.1