autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] add new AC_PROG_AR helper


From: Mike Frysinger
Subject: [PATCH] add new AC_PROG_AR helper
Date: Mon, 22 Feb 2021 11:09:16 -0500

This mirrors the existing RANLIB and related toolchain macros that
autoconf already exports.  Some projects assume `ar` is available
which isn't always safe, so provide a macro that probes the full
toolchain settings.

This also makes it easier to use AC_REQUIRE with the macro instead
of duplicating the AC_CHECK_TOOL call in projects.
---
 doc/autoconf.texi        | 9 +++++++++
 lib/autoconf/programs.m4 | 8 ++++++++
 2 files changed, 17 insertions(+)

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 7b42dd6a879f..ae76b91f2303 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -4158,6 +4158,15 @@ general program-check macros.
 These macros check for particular programs---whether they exist, and
 in some cases whether they support certain features.
 
+@defmac AC_PROG_AR
+@acindex{PROG_AR}
+@ovindex AR
+@c @caindex prog_AR
+@c @caindex prog_ac_ct_AR
+Set output variable @code{AR} to @samp{ar} if @code{ar} is found, and
+otherwise to @samp{:} (do nothing).
+@end defmac
+
 @defmac AC_PROG_AWK
 @acindex{PROG_AWK}
 @ovindex AWK
diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4
index 588a7bdc6213..f27e01a7dcde 100644
--- a/lib/autoconf/programs.m4
+++ b/lib/autoconf/programs.m4
@@ -341,6 +341,14 @@ fi
 # Please, keep this section sorted.
 # (But of course when keeping related things together).
 
+# AC_PROG_AR
+# --------------
+AN_MAKEVAR([AR], [AC_PROG_AR])
+AN_PROGRAM([ar], [AC_PROG_AR])
+AC_DEFUN([AC_PROG_AR],
+[AC_CHECK_TOOL(AR, ar, :)])
+
+
 # Check for gawk first since it's generally better.
 AN_MAKEVAR([AWK],  [AC_PROG_AWK])
 AN_PROGRAM([awk],  [AC_PROG_AWK])
-- 
2.30.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]