From dbe71d9e3370e130861ea5b4d46fd120b2afc230 Mon Sep 17 00:00:00 2001
From: Kang-Che Sung <explorer09@gmail.com>
Date: Sun, 5 May 2024 08:16:52 +0800
Subject: [PATCH] ax_prog_cc_for_build code simplification

No need to check whether ac_cv_exeext, ac_cv_objext or
ac_cv_c_compiler_gnu is set. The three variables are already present in
Autoconf 2.50 and they are always set by AC_REQUIRE([AC_PROG_CC]).
---
 m4/ax_prog_cc_for_build.m4 | 40 ++++++++++++++------------------------
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/m4/ax_prog_cc_for_build.m4 b/m4/ax_prog_cc_for_build.m4
index fd81564..8088d58 100644
--- a/m4/ax_prog_cc_for_build.m4
+++ b/m4/ax_prog_cc_for_build.m4
@@ -32,7 +32,7 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 23
+#serial 24
 
 AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
 AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
@@ -81,18 +81,17 @@ dnl AC_SUBST which prevents the renaming of EXEEXT and OBJEXT
 dnl variables. It's not a good idea to rename ac_cv_exeext and
 dnl ac_cv_objext either as they're related.
 dnl Renaming ac_exeext and ac_objext is safe though.
-AS_VAR_SET_IF([ac_cv_exeext],
-  [ac_cv_host_exeext=$ac_cv_exeext
-  AS_UNSET([ac_cv_exeext])])
-AS_VAR_SET_IF([ac_cv_objext],
-  [ac_cv_host_objext=$ac_cv_objext
-  AS_UNSET([ac_cv_objext])])
+dnl
+ac_cv_host_exeext=$ac_cv_exeext
+AS_UNSET([ac_cv_exeext])
+ac_cv_host_objext=$ac_cv_objext
+AS_UNSET([ac_cv_objext])
 dnl
 dnl ac_cv_c_compiler_gnu is used in _AC_LANG_COMPILER_GNU (called by
 dnl AC_PROG_CC) indirectly.
-AS_VAR_SET_IF([ac_cv_c_compiler_gnu],
-  [ac_cv_host_c_compiler_gnu=$ac_cv_c_compiler_gnu
-  AS_UNSET([ac_cv_c_compiler_gnu])])
+dnl
+ac_cv_host_c_compiler_gnu=$ac_cv_c_compiler_gnu
+AS_UNSET([ac_cv_c_compiler_gnu])
 
 cross_compiling_build=no
 
@@ -140,21 +139,12 @@ popdef([ac_cv_prog_CPP])dnl
 BUILD_EXEEXT=$ac_cv_exeext
 BUILD_OBJEXT=$ac_cv_objext
 
-AS_VAR_SET_IF([ac_cv_host_exeext],
-  [ac_cv_exeext=$ac_cv_host_exeext
-  EXEEXT=$ac_cv_host_exeext],
-  [AS_UNSET([ac_cv_exeext])
-  AS_UNSET([EXEEXT])])
-AS_VAR_SET_IF([ac_cv_host_objext],
-  [ac_cv_objext=$ac_cv_host_objext
-  OBJEXT=$ac_cv_host_objext],
-  [AS_UNSET([ac_cv_objext])
-  AS_UNSET([OBJEXT])])
-AS_VAR_SET_IF([ac_cv_host_c_compiler_gnu],
-  [ac_cv_c_compiler_gnu=$ac_cv_host_c_compiler_gnu
-  ac_compiler_gnu=$ac_cv_host_c_compiler_gnu],
-  [AS_UNSET([ac_cv_c_compiler_gnu])
-  AS_UNSET([ac_compiler_gnu])])
+ac_cv_exeext=$ac_cv_host_exeext
+EXEEXT=$ac_cv_host_exeext
+ac_cv_objext=$ac_cv_host_objext
+OBJEXT=$ac_cv_host_objext
+ac_cv_c_compiler_gnu=$ac_cv_host_c_compiler_gnu
+ac_compiler_gnu=$ac_cv_host_c_compiler_gnu
 
 dnl restore global variables ac_ext, ac_cpp, ac_compile,
 dnl ac_link, ac_compiler_gnu (dependant on the current
-- 
2.44.0

