Replace obsolete AC_CANONICAL_SYSTEM macro
PATCH 1/1 Replace obsolete AC_CANONICAL_SYSTEM macro
From: wang <[email protected]>
The macro AC_CANONICAL_SYSTEM is obsolete and triggers warnings in modern autoconf.
This patch replaces it with the recommended macros to silence these warnings.
--- config/ac_prog_cc_for_build.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
config/ac_prog_cc_for_build.m4 +3 -1
@@ -5,7 +5,9 @@ AC_DEFUN([AC_PROG_CC_FOR_BUILD], [dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_CPP])dnl AC_REQUIRE([AC_EXEEXT])dnl -AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_TARGET])dnl dnl pushdef([AC_TRY_COMPILER], [ cat > conftest.$ac_ext << EOF
Signature · 1 line
2.34.1
Quoted 4 lines · On 20.07.25 16:25, [email protected] wrote:
From: wang <[email protected]>
The macro
AC_CANONICAL_SYSTEMis obsolete and triggers warnings in modern autoconf.
Can we define which version of autoconf started to trigger this? And where it is printed? I have 2.69 here e.g., and it remained silent during scripts/bootstrap.
Quoted 13 lines
This patch replaces it with the recommended macros to silence these warnings.
Signed-off-by wang <[email protected]>--- config/ac_prog_cc_for_build.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)config/ac_prog_cc_for_build.m4 +0
-0
config/ac_prog_cc_for_build.m4 AC_DEFUN([AC_PROG_CC_FOR_BUILD], [dnl · line 10
Quoted 7 lines
config/ac_prog_cc_for_build.m4 +3
-1@@ -5,7 +5,9 @@ AC_DEFUN([AC_PROG_CC_FOR_BUILD], [dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_CPP])dnl AC_REQUIRE([AC_EXEEXT])dnl -AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_TARGET])dnl
Do we need to list them all?
"The user is encouraged to use either AC_CANONICAL_BUILD, or AC_CANONICAL_HOST, or AC_CANONICAL_TARGET, depending on the needs. Using AC_CANONICAL_TARGET is enough to run the two other macros [...]".
But we actually use AC_CANONICAL_BUILD and AC_CANONICAL_HOST in configure.ac.
Jan
Quoted 3 lines
config/ac_prog_cc_for_build.m4 +0
-0dnl pushdef([AC_TRY_COMPILER], [ cat > conftest.$ac_ext << EOF
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 73 lines · guangfeng.wang
Quoted 37 lines · Jan Kiszka
Quoted 4 lines · On 20.07.25 16:25, [email protected] wrote:
From: wang <[email protected]>
The macro
AC_CANONICAL_SYSTEMis obsolete and triggers warnings in modern autoconf.Can we define which version of autoconf started to trigger this? And where it is printed? I have 2.69 here e.g., and it remained silent during
scripts/bootstrap.Quoted 13 lines
This patch replaces it with the recommended macros to silence these warnings.
Signed-off-by wang <[email protected]>--- config/ac_prog_cc_for_build.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)config/ac_prog_cc_for_build.m4 +0
-0config/ac_prog_cc_for_build.m4 AC_DEFUN([AC_PROG_CC_FOR_BUILD], [dnl · line 10
Quoted 7 lines
config/ac_prog_cc_for_build.m4 +3
-1@@ -5,7 +5,9 @@ AC_DEFUN([AC_PROG_CC_FOR_BUILD], [dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_CPP])dnl AC_REQUIRE([AC_EXEEXT])dnl -AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_TARGET])dnlDo we need to list them all?
"The user is encouraged to use either
AC_CANONICAL_BUILD, orAC_CANONICAL_HOST, orAC_CANONICAL_TARGET, depending on the needs. UsingAC_CANONICAL_TARGETis enough to run the two other macros [...]".Quoted 12 lines
But we actually use
AC_CANONICAL_BUILDandAC_CANONICAL_HOSTin configure.ac.Jan
Quoted 3 lines
config/ac_prog_cc_for_build.m4 +0
-0dnl pushdef([AC_TRY_COMPILER], [ cat > conftest.$ac_ext << EOFSignature · 2 lines
Siemens AG, Foundational Technologies Linux Expert CenterIn version 2.69, we need to add *-Wall *or*-Wobsolete *for the warning to be printed. I checked my Autoconf version, and it is 2.71. Some warnings are printed to stderr when the macro is expanded. Running "autoupdate" can automatically replace old macros, and most obsolete warnings can be resolved, but this particular warning is still printed.
Starting from version 2.70, this warning is enabled by default. Autoconf also provides a "silent" parameter to suppress the warning. To do so, change the code from:
*
*
*AC_REQUIRE([AC_CANONICAL_SYSTEM], )dnl*
*
*
to:*AC_REQUIRE([AC_CANONICAL_SYSTEM], [silent])dnl*
*
*
With this change, the warning will not be printed on stderr.
Quoted 5 lines
Yes,
AC_CANONICAL_BUILDandAC_CANONICAL_HOSTare enough for native builds. I have tested it, and the warning wasn't printed. But for cross- compilation,AC_CANONICAL_TARGETmust be used instead.
"Using AC_CANONICAL_TARGET is enough to run the two other macros" - so, shouldn't it be enough to ONLY have that one then?
Jan
Quoted 19 lines
"Macro: AC_CANONICAL_TARGET Compute the canonical target- system type variable,
target, and its
three individual parts target_cpu, target_vendor, and target_os. If -- target
was specified, then target is the canonicalization
of target_alias by config.sub,
otherwise it defaults to host."Refs: - https://www.gnu.org/software/autoconf/manual/autoconf-2.69/
html_node/Obsoleting-Macros.html <https://www.gnu.org/software/autoconf/
manual/autoconf-2.69/html_node/Obsoleting-Macros.html>
- https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/
Obsoleting-Macros.html <https://www.gnu.org/software/autoconf/manual/
autoconf-2.70/html_node/Obsoleting-Macros.html>Best Regards,
Guang Feng Wang
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center