From 42f52a7948241ddea772a47aab44b0657045a6d5 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Wed, 15 Jul 2020 16:03:21 +0100 Subject: [PATCH] autoconf 2.7.0 --- meta/recipes-devtools/autoconf/autoconf.inc | 4 +- .../AC_HEADER_MAJOR-port-to-glibc-2.25.patch | 101 - .../autoconf/autoconf/add_musl_config.patch | 26 - ...in-shebangs-with-modern-use-warnings.patch | 120 - .../autoconf/autoreconf-exclude.patch | 113 +- .../autoconf/autoreconf-gnuconfigize.patch | 38 - .../autotest-automake-result-format.patch | 32 +- .../check-automake-cross-warning.patch | 34 - .../autoconf/autoconf/config_site.patch | 40 - .../autoconf/autoconf/fix_path_xtra.patch | 120 - .../autoconf/autoconf/from-master.patch | 3005 +++++++++++++++++ .../autoconf/autoconf/no-man.patch | 21 + .../autoconf/autoconf/performance.patch | 60 - .../autoconf/autoconf/preferbash.patch | 39 +- .../autoconf/autoconf/program_prefix.patch | 36 +- .../remove-usr-local-lib-from-m4.patch | 28 +- .../autoconf/autoconf_2.69.bb | 31 - .../autoconf/autoconf_2.70.bb | 22 + 18 files changed, 3173 insertions(+), 697 deletions(-) delete mode 100644 meta/recipes-devtools/autoconf/autoconf/AC_HEADER_MAJOR-port-to-glibc-2.25.patch delete mode 100644 meta/recipes-devtools/autoconf/autoconf/add_musl_config.patch delete mode 100644 meta/recipes-devtools/autoconf/autoconf/autoconf-replace-w-option-in-shebangs-with-modern-use-warnings.patch delete mode 100644 meta/recipes-devtools/autoconf/autoconf/autoreconf-gnuconfigize.patch delete mode 100644 meta/recipes-devtools/autoconf/autoconf/check-automake-cross-warning.patch delete mode 100644 meta/recipes-devtools/autoconf/autoconf/config_site.patch delete mode 100644 meta/recipes-devtools/autoconf/autoconf/fix_path_xtra.patch create mode 100644 meta/recipes-devtools/autoconf/autoconf/from-master.patch create mode 100644 meta/recipes-devtools/autoconf/autoconf/no-man.patch delete mode 100644 meta/recipes-devtools/autoconf/autoconf/performance.patch delete mode 100644 meta/recipes-devtools/autoconf/autoconf_2.69.bb create mode 100644 meta/recipes-devtools/autoconf/autoconf_2.70.bb diff --git a/meta/recipes-devtools/autoconf/autoconf.inc b/meta/recipes-devtools/autoconf/autoconf.inc index a4db7ca38f..c7d7a2f74b 100644 --- a/meta/recipes-devtools/autoconf/autoconf.inc +++ b/meta/recipes-devtools/autoconf/autoconf.inc @@ -5,7 +5,9 @@ file that lists the operating system features that the package can use, in the f LICENSE = "GPLv3" HOMEPAGE = "http://www.gnu.org/software/autoconf/" SECTION = "devel" -DEPENDS = "m4-native gnu-config-native" + +DEPENDS = "m4-native gnu-config-native help2man-native" +DEPENDS_remove_class-native = "help2man-native" RDEPENDS_${PN} = "m4 gnu-config \ perl \ diff --git a/meta/recipes-devtools/autoconf/autoconf/AC_HEADER_MAJOR-port-to-glibc-2.25.patch b/meta/recipes-devtools/autoconf/autoconf/AC_HEADER_MAJOR-port-to-glibc-2.25.patch deleted file mode 100644 index b2d7dc0e24..0000000000 --- a/meta/recipes-devtools/autoconf/autoconf/AC_HEADER_MAJOR-port-to-glibc-2.25.patch +++ /dev/null @@ -1,101 +0,0 @@ -From b859ab1b211d348b46eca9158b7742f050c8115e Mon Sep 17 00:00:00 2001 -From: Eric Blake -Date: Wed, 14 Sep 2016 08:17:06 -0500 -Subject: [PATCH] AC_HEADER_MAJOR: port to glibc 2.25 - -glibc 2.25 is deprecating the namespace pollution of -injecting major(), minor(), and makedev() into the compilation -environment, with a warning that insists that users include - instead. However, because the expansion of -AC_HEADER_MAJOR didn't bother checking sys/sysmacros.h until -after probing whether sys/types.h pollutes the namespace, it was -not defining MAJOR_IN_SYSMACROS, with the result that code -compiled with -Werror chokes on the deprecation warnings because -it was not including sysmacros.h. - -In addition to fixing autoconf (which only benefits projects -that rebuild configure after this fix is released), we can also -give a hint to distros on how they can populate config.site with -a cache variable to force pre-existing configure scripts without -the updated macro to behave sanely in the presence of glibc 2.25 -(the documentation is especially useful since that cache variable -is no longer present in autoconf after this patch). - -Note that mingw lacks major/minor/makedev in any of its standard -headers; for that platform, the behavior of this macro is unchanged -(code using the recommended include formula will get a compile error -when trying to use major(), whether before or after this patch); but -for now, it is assumed that programs actually concerned with -creating devices are not worried about portability to mingw. If -desired, a later patch could tighten AC_HEADER_MAJOR to fail at -configure time if the macros are unavailable in any of the three -system headers, but that semantic change is not worth mixing into -this patch. - -* lib/autoconf/headers.m4 (AC_HEADER_MAJOR): Drop check for -major within sys/types.h; it interferes with the need to check -sysmacros.h first. - -Signed-off-by: Eric Blake - -Remove the documentation change from the patch -Upstream-Status: Backport - -Signed-off-by: Hongxu Jia ---- - lib/autoconf/headers.m4 | 30 ++++++++++++++---------------- - 1 file changed, 14 insertions(+), 16 deletions(-) - -diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4 -index 81a7fa2..a57d0d3 100644 ---- a/lib/autoconf/headers.m4 -+++ b/lib/autoconf/headers.m4 -@@ -502,31 +502,29 @@ fi - - # AC_HEADER_MAJOR - # --------------- -+# Thanks to glibc 2.25 deprecating macros in sys/types.h, coupled with -+# back-compat to autoconf 2.69, we need the following logic: -+# Check whether compiles. -+# If compiles, assume it provides major/minor/makedev. -+# Otherwise, if compiles, assume it provides the macros. -+# Otherwise, either the macros were provided by , or do -+# not exist on the platform. Code trying to use these three macros is -+# assumed to not care about platforms that lack the macros. - AN_FUNCTION([major], [AC_HEADER_MAJOR]) - AN_FUNCTION([makedev], [AC_HEADER_MAJOR]) - AN_FUNCTION([minor], [AC_HEADER_MAJOR]) - AN_HEADER([sys/mkdev.h], [AC_HEADER_MAJOR]) - AC_DEFUN([AC_HEADER_MAJOR], --[AC_CACHE_CHECK(whether sys/types.h defines makedev, -- ac_cv_header_sys_types_h_makedev, --[AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], -- [[return makedev(0, 0);]])], -- [ac_cv_header_sys_types_h_makedev=yes], -- [ac_cv_header_sys_types_h_makedev=no]) --]) -- --if test $ac_cv_header_sys_types_h_makedev = no; then -+[AC_CHECK_HEADERS_ONCE([sys/types.h]) - AC_CHECK_HEADER(sys/mkdev.h, - [AC_DEFINE(MAJOR_IN_MKDEV, 1, - [Define to 1 if `major', `minor', and `makedev' are - declared in .])]) -- -- if test $ac_cv_header_sys_mkdev_h = no; then -- AC_CHECK_HEADER(sys/sysmacros.h, -- [AC_DEFINE(MAJOR_IN_SYSMACROS, 1, -- [Define to 1 if `major', `minor', and `makedev' -- are declared in .])]) -- fi -+if test $ac_cv_header_sys_mkdev_h = no; then -+ AC_CHECK_HEADER(sys/sysmacros.h, -+ [AC_DEFINE(MAJOR_IN_SYSMACROS, 1, -+ [Define to 1 if `major', `minor', and `makedev' -+ are declared in .])]) - fi - ])# AC_HEADER_MAJOR - --- -2.7.4 - diff --git a/meta/recipes-devtools/autoconf/autoconf/add_musl_config.patch b/meta/recipes-devtools/autoconf/autoconf/add_musl_config.patch deleted file mode 100644 index a9094d2128..0000000000 --- a/meta/recipes-devtools/autoconf/autoconf/add_musl_config.patch +++ /dev/null @@ -1,26 +0,0 @@ -backport http://git.savannah.gnu.org/cgit/config.git/commit/config.sub?id=062587eaa891396c936555ae51f7e77eeb71a5fe - -Signed-off-by: Khem Raj -Upstream-Status: Backport -Index: autoconf-2.69/build-aux/config.sub -=================================================================== ---- autoconf-2.69.orig/build-aux/config.sub -+++ autoconf-2.69/build-aux/config.sub -@@ -123,7 +123,7 @@ esac - maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` - case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ -- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ -+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) -@@ -1360,7 +1360,7 @@ case $os in - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ -- | -linux-newlib* | -linux-uclibc* \ -+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ diff --git a/meta/recipes-devtools/autoconf/autoconf/autoconf-replace-w-option-in-shebangs-with-modern-use-warnings.patch b/meta/recipes-devtools/autoconf/autoconf/autoconf-replace-w-option-in-shebangs-with-modern-use-warnings.patch deleted file mode 100644 index ae0e3825f6..0000000000 --- a/meta/recipes-devtools/autoconf/autoconf/autoconf-replace-w-option-in-shebangs-with-modern-use-warnings.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 236552ff5b9f1ebf666d8d0e9850007dcce03d26 Mon Sep 17 00:00:00 2001 -From: Serhii Popovych -Date: Wed, 10 Feb 2016 16:32:44 +0000 -Subject: [PATCH] perl: Replace -w option in shebangs with modern "use - warnings" - -In some builds we might provide ac_cv_path_PERL as /usr/bin/env perl -to use newer version of the perl from users PATH rather than -older from standard system path. - -However using /usr/bin/env perl -w from shebang line isn't -possible because it translates to something like -/usr/bin/env -w perl and env complains about illegal option. - -To address this we can remove -w option from perl shebang -line and add "use warnings" statement. - -Upstream-Status: Pending -Signed-off-by: Serhii Popovych ---- - bin/autom4te.in | 3 ++- - bin/autoreconf.in | 3 ++- - bin/autoscan.in | 3 ++- - bin/autoupdate.in | 3 ++- - bin/ifnames.in | 3 ++- - 5 files changed, 10 insertions(+), 5 deletions(-) - -diff --git a/bin/autom4te.in b/bin/autom4te.in -index 11773c9..a8f5e41 100644 ---- a/bin/autom4te.in -+++ b/bin/autom4te.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w -+#! @PERL@ - # -*- perl -*- - # @configure_input@ - -@@ -42,6 +42,7 @@ use Autom4te::General; - use Autom4te::XFile; - use File::Basename; - use strict; -+use warnings; - - # Data directory. - my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@'; -diff --git a/bin/autoreconf.in b/bin/autoreconf.in -index e245db4..1a318cb 100644 ---- a/bin/autoreconf.in -+++ b/bin/autoreconf.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w -+#! @PERL@ - # -*- perl -*- - # @configure_input@ - -@@ -45,6 +45,7 @@ use Autom4te::XFile; - # Do not use Cwd::chdir, since it might hang. - use Cwd 'cwd'; - use strict; -+use warnings; - - ## ----------- ## - ## Variables. ## -diff --git a/bin/autoscan.in b/bin/autoscan.in -index a67c48d..b931249 100644 ---- a/bin/autoscan.in -+++ b/bin/autoscan.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w -+#! @PERL@ - # -*- perl -*- - # @configure_input@ - -@@ -43,6 +43,7 @@ use Autom4te::XFile; - use File::Basename; - use File::Find; - use strict; -+use warnings; - - use vars qw(@cfiles @makefiles @shfiles @subdirs %printed); - -diff --git a/bin/autoupdate.in b/bin/autoupdate.in -index 9737d49..92cb147 100644 ---- a/bin/autoupdate.in -+++ b/bin/autoupdate.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w -+#! @PERL@ - # -*- perl -*- - # @configure_input@ - -@@ -44,6 +44,7 @@ use Autom4te::General; - use Autom4te::XFile; - use File::Basename; - use strict; -+use warnings; - - # Lib files. - my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; -diff --git a/bin/ifnames.in b/bin/ifnames.in -index ba2cd05..74b0278 100644 ---- a/bin/ifnames.in -+++ b/bin/ifnames.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w -+#! @PERL@ - # -*- perl -*- - # @configure_input@ - -@@ -44,6 +44,7 @@ BEGIN - use Autom4te::General; - use Autom4te::XFile; - use Autom4te::FileUtils; -+use warnings; - - # $HELP - # ----- --- -2.3.0 - diff --git a/meta/recipes-devtools/autoconf/autoconf/autoreconf-exclude.patch b/meta/recipes-devtools/autoconf/autoconf/autoreconf-exclude.patch index d1bd3a2a31..374b939404 100644 --- a/meta/recipes-devtools/autoconf/autoconf/autoreconf-exclude.patch +++ b/meta/recipes-devtools/autoconf/autoconf/autoreconf-exclude.patch @@ -1,32 +1,36 @@ -Upstream-Status: Pending +From 0071d28e304745a16871561f23117fdb00dd2559 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Thu, 12 Mar 2020 17:25:23 +0000 +Subject: [PATCH 4/7] autoreconf-exclude.patch -Index: autoconf-2.63/bin/autoreconf.in -=================================================================== ---- autoconf-2.63.orig/bin/autoreconf.in 2008-12-31 17:39:01.000000000 +0000 -+++ autoconf-2.63/bin/autoreconf.in 2008-12-31 17:43:38.000000000 +0000 -@@ -76,6 +76,7 @@ - -i, --install copy missing auxiliary files +--- + bin/autoreconf.in | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +diff --git a/bin/autoreconf.in b/bin/autoreconf.in +index bb9f316d..7da3005b 100644 +--- a/bin/autoreconf.in ++++ b/bin/autoreconf.in +@@ -82,6 +82,7 @@ Operation modes: + -i, --install copy missing standard auxiliary files --no-recursive don't rebuild sub-packages -s, --symlink with -i, install symbolic links instead of copies + -x, --exclude=STEPS steps we should not run -m, --make when applicable, re-run ./configure && make -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax] -@@ -136,6 +137,13 @@ +@@ -141,6 +142,10 @@ my $run_make = 0; # Recurse into subpackages my $recursive = 1; +# Steps to exclude +my @exclude; +my @ex; -+ -+my $uses_gettext; -+my $configure_ac; + ## ---------- ## ## Routines. ## ## ---------- ## -@@ -153,6 +161,7 @@ +@@ -161,6 +166,7 @@ sub parse_args () 'B|prepend-include=s' => \@prepend_include, 'i|install' => \$install, 's|symlink' => \$symlink, @@ -34,106 +38,85 @@ Index: autoconf-2.63/bin/autoreconf.in 'm|make' => \$run_make, 'recursive!' => \$recursive); -@@ -162,6 +171,8 @@ +@@ -170,6 +176,8 @@ sub parse_args () parse_WARNINGS; - parse_warnings '--warnings', @warning; + parse_warnings @warning; + @exclude = map { split /,/ } @exclude; + # Even if the user specified a configure.ac, trim to get the # directory, and look for configure.ac again. Because (i) the code # is simpler, and (ii) we are still able to diagnose simultaneous -@@ -255,6 +266,11 @@ - { - my ($aclocal, $flags) = @_; - -+ @ex = grep (/^aclocal$/, @exclude); -+ if ($#ex != -1) { -+ return; -+ } -+ - # aclocal 1.8+ does all this for free. It can be recognized by its - # --force support. - if ($aclocal_supports_force) -@@ -368,7 +384,10 @@ +@@ -493,8 +501,11 @@ sub autoreconf_current_directory ($) } else { -- xsystem_hint ("autopoint is needed because this package uses Gettext", "$autopoint"); + @ex = grep (/^autopoint$/, @exclude); + if ($#ex == -1) { -+ xsystem_hint ("autopoint is needed because this package uses Gettext", "$autopoint"); + xsystem_hint ("autopoint is needed because this package uses Gettext", + $autopoint); + } } -@@ -532,16 +551,17 @@ +@@ -687,9 +698,12 @@ sub autoreconf_current_directory ($) { $libtoolize .= " --ltdl"; } -- xsystem_hint ("libtoolize is needed because this package uses Libtool", $libtoolize); -- $rerun_aclocal = 1; + @ex = grep (/^libtoolize$/, @exclude); + if ($#ex == -1) { -+ xsystem_hint ("libtoolize is needed because this package uses Libtool", $libtoolize); -+ $rerun_aclocal = 1; + xsystem_hint ("libtoolize is needed because this package uses Libtool", + $libtoolize); + $rerun_aclocal = 1; + } } else { - verb "$configure_ac: not running libtoolize: --install not given"; +@@ -726,8 +740,11 @@ sub autoreconf_current_directory ($) } - -- -- - # ------------------- # - # Rerunning aclocal. # - # ------------------- # -@@ -572,7 +592,10 @@ + elsif ($install) + { ++ @ex = grep (/^gtkdocize$/, @exclude); ++ if ($#ex == -1) { + xsystem_hint ("gtkdocize is needed because this package uses Gtkdoc", + $gtkdocize); ++ } + } + else + { +@@ -765,7 +782,10 @@ sub autoreconf_current_directory ($) # latter runs the former, and (ii) autoconf is stricter than # autoheader. So all in all, autoconf should give better error # messages. -- xsystem ($autoconf); + @ex = grep (/^autoconf$/, @exclude); + if ($#ex == -1) { -+ xsystem ("$autoconf"); + xsystem ($autoconf); + } # -------------------- # -@@ -593,7 +616,10 @@ +@@ -786,7 +806,10 @@ sub autoreconf_current_directory ($) } else { -- xsystem ($autoheader); + @ex = grep (/^autoheader$/, @exclude); + if ($#ex == -1) { -+ xsystem ("$autoheader"); + xsystem ($autoheader); + } } -@@ -610,7 +636,10 @@ +@@ -803,7 +826,10 @@ sub autoreconf_current_directory ($) # We should always run automake, and let it decide whether it shall - # update the file or not. In fact, the effect of `$force' is already - # included in `$automake' via `--no-force'. -- xsystem ($automake); + # update the file or not. In fact, the effect of '$force' is already + # included in '$automake' via '--no-force'. + @ex = grep (/^automake$/, @exclude); + if ($#ex == -1) { -+ xsystem ("$automake"); + xsystem ($automake); + } } - -@@ -634,7 +663,10 @@ - } - else - { -- xsystem ("$make"); -+ @ex = grep (/^make$/, @exclude); -+ if ($#ex == -1) { -+ xsystem ("$make"); -+ } - } - } - } + # ---------------------------------------------------- # +-- +2.25.1 + diff --git a/meta/recipes-devtools/autoconf/autoconf/autoreconf-gnuconfigize.patch b/meta/recipes-devtools/autoconf/autoconf/autoreconf-gnuconfigize.patch deleted file mode 100644 index 5ff18c2350..0000000000 --- a/meta/recipes-devtools/autoconf/autoconf/autoreconf-gnuconfigize.patch +++ /dev/null @@ -1,38 +0,0 @@ -Upstream-Status: Pending - -# -# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher -# - -Index: autoconf-2.63/bin/autoreconf.in -=================================================================== ---- autoconf-2.63.orig/bin/autoreconf.in 2008-12-31 17:43:55.000000000 +0000 -+++ autoconf-2.63/bin/autoreconf.in 2008-12-31 17:46:16.000000000 +0000 -@@ -58,7 +58,7 @@ - $help = "Usage: $0 [OPTION]... [DIRECTORY]... - - Run `autoconf' (and `autoheader', `aclocal', `automake', `autopoint' --(formerly `gettextize'), and `libtoolize' where appropriate) -+(formerly `gettextize'), `libtoolize', and `gnu-configize' where appropriate) - repeatedly to remake the GNU Build System files in specified - DIRECTORIES and their subdirectories (defaulting to `.'). - -@@ -115,6 +115,7 @@ - my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize'; - my $autopoint = $ENV{'AUTOPOINT'} || 'autopoint'; - my $make = $ENV{'MAKE'} || 'make'; -+my $gnuconfigize = $ENV{'GNUCONFIGIZE'} || 'gnu-configize'; - - # --install -- as --add-missing in other tools. - my $install = 0; -@@ -644,6 +645,10 @@ - } - } - -+ @ex = grep (/^gnu-configize$/, @exclude); -+ if ($#ex == -1) { -+ xsystem ("$gnuconfigize"); -+ } - - # -------------- # - # Running make. # diff --git a/meta/recipes-devtools/autoconf/autoconf/autotest-automake-result-format.patch b/meta/recipes-devtools/autoconf/autoconf/autotest-automake-result-format.patch index b5e8174efd..de048d23d7 100644 --- a/meta/recipes-devtools/autoconf/autoconf/autotest-automake-result-format.patch +++ b/meta/recipes-devtools/autoconf/autoconf/autotest-automake-result-format.patch @@ -1,22 +1,14 @@ -From a7e722f974e2529d3e564d8d94c86cc8bdbc40e7 Mon Sep 17 00:00:00 2001 -From: Radu Patriu -Date: Mon, 24 Mar 2014 16:33:19 +0200 -Subject: [PATCH] autotest: new testsuite option to enable automake test - result format +From 8c0f24404bebffdaf3132d81e2b9560d34ff1677 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Thu, 12 Mar 2020 17:25:45 +0000 +Subject: [PATCH 6/7] autotest-automake-result-format.patch -* lib/autotest/general.m4: added "--am-fmt | -A" command line -parameter for testsuite script to enable "RESULT: testname" output; -will be used by yocto ptest packages. - -Upstream-Status: Pending - -Signed-off-by: Radu Patriu --- - lib/autotest/general.m4 | 39 +++++++++++++++++++++++++++++---------- + lib/autotest/general.m4 | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 -index 60c0352..c1f5a9b 100644 +index 0c0e3c5b..17590e96 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -412,6 +412,9 @@ at_recheck= @@ -29,7 +21,7 @@ index 60c0352..c1f5a9b 100644 # The directory we run the suite in. Default to . if no -C option. at_dir=`pwd` # An absolute reference to this testsuite script. -@@ -530,6 +533,10 @@ do +@@ -525,6 +528,10 @@ do at_check_filter_trace=at_fn_filter_trace ;; @@ -40,7 +32,7 @@ index 60c0352..c1f5a9b 100644 [[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]]) at_fn_validate_ranges at_option AS_VAR_APPEND([at_groups], ["$at_option$as_nl"]) -@@ -718,10 +725,10 @@ m4_divert_push([HELP_MODES])dnl +@@ -713,10 +720,10 @@ m4_divert_push([HELP_MODES])dnl cat <<_ATEOF || at_write_fail=1 Operation modes: @@ -55,7 +47,7 @@ index 60c0352..c1f5a9b 100644 _ATEOF m4_divert_pop([HELP_MODES])dnl m4_wrap([m4_divert_push([HELP_TUNING_BEGIN])dnl -@@ -747,6 +754,7 @@ Execution tuning: +@@ -742,6 +749,7 @@ Execution tuning: -d, --debug inhibit clean up and top-level logging [ default for debugging scripts] -x, --trace enable tests shell tracing @@ -63,7 +55,7 @@ index 60c0352..c1f5a9b 100644 _ATEOF m4_divert_pop([HELP_TUNING_BEGIN])])dnl m4_divert_push([HELP_END])dnl -@@ -1162,7 +1170,9 @@ at_fn_group_banner () +@@ -1129,7 +1137,9 @@ at_fn_group_banner () [*]) at_desc_line="$[1]: " ;; esac AS_VAR_APPEND([at_desc_line], ["$[3]$[4]"]) @@ -74,7 +66,7 @@ index 60c0352..c1f5a9b 100644 echo "# -*- compilation -*-" >> "$at_group_log" } -@@ -1188,42 +1198,51 @@ _ATEOF +@@ -1155,42 +1165,51 @@ _ATEOF case $at_xfail:$at_status in yes:0) at_msg="UNEXPECTED PASS" @@ -132,5 +124,5 @@ index 60c0352..c1f5a9b 100644 at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg" case $at_status in -- -1.7.9.5 +2.25.1 diff --git a/meta/recipes-devtools/autoconf/autoconf/check-automake-cross-warning.patch b/meta/recipes-devtools/autoconf/autoconf/check-automake-cross-warning.patch deleted file mode 100644 index 73394d7d52..0000000000 --- a/meta/recipes-devtools/autoconf/autoconf/check-automake-cross-warning.patch +++ /dev/null @@ -1,34 +0,0 @@ -Use --warning=cross only if supported by automake - -Upstream-Status: Inappropriate [configuration] - -Signed-off-by: Constantin Musca - ---- a/bin/autoreconf.in -+++ b/bin/autoreconf.in -@@ -127,6 +127,8 @@ my $aclocal_supports_warnings = 0; - my $automake_supports_force_missing = 0; - # Does automake support -Wfoo? - my $automake_supports_warnings = 0; -+# Does automake support --warning=cross -+my $automake_supports_cross_warning = 0; - - my @prepend_include; - my @include; -@@ -191,6 +193,7 @@ sub parse_args () - $aclocal_supports_warnings = $aclocal_help =~ /--warnings/; - $automake_supports_force_missing = $automake_help =~ /--force-missing/; - $automake_supports_warnings = $automake_help =~ /--warnings/; -+ $automake_supports_cross_warning = $automake_help =~ /cross/; - - # Dispatch autoreconf's option to the tools. - # --include; -@@ -244,6 +247,8 @@ sub parse_args () - $libtoolize .= ' --debug'; - } - # --warnings; -+ @warning = grep { $_ ne "cross" } @warning -+ if ! $automake_supports_cross_warning; - if (@warning) - { - my $warn = ' --warnings=' . join (',', @warning); diff --git a/meta/recipes-devtools/autoconf/autoconf/config_site.patch b/meta/recipes-devtools/autoconf/autoconf/config_site.patch deleted file mode 100644 index 9f044404dd..0000000000 --- a/meta/recipes-devtools/autoconf/autoconf/config_site.patch +++ /dev/null @@ -1,40 +0,0 @@ -Upstream-Status: Pending - -Poky provides a list of site files in CONFIG_SITE whereas autoconf -only expects one file. This patch changes autoconf to accept a list of -them. - -RP 1/2/10 - -Updated for 2.68 version: the CONFIG_SITE var was not getting used at all -fixed the 2.68 code -Nitin A Kamble 2011/05/27 - -Index: autoconf-2.68/lib/autoconf/general.m4 -=================================================================== ---- autoconf-2.68.orig/lib/autoconf/general.m4 -+++ autoconf-2.68/lib/autoconf/general.m4 -@@ -1878,7 +1878,6 @@ AU_DEFUN([AC_VALIDATE_CACHED_SYSTEM_TUPL - m4_define([AC_SITE_LOAD], - [# Prefer an explicitly selected file to automatically selected ones. - ac_site_file1=NONE --ac_site_file2=NONE - if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in @%:@(( -@@ -1886,14 +1885,8 @@ if test -n "$CONFIG_SITE"; then - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac --elif test "x$prefix" != xNONE; then -- ac_site_file1=$prefix/share/config.site -- ac_site_file2=$prefix/etc/config.site --else -- ac_site_file1=$ac_default_prefix/share/config.site -- ac_site_file2=$ac_default_prefix/etc/config.site - fi --for ac_site_file in "$ac_site_file1" "$ac_site_file2" -+for ac_site_file in $ac_site_file1 - do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then diff --git a/meta/recipes-devtools/autoconf/autoconf/fix_path_xtra.patch b/meta/recipes-devtools/autoconf/autoconf/fix_path_xtra.patch deleted file mode 100644 index 65df88f8f9..0000000000 --- a/meta/recipes-devtools/autoconf/autoconf/fix_path_xtra.patch +++ /dev/null @@ -1,120 +0,0 @@ -Upstream-Status: Pending - -We don't build xmkmf so any values returned from it are going to be wrong. -Using any paths in /usr/ for x headers/libs is a bad idea when cross compiling. -This patch removes them to stop any confusion. - -RP - 20071115 - -Index: autoconf-2.68/lib/autoconf/libs.m4 -=================================================================== ---- autoconf-2.68.orig/lib/autoconf/libs.m4 -+++ autoconf-2.68/lib/autoconf/libs.m4 -@@ -159,53 +159,6 @@ m4_popdef([AC_Lib_Name])dnl - # --------------------- # - - --# _AC_PATH_X_XMKMF --# ---------------- --# Internal subroutine of _AC_PATH_X. --# Set ac_x_includes and/or ac_x_libraries. --m4_define([_AC_PATH_X_XMKMF], --[AC_ARG_VAR(XMKMF, [Path to xmkmf, Makefile generator for X Window System])dnl --rm -f -r conftest.dir --if mkdir conftest.dir; then -- cd conftest.dir -- cat >Imakefile <<'_ACEOF' --incroot: -- @echo incroot='${INCROOT}' --usrlibdir: -- @echo usrlibdir='${USRLIBDIR}' --libdir: -- @echo libdir='${LIBDIR}' --_ACEOF -- if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then -- # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -- for ac_var in incroot usrlibdir libdir; do -- eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" -- done -- # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. -- for ac_extension in a so sl dylib la dll; do -- if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && -- test -f "$ac_im_libdir/libX11.$ac_extension"; then -- ac_im_usrlibdir=$ac_im_libdir; break -- fi -- done -- # Screen out bogus values from the imake configuration. They are -- # bogus both because they are the default anyway, and because -- # using them would break gcc on systems where it needs fixed includes. -- case $ac_im_incroot in -- /usr/include) ac_x_includes= ;; -- *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; -- esac -- case $ac_im_usrlibdir in -- /usr/lib | /usr/lib64 | /lib | /lib64) ;; -- *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; -- esac -- fi -- cd .. -- rm -f -r conftest.dir --fi --])# _AC_PATH_X_XMKMF -- -- - # _AC_PATH_X_DIRECT - # ----------------- - # Internal subroutine of _AC_PATH_X. -@@ -213,44 +166,7 @@ fi - m4_define([_AC_PATH_X_DIRECT], - [# Standard set of common directories for X headers. - # Check X11 before X11Rn because it is often a symlink to the current release. --ac_x_header_dirs=' --/usr/X11/include --/usr/X11R7/include --/usr/X11R6/include --/usr/X11R5/include --/usr/X11R4/include -- --/usr/include/X11 --/usr/include/X11R7 --/usr/include/X11R6 --/usr/include/X11R5 --/usr/include/X11R4 -- --/usr/local/X11/include --/usr/local/X11R7/include --/usr/local/X11R6/include --/usr/local/X11R5/include --/usr/local/X11R4/include -- --/usr/local/include/X11 --/usr/local/include/X11R7 --/usr/local/include/X11R6 --/usr/local/include/X11R5 --/usr/local/include/X11R4 -- --/usr/X386/include --/usr/x386/include --/usr/XFree86/include/X11 -- --/usr/include --/usr/local/include --/usr/unsupported/include --/usr/athena/include --/usr/local/x11r5/include --/usr/lpp/Xamples/include -- --/usr/openwin/include --/usr/openwin/share/include' -+ac_x_header_dirs='' - - if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for Xlib.h. -@@ -299,7 +215,6 @@ AC_DEFUN([_AC_PATH_X], - [AC_CACHE_VAL(ac_cv_have_x, - [# One or both of the vars are not set, and there is no cached value. - ac_x_includes=no ac_x_libraries=no --_AC_PATH_X_XMKMF - _AC_PATH_X_DIRECT - case $ac_x_includes,$ac_x_libraries in #( - no,* | *,no | *\'*) diff --git a/meta/recipes-devtools/autoconf/autoconf/from-master.patch b/meta/recipes-devtools/autoconf/autoconf/from-master.patch new file mode 100644 index 0000000000..2a331961a6 --- /dev/null +++ b/meta/recipes-devtools/autoconf/autoconf/from-master.patch @@ -0,0 +1,3005 @@ +From 29ed3a774de200dd064c7997293b2cfd134ce5c4 Mon Sep 17 00:00:00 2001 +From: Zack Weinberg +Date: Tue, 8 Dec 2020 13:04:16 -0500 +Subject: [PATCH 01/13] maint: post-release administrivia + +* NEWS: Add header line for next release. +* .prev-version: Record previous version. +* cfg.mk (old_NEWS_hash): Auto-update. +--- + .prev-version | 2 +- + NEWS | 3 +++ + cfg.mk | 2 +- + 3 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/.prev-version b/.prev-version +index 5e1b8b06..587cb39c 100644 +--- a/.prev-version ++++ b/.prev-version +@@ -1 +1 @@ +-2.69 ++2.70 +diff --git a/NEWS b/NEWS +index ba418d1a..2a4db5f6 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,5 +1,8 @@ + GNU Autoconf NEWS - User visible changes. + ++* Noteworthy changes in release ?.? (????-??-??) [?] ++ ++ + * Noteworthy changes in release 2.70 (2020-12-08) [stable] + + ** Backward incompatibilities: +diff --git a/cfg.mk b/cfg.mk +index 33ad6e06..a15974bf 100644 +--- a/cfg.mk ++++ b/cfg.mk +@@ -84,7 +84,7 @@ update-release-year: + .PHONY: update-release-year + + # Prevent incorrect NEWS edits. +-old_NEWS_hash = b6af714b06666cbc66cd26169a56bd9d ++old_NEWS_hash = 152f03614545887231fddaf67821b4d4 + + exclude_file_name_regexp--sc_prohibit_undesirable_word_seq = \ + ^(maint\.mk|build-aux/texinfo\.tex)$$ +-- +2.25.1 + + +From b693e208691c54fbe07cdf49b9a98358baadcfe2 Mon Sep 17 00:00:00 2001 +From: Zack Weinberg +Date: Tue, 8 Dec 2020 21:47:13 -0500 +Subject: [PATCH 02/13] maint: add outline for future NEWS (release branch). + +--- + NEWS | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/NEWS b/NEWS +index 2a4db5f6..56ad10f2 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,7 +1,8 @@ + GNU Autoconf NEWS - User visible changes. + +-* Noteworthy changes in release ?.? (????-??-??) [?] ++* Noteworthy changes in release 2.70.1 (????-??-??) [?] + ++** Bug fixes. + + * Noteworthy changes in release 2.70 (2020-12-08) [stable] + +-- +2.25.1 + + +From efc940dc82763b7b2d6e65f04d15d5972d829c0a Mon Sep 17 00:00:00 2001 +From: Zack Weinberg +Date: Tue, 8 Dec 2020 21:35:45 -0500 +Subject: [PATCH 03/13] _AC_PROG_CC_C99: fix typo (#110396) + +_AC_PROG_CC_C99 was using the wrong test program. + +Fixes #110396, reported anonymously. + +* lib/autoconf/c.m4 (_AC_PROG_CC_C99): Use the C99 test program, not + the C89 test program. +--- + lib/autoconf/c.m4 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 +index fe217cad..601c2df4 100644 +--- a/lib/autoconf/c.m4 ++++ b/lib/autoconf/c.m4 +@@ -1559,7 +1559,7 @@ dnl SVR4 -Xc -D__EXTENSIONS__ + # option to output variable CC to make it so. + AC_DEFUN([_AC_PROG_CC_C99], + [AC_REQUIRE([_AC_C_C99_TEST_PROGRAM])]dnl +-[_AC_C_STD_TRY([c99], [ac_c_conftest_c89_program], ++[_AC_C_STD_TRY([c99], [ac_c_conftest_c99_program], + dnl Try + dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999) + dnl IBM XL C -qlanglvl=extc1x (V12.1; does not pass C11 test) +-- +2.25.1 + + +From 8f19de6df0cfab5eff9e62e3c8ec8443558476d1 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Fri, 11 Dec 2020 15:15:28 -0800 +Subject: [PATCH 04/13] Improve port of AC_C_RESTRICT to Oracle C++ + +Problem reported by Christian Biesinger in: +https://lists.gnu.org/r/bug-gnulib/2019-12/msg00159.html +* lib/autoconf/c.m4 (AC_C_RESTRICT): Port better to +Oracle Developer Studio C++ 12.5 or later. +This patch is adapted from Gnulib. +--- + lib/autoconf/c.m4 | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 +index 601c2df4..14240460 100644 +--- a/lib/autoconf/c.m4 ++++ b/lib/autoconf/c.m4 +@@ -2031,12 +2031,13 @@ AC_DEFUN([AC_C_RESTRICT], + nothing if this is not supported. Do not define if restrict is + supported only directly. */ + #undef restrict +-/* Work around a bug in Sun C++ 5.13: it does not support _Restrict or +- __restrict__, even though the corresponding Sun C compiler ends up with +- "#define restrict _Restrict" or "#define restrict __restrict__". +- Perhaps some future version of Sun C++ will work with restrict; +- if so, hopefully it defines __RESTRICT like Sun C does. */ +-#if defined __SUNPRO_CC && !defined __RESTRICT ++/* Work around a bug in older versions of Sun C++, which did not ++ #define __restrict__ or support _Restrict or __restrict__ ++ even though the corresponding Sun C compiler ended up with ++ "#define restrict _Restrict" or "#define restrict __restrict__" ++ in the previous line. This workaround can be removed once ++ we assume Oracle Developer Studio 12.5 (2016) or later. */ ++#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__ + # define _Restrict + # define __restrict__ + #endif]) +-- +2.25.1 + + +From 2f3f782cdd8d5105dc15ef18e2d11aac40d7c462 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Fri, 11 Dec 2020 15:18:41 -0800 +Subject: [PATCH 05/13] Port minor AC_FUNC_ALLOCA fixes from Gnulib + +* lib/autoconf/functions.m4 (_AC_LIBOBJ_ALLOCA, AC_FUNC_ALLOCA): +Use ' not ` in generated comments, as per current GNU coding style. +(_AC_LIBOBJ_ALLOCA): Use plain # instead of unnecessary quadrigraph. +This patch is adapted from Gnulib. +--- + lib/autoconf/functions.m4 | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 +index 49aa5c58..12f60b99 100644 +--- a/lib/autoconf/functions.m4 ++++ b/lib/autoconf/functions.m4 +@@ -358,8 +358,8 @@ AN_FUNCTION([getwd], [warn: getwd is deprecated, use getcwd instead]) + + # _AC_LIBOBJ_ALLOCA + # ----------------- +-# Set up the LIBOBJ replacement of `alloca'. Well, not exactly +-# AC_LIBOBJ since we actually set the output variable `ALLOCA'. ++# Set up the LIBOBJ replacement of 'alloca'. Well, not exactly ++# AC_LIBOBJ since we actually set the output variable 'ALLOCA'. + # Nevertheless, for Automake, AC_LIBSOURCES it. + m4_define([_AC_LIBOBJ_ALLOCA], + [# The SVR3 libPW and SVR4 libucb both contain incompatible functions +@@ -368,7 +368,7 @@ m4_define([_AC_LIBOBJ_ALLOCA], + # use ar to extract alloca.o from them instead of compiling alloca.c. + AC_LIBSOURCES(alloca.c) + AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl +-AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using `alloca.c'.]) ++AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.]) + + AC_CACHE_CHECK([stack direction for C alloca], + [ac_cv_c_stack_direction], +@@ -400,7 +400,7 @@ AH_VERBATIM([STACK_DIRECTION], + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +-@%:@undef STACK_DIRECTION])dnl ++#undef STACK_DIRECTION])dnl + AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) + ])# _AC_LIBOBJ_ALLOCA + +@@ -453,7 +453,7 @@ fi + + if test $ac_cv_func_alloca_works = yes; then + AC_DEFINE(HAVE_ALLOCA, 1, +- [Define to 1 if you have `alloca', as a function or macro.]) ++ [Define to 1 if you have 'alloca', as a function or macro.]) + else + _AC_LIBOBJ_ALLOCA + fi +-- +2.25.1 + + +From 5c2bcf10c0b0bf5b463f6086b9548da84fe20cc7 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Fri, 11 Dec 2020 15:22:02 -0800 +Subject: [PATCH 06/13] Port minor AC_HEADER_MAJOR fixes from Gnulib + +* lib/autoconf/headers.m4 (AC_HEADER_MAJOR): +Improve m4 quoting. +--- + lib/autoconf/headers.m4 | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4 +index bc70e0b6..802eec2f 100644 +--- a/lib/autoconf/headers.m4 ++++ b/lib/autoconf/headers.m4 +@@ -499,13 +499,13 @@ AN_FUNCTION([minor], [AC_HEADER_MAJOR]) + AN_HEADER([sys/mkdev.h], [AC_HEADER_MAJOR]) + AC_DEFUN([AC_HEADER_MAJOR], + [AC_CHECK_HEADERS_ONCE([sys/types.h]) +-AC_CHECK_HEADER(sys/mkdev.h, +- [AC_DEFINE(MAJOR_IN_MKDEV, 1, ++AC_CHECK_HEADER([sys/mkdev.h], ++ [AC_DEFINE([MAJOR_IN_MKDEV], [1], + [Define to 1 if `major', `minor', and `makedev' are + declared in .])]) + if test $ac_cv_header_sys_mkdev_h = no; then +- AC_CHECK_HEADER(sys/sysmacros.h, +- [AC_DEFINE(MAJOR_IN_SYSMACROS, 1, ++ AC_CHECK_HEADER([sys/sysmacros.h], ++ [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], + [Define to 1 if `major', `minor', and `makedev' + are declared in .])]) + fi +-- +2.25.1 + + +From 8118c2adc4dc0a7ee4f9616197d0e3db42f9a788 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Fri, 11 Dec 2020 15:23:53 -0800 +Subject: [PATCH 07/13] Improve AC_USE_SYSTEM_EXTENSIONS port to HP-UX 11.11 + +* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): +Define _HPUX_ALT_XOPEN_SOCKET_API, for HP-UX 11.11. +This patch is adapted from Gnulib. +--- + lib/autoconf/specific.m4 | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 +index 275938ca..853276bb 100644 +--- a/lib/autoconf/specific.m4 ++++ b/lib/autoconf/specific.m4 +@@ -389,6 +389,11 @@ AH_VERBATIM([USE_SYSTEM_EXTENSIONS], + #ifndef _GNU_SOURCE + # undef _GNU_SOURCE + #endif ++/* Enable X/Open compliant socket functions that do not require linking ++ with -lxnet on HP-UX 11.11. */ ++#ifndef _HPUX_ALT_XOPEN_SOCKET_API ++# undef _HPUX_ALT_XOPEN_SOCKET_API ++#endif + /* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +@@ -496,6 +501,7 @@ dnl it should only be defined when necessary. + AC_DEFINE([_ALL_SOURCE]) + AC_DEFINE([_DARWIN_C_SOURCE]) + AC_DEFINE([_GNU_SOURCE]) ++ AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API]) + AC_DEFINE([_NETBSD_SOURCE]) + AC_DEFINE([_OPENBSD_SOURCE]) + AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) +-- +2.25.1 + + +From 616480956de06e32526775c8b7f8fd34d04238a5 Mon Sep 17 00:00:00 2001 +From: Zack Weinberg +Date: Mon, 21 Dec 2020 15:29:32 -0500 +Subject: [PATCH 08/13] =?UTF-8?q?autom4te:=20correct=20error=20message=20w?= + =?UTF-8?q?hen=20we=20can=E2=80=99t=20create=20autom4te.cache.?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +While testing something else, I noticed that autom4te may print a +nonsensical error message when it fails to create autom4te.cache, +because it checks again whether the directory already exists before +giving up, and this clobbers errno. + +Instead of doing (the perl equivalent of) + test -d $cache || mkdir $cache || test -d $cache +call mkdir unconditionally. If it fails with an errno code other than +EEXIST, consider that a hard failure; if it fails with EEXIST, check +whether the thing that exists is in fact a directory. (A symlink to +a directory qualifies; I wouldn’t be surprised if people are moving +autom4te.cache around with symlinks.) + +Either way, if we fail, report strerror(errno) from the original +mkdir failure. Also, print the current working directory as part +of the error message; this aids debugging when you’re working with a +big hairy nested tree. + +* bin/autom4te.in: Don’t check whether autom4te.cache exists before + attempting to create it. Only stat autom4te.cache if mkdir fails + with EEXIST, otherwise fail immediately. Make sure to report the + errno code from mkdir, not the subsequent stat (if any). Report + the current working directory as part of the error message. + +* tests/tools.at: Verify that autom4te reports the actual reason when + it fails to create autom4te.cache. Verify that failure to create + autom4te.cache because that name exists, but isn’t a directory, + is detected. +--- + bin/autom4te.in | 19 ++++++++++++++----- + tests/tools.at | 20 ++++++++++++++++++-- + 2 files changed, 32 insertions(+), 7 deletions(-) + +diff --git a/bin/autom4te.in b/bin/autom4te.in +index febcdeea..4c2b905c 100644 +--- a/bin/autom4te.in ++++ b/bin/autom4te.in +@@ -1012,12 +1012,21 @@ if ($freeze) + exit $exit_code; + } + +-# We need our cache directory. Don't fail with parallel creation. +-if (! -d "$cache") ++# Ensure the cache directory exists. ++if (! mkdir ($cache, 0755)) + { +- mkdir "$cache", 0755 +- or -d "$cache" +- or fatal "cannot create $cache: $!"; ++ # Snapshot $! immediately, the next few operations may clobber it. ++ my $eexist = $!{EEXIST}; ++ my $errmsg = "$!"; ++ ++ # If mkdir failed with EEXIST, that means the *name* $cache ++ # already exists, but it might be the wrong kind of file. ++ if (! $eexist || ! -d $cache) ++ { ++ require Cwd; ++ my $cwd = Cwd::cwd(); ++ fatal "cannot create $cache in $cwd: $errmsg"; ++ } + } + + # Open the index for update, and lock it. autom4te handles several +diff --git a/tests/tools.at b/tests/tools.at +index d32ad362..49710202 100644 +--- a/tests/tools.at ++++ b/tests/tools.at +@@ -1534,20 +1534,36 @@ end-language: "Autoconf-without-aclocal-m4" + # A failed redirection may cause a status of 2 with FreeBSD sh. + AT_CHECK([(: > sub/some-file) || exit 1 && exit 77], 1, [ignore], [ignore]) + +-# Failure to create cache directory. ++# Failure to create cache directory due to access permissions. + AT_CHECK_AUTOCONF([], [1], [ignore], [stderr]) + AT_CHECK([grep 'cannot create .*autom4te.cache' stderr], [0], [ignore]) ++AT_CHECK([grep ': Permission denied' stderr], [0], [ignore]) + AT_CHECK([test -f configure], [1]) + ++# Failure to create cache directory due to something else in the way. + chmod u+w sub ++: > sub/autom4te.cache ++AT_CHECK_AUTOCONF([], [1], [ignore], [stderr]) ++AT_CHECK([grep 'cannot create .*autom4te.cache' stderr], [0], [ignore]) ++AT_CHECK([grep ': File exists' stderr], [0], [ignore]) ++AT_CHECK([test -f configure], [1]) ++ ++# This time, creation should succeed. ++rm -f sub/autom4te.cache + AT_CHECK_AUTOCONF ++AT_CHECK([test -d sub/autom4te.cache]) + + rm -f configure sub/autom4te.cache/* + chmod a-w sub/autom4te.cache + + # Failure to create a file in the cache directory. + AT_CHECK_AUTOCONF([], [1], [ignore], [stderr]) +-AT_CHECK([grep 'cannot open.*autom4te.cache' stderr], [0], [ignore]) ++AT_CHECK([grep 'cannot open .*autom4te.cache' stderr], [0], [ignore]) ++AT_CHECK([test -f configure], [1]) ++ ++# If the directory already exists, that should be fine. ++chmod u+w sub/autom4te.cache ++AT_CHECK_AUTOCONF + + AT_CLEANUP + +-- +2.25.1 + + +From de36ccf6637974f4faba3747813d38ee46e77d69 Mon Sep 17 00:00:00 2001 +From: Zack Weinberg +Date: Wed, 23 Dec 2020 12:14:06 -0500 +Subject: [PATCH 09/13] Use -fno-builtin, not -Werror, in AC_CHECK_DECLS + (#110400) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +clang issues only a warning, not an error, when an undeclared +identifier that names a built-in function is used: for instance + + char *(*p)(const char *, int) = strchr; + +(with no `#include `) is an error with most compilers, +a warning with clang. This broke the 2.69 implementation of +AC_CHECK_DECL. In commit 82ef7805faffa151e724aa76c245ec590d174580, +we tried to work around this quirk by using -Werror, but that put us +at risk of being tripped up by other warnings. Bug 110400 reports, +for instance, that this fragment (which is roughly what you get, after +preprocessing, when AC_CHECK_DECL is applied to a function that *is* +properly declared) + + extern void ac_decl (int, char *); + int main (void) + { + (void) ac_decl; + ; + return 0; + } + +provokes a warning from clang (and thus an error) when -Wextra-semi-stmt +has been added to CFLAGS earlier in the configure script. The extra +semicolon comes from AC_LANG_PROGRAM, and we can’t get rid of it +because we have no way of telling reliably when someone wrote +something like + + AC_LANG_PROGRAM([[#include ]], + [[puts("hello world")]]) + +with no semicolon at the end of the statement; this has been +acceptable for decades. Besides, that’s just one warning, who knows +what compilers will start complaining about tomorrow? + +So: change AC_CHECK_DECL to compile its programs with -fno-builtin, +instead, when the default compilation mode fails to detect an +undeclared strchr. The code is restructured so that we can try other +options as well, if we find another compiler with the same quirk but +different command-line syntax. + +(All of this logic is very C-family specific, but it appears to me +that AC_CHECK_DECL has never worked with other languages, so we can +continue to live with that for now.) + +Fixes bug 110400; partially reverts 82ef7805faffa151e724aa76c245ec590d174580. + + * lib/autoconf/general.m4 (_AC_UNDECLARED_WARNING): Rename to + _AC_UNDECLARED_BUILTIN. Instead of looking at diagnostic output, + loop trying to find a command-line option that makes the compiler + error out on undeclared builtins. + (_AC_CHECK_DECL_BODY): Don’t AC_REQUIRE anything here. + Make shell code language-agnostic, except for the actual test program. + Add arguments to the shell function for additional compiler options + to use. + (AC_CHECK_DECL): AC_REQUIRE _AC_UNDECLARED_BUILTIN here. + Supply $ac_{AC_LANG_ABBREV}_undeclared_builtin_options to + ac_fn_check_decl. + + * tests/local.at (AT_CONFIG_CMP): Update list of variables to ignore + when comparing C and C++ configure runs. + * tests/semantics.at (AC_CHECK_DECLS): Add memcpy and strchr to + AC_CHECK_DECLS call for functions that may be known to the compiler. + + * doc/autoconf.texi (AC_CHECK_DECL, AC_CHECK_DECLS): Remove note + about compiler warnings. +--- + doc/autoconf.texi | 12 --- + lib/autoconf/general.m4 | 158 +++++++++++++++++++++------------------- + tests/local.at | 10 +-- + tests/semantics.at | 10 ++- + 4 files changed, 95 insertions(+), 95 deletions(-) + +diff --git a/doc/autoconf.texi b/doc/autoconf.texi +index a67cccb2..5e17280e 100644 +--- a/doc/autoconf.texi ++++ b/doc/autoconf.texi +@@ -6583,12 +6583,6 @@ parentheses for types which can be zero-initialized: + AC_CHECK_DECL([basename(char *)]) + @end example + +-Some compilers don't indicate every missing declaration by the error +-status. This macro checks the standard error from such compilers and +-considers a declaration missing if any warnings have been reported. For +-most compilers, though, warnings do not affect this macro's outcome +-unless @code{AC_LANG_WERROR} is also specified. +- + This macro caches its result in the @code{ac_cv_have_decl_@var{symbol}} + variable, with characters not suitable for a variable name mapped to + underscores. +@@ -6649,12 +6643,6 @@ You fall into the second category only in extreme situations: either + your files may be used without being configured, or they are used during + the configuration. In most cases the traditional approach is enough. + +-Some compilers don't indicate every missing declaration by the error +-status. This macro checks the standard error from such compilers and +-considers a declaration missing if any warnings have been reported. For +-most compilers, though, warnings do not affect this macro's outcome +-unless @code{AC_LANG_WERROR} is also specified. +- + This macro caches its results in @code{ac_cv_have_decl_@var{symbol}} + variables, with characters not suitable for a variable name mapped to + underscores. +diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 +index 16f0d074..47f7ee42 100644 +--- a/lib/autoconf/general.m4 ++++ b/lib/autoconf/general.m4 +@@ -3046,84 +3046,89 @@ AC_DEFUN([AC_CHECK_FILES], + ## Checking for declared symbols. ## + ## ------------------------------- ## + +- +-# _AC_UNDECLARED_WARNING ++# _AC_UNDECLARED_BUILTIN + # ---------------------- +-# Set ac_[]_AC_LANG_ABBREV[]_decl_warn_flag=yes if the compiler uses a warning, +-# not a more-customary error, to report some undeclared identifiers. Fail when +-# an affected compiler warns also on valid input. _AC_PROG_PREPROC_WORKS_IFELSE +-# solves a related problem. +-AC_DEFUN([_AC_UNDECLARED_WARNING], +-[# The Clang compiler raises a warning for an undeclared identifier that matches +-# a compiler builtin function. All extant Clang versions are affected, as of +-# Clang 3.6.0. Test a builtin known to every version. This problem affects the +-# C and Objective C languages, but Clang does report an error under C++ and +-# Objective C++. +-# +-# Passing -fno-builtin to the compiler would suppress this problem. That +-# strategy would have the advantage of being insensitive to stray warnings, but +-# it would make tests less realistic. +-AC_CACHE_CHECK([how $[]_AC_CC[] reports undeclared, standard C functions], +-[ac_cv_[]_AC_LANG_ABBREV[]_decl_report], +-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [(void) strchr;])], +- [AS_IF([test -s conftest.err], [dnl +- # For AC_CHECK_DECL to react to warnings, the compiler must be silent on +- # valid AC_CHECK_DECL input. No library function is consistently available +- # on freestanding implementations, so test against a dummy declaration. +- # Include always-available headers on the off chance that they somehow +- # elicit warnings. +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl +-#include ++# Set ac_[]_AC_LANG_ABBREV[]_undeclared_builtin_options to any options ++# needed to make the compiler issue a hard error, not a warning, when ++# an undeclared function is used whose declaration happens to be ++# built into the compiler (e.g. 'strchr' is often known in advance to ++# the C compiler). These options should not cause any other unrelated ++# warnings to become errors. If no such options can be found, or if ++# they make the compiler error out on a correct program of the form ++# used by AC_CHECK_DECL, report failure. ++AC_DEFUN([_AC_UNDECLARED_BUILTIN], ++[AC_CACHE_CHECK( ++ [for $[]_AC_CC options needed to detect all undeclared functions], ++ [ac_cv_[]_AC_LANG_ABBREV[]_undeclared_builtin_options], ++ [ac_save_CFLAGS=$CFLAGS ++ ac_cv_[]_AC_LANG_ABBREV[]_undeclared_builtin_options='cannot detect' ++ for ac_arg in '' -fno-builtin; do ++ CFLAGS="$ac_save_CFLAGS $ac_arg" ++ # This test program should *not* compile successfully. ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [(void) strchr;])], ++ [], ++ [# This test program should compile successfully. ++ # No library function is consistently available on ++ # freestanding implementations, so test against a dummy ++ # declaration. Include always-available headers on the ++ # off chance that they somehow elicit warnings. ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( ++[[#include + #include + #include + #include +-extern void ac_decl (int, char *);], +-[@%:@ifdef __cplusplus +- (void) ac_decl ((int) 0, (char *) 0); +- (void) ac_decl; +-@%:@else ++extern void ac_decl (int, char *); ++]], ++[[(void) ac_decl (0, (char *) 0); + (void) ac_decl; +-@%:@endif +-])], +- [AS_IF([test -s conftest.err], +- [AC_MSG_FAILURE([cannot detect from compiler exit status or warnings])], +- [ac_cv_[]_AC_LANG_ABBREV[]_decl_report=warning])], +- [AC_MSG_FAILURE([cannot compile a simple declaration test])])], +- [AC_MSG_FAILURE([compiler does not report undeclared identifiers])])], +- [ac_cv_[]_AC_LANG_ABBREV[]_decl_report=error])]) +- +-case $ac_cv_[]_AC_LANG_ABBREV[]_decl_report in +- warning) ac_[]_AC_LANG_ABBREV[]_decl_warn_flag=yes ;; +- *) ac_[]_AC_LANG_ABBREV[]_decl_warn_flag= ;; +-esac +-])# _AC_UNDECLARED_WARNING ++]])], ++ [AS_IF([test x"$ac_arg" = x], ++ [ac_cv_[]_AC_LANG_ABBREV[]_undeclared_builtin_options='none needed'], ++ [ac_cv_[]_AC_LANG_ABBREV[]_undeclared_builtin_options=$ac_arg]) ++ break], ++ [])]) ++ done ++ CFLAGS=$ac_save_CFLAGS ++ ]) ++ AS_CASE([$ac_cv_[]_AC_LANG_ABBREV[]_undeclared_builtin_options], ++ ['cannot detect'], ++ [AC_MSG_FAILURE([cannot make $[]_AC_CC report undeclared builtins])], ++ ['none needed'], ++ [ac_[]_AC_LANG_ABBREV[]_undeclared_builtin_options=''], ++ [ac_[]_AC_LANG_ABBREV[]_undeclared_builtin_options=$ac_cv_[]_AC_LANG_ABBREV[]_undeclared_builtin_options]) ++]) + + # _AC_CHECK_DECL_BODY + # ------------------- + # Shell function body for AC_CHECK_DECL. ++# If we are compiling C, just refer to the name of the function, so we ++# don't implicitly declare it. However, if we are compiling C++, ++# `(void) function_name;' won't work when function_name has more than one ++# overload, we need to fabricate a function call. Fortunately, there is ++# no such thing as an implicit function declaration in C++. ++# If the function is defined as a macro, we cannot verify its signature ++# without calling it, and it might not expand to a construct that's valid ++# as the only statement in a function body; just report it as available. + m4_define([_AC_CHECK_DECL_BODY], + [ AS_LINENO_PUSH([$[]1]) +- # Initialize each $ac_[]_AC_LANG_ABBREV[]_decl_warn_flag once. +- AC_DEFUN([_AC_UNDECLARED_WARNING_]_AC_LANG_ABBREV, +- [_AC_UNDECLARED_WARNING])dnl +- AC_REQUIRE([_AC_UNDECLARED_WARNING_]_AC_LANG_ABBREV)dnl +- [as_decl_name=`echo $][2|sed 's/ *(.*//'`] +- [as_decl_use=`echo $][2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`] +- AC_CACHE_CHECK([whether $as_decl_name is declared], [$[]3], +- [ac_save_werror_flag=$ac_[]_AC_LANG_ABBREV[]_werror_flag +- ac_[]_AC_LANG_ABBREV[]_werror_flag="$ac_[]_AC_LANG_ABBREV[]_decl_warn_flag$ac_[]_AC_LANG_ABBREV[]_werror_flag" +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]4], +-[@%:@ifndef $[]as_decl_name +-@%:@ifdef __cplusplus +- (void) $[]as_decl_use; +-@%:@else +- (void) $[]as_decl_name; +-@%:@endif +-@%:@endif +-])], ++ as_decl_name=`echo $[]2|sed 's/ *(.*//'` ++ AC_CACHE_CHECK([whether $][as_decl_name is declared], [$[]3], ++ [as_decl_use=`echo $[]2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` ++ AS_VAR_COPY([ac_save_FLAGS], [$[]6]) ++ AS_VAR_APPEND([$[]6], [" $[]5"]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$][4]], ++[[#ifndef $][as_decl_name ++#ifdef __cplusplus ++ (void) $][as_decl_use; ++#else ++ (void) $][as_decl_name; ++#endif ++#endif ++]])], + [AS_VAR_SET([$[]3], [yes])], + [AS_VAR_SET([$[]3], [no])]) +- ac_[]_AC_LANG_ABBREV[]_werror_flag=$ac_save_werror_flag]) ++ AS_VAR_COPY([$[]6], [ac_save_FLAGS]) ++]) + AS_LINENO_POP + ])# _AC_CHECK_DECL_BODY + +@@ -3133,18 +3138,23 @@ m4_define([_AC_CHECK_DECL_BODY], + # ------------------------------------------------------- + # Check whether SYMBOL (a function, variable, or constant) is declared. + AC_DEFUN([AC_CHECK_DECL], +-[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_decl], +- [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_decl], +- [LINENO SYMBOL VAR INCLUDES], ++[AC_REQUIRE_SHELL_FN([ac_fn_check_decl], ++ [AS_FUNCTION_DESCRIBE([ac_fn_check_decl], ++ [LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR], + [Tests whether SYMBOL is declared in INCLUDES, setting cache variable +- VAR accordingly.])], ++ VAR accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR.])], + [_$0_BODY])]dnl ++dnl Initialize each $ac_[]_AC_LANG_ABBREV[]_undeclared_builtin_options once. ++[AC_DEFUN([_AC_UNDECLARED_BUILTIN_]_AC_LANG_ABBREV, ++ [_AC_UNDECLARED_BUILTIN])]dnl ++[AC_REQUIRE([_AC_UNDECLARED_BUILTIN_]_AC_LANG_ABBREV)]dnl + [AS_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])]dnl +-[ac_fn_[]_AC_LANG_ABBREV[]_check_decl ]dnl +-["$LINENO" "$1" "ac_Symbol" "AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])" +-AS_VAR_IF([ac_Symbol], [yes], [$2], [$3]) +-AS_VAR_POPDEF([ac_Symbol])dnl +-])# AC_CHECK_DECL ++[ac_fn_check_decl ]dnl ++["$LINENO" "$1" "ac_Symbol" "AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])" ]dnl ++["$ac_[]_AC_LANG_ABBREV[]_undeclared_builtin_options" "_AC_LANG_PREFIX[]FLAGS"] ++[AS_VAR_IF([ac_Symbol], [yes], [$2], [$3])]dnl ++[AS_VAR_POPDEF([ac_Symbol])]dnl ++)# AC_CHECK_DECL + + + # _AC_CHECK_DECLS(SYMBOL, ACTION-IF_FOUND, ACTION-IF-NOT-FOUND, +diff --git a/tests/local.at b/tests/local.at +index 536f9a54..9ab903be 100644 +--- a/tests/local.at ++++ b/tests/local.at +@@ -452,9 +452,9 @@ fi + # cxx: ignore all of: + # - CC, CPP, CCC, CXX, CXXCPP, CFLAGS, CXXFLAGS, GCC, GXX + # - ac_cv_env_(any of the above)_(set|value) +-# - ac_cv_c_compiler_gnu, ac_cv_cxx_compiler_gnu +-# - ac_cv_c_decl_report, ac_cv_cxx_decl_report +-# - ac_cv_prog_c_*, ac_cv_prog_cxx_*, ++# - ac_cv_(c|cxx)_compiler_gnu ++# - ac_cv_(c|cxx)_undeclared_builtin_options ++# - ac_cv_prog_c_*, ac_cv_prog_cxx_* + # - ac_cv_prog_(ac_ct_)?(CC|CXX|CPP|CXXCPP) + # + other ac_cv_c_* are renamed to ac_cv_cxx_* + # + OPENMP_CFLAGS is renamed to OPENMP_CXXFLAGS +@@ -546,8 +546,8 @@ m4_define([_AT_CONFIG_CMP_PRUNE], + /^ac_cv_prog_ac_ct_CXXCPP=/ d + /^ac_cv_c_compiler_gnu=/ d + /^ac_cv_cxx_compiler_gnu=/ d +- /^ac_cv_c_decl_report=/ d +- /^ac_cv_cxx_decl_report=/ d ++ /^ac_cv_c_undeclared_builtin_options=/ d ++ /^ac_cv_cxx_undeclared_builtin_options=/ d + /^ac_cv_prog_c_@<:@^=@:>@*=/ d + /^ac_cv_prog_cc_@<:@^=@:>@*=/ d + /^ac_cv_prog_cxx_@<:@^=@:>@*=/ d +diff --git a/tests/semantics.at b/tests/semantics.at +index ac7fe013..d449ce00 100644 +--- a/tests/semantics.at ++++ b/tests/semantics.at +@@ -201,8 +201,7 @@ fi + + # AC_CHECK_DECLS + # -------------- +-# For the benefit of _AC_UNDECLARED_WARNING compilers, these INCLUDES sections +-# should not elicit warnings. ++# Check that it performs the correct actions: + AT_CHECK_MACRO([AC_CHECK_DECLS], + [[AC_CHECK_DECLS([yes, no, myenum, mystruct, myfunc, mymacro1, mymacro2],,, + [[extern int yes; +@@ -211,8 +210,9 @@ AT_CHECK_MACRO([AC_CHECK_DECLS], + extern int myfunc(); + #define mymacro1(arg) arg + #define mymacro2]]) +- # Clang reports a warning for an undeclared builtin. +- AC_CHECK_DECLS([strerror],,, [[]]) ++ # Ensure we can detect missing declarations of functions whose ++ # signature may be built into the compiler. ++ AC_CHECK_DECLS([memcpy, strchr, strerror],,, [[]]) + # The difference in space-before-open-paren is intentional. + AC_CHECK_DECLS([basenam (char *), dirnam(char *), + moreargs (char, short, int, long, void *, char *, float, double)],,, +@@ -248,6 +248,7 @@ AT_CHECK_MACRO([AC_CHECK_DECLS], + [AT_CHECK_DEFINES( + [#define HAVE_DECL_BASENAM 1 + #define HAVE_DECL_DIRNAM 0 ++#define HAVE_DECL_MEMCPY 0 + #define HAVE_DECL_MOREARGS 1 + #define HAVE_DECL_MYENUM 1 + #define HAVE_DECL_MYFUNC 1 +@@ -255,6 +256,7 @@ AT_CHECK_MACRO([AC_CHECK_DECLS], + #define HAVE_DECL_MYMACRO2 1 + #define HAVE_DECL_MYSTRUCT 1 + #define HAVE_DECL_NO 0 ++#define HAVE_DECL_STRCHR 0 + #define HAVE_DECL_STRERROR 0 + #define HAVE_DECL_YES 1 + ])]) +-- +2.25.1 + + +From 08bb0fe5b409a4cd86620f114f4366e62b76ef49 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Tue, 29 Dec 2020 22:48:02 -0800 +Subject: [PATCH 10/13] doc: modernize grep discussion + +--- + doc/autoconf.texi | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/doc/autoconf.texi b/doc/autoconf.texi +index 5e17280e..d09aba70 100644 +--- a/doc/autoconf.texi ++++ b/doc/autoconf.texi +@@ -19291,8 +19291,8 @@ dir=`AS_DIRNAME(["$file"])` # This is more portable. + @item @command{egrep} + @c ------------------ + @prindex @command{egrep} +-Posix 1003.1-2001 no longer requires @command{egrep}, +-but many hosts do not yet support the Posix ++Although Posix stopped requiring @command{egrep} in 2001, ++a few traditional hosts (notably Solaris) do not support the Posix + replacement @code{grep -E}. Also, some traditional implementations do + not work on long input lines. To work around these problems, invoke + @code{AC_PROG_EGREP} and then use @code{$EGREP}. +@@ -19477,8 +19477,8 @@ expr: More than one '\(' was used. + @item @command{fgrep} + @c ------------------ + @prindex @command{fgrep} +-Posix 1003.1-2001 no longer requires @command{fgrep}, +-but many hosts do not yet support the Posix ++Although Posix stopped requiring @command{fgrep} in 2001, ++a few traditional hosts (notably Solaris) do not support the Posix + replacement @code{grep -F}. Also, some traditional implementations do + not work on long input lines. To work around these problems, invoke + @code{AC_PROG_FGREP} and then use @code{$FGREP}. +@@ -19519,7 +19519,7 @@ portable scripts should not combine @option{-c} with @option{-l}, + as Posix does not allow this. + + Some of the options required by Posix are not portable in practice. +-Don't use @samp{grep -q} to suppress output, because many @command{grep} ++Don't use @samp{grep -q} to suppress output, because traditional @command{grep} + implementations (e.g., Solaris) do not support @option{-q}. + Don't use @samp{grep -s} to suppress output either, because Posix + says @option{-s} does not suppress output, only some error messages; +@@ -19537,7 +19537,7 @@ Some traditional @command{grep} implementations do not work on long + input lines. On AIX the default @code{grep} silently truncates long + lines on the input before matching. + +-Also, many implementations do not support multiple regexps ++Also, traditional implementations do not support multiple regexps + with @option{-e}: they either reject @option{-e} entirely (e.g., Solaris) + or honor only the last pattern (e.g., IRIX 6.5 and NeXT). To + work around these problems, invoke @code{AC_PROG_GREP} and then use +-- +2.25.1 + + +From ec2aa28b6427274b214c244d05b32bc4d7e865cd Mon Sep 17 00:00:00 2001 +From: Bruno Haible +Date: Wed, 30 Dec 2020 10:21:48 -0500 +Subject: [PATCH 11/13] doc: Document another portability problem of 'od'. + +* doc/autoconf.texi (Limitations of Usual Tools): Document that decimal output +is not portable. +--- + doc/autoconf.texi | 23 +++++++++++++++++++++-- + 1 file changed, 21 insertions(+), 2 deletions(-) + +diff --git a/doc/autoconf.texi b/doc/autoconf.texi +index d09aba70..db1e0f46 100644 +--- a/doc/autoconf.texi ++++ b/doc/autoconf.texi +@@ -19782,14 +19782,33 @@ perfectly portable among Posix hosts. + @c --------------- + @prindex @command{od} + +-In Mac OS X 10.3, @command{od} does not support the ++In MacOS X versions prior to 10.4.3, @command{od} does not support the + standard Posix options @option{-A}, @option{-j}, @option{-N}, or + @option{-t}, or the XSI option, @option{-s}. The only + supported Posix option is @option{-v}, and the only supported + XSI options are those in @option{-bcdox}. The BSD + @command{hexdump} program can be used instead. + +-This problem no longer exists in Mac OS X 10.4.3. ++In some versions of some operating systems derived from Solaris 11, ++@command{od} prints decimal byte values padded with zeroes rather than ++with spaces: ++ ++@smallexample ++$ @kbd{printf '#!' | od -A n -t d1 -N 2} ++ 035 033 ++@end smallexample ++ ++@noindent ++instead of ++ ++@smallexample ++$ @kbd{printf '#!' | od -A n -t d1 -N 2} ++ 35 33 ++@end smallexample ++ ++We have observed this on both OpenIndiana and OmniOS; ++Illumos may also be affected. ++As a workaround, you can use octal output (option @code{-t o1}). + + + @item @command{rm} +-- +2.25.1 + + +From fac6e5e5cf5b974dda2b82d6331d9dcb4b3e0016 Mon Sep 17 00:00:00 2001 +From: Zack Weinberg +Date: Mon, 21 Dec 2020 14:04:22 -0500 +Subject: [PATCH 12/13] Restore compatibility with older std-gnu11.m4. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Gnulib’s std-gnu11.m4 backports C11 and C++11 detection to autoconf +2.69. It does this by replacing the definitions of AC_PROC_CC and +AC_PROG_CXX and most of their subroutines. In particular, it replaces +the definitions of _AC_PROG_CC_C11, _AC_PROG_CC_C99, and _AC_C_STD_TRY, +but it does *not* replace the definition of _AC_PROG_CC_C89. + +Autoconf commit 131d8c69f31dc6fc8dc93abe1096d52d1fe19fd3 changed the +calling convention of _AC_C_STD_TRY, and changed the internal +definitions of _AC_PROG_CC_C{11,99,89} to match. If std-gnu11.m4 is +in use, our _AC_PROG_CC_C89 calls their _AC_C_STD_TRY with the new +calling convention, and this produces a syntactically invalid +configure script. (This is is fortunate: it could easily have been a +runtime malfunction that only manifested with compilers that only +implement C89, and then we might not have noticed the problem for +years.) + +Gnulib commit a3b3fc85e3e632374811b27cb2111e50fa177e36 makes +std-gnu11.m4 do nothing when used with autoconf >=2.70, but older +versions of the file will circulate for years to come, so this patch +works around the problem in autoconf. It does this by renaming all of +the internal macros involved with C and C++ standard edition +detection, *except* _AC_PROG_CC_C89. AC_PROG_CC now calls +_AC_PROG_CC_STDC_EDITION, which loops over all supported editions +calling _AC_PROG_CC_STDC_EDITION_TRY, which uses the data provided by +the existing _AC_C_C${edition}_TEST_PROGRAM macros and a new set of +macros called _AC_C_C${edition}_OPTIONS to perform the test for that +edition of the standard. Similarly, AC_PROG_CXX calls +_AC_PROG_CXX_STDCXX_EDITION, which loops calling +_AC_PROG_CXX_STDCXX_EDITION_TRY, which uses data from +_AC_CXX_CXX${edition}_TEST_PROGRAM and _AC_CXX_CXX${edition}_OPTIONS. + +_AC_PROG_CC_C89 is the only macro from the old set that we still +define, and its definition is reverted to what std-gnu11.m4 expects it +to be. Nothing in Autoconf proper uses it anymore. + +foreign.at grows a test to verify that the compatibility stub version +of _AC_PROG_CC_C89 does its job. Since this is now the third test +involving an embedded copy of a third-party macro, I broke them all +out of foreign.at to separate files in test/data/. + +In addition to fixing the breakage, this patch should make it easier +to extend C / C++ standard edition detection in the future, by getting +rid of the if-else chains in AC_PROG_CC/CXX and by disentangling the +lists of command-line options to test from the logic. + +I also changed the manual to suggest people refer to the variables +‘ac_prog_cc_stdc’ and ‘ac_prog_cxx_stdcxx’ to learn which edition +of the C and C++ standards are selected; these are much easier to +work with than the ac_cv_prog_cc_cNN cache variables. + +* lib/autoconf/c.m4 (_AC_C_STD_TRY, _AC_PROG_CC_C99, _AC_PROG_CC_C11) + (_AC_CXX_STD_TRY, _AC_PROG_CXX_CXX98, _AC_PROG_CXX_CXX11): Remove macro. + + (_AC_C_C89_OPTIONS, _AC_C_C99_OPTIONS, _AC_C_C11_OPTIONS) + (_AC_PROG_CC_STDC_EDITION, _AC_PROG_CC_STDC_EDITION_TRY) + (_AC_CXX_CXX98_OPTIONS, _AC_CXX_CXX11_OPTIONS) + (_AC_PROG_CXX_STDCXX_EDITION, _AC_PROG_CXX_STDCXX_EDITION_TRY): New macros. + + (_AC_PROG_CC_C89): Convert to compatibility stub for std-gnu11.m4. + + (AC_PROG_CC): Use _AC_PROG_CC_STDC_EDITION. + (AC_PROG_CXX): Use _AC_PROG_CXX_STDCXX_EDITION. + +* tests/data/ax_prog_cc_for_build_v18.m4 +* tests/data/ax_prog_cxx_for_build_v3.m4 +* tests/data/gnulib_std_gnu11_2020_08_17.m4: New files. +* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD): + Remove embedded copy of ax_prog_cc_for_build_v18.m4, + ax_prog_cxx_for_build_v3.m4 respectively. + (gnulib-std-gnu11.m4): New test. +* tests/local.mk: Distribute tests/data/*.m4. + +* doc/autoconf.texi (AC_PROG_CC, AC_PROG_CXX): Document use of + ac_prog_cc_stdc / ac_prog_cxx_stdcxx, respectively, to tell which + edition of the C / C++ standards are selected, instead of looking + through a series of cache variables with awkward definitions. +--- + doc/autoconf.texi | 45 +- + lib/autoconf/c.m4 | 444 +++++++----- + tests/data/ax_prog_cc_for_build_v18.m4 | 139 ++++ + tests/data/ax_prog_cxx_for_build_v3.m4 | 110 +++ + tests/data/gnulib_std_gnu11_2020_08_17.m4 | 824 ++++++++++++++++++++++ + tests/foreign.at | 215 +----- + tests/local.mk | 7 +- + 7 files changed, 1384 insertions(+), 400 deletions(-) + create mode 100644 tests/data/ax_prog_cc_for_build_v18.m4 + create mode 100644 tests/data/ax_prog_cxx_for_build_v3.m4 + create mode 100644 tests/data/gnulib_std_gnu11_2020_08_17.m4 + +diff --git a/doc/autoconf.texi b/doc/autoconf.texi +index db1e0f46..b65d698e 100644 +--- a/doc/autoconf.texi ++++ b/doc/autoconf.texi +@@ -7453,7 +7453,6 @@ makes this invalid. That is why Autoconf stopped issuing + @evindex CFLAGS + @ovindex CC + @ovindex CFLAGS +-@caindex prog_cc_stdc + Determine a C compiler to use. + + If the environment variable @code{CC} is set, its value will be taken as +@@ -7485,21 +7484,15 @@ default. (It is important to use this construct rather than a normal + assignment, so that @code{CFLAGS} can still be overridden by the + person building the package. @xref{Preset Output Variables}.) + +-If necessary, options are added to @code{CC} to enable support for ISO +-Standard C features with extensions, preferring the newest C standard +-that is supported. Currently the newest standard Autoconf knows how to +-detect support for is ISO C 2011. After calling this macro you can +-check whether the C compiler has been set to accept Standard C by +-inspecting cache variables. If @code{ac_cv_prog_cc_c11} is set to any +-value other than @samp{no} (including the empty string), then @code{CC} +-can compile code as standard C 2011, and this mode has been enabled. +-Otherwise, if @code{ac_cv_prog_cc_c99} is set to any value other than +-@samp{no} (including the empty string), then @code{CC} can compile code +-as standard C 1999, and this mode has been enabled. Otherwise, if +-@code{ac_cv_prog_cc_c89} is set to any value other than @samp{no} +-(including the empty string), then @code{CC} can compile code as +-standard C 1989, and this mode has been enabled. Finally, if all +-three variables are set to @samp{no}, then @code{CC} cannot compile ++If necessary, options are added to @code{CC} to enable support for ++ISO Standard C features with extensions, preferring the newest edition ++of the C standard that is supported. Currently the newest edition ++Autoconf knows how to detect support for is ISO C 2011. After calling ++this macro you can check whether the C compiler has been set to accept ++standard C by inspecting the shell variable @code{ac_prog_cc_stdc}. ++Its value will be @samp{c11}, @samp{c99}, or @samp{c89}, respectively, ++if the C compiler has been set to use the 2011, 1999, or 1990 edition of ++the C standard, and @samp{no} if the compiler does not support compiling + standard C at all. + + The tests for standard conformance are not comprehensive. They test the +@@ -7890,17 +7883,15 @@ assignment, so that @code{CXXFLAGS} can still be overridden by the + person building the package. @xref{Preset Output Variables}.) + + If necessary, options are added to @code{CXX} to enable support for +-ISO Standard C++ features with extensions. ISO C++ 2011 is preferred +-if the compiler supports it. After calling this macro, you can check +-whether the C++ compiler has been set to accept standard C++ by +-inspecting cache variables. If @code{ac_cv_prog_cxx_cxx11} is set to +-any value other than @samp{no} (including the empty string), then +-@code{CXX} can compile code as standard C++ 2011, and this mode has +-been enabled. Otherwise, if @code{ac_cv_prog_cxx_cxx98} is set to +-any value other than @samp{no} (including the empty string), then +-@code{CXX} can compile code as standard C++ 1998, and this mode has +-been enabled. Finally, if both variables are set to @samp{no}, then +-@code{CXX} cannot compile standard C++ at all. ++ISO Standard C++ features with extensions, preferring the newest edition ++of the C++ standard that is supported. Currently the newest edition ++Autoconf knows how to detect support for is ISO C++ 2011. After calling ++this macro, you can check whether the C++ compiler has been set to ++accept standard C++ by inspecting the shell variable @code{ac_prog_cc_stdc}. ++Its value will be @samp{cxx11} or @samp{cxx98}, respectively, ++if the C++ compiler has been set to use the 2011 or 1990 edition of the ++C++ standard, and @samp{no} if the compiler does not support compiling ++standard C++ at all. + + The tests for standard conformance are not comprehensive. They test + the value of @code{__cplusplus} and a representative sample of the +diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 +index 14240460..7ad6b4f7 100644 +--- a/lib/autoconf/c.m4 ++++ b/lib/autoconf/c.m4 +@@ -498,19 +498,7 @@ else + GCC= + fi + _AC_PROG_CC_G +-dnl +-dnl Set ac_prog_cc_stdc to the supported C version. +-dnl Also set the documented variable ac_cv_prog_cc_stdc; +-dnl its name was chosen when it was cached, but it is no longer cached. +-_AC_PROG_CC_C11([ac_prog_cc_stdc=c11 +- ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11], +- [_AC_PROG_CC_C99([ac_prog_cc_stdc=c99 +- ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99], +- [_AC_PROG_CC_C89([ac_prog_cc_stdc=c89 +- ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89], +- [ac_prog_cc_stdc=no +- ac_cv_prog_cc_stdc=no])])]) +-dnl ++_AC_PROG_CC_STDC_EDITION + AC_LANG_POP(C)dnl + ])# AC_PROG_CC + +@@ -745,13 +733,7 @@ else + GXX= + fi + _AC_PROG_CXX_G +-_AC_PROG_CXX_CXX11([ac_prog_cxx_stdcxx=cxx11 +- ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 +- ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11], +- [_AC_PROG_CXX_CXX98([ac_prog_cxx_stdcxx=cxx98 +- ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98], +- [ac_prog_cxx_stdcxx=no +- ac_cv_prog_cxx_stdcxx=no])]) ++_AC_PROG_CXX_STDCXX_EDITION + AC_LANG_POP(C++)dnl + ])# AC_PROG_CXX + +@@ -1496,114 +1478,170 @@ main (int argc, char **argv) + ]])]) + + +-# _AC_C_STD_TRY(STANDARD, TEST-PROGRAM-HOLDER, OPTION-LIST, +-# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) +-# -------------------------------------------------------------- +-# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99') +-# by trying to compile the program in the shell variable TEST-PROGRAM-HOLDER. +-# Caller is responsible for making sure this variable has been initialized. +-# If compilation fails in the default mode, try again with each compiler +-# option in the space-separated OPTION-LIST; if one helps, append it to CC. +-# If eventually successful, run ACTION-IF-AVAILABLE, else ACTION-IF-UNAVAILABLE. +-AC_DEFUN([_AC_C_STD_TRY], ++# _AC_C_C89_OPTIONS ++# ----------------- ++# Whitespace-separated list of options that might put the C compiler ++# into a mode conforming to ISO C1990 with extensions. Do not try ++# "strictly conforming" modes (e.g. gcc's -std=c90); they break some ++# systems' header files. If more than one option is needed, put ++# shell quotes around the group. ++# ++# AIX circa 2003 -qlanglvl=extc89 ++# old AIX -qlanglvl=ansi ++# Ultrix, OSF/1, Tru64 -std ++# HP-UX 10.20 and later -Ae ++# HP-UX older versions -Aa -D_HPUX_SOURCE ++# SVR4 -Xc -D__EXTENSIONS__ ++m4_define([_AC_C_C89_OPTIONS], [ ++ -qlanglvl=extc89 ++ -qlanglvl=ansi ++ -std ++ -Ae ++ "-Aa -D_HPUX_SOURCE" ++ "-Xc -D__EXTENSIONS__" ++]) ++ ++ ++# _AC_C_C99_OPTIONS ++# ----------------- ++# Whitespace-separated list of options that might put the C compiler ++# into a mode conforming to ISO C1999 with extensions. Do not try ++# "strictly conforming" modes (e.g. gcc's -std=c99); they break some ++# systems' header files. If more than one option is needed, put ++# shell quotes around the group. ++# ++# GCC, Clang -std=gnu99 ++# Intel ICC -std=c99, -c99 (deprecated) ++# Note: because -std=c99 puts GCC in strictly conforming mode, ++# this option must be tested *after* -std=gnu99. ++# IRIX -c99 ++# Tru64 -c99 ++# IBM XL C -qlanglvl=extc1x (V12.1; does not pass C11 test) ++# IBM XL C -qlanglvl=extc99 (pre-V12.1) ++# HP cc -AC99 ++# Solaris -D_STDC_C99= ++# Note: acc's -xc99 option uses linker magic to define the external ++# symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99 ++# behavior for C library functions. This is not wanted here, ++# because it means that a single module compiled with -xc99 alters ++# C runtime behavior for the entire program, not for just the ++# module. Instead, define the (private) symbol _STDC_C99, which ++# suppresses a bogus failure in . The resulting compiler ++# passes the test case here, and that's good enough. ++# For more, please see the thread starting at: ++# https://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html ++m4_define([_AC_C_C99_OPTIONS], [ ++ -std=gnu99 ++ -std=c99 ++ -c99 ++ -qlanglvl=extc1x ++ -qlanglvl=extc99 ++ -AC99 ++ -D_STDC_C99= ++]) ++ ++ ++# _AC_C_C11_OPTIONS ++# ----------------- ++# Whitespace-separated list of options that might put the C compiler ++# into a mode conforming to ISO C2011 with extensions. Do not try ++# "strictly conforming" modes (e.g. gcc's -std=c11); they break some ++# systems' header files. If more than one option is needed, put ++# shell quotes around the group. ++# ++# GCC, Clang -std=gnu11 ++# ++# For IBM XL C for AIX V16.1 or later, '-std=gnu11' should work if ++# the user configured with CC='xlclang'. Otherwise, do not try ++# -qlanglvl=extc1x as xlc with IBM XL C V16.1 (the latest version as ++# of August 2020) does not pass the C11 test. Instead, try extc1x when ++# compiling the C99 test instead, since it enables _Static_assert and ++# _Noreturn, which is a win. ++m4_define([_AC_C_C11_OPTIONS], [ ++ -std=gnu11 ++]) ++ ++ ++# _AC_PROG_CC_STDC_EDITION_TRY(EDITION) ++# ------------------------------------- ++# Subroutine of _AC_PROG_CC_STDC_EDITION. Not to be called directly. ++# ++# Check whether the C compiler accepts features of EDITION of the ++# C standard. EDITION should be a two-digit year (e.g. 89, 99, 11). ++# (FIXME: Switch to four-digit years for futureproofing.) ++# This is done by compiling the test program defined by ++# _AC_C_C{EDITION}_TEST_PROGRAM, first with no additional ++# command-line options, and then with each of the options ++# in the space-separated list defined by _AC_C_C{EDITION}_OPTIONS. ++# ++# If we find a way to make the test program compile, set cache variable ++# ac_cv_prog_cc_cEDITION to the options required (if any), and add those ++# options to $CC. Set shell variable ac_prog_cc_stdc to `cEDITION', ++# and set shell variable ac_cv_prog_cc_stdc to the options required. ++# (Neither of these variables is AC_SUBSTed. ac_cv_prog_cc_stdc used ++# to be a cache variable and is preserved with this name for backward ++# compatibility.) Otherwise, ac_cv_prog_cc_cEDITION is set to `no' ++# and the other variables are not changed. ++# ++# If ac_prog_cc_stdc is already set to a value other than `no', ++# the shell code produced by this macro does nothing. This is so ++# _AC_PROG_CC_STDC_EDITION can use m4_map to iterate through ++# all the editions. ++AC_DEFUN([_AC_PROG_CC_STDC_EDITION_TRY], + [AC_LANG_ASSERT([C])]dnl +-[AC_MSG_CHECKING([for $CC option to enable ]dnl +-m4_translit($1, [c], [C])[ features]) +-AC_CACHE_VAL([ac_cv_prog_cc_$1], +-[ac_cv_prog_cc_$1=no ++[AC_REQUIRE([_AC_C_C$1_TEST_PROGRAM])]dnl ++[AS_IF([test x$ac_prog_cc_stdc = xno], ++[AC_MSG_CHECKING([for $CC option to enable C$1 features]) ++AC_CACHE_VAL([ac_cv_prog_cc_c$1], ++[ac_cv_prog_cc_c$1=no + ac_save_CC=$CC +-AC_LANG_CONFTEST([AC_LANG_DEFINES_PROVIDED][$][$2]) +-for ac_arg in '' $3 ++AC_LANG_CONFTEST([AC_LANG_DEFINES_PROVIDED][$][ac_c_conftest_c$1_program]) ++for ac_arg in '' m4_normalize(m4_defn([_AC_C_C$1_OPTIONS])) + do + CC="$ac_save_CC $ac_arg" +- _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg]) +- test "x$ac_cv_prog_cc_$1" != "xno" && break ++ _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_c$1=$ac_arg]) ++ test "x$ac_cv_prog_cc_c$1" != "xno" && break + done + rm -f conftest.$ac_ext +-CC=$ac_save_CC +-])# AC_CACHE_VAL +-ac_prog_cc_stdc_options= +-AS_CASE(["x$ac_cv_prog_cc_$1"], +- [x], [AC_MSG_RESULT([none needed])], +- [xno], [AC_MSG_RESULT([unsupported])], +- [ac_prog_cc_stdc_options=" $ac_cv_prog_cc_$1" +- CC="$CC$ac_prog_cc_stdc_options" +- AC_MSG_RESULT([$ac_cv_prog_cc_$1])]) +-AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$4], [$5]) +-])# _AC_C_STD_TRY +- +- +-# _AC_PROG_CC_C89 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +-# ---------------------------------------------------------------- +-# If the C compiler is not in ANSI C89 (ISO C90) mode by default, try +-# to add an option to output variable CC to make it so. ++CC=$ac_save_CC]) ++AS_IF([test "x$ac_cv_prog_cc_c$1" = xno], ++ [AC_MSG_RESULT([unsupported])], ++ [AS_IF([test "x$ac_cv_prog_cc_c$1" = x], ++ [AC_MSG_RESULT([none needed])], ++ [AC_MSG_RESULT([$ac_cv_prog_cc_c$1]) ++ CC="$CC $ac_cv_prog_cc_c$1"]) ++ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c$1 ++ ac_prog_cc_stdc=c$1])]) ++]) ++ ++ ++# _AC_PROG_CC_STDC_EDITION ++# ------------------------ ++# Detect the most recent edition of the ISO C standard that is ++# supported by the C compiler. Add command-line options to $CC, if ++# necessary, to enable support for this edition. Set the shell ++# variable ac_prog_cc_stdc to indicate the edition. ++AC_DEFUN([_AC_PROG_CC_STDC_EDITION], ++[ac_prog_cc_stdc=no ++m4_map([_AC_PROG_CC_STDC_EDITION_TRY], [[11], [99], [89]])]) ++ ++ ++# _AC_PROG_CC_C89(ACTION-IF-SUPPORTED, ACTION-IF-NOT-SUPPORTED) ++# ------------------------------------------------------------- ++# Obsolete internal macro. No longer used by Autoconf itself, but ++# preserved for backward compatibility with pre-December 2020 versions ++# of Gnulib's std-gnu11.m4, which replaced the entire definition of ++# AC_PROG_CC *except* for this macro. Can be removed once everyone is ++# using Autoconf 2.70 and/or a current std-gnu11.m4. + AC_DEFUN([_AC_PROG_CC_C89], +-[AC_REQUIRE([_AC_C_C89_TEST_PROGRAM])]dnl +-[_AC_C_STD_TRY([c89], [ac_c_conftest_c89_program], +-dnl Don't try gcc -ansi; that turns off useful extensions and +-dnl breaks some systems' header files. +-dnl AIX circa 2003 -qlanglvl=extc89 +-dnl old AIX -qlanglvl=ansi +-dnl Ultrix, OSF/1, Tru64 -std +-dnl HP-UX 10.20 and later -Ae +-dnl HP-UX older versions -Aa -D_HPUX_SOURCE +-dnl SVR4 -Xc -D__EXTENSIONS__ +-[-qlanglvl=extc89 -qlanglvl=ansi -std \ +- -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"], [$1], [$2])[]dnl +-])# _AC_PROG_CC_C89 +- +- +-# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +-# ---------------------------------------------------------------- +-# If the C compiler is not in ISO C99 mode by default, try to add an +-# option to output variable CC to make it so. +-AC_DEFUN([_AC_PROG_CC_C99], +-[AC_REQUIRE([_AC_C_C99_TEST_PROGRAM])]dnl +-[_AC_C_STD_TRY([c99], [ac_c_conftest_c99_program], +-dnl Try +-dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999) +-dnl IBM XL C -qlanglvl=extc1x (V12.1; does not pass C11 test) +-dnl IBM XL C -qlanglvl=extc99 +-dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdc99) +-dnl HP cc -AC99 +-dnl Intel ICC -std=c99, -c99 (deprecated) +-dnl IRIX -c99 +-dnl Solaris -D_STDC_C99= +-dnl cc's -xc99 option uses linker magic to define the external +-dnl symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99 +-dnl behavior for C library functions. This is not wanted here, +-dnl because it means that a single module compiled with -xc99 +-dnl alters C runtime behavior for the entire program, not for +-dnl just the module. Instead, define the (private) symbol +-dnl _STDC_C99, which suppresses a bogus failure in . +-dnl The resulting compiler passes the test case here, and that's +-dnl good enough. For more, please see the thread starting at: +-dnl https://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html +-dnl Tru64 -c99 +-dnl with extended modes being tried first. +-[[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99]], [$1], [$2])[]dnl +-])# _AC_PROG_CC_C99 +- +- +-# _AC_PROG_CC_C11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +-# ---------------------------------------------------------------- +-# If the C compiler is not in ISO C11 mode by default, try to add an +-# option to output variable CC to make it so. +-AC_DEFUN([_AC_PROG_CC_C11], +-[AC_REQUIRE([_AC_C_C11_TEST_PROGRAM])]dnl +-[_AC_C_STD_TRY([c11], [ac_c_conftest_c11_program], +-dnl Try +-dnl GCC -std=gnu11 (unused restrictive mode: -std=c11) +-dnl with extended modes being tried first. +-dnl +-dnl For IBM XL C for AIX V16.1 or later, '-std=gnu11' should work if +-dnl the user configured with CC='xlclang'. Otherwise, do not try +-dnl -qlanglvl=extc1x as xlc with IBM XL C V16.1 (the latest version as +-dnl of August 2020) does not pass the C11 test. Instead, try extc1x when +-dnl compiling the C99 test instead, since it enables _Static_assert and +-dnl _Noreturn, which is a win. +-[[-std=gnu11]], [$1], [$2])[]dnl +-])# _AC_PROG_CC_C11 ++[AC_REQUIRE([_AC_C_C89_TEST_GLOBALS])]dnl ++[AC_REQUIRE([_AC_C_C89_TEST_MAIN])]dnl ++[_AC_C_STD_TRY([c89], ++ [$ac_c_conftest_c89_globals], [$ac_c_conftest_c89_main], ++ m4_quote(m4_normalize(m4_defn([_AC_C_C89_OPTIONS]))), ++ [$1], ++ [$2])]) ++ + + + # AC_PROG_CC_C89 +@@ -2633,78 +2671,112 @@ main (int argc, char **argv) + " + ]])]) + ++# _AC_CXX_CXX98_OPTIONS ++# --------------------- ++# Whitespace-separated list of options that might put the C++ compiler ++# into a mode conforming to ISO C++ 1998 with extensions. Do not try ++# "strictly conforming" modes (e.g. gcc's -std=c++98); they break some ++# systems' header files. If more than one option is needed, put ++# shell quotes around the group. ++# ++# GCC -std=gnu++98 ++# Intel ICC -std=c++98 ++# Note: because -std=c++98 puts GCC in strictly conforming mode, ++# this option must be tested *after* -std=gnu++98. ++# IBM XL C -qlanglvl=extended ++# HP aC++ -AA ++# Solaris N/A (default) ++# Tru64 N/A (default, but -std gnu could be used) ++m4_define([_AC_CXX_CXX98_OPTIONS], [ ++ -std=gnu++98 ++ -std=c++98 ++ -qlanglvl=extended ++ -AA ++]) + +-# _AC_CXX_STD_TRY(STANDARD, TEST-PROGRAM-HOLDER, OPTION-LIST, +-# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) +-# ---------------------------------------------------------------- +-# Check whether the C++ compiler accepts features of STANDARD (e.g `cxx98', +-# `cxx11') by trying to compile the program in the shell variable +-# TEST-PROGRAM-HOLDER. Caller is responsible for making sure this variable +-# has been initialized. If compilation fails in the default mode, try again +-# with each compiler option in the space-separated OPTION-LIST; if one helps, +-# append it to CXX. If eventually successful, run ACTION-IF-AVAILABLE, else +-# ACTION-IF-UNAVAILABLE. ++# _AC_CXX_CXX11_OPTIONS ++# --------------------- ++# Whitespace-separated list of options that might put the C++ compiler ++# into a mode conforming to ISO C++ 2011 with extensions. Do not try ++# "strictly conforming" modes (e.g. gcc's -std=c++11); they break some ++# systems' header files. If more than one option is needed, put ++# shell quotes around the group. ++# ++# GCC -std=gnu++11, -std=gnu++0x ++# Intel ICC -std=c++11, -std=c++0x ++# Note: because -std=c++11 puts GCC in strictly conforming mode, ++# these options must be tested *after* -std=gnu++11. ++# IBM XL C -qlanglvl=extended0x (pre-V12.1) ++# HP aC++ -AA ++# Solaris N/A (no support) ++# Tru64 N/A (no support) ++m4_define([_AC_CXX_CXX11_OPTIONS], [ ++ -std=gnu++11 ++ -std=gnu++0x ++ -std=c++11 ++ -std=c++0x ++ -qlanglvl=extended0x ++ -AA ++]) + +-AC_DEFUN([_AC_CXX_STD_TRY], ++# _AC_PROG_CXX_STDCXX_EDITION_TRY(EDITION) ++# ---------------------------------------- ++# Subroutine of _AC_PROG_CXX_STDCXX_EDITION. Not to be called directly. ++# ++# Check whether the C++ compiler accepts features of EDITION of the ++# C++ standard. EDITION should be a two-digit year (e.g. 98, 11). ++# (FIXME: Switch to four-digit years for futureproofing.) ++# This is done by compiling the test program defined by ++# _AC_C_CXX{EDITION}_TEST_PROGRAM, first with no additional ++# command-line options, and then with each of the options ++# in the space-separated list defined by _AC_C_CXX{EDITION}_OPTIONS. ++# ++# If we find a way to make the test program compile, set cache variable ++# ac_cv_prog_cxx_cxxEDITION to the options required (if any), and add those ++# options to $CXX. Set shell variable ac_prog_cxx_stdcxx to `cxxEDITION', ++# and set shell variable ac_cv_prog_cxx_stdcxx to the options required. ++# (Neither of these variables is AC_SUBSTed. ac_cv_prog_cxx_stdcxx used ++# to be a cache variable and is preserved with this name for backward ++# compatibility.) Otherwise, ac_cv_prog_cxx_cxxEDITION is set to `no' ++# and the other variables are not changed. ++# ++# If ac_prog_cxx_stdcxx is already set to a value other than `no', ++# the shell code produced by this macro does nothing. This is so ++# _AC_PROG_CXX_STDCXX_EDITION can use m4_map to iterate through ++# all the editions. ++AC_DEFUN([_AC_PROG_CXX_STDCXX_EDITION_TRY], + [AC_LANG_ASSERT([C++])]dnl +-[AC_MSG_CHECKING([for $CXX option to enable ]dnl +-m4_translit([$1], [a-wxyz], [A-W+YZ])[ features]) ++[AC_REQUIRE([_AC_CXX_CXX$1_TEST_PROGRAM])]dnl ++[AS_IF([test x$ac_prog_cxx_stdcxx = xno], ++[AC_MSG_CHECKING([for $CXX option to enable C++$1 features]) + AC_CACHE_VAL(ac_cv_prog_cxx_$1, + [ac_cv_prog_cxx_$1=no + ac_save_CXX=$CXX +-AC_LANG_CONFTEST([AC_LANG_DEFINES_PROVIDED][$][$2]) +-for ac_arg in '' $3 ++AC_LANG_CONFTEST([AC_LANG_DEFINES_PROVIDED][$][ac_cxx_conftest_cxx$1_program]) ++for ac_arg in '' m4_normalize(m4_defn([_AC_CXX_CXX$1_OPTIONS])) + do + CXX="$ac_save_CXX $ac_arg" +- _AC_COMPILE_IFELSE([], [ac_cv_prog_cxx_$1=$ac_arg]) +- test "x$ac_cv_prog_cxx_$1" != "xno" && break ++ _AC_COMPILE_IFELSE([], [ac_cv_prog_cxx_cxx$1=$ac_arg]) ++ test "x$ac_cv_prog_cxx_cxx$1" != "xno" && break + done + rm -f conftest.$ac_ext +-CXX=$ac_save_CXX +-])# AC_CACHE_VAL +-ac_prog_cxx_stdcxx_options= +-AS_CASE(["x$ac_cv_prog_cxx_$1"], +- [x], [AC_MSG_RESULT([none needed])], +- [xno], [AC_MSG_RESULT([unsupported])], +- [ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_$1" +- CXX=$CXX$ac_prog_cxx_stdcxx_options +- AC_MSG_RESULT([$ac_cv_prog_cxx_$1])]) +-AS_IF([test "x$ac_cv_prog_cxx_$1" != xno], [$4], [$5]) +-])# _AC_CXX_STD_TRY +- +-# _AC_PROG_CXX_CXX98 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +-# ------------------------------------------------------------------- +-# If the C++ compiler is not in ISO C++98 mode by default, try to add +-# an option to output variable CXX to make it so. +-AC_DEFUN([_AC_PROG_CXX_CXX98], +-[AC_REQUIRE([_AC_CXX_CXX98_TEST_PROGRAM])]dnl +-[_AC_CXX_STD_TRY([cxx98], [ac_cxx_conftest_cxx98_program], +-dnl Try +-dnl GCC -std=gnu++98 (unused restrictive mode: -std=c++98) +-dnl IBM XL C -qlanglvl=extended +-dnl HP aC++ -AA +-dnl Intel ICC -std=gnu++98 +-dnl Solaris N/A (default) +-dnl Tru64 N/A (default, but -std gnu could be used) +-dnl with extended modes being tried first. +-[[-std=gnu++98 -std=c++98 -qlanglvl=extended -AA]], [$1], [$2])[]dnl +-])# _AC_PROG_CXX_CXX98 +- +-# _AC_PROG_CXX_CXX11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +-# ------------------------------------------------------------------- +-# If the C++ compiler is not in ISO CXX11 mode by default, try to add +-# an option to output variable CXX to make it so. +-AC_DEFUN([_AC_PROG_CXX_CXX11], +-[AC_REQUIRE([_AC_CXX_CXX11_TEST_PROGRAM])]dnl +-[_AC_CXX_STD_TRY([cxx11], [ac_cxx_conftest_cxx11_program], +-dnl Try +-dnl GCC -std=gnu++11 (unused restrictive mode: -std=c++11) [and 0x variants] +-dnl IBM XL C -qlanglvl=extended0x +-dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdcxx11) +-dnl HP aC++ -AA +-dnl Intel ICC -std=c++11 -std=c++0x +-dnl Solaris N/A (no support) +-dnl Tru64 N/A (no support) +-dnl with extended modes being tried first. +-[[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl +-])# _AC_PROG_CXX_CXX11 ++CXX=$ac_save_CXX]) ++AS_IF([test "x$ac_cv_prog_cxx_cxx$1" = xno], ++ [AC_MSG_RESULT([unsupported])], ++ [AS_IF([test "x$ac_cv_prog_cxx_cxx$1" = x], ++ [AC_MSG_RESULT([none needed])], ++ [AC_MSG_RESULT([$ac_cv_prog_cxx_cxx$1]) ++ CXX="$CXX $ac_cv_prog_cxx_cxx$1"]) ++ ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx$1 ++ ac_prog_cxx_stdcxx=cxx$1])]) ++]) ++ ++# _AC_PROG_CXX_STDCXX_EDITION ++# --------------------------- ++# Detect the most recent edition of the ISO C++ standard that is ++# supported by the C++ compiler. Add command-line options to $CXX, ++# if necessary, to enable support for this edition. Set the shell ++# variable ac_prog_cxx_stdcxx to indicate the edition. ++AC_DEFUN([_AC_PROG_CXX_STDCXX_EDITION], ++[ac_prog_cxx_stdcxx=no ++m4_map([_AC_PROG_CXX_STDCXX_EDITION_TRY], [[11], [98]])]) +diff --git a/tests/data/ax_prog_cc_for_build_v18.m4 b/tests/data/ax_prog_cc_for_build_v18.m4 +new file mode 100644 +index 00000000..f7410d74 +--- /dev/null ++++ b/tests/data/ax_prog_cc_for_build_v18.m4 +@@ -0,0 +1,139 @@ ++# =========================================================================== ++# https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html ++# =========================================================================== ++# ++# SYNOPSIS ++# ++# AX_PROG_CC_FOR_BUILD ++# ++# DESCRIPTION ++# ++# This macro searches for a C compiler that generates native executables, ++# that is a C compiler that surely is not a cross-compiler. This can be ++# useful if you have to generate source code at compile-time like for ++# example GCC does. ++# ++# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything ++# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD). ++# The value of these variables can be overridden by the user by specifying ++# a compiler with an environment variable (like you do for standard CC). ++# ++# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object ++# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if ++# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are ++# substituted in the Makefile. ++# ++# LICENSE ++# ++# Copyright (c) 2008 Paolo Bonzini ++# ++# Copying and distribution of this file, with or without modification, are ++# permitted in any medium without royalty provided the copyright notice ++# and this notice are preserved. This file is offered as-is, without any ++# warranty. ++ ++#serial 18 ++ ++AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD]) ++AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl ++AC_REQUIRE([AC_PROG_CC])dnl ++AC_REQUIRE([AC_PROG_CPP])dnl ++AC_REQUIRE([AC_CANONICAL_BUILD])dnl ++ ++dnl Use the standard macros, but make them use other variable names ++dnl ++pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl ++pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl ++pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl ++pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl ++pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl ++pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl ++pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu)dnl ++pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl ++pushdef([ac_cv_objext], ac_cv_build_objext)dnl ++pushdef([ac_exeext], ac_build_exeext)dnl ++pushdef([ac_objext], ac_build_objext)dnl ++pushdef([CC], CC_FOR_BUILD)dnl ++pushdef([CPP], CPP_FOR_BUILD)dnl ++pushdef([GCC], GCC_FOR_BUILD)dnl ++pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl ++pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl ++pushdef([EXEEXT], BUILD_EXEEXT)dnl ++pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl ++pushdef([OBJEXT], BUILD_OBJEXT)dnl ++pushdef([host], build)dnl ++pushdef([host_alias], build_alias)dnl ++pushdef([host_cpu], build_cpu)dnl ++pushdef([host_vendor], build_vendor)dnl ++pushdef([host_os], build_os)dnl ++pushdef([ac_cv_host], ac_cv_build)dnl ++pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl ++pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl ++pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl ++pushdef([ac_cv_host_os], ac_cv_build_os)dnl ++pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl ++pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl ++pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl ++pushdef([cross_compiling], cross_compiling_build)dnl ++ ++cross_compiling_build=no ++ ++ac_build_tool_prefix= ++AS_IF([test -n "$build"], [ac_build_tool_prefix="$build-"], ++ [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"]) ++ ++AC_LANG_PUSH([C]) ++AC_PROG_CC ++_AC_COMPILER_EXEEXT ++_AC_COMPILER_OBJEXT ++AC_PROG_CPP ++ ++dnl Restore the old definitions ++dnl ++popdef([cross_compiling])dnl ++popdef([am_cv_prog_cc_c_o])dnl ++popdef([am_cv_CC_dependencies_compiler_type])dnl ++popdef([ac_tool_prefix])dnl ++popdef([ac_cv_host_os])dnl ++popdef([ac_cv_host_vendor])dnl ++popdef([ac_cv_host_cpu])dnl ++popdef([ac_cv_host_alias])dnl ++popdef([ac_cv_host])dnl ++popdef([host_os])dnl ++popdef([host_vendor])dnl ++popdef([host_cpu])dnl ++popdef([host_alias])dnl ++popdef([host])dnl ++popdef([OBJEXT])dnl ++popdef([LDFLAGS])dnl ++popdef([EXEEXT])dnl ++popdef([CPPFLAGS])dnl ++popdef([CFLAGS])dnl ++popdef([GCC])dnl ++popdef([CPP])dnl ++popdef([CC])dnl ++popdef([ac_objext])dnl ++popdef([ac_exeext])dnl ++popdef([ac_cv_objext])dnl ++popdef([ac_cv_exeext])dnl ++popdef([ac_cv_c_compiler_gnu])dnl ++popdef([ac_cv_prog_cc_g])dnl ++popdef([ac_cv_prog_cc_cross])dnl ++popdef([ac_cv_prog_cc_works])dnl ++popdef([ac_cv_prog_cc_c89])dnl ++popdef([ac_cv_prog_gcc])dnl ++popdef([ac_cv_prog_CPP])dnl ++ ++dnl restore global variables ac_ext, ac_cpp, ac_compile, ++dnl ac_link, ac_compiler_gnu (dependant on the current ++dnl language after popping): ++AC_LANG_POP([C]) ++ ++dnl Finally, set Makefile variables ++dnl ++AC_SUBST(BUILD_EXEEXT)dnl ++AC_SUBST(BUILD_OBJEXT)dnl ++AC_SUBST([CFLAGS_FOR_BUILD])dnl ++AC_SUBST([CPPFLAGS_FOR_BUILD])dnl ++AC_SUBST([LDFLAGS_FOR_BUILD])dnl ++]) +diff --git a/tests/data/ax_prog_cxx_for_build_v3.m4 b/tests/data/ax_prog_cxx_for_build_v3.m4 +new file mode 100644 +index 00000000..17c19a89 +--- /dev/null ++++ b/tests/data/ax_prog_cxx_for_build_v3.m4 +@@ -0,0 +1,110 @@ ++# =========================================================================== ++# https://www.gnu.org/software/autoconf-archive/ax_prog_cxx_for_build.html ++# =========================================================================== ++# ++# SYNOPSIS ++# ++# AX_PROG_CXX_FOR_BUILD ++# ++# DESCRIPTION ++# ++# This macro searches for a C++ compiler that generates native ++# executables, that is a C++ compiler that surely is not a cross-compiler. ++# This can be useful if you have to generate source code at compile-time ++# like for example GCC does. ++# ++# The macro sets the CXX_FOR_BUILD and CXXCPP_FOR_BUILD macros to anything ++# needed to compile or link (CXX_FOR_BUILD) and preprocess ++# (CXXCPP_FOR_BUILD). The value of these variables can be overridden by ++# the user by specifying a compiler with an environment variable (like you ++# do for standard CXX). ++# ++# LICENSE ++# ++# Copyright (c) 2008 Paolo Bonzini ++# Copyright (c) 2012 Avionic Design GmbH ++# ++# Based on the AX_PROG_CC_FOR_BUILD macro by Paolo Bonzini. ++# ++# Copying and distribution of this file, with or without modification, are ++# permitted in any medium without royalty provided the copyright notice ++# and this notice are preserved. This file is offered as-is, without any ++# warranty. ++ ++#serial 3 ++ ++AU_ALIAS([AC_PROG_CXX_FOR_BUILD], [AX_PROG_CXX_FOR_BUILD]) ++AC_DEFUN([AX_PROG_CXX_FOR_BUILD], [dnl ++AC_REQUIRE([AX_PROG_CC_FOR_BUILD])dnl ++AC_REQUIRE([AC_PROG_CXX])dnl ++AC_REQUIRE([AC_PROG_CXXCPP])dnl ++AC_REQUIRE([AC_CANONICAL_HOST])dnl ++ ++dnl Use the standard macros, but make them use other variable names ++dnl ++pushdef([ac_cv_prog_CXXCPP], ac_cv_build_prog_CXXCPP)dnl ++pushdef([ac_cv_prog_gxx], ac_cv_build_prog_gxx)dnl ++pushdef([ac_cv_prog_cxx_works], ac_cv_build_prog_cxx_works)dnl ++pushdef([ac_cv_prog_cxx_cross], ac_cv_build_prog_cxx_cross)dnl ++pushdef([ac_cv_prog_cxx_g], ac_cv_build_prog_cxx_g)dnl ++pushdef([CXX], CXX_FOR_BUILD)dnl ++pushdef([CXXCPP], CXXCPP_FOR_BUILD)dnl ++pushdef([CXXFLAGS], CXXFLAGS_FOR_BUILD)dnl ++pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl ++pushdef([CXXCPPFLAGS], CXXCPPFLAGS_FOR_BUILD)dnl ++pushdef([host], build)dnl ++pushdef([host_alias], build_alias)dnl ++pushdef([host_cpu], build_cpu)dnl ++pushdef([host_vendor], build_vendor)dnl ++pushdef([host_os], build_os)dnl ++pushdef([ac_cv_host], ac_cv_build)dnl ++pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl ++pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl ++pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl ++pushdef([ac_cv_host_os], ac_cv_build_os)dnl ++pushdef([ac_cxxcpp], ac_build_cxxcpp)dnl ++pushdef([ac_compile], ac_build_compile)dnl ++pushdef([ac_link], ac_build_link)dnl ++ ++save_cross_compiling=$cross_compiling ++save_ac_tool_prefix=$ac_tool_prefix ++cross_compiling=no ++ac_tool_prefix= ++ ++AC_PROG_CXX ++AC_PROG_CXXCPP ++ ++ac_tool_prefix=$save_ac_tool_prefix ++cross_compiling=$save_cross_compiling ++ ++dnl Restore the old definitions ++dnl ++popdef([ac_link])dnl ++popdef([ac_compile])dnl ++popdef([ac_cxxcpp])dnl ++popdef([ac_cv_host_os])dnl ++popdef([ac_cv_host_vendor])dnl ++popdef([ac_cv_host_cpu])dnl ++popdef([ac_cv_host_alias])dnl ++popdef([ac_cv_host])dnl ++popdef([host_os])dnl ++popdef([host_vendor])dnl ++popdef([host_cpu])dnl ++popdef([host_alias])dnl ++popdef([host])dnl ++popdef([CXXCPPFLAGS])dnl ++popdef([CPPFLAGS])dnl ++popdef([CXXFLAGS])dnl ++popdef([CXXCPP])dnl ++popdef([CXX])dnl ++popdef([ac_cv_prog_cxx_g])dnl ++popdef([ac_cv_prog_cxx_cross])dnl ++popdef([ac_cv_prog_cxx_works])dnl ++popdef([ac_cv_prog_gxx])dnl ++popdef([ac_cv_prog_CXXCPP])dnl ++ ++dnl Finally, set Makefile variables ++dnl ++AC_SUBST([CXXFLAGS_FOR_BUILD])dnl ++AC_SUBST([CXXCPPFLAGS_FOR_BUILD])dnl ++]) +diff --git a/tests/data/gnulib_std_gnu11_2020_08_17.m4 b/tests/data/gnulib_std_gnu11_2020_08_17.m4 +new file mode 100644 +index 00000000..db833d82 +--- /dev/null ++++ b/tests/data/gnulib_std_gnu11_2020_08_17.m4 +@@ -0,0 +1,824 @@ ++# Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- ++ ++# This implementation is taken from GNU Autoconf lib/autoconf/c.m4 ++# commit 017d5ddd82854911f0119691d91ea8a1438824d6 ++# dated Sun Apr 3 13:57:17 2016 -0700 ++# This implementation will be obsolete once we can assume Autoconf 2.70 ++# or later is installed everywhere a Gnulib program might be developed. ++ ++ ++# Copyright (C) 2001-2020 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Written by David MacKenzie, with help from ++# Akim Demaille, Paul Eggert, ++# François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, ++# Roland McGrath, Noah Friedman, david d zuhn, and many others. ++ ++ ++# AC_PROG_CC([COMPILER ...]) ++# -------------------------- ++# COMPILER ... is a space separated list of C compilers to search for. ++# This just gives the user an opportunity to specify an alternative ++# search list for the C compiler. ++AC_DEFUN_ONCE([AC_PROG_CC], ++[AC_LANG_PUSH(C)dnl ++AC_ARG_VAR([CC], [C compiler command])dnl ++AC_ARG_VAR([CFLAGS], [C compiler flags])dnl ++_AC_ARG_VAR_LDFLAGS()dnl ++_AC_ARG_VAR_LIBS()dnl ++_AC_ARG_VAR_CPPFLAGS()dnl ++m4_ifval([$1], ++ [AC_CHECK_TOOLS(CC, [$1])], ++[AC_CHECK_TOOL(CC, gcc) ++if test -z "$CC"; then ++ dnl Here we want: ++ dnl AC_CHECK_TOOL(CC, cc) ++ dnl but without the check for a tool without the prefix. ++ dnl Until the check is removed from there, copy the code: ++ if test -n "$ac_tool_prefix"; then ++ AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc]) ++ fi ++fi ++if test -z "$CC"; then ++ AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) ++fi ++if test -z "$CC"; then ++ AC_CHECK_TOOLS(CC, cl.exe) ++fi ++if test -z "$CC"; then ++ AC_CHECK_TOOL(CC, clang) ++fi ++]) ++ ++test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH]) ++ ++# Provide some information about the compiler. ++_AS_ECHO_LOG([checking for _AC_LANG compiler version]) ++set X $ac_compile ++ac_compiler=$[2] ++for ac_option in --version -v -V -qversion -version; do ++ _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) ++done ++ ++m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl ++m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl ++_AC_LANG_COMPILER_GNU ++if test $ac_compiler_gnu = yes; then ++ GCC=yes ++else ++ GCC= ++fi ++_AC_PROG_CC_G ++dnl ++dnl Set ac_prog_cc_stdc to the supported C version. ++dnl Also set the documented variable ac_cv_prog_cc_stdc; ++dnl its name was chosen when it was cached, but it is no longer cached. ++_AC_PROG_CC_C11([ac_prog_cc_stdc=c11 ++ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11], ++ [_AC_PROG_CC_C99([ac_prog_cc_stdc=c99 ++ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99], ++ [_AC_PROG_CC_C89([ac_prog_cc_stdc=c89 ++ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89], ++ [ac_prog_cc_stdc=no ++ ac_cv_prog_cc_stdc=no])])]) ++dnl ++AC_LANG_POP(C)dnl ++])# AC_PROG_CC ++ ++ ++ ++# AC_PROG_CXX([LIST-OF-COMPILERS]) ++# -------------------------------- ++# LIST-OF-COMPILERS is a space separated list of C++ compilers to search ++# for (if not specified, a default list is used). This just gives the ++# user an opportunity to specify an alternative search list for the C++ ++# compiler. ++# aCC HP-UX C++ compiler much better than `CC', so test before. ++# FCC Fujitsu C++ compiler ++# KCC KAI C++ compiler ++# RCC Rational C++ ++# xlC_r AIX C Set++ (with support for reentrant code) ++# xlC AIX C Set++ ++AC_DEFUN([AC_PROG_CXX], ++[AC_LANG_PUSH(C++)dnl ++AC_ARG_VAR([CXX], [C++ compiler command])dnl ++AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl ++_AC_ARG_VAR_LDFLAGS()dnl ++_AC_ARG_VAR_LIBS()dnl ++_AC_ARG_VAR_CPPFLAGS()dnl ++_AC_ARG_VAR_PRECIOUS([CCC])dnl ++if test -z "$CXX"; then ++ if test -n "$CCC"; then ++ CXX=$CCC ++ else ++ AC_CHECK_TOOLS(CXX, ++ [m4_default([$1], ++ [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++])], ++ g++) ++ fi ++fi ++# Provide some information about the compiler. ++_AS_ECHO_LOG([checking for _AC_LANG compiler version]) ++set X $ac_compile ++ac_compiler=$[2] ++for ac_option in --version -v -V -qversion; do ++ _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) ++done ++ ++m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl ++m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl ++_AC_LANG_COMPILER_GNU ++if test $ac_compiler_gnu = yes; then ++ GXX=yes ++else ++ GXX= ++fi ++_AC_PROG_CXX_G ++_AC_PROG_CXX_CXX11([ac_prog_cxx_stdcxx=cxx11 ++ ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ++ ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11], ++ [_AC_PROG_CXX_CXX98([ac_prog_cxx_stdcxx=cxx98 ++ ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98], ++ [ac_prog_cxx_stdcxx=no ++ ac_cv_prog_cxx_stdcxx=no])]) ++AC_LANG_POP(C++)dnl ++])# AC_PROG_CXX ++ ++ ++# _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST, ++# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) ++# -------------------------------------------------------------- ++# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99') ++# by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails, ++# try again with each compiler option in the space-separated OPTION-LIST; if one ++# helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE, ++# else ACTION-IF-UNAVAILABLE. ++AC_DEFUN([_AC_C_STD_TRY], ++[AC_MSG_CHECKING([for $CC option to enable ]m4_translit($1, [c], [C])[ features]) ++AC_CACHE_VAL(ac_cv_prog_cc_$1, ++[ac_cv_prog_cc_$1=no ++ac_save_CC=$CC ++AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])]) ++for ac_arg in '' $4 ++do ++ CC="$ac_save_CC $ac_arg" ++ _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg]) ++ test "x$ac_cv_prog_cc_$1" != "xno" && break ++done ++rm -f conftest.$ac_ext ++CC=$ac_save_CC ++])# AC_CACHE_VAL ++ac_prog_cc_stdc_options= ++case "x$ac_cv_prog_cc_$1" in ++ x) ++ AC_MSG_RESULT([none needed]) ;; ++ xno) ++ AC_MSG_RESULT([unsupported]) ;; ++ *) ++ ac_prog_cc_stdc_options=" $ac_cv_prog_cc_$1" ++ CC=$CC$ac_prog_cc_stdc_options ++ AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;; ++esac ++AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6]) ++])# _AC_C_STD_TRY ++ ++# _AC_C_C99_TEST_HEADER ++# --------------------- ++# A C header suitable for testing for C99. ++AC_DEFUN([_AC_C_C99_TEST_HEADER], ++[[#include ++#include ++#include ++#include ++#include ++#include ++ ++// Check varargs macros. These examples are taken from C99 6.10.3.5. ++#define debug(...) fprintf (stderr, __VA_ARGS__) ++#define showlist(...) puts (#__VA_ARGS__) ++#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) ++static void ++test_varargs_macros (void) ++{ ++ int x = 1234; ++ int y = 5678; ++ debug ("Flag"); ++ debug ("X = %d\n", x); ++ showlist (The first, second, and third items.); ++ report (x>y, "x is %d but y is %d", x, y); ++} ++ ++// Check long long types. ++#define BIG64 18446744073709551615ull ++#define BIG32 4294967295ul ++#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) ++#if !BIG_OK ++ your preprocessor is broken; ++#endif ++#if BIG_OK ++#else ++ your preprocessor is broken; ++#endif ++static long long int bignum = -9223372036854775807LL; ++static unsigned long long int ubignum = BIG64; ++ ++struct incomplete_array ++{ ++ int datasize; ++ double data[]; ++}; ++ ++struct named_init { ++ int number; ++ const wchar_t *name; ++ double average; ++}; ++ ++typedef const char *ccp; ++ ++static inline int ++test_restrict (ccp restrict text) ++{ ++ // See if C++-style comments work. ++ // Iterate through items via the restricted pointer. ++ // Also check for declarations in for loops. ++ for (unsigned int i = 0; *(text+i) != '\0'; ++i) ++ continue; ++ return 0; ++} ++ ++// Check varargs and va_copy. ++static bool ++test_varargs (const char *format, ...) ++{ ++ va_list args; ++ va_start (args, format); ++ va_list args_copy; ++ va_copy (args_copy, args); ++ ++ const char *str = ""; ++ int number = 0; ++ float fnumber = 0; ++ ++ while (*format) ++ { ++ switch (*format++) ++ { ++ case 's': // string ++ str = va_arg (args_copy, const char *); ++ break; ++ case 'd': // int ++ number = va_arg (args_copy, int); ++ break; ++ case 'f': // float ++ fnumber = va_arg (args_copy, double); ++ break; ++ default: ++ break; ++ } ++ } ++ va_end (args_copy); ++ va_end (args); ++ ++ return *str && number && fnumber; ++}]])# _AC_C_C99_TEST_HEADER ++ ++# _AC_C_C99_TEST_BODY ++# ------------------- ++# A C body suitable for testing for C99, assuming the corresponding header. ++AC_DEFUN([_AC_C_C99_TEST_BODY], ++[[ ++ // Check bool. ++ _Bool success = false; ++ ++ // Check restrict. ++ if (test_restrict ("String literal") == 0) ++ success = true; ++ char *restrict newvar = "Another string"; ++ ++ // Check varargs. ++ success &= test_varargs ("s, d' f .", "string", 65, 34.234); ++ test_varargs_macros (); ++ ++ // Check flexible array members. ++ struct incomplete_array *ia = ++ malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ++ ia->datasize = 10; ++ for (int i = 0; i < ia->datasize; ++i) ++ ia->data[i] = i * 1.234; ++ ++ // Check named initializers. ++ struct named_init ni = { ++ .number = 34, ++ .name = L"Test wide string", ++ .average = 543.34343, ++ }; ++ ++ ni.number = 58; ++ ++ int dynamic_array[ni.number]; ++ dynamic_array[ni.number - 1] = 543; ++ ++ // work around unused variable warnings ++ return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' ++ || dynamic_array[ni.number - 1] != 543); ++]]) ++ ++# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) ++# ---------------------------------------------------------------- ++# If the C compiler is not in ISO C99 mode by default, try to add an ++# option to output variable CC to make it so. This macro tries ++# various options that select ISO C99 on some system or another. It ++# considers the compiler to be in ISO C99 mode if it handles _Bool, ++# // comments, flexible array members, inline, long long int, mixed ++# code and declarations, named initialization of structs, restrict, ++# va_copy, varargs macros, variable declarations in for loops and ++# variable length arrays. ++AC_DEFUN([_AC_PROG_CC_C99], ++[_AC_C_STD_TRY([c99], ++[_AC_C_C99_TEST_HEADER], ++[_AC_C_C99_TEST_BODY], ++dnl Try ++dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999) ++dnl IBM XL C -qlanglvl=extc1x (V12.1; does not pass C11 test) ++dnl IBM XL C -qlanglvl=extc99 ++dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdc99) ++dnl HP cc -AC99 ++dnl Intel ICC -std=c99, -c99 (deprecated) ++dnl IRIX -c99 ++dnl Solaris -D_STDC_C99= ++dnl cc's -xc99 option uses linker magic to define the external ++dnl symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99 ++dnl behavior for C library functions. This is not wanted here, ++dnl because it means that a single module compiled with -xc99 ++dnl alters C runtime behavior for the entire program, not for ++dnl just the module. Instead, define the (private) symbol ++dnl _STDC_C99, which suppresses a bogus failure in . ++dnl The resulting compiler passes the test case here, and that's ++dnl good enough. For more, please see the thread starting at: ++dnl https://lists.gnu.org/r/autoconf/2010-12/msg00059.html ++dnl Tru64 -c99 ++dnl with extended modes being tried first. ++[[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99]], [$1], [$2])[]dnl ++])# _AC_PROG_CC_C99 ++ ++ ++# _AC_PROG_CC_C11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) ++# ---------------------------------------------------------------- ++# If the C compiler is not in ISO C11 mode by default, try to add an ++# option to output variable CC to make it so. This macro tries ++# various options that select ISO C11 on some system or another. It ++# considers the compiler to be in ISO C11 mode if it handles _Alignas, ++# _Alignof, _Noreturn, _Static_assert, UTF-8 string literals, ++# duplicate typedefs, and anonymous structures and unions. ++AC_DEFUN([_AC_PROG_CC_C11], ++[_AC_C_STD_TRY([c11], ++[_AC_C_C99_TEST_HEADER[ ++// Check _Alignas. ++char _Alignas (double) aligned_as_double; ++char _Alignas (0) no_special_alignment; ++extern char aligned_as_int; ++char _Alignas (0) _Alignas (int) aligned_as_int; ++ ++// Check _Alignof. ++enum ++{ ++ int_alignment = _Alignof (int), ++ int_array_alignment = _Alignof (int[100]), ++ char_alignment = _Alignof (char) ++}; ++_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); ++ ++// Check _Noreturn. ++int _Noreturn does_not_return (void) { for (;;) continue; } ++ ++// Check _Static_assert. ++struct test_static_assert ++{ ++ int x; ++ _Static_assert (sizeof (int) <= sizeof (long int), ++ "_Static_assert does not work in struct"); ++ long int y; ++}; ++ ++// Check UTF-8 literals. ++#define u8 syntax error! ++char const utf8_literal[] = u8"happens to be ASCII" "another string"; ++ ++// Check duplicate typedefs. ++typedef long *long_ptr; ++typedef long int *long_ptr; ++typedef long_ptr long_ptr; ++ ++// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. ++struct anonymous ++{ ++ union { ++ struct { int i; int j; }; ++ struct { int k; long int l; } w; ++ }; ++ int m; ++} v1; ++]], ++[_AC_C_C99_TEST_BODY[ ++ v1.i = 2; ++ v1.w.k = 5; ++ _Static_assert ((offsetof (struct anonymous, i) ++ == offsetof (struct anonymous, w.k)), ++ "Anonymous union alignment botch"); ++]], ++dnl Try ++dnl GCC -std=gnu11 (unused restrictive mode: -std=c11) ++dnl with extended modes being tried first. ++dnl ++dnl Do not try -qlanglvl=extc1x, because IBM XL C V12.1 (the latest version as ++dnl of September 2012) does not pass the C11 test. For now, try extc1x when ++dnl compiling the C99 test instead, since it enables _Static_assert and ++dnl _Noreturn, which is a win. If -qlanglvl=extc11 or -qlanglvl=extc1x passes ++dnl the C11 test in some future version of IBM XL C, we'll add it here, ++dnl preferably extc11. ++[[-std=gnu11]], [$1], [$2])[]dnl ++])# _AC_PROG_CC_C11 ++ ++ ++# AC_PROG_CC_C89 ++# -------------- ++# Do not use AU_ALIAS here and in AC_PROG_CC_C99 and AC_PROG_CC_STDC, ++# as that'd be incompatible with how Automake redefines AC_PROG_CC. See ++# . ++AU_DEFUN([AC_PROG_CC_C89], ++ [AC_REQUIRE([AC_PROG_CC])], ++ [$0 is obsolete; use AC_PROG_CC] ++) ++ ++# AC_PROG_CC_C99 ++# -------------- ++AU_DEFUN([AC_PROG_CC_C99], ++ [AC_REQUIRE([AC_PROG_CC])], ++ [$0 is obsolete; use AC_PROG_CC] ++) ++ ++# AC_PROG_CC_STDC ++# --------------- ++AU_DEFUN([AC_PROG_CC_STDC], ++ [AC_REQUIRE([AC_PROG_CC])], ++ [$0 is obsolete; use AC_PROG_CC] ++) ++ ++ ++# AC_C_PROTOTYPES ++# --------------- ++# Check if the C compiler supports prototypes, included if it needs ++# options. ++AC_DEFUN([AC_C_PROTOTYPES], ++[AC_REQUIRE([AC_PROG_CC])dnl ++if test "$ac_prog_cc_stdc" != no; then ++ AC_DEFINE(PROTOTYPES, 1, ++ [Define to 1 if the C compiler supports function prototypes.]) ++ AC_DEFINE(__PROTOTYPES, 1, ++ [Define like PROTOTYPES; this can be used by system headers.]) ++fi ++])# AC_C_PROTOTYPES ++ ++ ++# _AC_CXX_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST, ++# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) ++# ---------------------------------------------------------------- ++# Check whether the C++ compiler accepts features of STANDARD (e.g ++# `cxx98', `cxx11') by trying to compile a program of TEST-PROLOGUE ++# and TEST-BODY. If this fails, try again with each compiler option ++# in the space-separated OPTION-LIST; if one helps, append it to CXX. ++# If eventually successful, run ACTION-IF-AVAILABLE, else ++# ACTION-IF-UNAVAILABLE. ++AC_DEFUN([_AC_CXX_STD_TRY], ++[AC_MSG_CHECKING([for $CXX option to enable ]m4_translit(m4_translit($1, [x], [+]), [a-z], [A-Z])[ features]) ++AC_LANG_PUSH(C++)dnl ++AC_CACHE_VAL(ac_cv_prog_cxx_$1, ++[ac_cv_prog_cxx_$1=no ++ac_save_CXX=$CXX ++AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])]) ++for ac_arg in '' $4 ++do ++ CXX="$ac_save_CXX $ac_arg" ++ _AC_COMPILE_IFELSE([], [ac_cv_prog_cxx_$1=$ac_arg]) ++ test "x$ac_cv_prog_cxx_$1" != "xno" && break ++done ++rm -f conftest.$ac_ext ++CXX=$ac_save_CXX ++])# AC_CACHE_VAL ++ac_prog_cxx_stdcxx_options= ++case "x$ac_cv_prog_cxx_$1" in ++ x) ++ AC_MSG_RESULT([none needed]) ;; ++ xno) ++ AC_MSG_RESULT([unsupported]) ;; ++ *) ++ ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_$1" ++ CXX=$CXX$ac_prog_cxx_stdcxx_options ++ AC_MSG_RESULT([$ac_cv_prog_cxx_$1]) ;; ++esac ++AC_LANG_POP(C++)dnl ++AS_IF([test "x$ac_cv_prog_cxx_$1" != xno], [$5], [$6]) ++])# _AC_CXX_STD_TRY ++ ++# _AC_CXX_CXX98_TEST_HEADER ++# ------------------------- ++# A C++ header suitable for testing for CXX98. ++AC_DEFUN([_AC_CXX_CXX98_TEST_HEADER], ++[[ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace test { ++ typedef std::vector string_vec; ++ typedef std::pair map_value; ++ typedef std::map map_type; ++ typedef std::set set_type; ++ ++ template ++ class printer { ++ public: ++ printer(std::ostringstream& os): os(os) {} ++ void operator() (T elem) { os << elem << std::endl; } ++ private: ++ std::ostringstream& os; ++ }; ++} ++]])# _AC_CXX_CXX98_TEST_HEADER ++ ++# _AC_CXX_CXX98_TEST_BODY ++# ----------------------- ++# A C++ body suitable for testing for CXX98, assuming the corresponding header. ++AC_DEFUN([_AC_CXX_CXX98_TEST_BODY], ++[[ ++ ++try { ++ // Basic string. ++ std::string teststr("ASCII text"); ++ teststr += " string"; ++ ++ // Simple vector. ++ test::string_vec testvec; ++ testvec.push_back(teststr); ++ testvec.push_back("foo"); ++ testvec.push_back("bar"); ++ if (testvec.size() != 3) { ++ throw std::runtime_error("vector size is not 1"); ++ } ++ ++ // Dump vector into stringstream and obtain string. ++ std::ostringstream os; ++ for (test::string_vec::const_iterator i = testvec.begin(); ++ i != testvec.end(); ++i) { ++ if (i + 1 != testvec.end()) { ++ os << teststr << '\n'; ++ } ++ } ++ // Check algorithms work. ++ std::for_each(testvec.begin(), testvec.end(), test::printer(os)); ++ std::string os_out = os.str(); ++ ++ // Test pair and map. ++ test::map_type testmap; ++ testmap.insert(std::make_pair(std::string("key"), ++ std::make_pair(53,false))); ++ ++ // Test set. ++ int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; ++ test::set_type testset(values, values + sizeof(values)/sizeof(values[0])); ++ std::list testlist(testset.begin(), testset.end()); ++ std::copy(testset.begin(), testset.end(), std::back_inserter(testlist)); ++} catch (const std::exception& e) { ++ std::cerr << "Caught exception: " << e.what() << std::endl; ++ ++ // Test fstream ++ std::ofstream of("test.txt"); ++ of << "Test ASCII text\n" << std::flush; ++ of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl; ++ of.close(); ++} ++std::exit(0); ++]]) ++ ++# _AC_CXX_CXX11_TEST_HEADER ++# ------------------------- ++# A C++ header suitable for testing for CXX11. ++AC_DEFUN([_AC_CXX_CXX11_TEST_HEADER], ++[[ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace cxx11test ++{ ++ typedef std::shared_ptr sptr; ++ typedef std::weak_ptr wptr; ++ ++ typedef std::tuple tp; ++ typedef std::array int_array; ++ ++ constexpr int get_val() { return 20; } ++ ++ struct testinit ++ { ++ int i; ++ double d; ++ }; ++ ++ class delegate { ++ public: ++ delegate(int n) : n(n) {} ++ delegate(): delegate(2354) {} ++ ++ virtual int getval() { return this->n; }; ++ protected: ++ int n; ++ }; ++ ++ class overridden : public delegate { ++ public: ++ overridden(int n): delegate(n) {} ++ virtual int getval() override final { return this->n * 2; } ++ }; ++ ++ class nocopy { ++ public: ++ nocopy(int i): i(i) {} ++ nocopy() = default; ++ nocopy(const nocopy&) = delete; ++ nocopy & operator=(const nocopy&) = delete; ++ private: ++ int i; ++ }; ++} ++]])# _AC_CXX_CXX11_TEST_HEADER ++ ++# _AC_CXX_CXX11_TEST_BODY ++# ----------------------- ++# A C++ body suitable for testing for CXX11, assuming the corresponding header. ++AC_DEFUN([_AC_CXX_CXX11_TEST_BODY], ++[[ ++{ ++ // Test auto and decltype ++ std::deque d; ++ d.push_front(43); ++ d.push_front(484); ++ d.push_front(3); ++ d.push_front(844); ++ int total = 0; ++ for (auto i = d.begin(); i != d.end(); ++i) { total += *i; } ++ ++ auto a1 = 6538; ++ auto a2 = 48573953.4; ++ auto a3 = "String literal"; ++ ++ decltype(a2) a4 = 34895.034; ++} ++{ ++ // Test constexpr ++ short sa[cxx11test::get_val()] = { 0 }; ++} ++{ ++ // Test initializer lists ++ cxx11test::testinit il = { 4323, 435234.23544 }; ++} ++{ ++ // Test range-based for and lambda ++ cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; ++ for (int &x : array) { x += 23; } ++ std::for_each(array.begin(), array.end(), [](int v1){ std::cout << v1; }); ++} ++{ ++ using cxx11test::sptr; ++ using cxx11test::wptr; ++ ++ sptr sp(new std::string("ASCII string")); ++ wptr wp(sp); ++ sptr sp2(wp); ++} ++{ ++ cxx11test::tp tuple("test", 54, 45.53434); ++ double d = std::get<2>(tuple); ++ std::string s; ++ int i; ++ std::tie(s,i,d) = tuple; ++} ++{ ++ static std::regex filename_regex("^_?([a-z0-9_.]+-)+[a-z0-9]+$"); ++ std::string testmatch("Test if this string matches"); ++ bool match = std::regex_search(testmatch, filename_regex); ++} ++{ ++ cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; ++ cxx11test::int_array::size_type size = array.size(); ++} ++{ ++ // Test constructor delegation ++ cxx11test::delegate d1; ++ cxx11test::delegate d2(); ++ cxx11test::delegate d3(45); ++} ++{ ++ // Test override and final ++ cxx11test::overridden o1(55464); ++} ++{ ++ // Test nullptr ++ char *c = nullptr; ++} ++{ ++ // Test template brackets ++ std::vector> v1; ++} ++{ ++ // Unicode literals ++ char const *utf8 = u8"UTF-8 string \u2500"; ++ char16_t const *utf16 = u"UTF-8 string \u2500"; ++ char32_t const *utf32 = U"UTF-32 string \u2500"; ++} ++]]) ++ ++# _AC_PROG_CXX_CXX98 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) ++# ------------------------------------------------------------------- ++ ++# If the C++ compiler is not in ISO C++98 mode by default, try to add ++# an option to output variable CXX to make it so. This macro tries ++# various options that select ISO C++98 on some system or another. It ++# considers the compiler to be in ISO C++98 mode if it handles basic ++# features of the std namespace including: string, containers (list, ++# map, set, vector), streams (fstreams, iostreams, stringstreams, ++# iomanip), pair, exceptions and algorithms. ++ ++ ++AC_DEFUN([_AC_PROG_CXX_CXX98], ++[_AC_CXX_STD_TRY([cxx98], ++[_AC_CXX_CXX98_TEST_HEADER], ++[_AC_CXX_CXX98_TEST_BODY], ++dnl Try ++dnl GCC -std=gnu++98 (unused restrictive mode: -std=c++98) ++dnl IBM XL C -qlanglvl=extended ++dnl HP aC++ -AA ++dnl Intel ICC -std=gnu++98 ++dnl Solaris N/A (default) ++dnl Tru64 N/A (default, but -std gnu could be used) ++dnl with extended modes being tried first. ++[[-std=gnu++98 -std=c++98 -qlanglvl=extended -AA]], [$1], [$2])[]dnl ++])# _AC_PROG_CXX_CXX98 ++ ++# _AC_PROG_CXX_CXX11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) ++# ------------------------------------------------------------------- ++# If the C++ compiler is not in ISO CXX11 mode by default, try to add ++# an option to output variable CXX to make it so. This macro tries ++# various options that select ISO C++11 on some system or another. It ++# considers the compiler to be in ISO C++11 mode if it handles all the ++# tests from the C++98 checks, plus the following: Language features ++# (auto, constexpr, decltype, default/deleted constructors, delegate ++# constructors, final, initializer lists, lambda functions, nullptr, ++# override, range-based for loops, template brackets without spaces, ++# unicode literals) and library features (array, memory (shared_ptr, ++# weak_ptr), regex and tuple types). ++AC_DEFUN([_AC_PROG_CXX_CXX11], ++[_AC_CXX_STD_TRY([cxx11], ++[_AC_CXX_CXX11_TEST_HEADER ++_AC_CXX_CXX98_TEST_HEADER], ++[_AC_CXX_CXX11_TEST_BODY ++_AC_CXX_CXX98_TEST_BODY], ++dnl Try ++dnl GCC -std=gnu++11 (unused restrictive mode: -std=c++11) [and 0x variants] ++dnl IBM XL C -qlanglvl=extended0x ++dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdcxx11) ++dnl HP aC++ -AA ++dnl Intel ICC -std=c++11 -std=c++0x ++dnl Solaris N/A (no support) ++dnl Tru64 N/A (no support) ++dnl with extended modes being tried first. ++[[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl ++])# _AC_PROG_CXX_CXX11 +diff --git a/tests/foreign.at b/tests/foreign.at +index f3a53420..50e49efc 100644 +--- a/tests/foreign.at ++++ b/tests/foreign.at +@@ -153,111 +153,8 @@ cp "$abs_top_srcdir/build-aux/install-sh" \ + # the second time. Git commit 18c140b50b0619454d4da50d58a318cc257d580a + # broke this usage and the breakage went unnoticed for *eight years*. + +-AT_DATA([aclocal.m4], +-[[# ax_prog_cc_for_build.m4 +-# serial 18 +-# Copyright (c) 2008 Paolo Bonzini +- +-AC_DEFUN([AX_PROG_CC_FOR_BUILD], [ +-AC_REQUIRE([AC_PROG_CC]) +-AC_REQUIRE([AC_PROG_CPP]) +-AC_REQUIRE([AC_CANONICAL_BUILD]) +- +-# Use the standard macros, but make them use other variable names +-m4@&t@_pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP) +-m4@&t@_pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89) +-m4@&t@_pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc) +-m4@&t@_pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works) +-m4@&t@_pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross) +-m4@&t@_pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g) +-m4@&t@_pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu) +-m4@&t@_pushdef([ac_cv_exeext], ac_cv_build_exeext) +-m4@&t@_pushdef([ac_cv_objext], ac_cv_build_objext) +-m4@&t@_pushdef([ac_exeext], ac_build_exeext) +-m4@&t@_pushdef([ac_objext], ac_build_objext) +-m4@&t@_pushdef([CC], CC_FOR_BUILD) +-m4@&t@_pushdef([CPP], CPP_FOR_BUILD) +-m4@&t@_pushdef([GCC], GCC_FOR_BUILD) +-m4@&t@_pushdef([CFLAGS], CFLAGS_FOR_BUILD) +-m4@&t@_pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD) +-m4@&t@_pushdef([EXEEXT], BUILD_EXEEXT) +-m4@&t@_pushdef([LDFLAGS], LDFLAGS_FOR_BUILD) +-m4@&t@_pushdef([OBJEXT], BUILD_OBJEXT) +-m4@&t@_pushdef([host], build) +-m4@&t@_pushdef([host_alias], build_alias) +-m4@&t@_pushdef([host_cpu], build_cpu) +-m4@&t@_pushdef([host_vendor], build_vendor) +-m4@&t@_pushdef([host_os], build_os) +-m4@&t@_pushdef([ac_cv_host], ac_cv_build) +-m4@&t@_pushdef([ac_cv_host_alias], ac_cv_build_alias) +-m4@&t@_pushdef([ac_cv_host_cpu], ac_cv_build_cpu) +-m4@&t@_pushdef([ac_cv_host_vendor], ac_cv_build_vendor) +-m4@&t@_pushdef([ac_cv_host_os], ac_cv_build_os) +-m4@&t@_pushdef([ac_tool_prefix], ac_build_tool_prefix) +-m4@&t@_pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type) +-m4@&t@_pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o) +-m4@&t@_pushdef([cross_compiling], cross_compiling_build) +- +-cross_compiling_build=no +- +-ac_build_tool_prefix= +-AS@&t@_IF([test -n "$build"], [ac_build_tool_prefix="$build-"], +- [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"]) +- +-AC_LANG_PUSH([C]) +-AC_PROG_CC +-_AC_COMPILER_EXEEXT +-_AC_COMPILER_OBJEXT +-AC_PROG_CPP +- +-# Restore the old definitions +-m4@&t@_popdef([cross_compiling]) +-m4@&t@_popdef([am_cv_prog_cc_c_o]) +-m4@&t@_popdef([am_cv_CC_dependencies_compiler_type]) +-m4@&t@_popdef([ac_tool_prefix]) +-m4@&t@_popdef([ac_cv_host_os]) +-m4@&t@_popdef([ac_cv_host_vendor]) +-m4@&t@_popdef([ac_cv_host_cpu]) +-m4@&t@_popdef([ac_cv_host_alias]) +-m4@&t@_popdef([ac_cv_host]) +-m4@&t@_popdef([host_os]) +-m4@&t@_popdef([host_vendor]) +-m4@&t@_popdef([host_cpu]) +-m4@&t@_popdef([host_alias]) +-m4@&t@_popdef([host]) +-m4@&t@_popdef([OBJEXT]) +-m4@&t@_popdef([LDFLAGS]) +-m4@&t@_popdef([EXEEXT]) +-m4@&t@_popdef([CPPFLAGS]) +-m4@&t@_popdef([CFLAGS]) +-m4@&t@_popdef([GCC]) +-m4@&t@_popdef([CPP]) +-m4@&t@_popdef([CC]) +-m4@&t@_popdef([ac_objext]) +-m4@&t@_popdef([ac_exeext]) +-m4@&t@_popdef([ac_cv_objext]) +-m4@&t@_popdef([ac_cv_exeext]) +-m4@&t@_popdef([ac_cv_c_compiler_gnu]) +-m4@&t@_popdef([ac_cv_prog_cc_g]) +-m4@&t@_popdef([ac_cv_prog_cc_cross]) +-m4@&t@_popdef([ac_cv_prog_cc_works]) +-m4@&t@_popdef([ac_cv_prog_cc_c89]) +-m4@&t@_popdef([ac_cv_prog_gcc]) +-m4@&t@_popdef([ac_cv_prog_CPP]) +- +-# restore global variables ac_ext, ac_cpp, ac_compile, +-# ac_link, ac_compiler_gnu (dependant on the current +-# language after popping): +-AC_LANG_POP([C]) +- +-# Finally, set Makefile variables +-AC_SUBST(BUILD_EXEEXT) +-AC_SUBST(BUILD_OBJEXT) +-AC_SUBST([CFLAGS_FOR_BUILD]) +-AC_SUBST([CPPFLAGS_FOR_BUILD]) +-AC_SUBST([LDFLAGS_FOR_BUILD]) +-]) +-]]) ++cp "$abs_top_srcdir/tests/data/ax_prog_cc_for_build_v18.m4" \ ++ aclocal.m4 + + AT_DATA([configure.ac], + [[AC_INIT([foo], [1.0]) +@@ -290,87 +187,9 @@ cp "$abs_top_srcdir/build-aux/install-sh" \ + # the second time. This usage was never broken (unlike with AC_PROG_CC) + # but it seems sensible to make sure it doesn't *get* broken. + +-AT_DATA([aclocal.m4], +-[[# ax_prog_cxx_for_build.m4 +-# serial 3 +-# Copyright (c) 2008 Paolo Bonzini +-# Copyright (c) 2012 Avionic Design GmbH +- +-AC_DEFUN([AX_PROG_CXX_FOR_BUILD], [ +-AC_LANG_PUSH([C++]) +- +-AC_REQUIRE([AC_PROG_CXX]) +-AC_REQUIRE([AC_PROG_CXXCPP]) +-AC_REQUIRE([AC_CANONICAL_HOST]) +- +-# Use the standard macros, but make them use other variable names +-m4@&t@_pushdef([ac_cv_prog_CXXCPP], ac_cv_build_prog_CXXCPP) +-m4@&t@_pushdef([ac_cv_prog_gxx], ac_cv_build_prog_gxx) +-m4@&t@_pushdef([ac_cv_prog_cxx_works], ac_cv_build_prog_cxx_works) +-m4@&t@_pushdef([ac_cv_prog_cxx_cross], ac_cv_build_prog_cxx_cross) +-m4@&t@_pushdef([ac_cv_prog_cxx_g], ac_cv_build_prog_cxx_g) +-m4@&t@_pushdef([CXX], CXX_FOR_BUILD) +-m4@&t@_pushdef([CXXCPP], CXXCPP_FOR_BUILD) +-m4@&t@_pushdef([CXXFLAGS], CXXFLAGS_FOR_BUILD) +-m4@&t@_pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD) +-m4@&t@_pushdef([CXXCPPFLAGS], CXXCPPFLAGS_FOR_BUILD) +-m4@&t@_pushdef([host], build) +-m4@&t@_pushdef([host_alias], build_alias) +-m4@&t@_pushdef([host_cpu], build_cpu) +-m4@&t@_pushdef([host_vendor], build_vendor) +-m4@&t@_pushdef([host_os], build_os) +-m4@&t@_pushdef([ac_cv_host], ac_cv_build) +-m4@&t@_pushdef([ac_cv_host_alias], ac_cv_build_alias) +-m4@&t@_pushdef([ac_cv_host_cpu], ac_cv_build_cpu) +-m4@&t@_pushdef([ac_cv_host_vendor], ac_cv_build_vendor) +-m4@&t@_pushdef([ac_cv_host_os], ac_cv_build_os) +-m4@&t@_pushdef([ac_cxxcpp], ac_build_cxxcpp) +-m4@&t@_pushdef([ac_compile], ac_build_compile) +-m4@&t@_pushdef([ac_link], ac_build_link) +- +-save_cross_compiling=$cross_compiling +-save_ac_tool_prefix=$ac_tool_prefix +-cross_compiling=no +-ac_tool_prefix= +- +-AC_PROG_CXX +-AC_PROG_CXXCPP +- +-ac_tool_prefix=$save_ac_tool_prefix +-cross_compiling=$save_cross_compiling +- +-# Restore the old definitions +-m4@&t@_popdef([ac_link]) +-m4@&t@_popdef([ac_compile]) +-m4@&t@_popdef([ac_cxxcpp]) +-m4@&t@_popdef([ac_cv_host_os]) +-m4@&t@_popdef([ac_cv_host_vendor]) +-m4@&t@_popdef([ac_cv_host_cpu]) +-m4@&t@_popdef([ac_cv_host_alias]) +-m4@&t@_popdef([ac_cv_host]) +-m4@&t@_popdef([host_os]) +-m4@&t@_popdef([host_vendor]) +-m4@&t@_popdef([host_cpu]) +-m4@&t@_popdef([host_alias]) +-m4@&t@_popdef([host]) +-m4@&t@_popdef([CXXCPPFLAGS]) +-m4@&t@_popdef([CPPFLAGS]) +-m4@&t@_popdef([CXXFLAGS]) +-m4@&t@_popdef([CXXCPP]) +-m4@&t@_popdef([CXX]) +-m4@&t@_popdef([ac_cv_prog_cxx_g]) +-m4@&t@_popdef([ac_cv_prog_cxx_cross]) +-m4@&t@_popdef([ac_cv_prog_cxx_works]) +-m4@&t@_popdef([ac_cv_prog_gxx]) +-m4@&t@_popdef([ac_cv_prog_CXXCPP]) +- +-# Finally, set Makefile variables +-AC_SUBST([CXXFLAGS_FOR_BUILD]) +-AC_SUBST([CXXCPPFLAGS_FOR_BUILD]) +- +-AC_LANG_POP([C++]) +-]) +-]]) ++cat "$abs_top_srcdir/tests/data/ax_prog_cc_for_build_v18.m4" \ ++ "$abs_top_srcdir/tests/data/ax_prog_cxx_for_build_v3.m4" \ ++ > aclocal.m4 + + AT_DATA([configure.ac], + [[AC_INIT([foo], [1.0]) +@@ -391,3 +210,27 @@ AT_CHECK([grep '^CXX = ..*$' Makefile > /dev/null 2>&1]) + AT_CHECK([grep '^CXX_FOR_BUILD = ..*$' Makefile > /dev/null 2>&1]) + + AT_CLEANUP ++ ++ ++AT_SETUP([gnulib-std-gnu11.m4]) ++ ++# Gnulib's std-gnu11.m4 (last significant change 2016-03-15) overrides ++# most but not all of the internal macros used by AC_PROG_CC and AC_PROG_CXX. ++# Commit 131d8c69f31dc6fc8dc93abe1096d52d1fe19fd3 changed the calling ++# convention of _AC_C_STD_TRY, causing configure scripts that load ++# std-gnu11.m4 to have shell syntax errors. ++ ++cp "$abs_top_srcdir/tests/data/gnulib_std_gnu11_2020_08_17.m4" \ ++ aclocal.m4 ++ ++AT_DATA([configure.ac], ++[[AC_INIT([foo], [1.0]) ++AC_PROG_CC ++AC_PROG_CXX ++AC_OUTPUT ++]]) ++ ++AT_CHECK_AUTOCONF ++AT_CHECK_CONFIGURE ++ ++AT_CLEANUP +diff --git a/tests/local.mk b/tests/local.mk +index df5551ba..a1efbd1f 100644 +--- a/tests/local.mk ++++ b/tests/local.mk +@@ -120,8 +120,13 @@ TESTSUITE_HAND_AT = \ + tests/autoscan.at \ + tests/foreign.at + ++TESTSUITE_EXTRA = \ ++ tests/data/ax_prog_cc_for_build_v18.m4 \ ++ tests/data/ax_prog_cxx_for_build_v3.m4 \ ++ tests/data/gnulib_std_gnu11_2020_08_17.m4 ++ + CLEANFILES += $(TESTSUITE_GENERATED_AT) +-EXTRA_DIST += $(TESTSUITE_HAND_AT) ++EXTRA_DIST += $(TESTSUITE_HAND_AT) $(TESTSUITE_EXTRA) + + TESTSUITE_AT = $(TESTSUITE_GENERATED_AT) $(TESTSUITE_HAND_AT) + TESTSUITE = tests/testsuite +-- +2.25.1 + + +From bef282971ce1ad6a13b8fac57a9b45a88ec5e61d Mon Sep 17 00:00:00 2001 +From: Zack Weinberg +Date: Tue, 29 Dec 2020 15:33:33 -0500 +Subject: [PATCH 13/13] =?UTF-8?q?autom4te:=20always=20update=20the=20outpu?= + =?UTF-8?q?t=20file,=20even=20if=20it=20hasn=E2=80=99t=20changed?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Automake generates a Makefile rule for regenerating the configure +script, that relies on an invocation of ‘autoconf’ always bumping the +timestamp on the configure script, even if it hasn’t changed. +The patch to make autom4te update the output file atomically +(1725c947144d9bebfe7817c2c5f0d53d884b1297) broke this. + +Fixes several failures in automake’s test suite. + + * bin/autom4te.in (handle_output): Always call update_file with force=1. + * tests/tools.at (autoconf: timestamp changes): New test. +--- + bin/autom4te.in | 4 +++- + tests/tools.at | 46 ++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 49 insertions(+), 1 deletion(-) + +diff --git a/bin/autom4te.in b/bin/autom4te.in +index 4c2b905c..64653a44 100644 +--- a/bin/autom4te.in ++++ b/bin/autom4te.in +@@ -609,7 +609,9 @@ sub handle_output ($$) + } + + $out->close(); +- update_file ($scratchfile, $output, $force) ++ # Always update the file, even if it didn't change; ++ # Automake relies on this. ++ update_file ($scratchfile, $output, 1) + if defined $scratchfile; + + # If no forbidden words, we're done. +diff --git a/tests/tools.at b/tests/tools.at +index 49710202..89b8b63b 100644 +--- a/tests/tools.at ++++ b/tests/tools.at +@@ -662,6 +662,52 @@ arbitrary $text + AT_CLEANUP + + ++# autoconf: timestamp changes ++# --------------------------- ++# Automake needs autoconf to update the timestamp on the configure script ++# whenever configure.ac or aclocal.m4 changes, even if the contents of the ++# configure script have not changed. ++AT_SETUP([autoconf: timestamp changes]) ++ ++AT_DATA([aclocal.m4], ++[[AC_DEFUN([local_KILROY], [# kilroy was here ++]) ++]]) ++ ++AT_DATA_AUTOCONF([configure.ac], ++[[AC_INIT ++AC_PROG_CC ++local_KILROY ++AC_OUTPUT ++]]) ++ ++AT_CHECK_AUTOCONF ++ ++cp configure configure.1 ++sleep 1 ++printf '%s\n' 'AC_LIBSOURCES([foo.c])dn@&t@l' >> configure.ac ++ ++# This step must not use --force. ++# We don't need to check shell syntax, because if all goes well, ++# the script will be unchanged from what it was in the first autoconf ++# pass, and that was already checked. ++AT_CHECK_M4([autoconf]) ++AT_CHECK([cmp configure configure.1]) ++AT_CHECK([test configure -nt configure.1]) ++ ++cp configure configure.2 ++sleep 1 ++printf '%s\n' \ ++ 'AC_DEFUN([unused_MACRO], [# bob was there too' \ ++ '])' >> aclocal.m4 ++ ++# Same as above. ++AT_CHECK_M4([autoconf]) ++AT_CHECK([cmp configure configure.2]) ++AT_CHECK([test configure -nt configure.2]) ++ ++AT_CLEANUP ++ + + ## --------- ## + ## ifnames. ## +-- +2.25.1 + diff --git a/meta/recipes-devtools/autoconf/autoconf/no-man.patch b/meta/recipes-devtools/autoconf/autoconf/no-man.patch new file mode 100644 index 0000000000..2c44375f43 --- /dev/null +++ b/meta/recipes-devtools/autoconf/autoconf/no-man.patch @@ -0,0 +1,21 @@ +For native builds we don't care about the documentation, and this would +otherwise pull in a dependency on help2man. + +Upstream-Status: Inappropriate +Signed-off-by: Ross Burton + +diff --git a/Makefile.in b/Makefile.in +index 146e8e3..a1827c1 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -763,10 +762,0 @@ dist_buildaux_SCRIPTS = \ +-dist_man_MANS = \ +- man/autoconf.1 \ +- man/autoheader.1 \ +- man/autom4te.1 \ +- man/autoreconf.1 \ +- man/autoscan.1 \ +- man/autoupdate.1 \ +- man/ifnames.1 +- +- diff --git a/meta/recipes-devtools/autoconf/autoconf/performance.patch b/meta/recipes-devtools/autoconf/autoconf/performance.patch deleted file mode 100644 index 1842fe92b7..0000000000 --- a/meta/recipes-devtools/autoconf/autoconf/performance.patch +++ /dev/null @@ -1,60 +0,0 @@ -The check for solaris 'print' causes significant problems on a linux machine -with dash as /bin/sh since it triggers the execution of "print" which on some -linux systems is a perl script which is part of mailcap. Worse, this perl -script calls "which file" and if successful ignores the path file was found -in and just runs "file" without a path. Each exection causes PATH to be searched. - -Simply assuming the shell's printf function works cuts out all the fork overhead -and when parallel tasks are running, this overhead appears to be significant. - -RP -2015/11/28 -Upstream-Status: Inappropriate - -Index: autoconf-2.69/lib/m4sugar/m4sh.m4 -=================================================================== ---- autoconf-2.69.orig/lib/m4sugar/m4sh.m4 -+++ autoconf-2.69/lib/m4sugar/m4sh.m4 -@@ -1045,40 +1045,8 @@ m4_defun([_AS_ECHO_PREPARE], - [[as_nl=' - ' - export as_nl --# Printing a long string crashes Solaris 7 /usr/bin/printf. --as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' --as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo --as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo --# Prefer a ksh shell builtin over an external printf program on Solaris, --# but without wasting forks for bash or zsh. --if test -z "$BASH_VERSION$ZSH_VERSION" \ -- && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then -- as_echo='print -r --' -- as_echo_n='print -rn --' --elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then -- as_echo='printf %s\n' -- as_echo_n='printf %s' --else -- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then -- as_echo_body='eval /usr/ucb/echo -n "$][1$as_nl"' -- as_echo_n='/usr/ucb/echo -n' -- else -- as_echo_body='eval expr "X$][1" : "X\\(.*\\)"' -- as_echo_n_body='eval -- arg=$][1; -- case $arg in @%:@( -- *"$as_nl"*) -- expr "X$arg" : "X\\(.*\\)$as_nl"; -- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; -- esac; -- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" -- ' -- export as_echo_n_body -- as_echo_n='sh -c $as_echo_n_body as_echo' -- fi -- export as_echo_body -- as_echo='sh -c $as_echo_body as_echo' --fi -+as_echo='printf %s\n' -+as_echo_n='printf %s' - ]])# _AS_ECHO_PREPARE - - diff --git a/meta/recipes-devtools/autoconf/autoconf/preferbash.patch b/meta/recipes-devtools/autoconf/autoconf/preferbash.patch index fa76ee9bdd..3979e83f70 100644 --- a/meta/recipes-devtools/autoconf/autoconf/preferbash.patch +++ b/meta/recipes-devtools/autoconf/autoconf/preferbash.patch @@ -1,25 +1,36 @@ -This value is used to determine CONFIG_SHELL and SHELL which may get exported into -scripts shared via sstate onto other systems. +From 0aac3047cd7681d610b22d79501c297fa3433148 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Thu, 12 Mar 2020 17:25:41 +0000 +Subject: [PATCH 2/7] m4sh: prefer bash over sh -Some systems have /bin/sh -> dash and others /bin/sh -> bash. Bash is preferred -but sometimes we can sometimes end up exporting /bin/sh yet use bashisms. +_AS_DETECT_BETTER_SHELL looks for a good shell to use, and tries to look for +'sh' before 'bash'. Whilst for many systems sh is a symlink to bash, +there are many where sh is a symlink to a more minimal sh implementation. -This patch puts bash first in the search results which avoids the bash/dash confusion. +For example, Debian by default has /bin/sh -> /bin/dash: dash is a faster +shell to start (which makes a notable difference to boot speed) but is not +as fast as bash at executing long scripts (and configure scripts are not +known for their conciseness). -RP 2012/9/23 +Change the search order to bash then sh, so that a known-good shell (bash) +is used if available over something which is merely POSIX compliant. +--- + lib/m4sugar/m4sh.m4 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -Upstream-Status: Inappropriate [OE specific configuration] - -Index: autoconf-2.69/lib/m4sugar/m4sh.m4 -=================================================================== ---- autoconf-2.69.orig/lib/m4sugar/m4sh.m4 2012-03-07 17:35:26.000000000 +0000 -+++ autoconf-2.69/lib/m4sugar/m4sh.m4 2013-09-23 16:12:38.853597515 +0000 -@@ -229,7 +229,7 @@ +diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 +index 9d543952..84ef84a9 100644 +--- a/lib/m4sugar/m4sh.m4 ++++ b/lib/m4sugar/m4sh.m4 +@@ -230,7 +230,7 @@ dnl Remove any tests from suggested that are also required [_AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH], [case $as_dir in @%:@( /*) - for as_base in sh bash ksh sh5; do + for as_base in bash sh ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } && +-- +2.25.1 + diff --git a/meta/recipes-devtools/autoconf/autoconf/program_prefix.patch b/meta/recipes-devtools/autoconf/autoconf/program_prefix.patch index 978a401f0a..4ff535fc15 100644 --- a/meta/recipes-devtools/autoconf/autoconf/program_prefix.patch +++ b/meta/recipes-devtools/autoconf/autoconf/program_prefix.patch @@ -1,20 +1,26 @@ -Upstream-Status: Pending +From f4f19a5c03e8ae3b9cc93d24b76694f4b7b2eb76 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Thu, 12 Mar 2020 17:28:38 +0000 +Subject: [PATCH 3/7] program_prefix.patch -# -# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher -# +Signed-off-by: Ross Burton +--- + lib/autoconf/general.m4 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) ---- autoconf-2.57/lib/autoconf/general.m4~program_prefix -+++ autoconf-2.57/lib/autoconf/general.m4 -@@ -1676,8 +1676,9 @@ +diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 +index 16f0d074..4c5e0b36 100644 +--- a/lib/autoconf/general.m4 ++++ b/lib/autoconf/general.m4 +@@ -2070,7 +2070,7 @@ _AC_CANONICAL_SPLIT([target]) + # The aliases save the names the user supplied, while $host etc. # will get canonicalized. - test -n "$target_alias" && -- test "$program_prefix$program_suffix$program_transform_name" = \ -- NONENONEs,x,x, && -+ test "$target_alias" != "$host_alias" && -+ test "$program_prefix$program_suffix$program_transform_name" = \ -+ NONENONEs,x,x, && +-test -n "$target_alias" && ++test -n "$target_alias" && test "$target_alias" != "$host_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && program_prefix=${target_alias}-[]dnl - ])# AC_CANONICAL_TARGET - +-- +2.25.1 + diff --git a/meta/recipes-devtools/autoconf/autoconf/remove-usr-local-lib-from-m4.patch b/meta/recipes-devtools/autoconf/autoconf/remove-usr-local-lib-from-m4.patch index 55d2e2fe7e..b842f14f4f 100644 --- a/meta/recipes-devtools/autoconf/autoconf/remove-usr-local-lib-from-m4.patch +++ b/meta/recipes-devtools/autoconf/autoconf/remove-usr-local-lib-from-m4.patch @@ -1,17 +1,18 @@ -We have problem using hardcoded directories like /usr/local here -which will be checked for cross builds. This is a special case which -is valid for AIX only. We do not have AIX as one of our supported -build host or target. Therefore we get rid of the hardcoded paths -and make life easier for cross compilation process. +From a08643ac3fef884900d6cfa161f0acec3ef104d1 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Thu, 12 Mar 2020 17:25:37 +0000 +Subject: [PATCH 1/7] remove-usr-local-lib-from-m4.patch -Signed-off-by: Khem Raj +Signed-off-by: Ross Burton +--- + lib/autoconf/functions.m4 | 9 --------- + 1 file changed, 9 deletions(-) -Upstream-Status: Inappropriate [Upstream does care for AIX while we may not] -Index: autoconf-2.68/lib/autoconf/functions.m4 -=================================================================== ---- autoconf-2.68.orig/lib/autoconf/functions.m4 2010-09-22 14:52:19.000000000 -0700 -+++ autoconf-2.68/lib/autoconf/functions.m4 2011-08-03 11:57:05.822199513 -0700 -@@ -749,15 +749,6 @@ if test $ac_have_func = no; then +diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 +index 12f60b99..07da7941 100644 +--- a/lib/autoconf/functions.m4 ++++ b/lib/autoconf/functions.m4 +@@ -801,15 +801,6 @@ if test $ac_have_func = no; then [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes]) fi @@ -27,3 +28,6 @@ Index: autoconf-2.68/lib/autoconf/functions.m4 # Make sure it is really in the library, if we think we found it, # otherwise set up the replacement function. AC_CHECK_FUNCS(getloadavg, [], +-- +2.25.1 + diff --git a/meta/recipes-devtools/autoconf/autoconf_2.69.bb b/meta/recipes-devtools/autoconf/autoconf_2.69.bb deleted file mode 100644 index 2e1b9bdc90..0000000000 --- a/meta/recipes-devtools/autoconf/autoconf_2.69.bb +++ /dev/null @@ -1,31 +0,0 @@ -require autoconf.inc - -PR = "r11" - -LICENSE = "GPLv2 & GPLv3" -LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \ - file://COPYINGv3;md5=d32239bcb673463ab874e80d47fae504" - -SRC_URI = "${GNU_MIRROR}/autoconf/autoconf-${PV}.tar.gz \ - file://program_prefix.patch \ - file://check-automake-cross-warning.patch \ - file://autoreconf-exclude.patch \ - file://autoreconf-gnuconfigize.patch \ - file://config_site.patch \ - file://remove-usr-local-lib-from-m4.patch \ - file://preferbash.patch \ - file://autotest-automake-result-format.patch \ - file://add_musl_config.patch \ - file://performance.patch \ - file://AC_HEADER_MAJOR-port-to-glibc-2.25.patch \ - file://autoconf-replace-w-option-in-shebangs-with-modern-use-warnings.patch \ - " - -SRC_URI[md5sum] = "82d05e03b93e45f5a39b828dc9c6c29b" -SRC_URI[sha256sum] = "954bd69b391edc12d6a4a51a2dd1476543da5c6bbf05a95b59dc0dd6fd4c2969" - -SRC_URI_append_class-native = " file://fix_path_xtra.patch" - -EXTRA_OECONF += "ac_cv_path_M4=m4 ac_cv_prog_TEST_EMACS=no" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-devtools/autoconf/autoconf_2.70.bb b/meta/recipes-devtools/autoconf/autoconf_2.70.bb new file mode 100644 index 0000000000..d6f543545e --- /dev/null +++ b/meta/recipes-devtools/autoconf/autoconf_2.70.bb @@ -0,0 +1,22 @@ +require autoconf.inc + +LICENSE = "GPLv2 & GPLv3" +LIC_FILES_CHKSUM = "file://COPYING;md5=cc3f3a7596cb558bbd9eb7fbaa3ef16c \ + file://COPYINGv3;md5=1ebbd3e34237af26da5dc08a4e440464" + +SRC_URI = "${GNU_MIRROR}/autoconf/${BP}.tar.gz \ + file://from-master.patch \ + file://program_prefix.patch \ + file://autoreconf-exclude.patch \ + file://remove-usr-local-lib-from-m4.patch \ + file://preferbash.patch \ + file://autotest-automake-result-format.patch \ + " + +SRC_URI[sha256sum] = "f05f410fda74323ada4bdc4610db37f8dbd556602ba65bc843edb4d4d4a1b2b7" + +SRC_URI_append_class-native = " file://no-man.patch" + +EXTRA_OECONF += "ac_cv_path_M4=m4 ac_cv_prog_TEST_EMACS=no" + +BBCLASSEXTEND = "native nativesdk" -- 2.40.1