Skip to content

Commit c48fdb8

Browse files
vapierzackw
authored andcommitted
add new AC_PROG_AR helper
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.
1 parent b0d5d2d commit c48fdb8

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

doc/autoconf.texi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4158,6 +4158,15 @@ general program-check macros.
41584158
These macros check for particular programs---whether they exist, and
41594159
in some cases whether they support certain features.
41604160

4161+
@defmac AC_PROG_AR
4162+
@acindex{PROG_AR}
4163+
@ovindex AR
4164+
@c @caindex prog_AR
4165+
@c @caindex prog_ac_ct_AR
4166+
Set output variable @code{AR} to @samp{ar} if @code{ar} is found, and
4167+
otherwise to @samp{:} (do nothing).
4168+
@end defmac
4169+
41614170
@defmac AC_PROG_AWK
41624171
@acindex{PROG_AWK}
41634172
@ovindex AWK

lib/autoconf/programs.m4

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,14 @@ fi
341341
# Please, keep this section sorted.
342342
# (But of course when keeping related things together).
343343

344+
# AC_PROG_AR
345+
# --------------
346+
AN_MAKEVAR([AR], [AC_PROG_AR])
347+
AN_PROGRAM([ar], [AC_PROG_AR])
348+
AC_DEFUN([AC_PROG_AR],
349+
[AC_CHECK_TOOL(AR, ar, :)])
350+
351+
344352
# Check for gawk first since it's generally better.
345353
AN_MAKEVAR([AWK], [AC_PROG_AWK])
346354
AN_PROGRAM([awk], [AC_PROG_AWK])

tests/local.at

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ if test -f state-env.before && test -f state-env.after; then
399399
[GFC|F77_DUMMY_MAIN|f77_(case|underscore)],
400400
[FC(_DUMMY_MAIN|FLAGS|LIBS|FLAGS_[fF]|_MODEXT|_MODINC|_MODOUT|_DEFINE)?],
401401
[ALLOCA|GETLOADAVG_LIBS|KMEM_GROUP|NEED_SETGID|POW_LIB],
402-
[AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|MKDIR_P|RANLIB|SET_MAKE|YACC],
402+
[AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|MKDIR_P|AR|RANLIB|SET_MAKE|YACC],
403403
[GREP|[EF]GREP|SED],
404404
[[_@]|.[*@%:@?$].],
405405
[argv|ARGC|LINENO|BASH_ARGC|BASH_ARGV|OLDPWD|PIPESTATUS|RANDOM],

0 commit comments

Comments
 (0)