]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
add new AC_PROG_AR helper
authorMike Frysinger <vapier@gentoo.org>
Mon, 22 Feb 2021 16:09:16 +0000 (11:09 -0500)
committerZack Weinberg <zackw@panix.com>
Mon, 24 Jan 2022 14:33:20 +0000 (09:33 -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.

  * lib/autoconf/programs.m4 (AC_PROG_AR): New macro.
  * doc/autoconf.texi: Document it.
  * tests/local.at (_AT_CHECK_ENV): Allow $AR output variable.

doc/autoconf.texi
lib/autoconf/programs.m4
tests/local.at

index 06a98dd0b808192d533583f79df26a87ebcaafe6..49ee61cd0a44842fdc5b461fa83e73b58ded070e 100644 (file)
@@ -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
index a899218fa37b3ffdaddd76079ba71be2fa71ed58..b541517611332ab5f437f1e10bb0f188518baaea 100644 (file)
@@ -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])
index 4135ad9a07da23ba2c612de9fe47f76a50c6b31b..cf907ada0eef7bb0e22676cb5564b70a668c665a 100644 (file)
@@ -399,7 +399,7 @@ if test -f state-env.before && test -f state-env.after; then
       [GFC|F77_DUMMY_MAIN|f77_(case|underscore)],
       [FC(_DUMMY_MAIN|FLAGS|LIBS|FLAGS_[fF]|_MODEXT|_MODINC|_MODOUT|_DEFINE)?],
       [ALLOCA|GETLOADAVG_LIBS|KMEM_GROUP|NEED_SETGID|POW_LIB],
-      [AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|MKDIR_P|RANLIB|SET_MAKE|YACC],
+      [AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|MKDIR_P|AR|RANLIB|SET_MAKE|YACC],
       [GREP|[EF]GREP|SED],
       [[_@]|.[*@%:@?$].],
       [argv|ARGC|LINENO|BASH_ARGC|BASH_ARGV|OLDPWD|PIPESTATUS|RANDOM],