Skip to contentSkip to conversation

Replace obsolete AC_CANONICAL_SYSTEM macro

PATCH Superseded [email protected] 2 participants 3 messages Jul 20, 2025 – Aug 21, 2025 1 message not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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
index 8cba24927..2c78c3f6b 100644
@@ -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
#1 lore raw
Quoted 4 lines · On 20.07.25 16:25, [email protected] wrote:

From: wang <[email protected]>

The macro AC_CANONICAL_SYSTEM is 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.

---
 config/ac_prog_cc_for_build.m4 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
config/ac_prog_cc_for_build.m4 +0 -0
index 8cba24927..2c78c3f6b 100644

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 -0
 dnl
 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]

#3 lore raw
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_SYSTEM is 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.

---
 config/ac_prog_cc_for_build.m4 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
config/ac_prog_cc_for_build.m4 +0 -0
index 8cba24927..2c78c3f6b 100644

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 [...]".

Quoted 12 lines

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 -0
 dnl
 pushdef([AC_TRY_COMPILER], [
 cat > conftest.$ac_ext << EOF
Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center

In 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_BUILD and AC_CANONICAL_HOST are enough for native builds. I have tested it, and the warning wasn't printed. But for cross- compilation,
AC_CANONICAL_TARGET must 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