automake-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Add new 'AM_PROG_AR' macro, triggering the 'ar-lib' script.


From: Peter Rosin
Subject: Re: [PATCH] Add new 'AM_PROG_AR' macro, triggering the 'ar-lib' script.
Date: Thu, 16 Sep 2010 10:50:05 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2

Den 2010-09-15 12:44 skrev Stefano Lattarini:
> On Wednesday 15 September 2010, Peter Rosin wrote:
>> Hi Stefano,
>>
>> Den 2010-09-15 01:45 skrev Stefano Lattarini:
>>>>>> +: ${AR=ar}
>>>>>> +
>>>>>> +AC_CACHE_CHECK([the archiver ($AR) interface],
>>>>>> [am_cv_ar_interface], +  [am_cv_ar_interface=ar
>>>>>> +   AC_COMPILE_IFELSE([[int some_variable = 0;]],
>>>>>> +     [am_ar_try='$AR cru libconftest.a conftest.$ac_objext 
>>>>>> >&AS_MESSAGE_LOG_FD'
>>>>>
>>>>> What is the rationale for not redirecting stderr here, along
>>>>> with stdout?
>>>>
>>>> But stderr is redirected?
>>>
>>> Where?  Am I mising something?
>>
>> ">&foo" is the same as ">foo 2>&1", or what am I missing?
> No, "&>foo" is the same as ">foo 2>&1" on bash and zsh (at least), but
> is not portable. ">&n" redirects the stdout to file descriptor n, which
> must be an open file descriptor:

<snip>

Facepalm
Ok, Ralf set us both straight...

>> [MEGA CUT]
> 
>>>> +  # and then we could set am__AR="\$(am_aux_dir)/ar-lib \$(AR)"
>>> What about:
>>>  ``... and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or
>>>    something similar''.
>>> instead?  This seems somewhat more correct, without forcing us to be
>>> overly precise and explicit.
>> I also changed \$(AR) to $AR and went with your version.
> But the \$(AR) was meant, so that the user could override AR (but not
> am__AR) at make time ;-)

Ok, sigh. :-)

>>>> +      test $exit_status = 76 && exit 77
>>>
>>> I'm not sure I understand the semantic here; an exit status of 76
>>> means you have the expected `lib' program... and in this case you
>>> skip the test because it requires `lib' itself?  (BTW, sorry for
>>> not having noticed this in my prevous review).
>>
>> Arrgh. I had requires=lib in ar-lib5.test instead of required=lib,
>> so it didn't really check if lib was there at all, it just blindly
>> used it.
> Probably a new maintainer-check rule would help here, by catching
> assigement to (say) `requires' and `require' instead of `required'.
> Do you want to try to write it?

No, you go ahead. I wouldn't have had any use of it this time anyway
since I'm not running the full testsuite just for fun. It takes too
bloody long. If you could fix that instead, that'd be grand? :-)

>> So the above was totally untested dead code. In this
>> iteration I have tested that the test skips if lib is missing.
>> Sorry for being so sloppy.
> No problem.  Moreover, I could have applied your patch on my tree,
> and I'd have noticed the failure right away.

Indeed. But more embarrassing for me, so I'm glad you didn't. :-)

>> I have also added some words about the optional argument in the
>> documentation, and I noticed that AM_PROG_AR does not handle
>> ARFLAGS (which I thought it did), so I adjusted the code in
>> automake.in:handle_libraries accordingly.
> Did the tests failed on this?  If not, this is a testsuite
> weakness that should be fixed.  The best way to do so IMO would
> be to temporarily revert you fix to handle_libraries, add a new
> test exposing the bug (ar3.test), check that the test fails,
> re-apply your fix, and check that it passes.  Does the attached
> test script `ar3.test' succeed in doing this?

No, it was not exposed previously, but your ar3 doesn't expose it
either. I'm squashing in an ar3.test that exposes the issue since
it is related to AM_PROG_AR. ar3.test failed with the code in the
first two (broken) versions of the patch, but passes with the third
and this fourth version.

> Some more nits and not-so-nits below...
> 
> BTW, sorry if I seem overly nitpicking; please do not mistake this
> attitude as a belittling of you or your good work!

No problem, it's hard to do reviews.

>> diff --git a/NEWS b/NEWS
>> index 6971bd7..41a6cc8 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -8,6 +8,9 @@ New in 1.11.0a:
>>    - The `compile' script now converts some options for MSVC for a
>>      better user experience.  Similarly, the new `ar-lib' script wraps
>>      Microsoft lib.
>>
>> +  - New macro AM_PROG_AR that looks for an archiver and wraps it in the new
>> +    'ar-lib' auxiliary script if the found archiver is Microsoft lib.
>> +
> Also, use of AM_PROG_AR is now *required* when you use LIBRARIES or
> LTLIBRARIES primaries with -Werror in AUTOMAKE_OPTIONS.  This is a
> backward-incompatibility that IMO should be clearly noted in NEWS.

Agreed, I added some words.

>> diff --git a/tests/ar-lib5.test b/tests/ar-lib5.test
> What about adding also a sister test for ar-lib5.test, which would
> use a `lib' script that fakes the Microsoft lib interface?  Such a
> test could also run on Unix, thus improving coverage.
> 
> I've gone ahead and tried this idea; see the attached scripts
> ar-lib5a.test (which is basically your old ar-lib5.test) and
> ar-lib5b.test (which fakes microsoft lib).

Ok, but I used an absolute file name instead of fiddling with $PATH.
I also added your name to the ChangeLog.

> I've also extended them a bit, by making them check that configure
> detects the right archiver interface.

That's a nice addition.

>> diff --git a/tests/Makefile.am b/tests/Makefile.am
>> index 01acd76..ecc6ab6 100644
>> --- a/tests/Makefile.am
>> +++ b/tests/Makefile.am
>> @@ -89,6 +89,12 @@ ansi8.test \
>>  ansi9.test \
>>  ansi10.test \
>>  ar-lib.test \
>> +ar-lib2.test \
>> +ar-lib3.test \
>> +ar-lib4.test \
>> +ar-lib5.test \
> This might have to be adjusted to ar-lib5a.test and ar-lib5b.test,
> if you decide to follow my idea above.
>> +ar-lib6.test \
>> +ar-lib7.test \
>>  ar.test \
>>  ar2.test \
> Please add ar3.test here if it works.
> 
>> diff --git a/tests/ar.test b/tests/ar.test
> I think you could fix also ar2.test right away, since you are at it.

In this version (I think) I have fixed all affected tests. I ventured
ahead since Ralf has had enough time to scream stop if this is going
in some totally undesired direction. I only picked one random test
as an example for the first rounds.

The rationale for the fixes is to add AM_PROG_AR to most of the
library using tests, but not all. In some cases I added
-Wno-portability instead, those cases being tests related to
problem reports (on the grounds that the report surely didn't use
AM_PROG_AR, and that it is desired to test the original case), and
some ar tests ensuring that some things still work even if AM_PROG_AR
is not used.

When I have added AM_PROG_AR, I have also added ": > ar-lib" if
that is sufficient to make the test fly, or --add-missing if that
is required. For tests that use AUTOMAKE_fails that will just fail
for one more reason, but uses grep to check for the original failure
case after that, I have not bothered to adjust so that the test
doesn't have portability problems (e.g. reqd2.test).

>> diff --git a/tests/defs.in b/tests/defs.in
>> +      # There is no way to get any identifying output with
>> +      # a zero exit status. So, remap exit status 76 to 0.
>> +      echo "$me: running $AR -?"
>> +      exit_status=0
>> +      $AR -\? || exit_status=$?
>> +      test $exit_status = 76 || exit 77
>> +      ;;
> Since the `errexit' shell flag is not active in `tests/defs', this could
> be simplified even more, as e.g.:
>    # Microsoft lib exit with status `76 'when asked to identify output.
>    echo "$me: running $AR -?"
>    $AR -\?
>    test $? = 76 || exit 77
> Also, is "identify output" really meant, or would it better written as
> "identify version"?

"Identify output" is indeed not meant, which is why I wrote
"identifying output", i.e. some output that can be used to identify
the one doing the output, in this case lib.exe. lib.exe has no explicit
option that makes it print just the version, that part will just show
up when you ask it for help with -? (or if you ask it to do anything
really, unless you also supply the -nologo option of course).

I did some further tests, and if I run
        lib -out:gazonk.lib
it will exit with zero exit status and it will output only the logo part
Microsoft (R) Library Manager Version 8.00.50727.762
Copyright (C) Microsoft Corporation.  All rights reserved.

and it will also not actually create gazonk.lib. Seems like a winner to
me, so I'm going with that.

Here's the 4th iteration.

Cheers,
Peter

>From de2d6b014861d135bc6a63090f23861596217885 Mon Sep 17 00:00:00 2001
From: Peter Rosin <address@hidden>
Date: Thu, 16 Sep 2010 10:14:02 +0200
Subject: [PATCH] Add new 'AM_PROG_AR' macro, triggering the 'ar-lib' script.

* m4/ar-lib.m4: New macro AM_PROG_AR, which locates an
archiver and triggers the auxiliary 'ar-lib' script if needed.
* m4/Makefile.am (dist_m4data_DATA): Update.
* automake.in ($seen_ar): New variable.
(scan_autoconf_traces): Set it.
(handle_libraries): Don't set any default value for AR if
AM_PROG_AR has been seen.
(handle_libraries, handle_ltlibraries): Require AM_PROG_AR for
portability.
* doc/automake.texi (Public Macros): Mention the new
'AM_PROG_AR' macro.
(Subpackages): Add AM_PROG_AR to the example.
(A Library): Adjust recommendations for AR given the new
AM_PROG_AR macro.
* tests/aclibobj.test, tests/aclocal4.test, tests/ansi10.test,
tests/ar.test, tests/ar2.test, tests/canon4.test,
tests/compile4.test, tests/cond13.test, tests/condlib.test,
tests/depcomp4.test, tests/depcomp6.test, tests/depcomp7.test,
tests/fort5.test, tests/instdir-ltlib.test,
tests/instdir-prog.test, tests/instfail-libtool.test,
tests/instfail.test, tests/instspc.test, tests/ldflags.test,
tests/libobj10.test, tests/libobj11.test, tests/libobj12.test,
tests/libobj13.test, tests/libobj2.test, tests/libobj7.test,
tests/libobj8.test, tests/library.test, tests/libtoo10.test,
tests/libtool2.test, tests/libtool3.test, tests/libtool5.test,
tests/libtool6.test, tests/libtool7.test, tests/libtool8.test,
tests/libtool9.test, tests/listval.test, tests/location.test,
tests/ltcond.test, tests/ltcond2.test, tests/ltconv.test,
tests/ltdeps.test, tests/ltinstloc.test, tests/ltlibobjs.test,
tests/ltlibsrc.test, tests/ltorder.test, tests/multlib.test,
tests/nobase.test, tests/nobase-libtool.test,
tests/noinstdir.test, test/pr72.test, tests/pr300-lib.test,
tests/pr300-ltlib.test, tests/pr307.test, tests/pr401.test,
tests/pr401b.test, tests/pr401c.test, tests/silent3.test,
tests/silent4.test, tests/silent9.test, tests/specflg2.test,
tests/stdlib2.test, tests/subdir4.test,
tests/subdirbuiltsources.test, tests/subobj9.test,
tests/subobj10.test, tests/subpkg.test, tests/subst3.test,
tests/substtarg.test, tests/suffix2.test, tests/suffix5.test,
tests/suffix8.test, tests/suffix10.test, tests/vala.test,
tests/vala1.test: Adjust to new portability requirements due to
the new AM_PROG_AR macro.
* tests/ar-lib2.test: New test, checking that AM_PROG_AR triggers
install of ar-lib.
* tests/ar-lib3.test: New test, checking that lib_LIBRARIES
requires AM_PROG_AR.
* tests/ar-lib4.test: New test, checking that lib_LTLIBRARIES
requires AM_PROG_AR.
* tests/ar-lib5a.test: New test, checking that AM_PROG_AR triggers
use of ar-lib when the archiver is Microsoft lib.
* tests/ar-lib5b.test: New test, checking that AM_PROG_AR triggers
use of ar-lib when the archiver is a faked lib.
* tests/ar-lib6.test: New test, checking the ordering of
AM_PROG_AR and LT_INIT.
* tests/ar-lib7.test: New test, checking that automake warns
if ar-lib is missing.
* tests/ar3.test: New test, checking that AR and ARFLAGS may
be overridden by the user even if AM_PROG_AR is used.
* tests/defs.in: New required entry 'lib'.
* tests/Makefile.am (TESTS): Update.
* NEWS: Update.

Signed-off-by: Peter Rosin <address@hidden>
---
 ChangeLog                     |   67 +++++++++++++++++++++++++++++++++
 NEWS                          |    5 ++
 automake.in                   |   27 +++++++++++++-
 doc/automake.texi             |   21 ++++++++--
 m4/Makefile.am                |    1 +
 m4/Makefile.in                |    1 +
 m4/ar-lib.m4                  |   58 ++++++++++++++++++++++++++++
 tests/Makefile.am             |    8 ++++
 tests/Makefile.in             |    8 ++++
 tests/aclibobj.test           |    2 +
 tests/aclocal4.test           |    3 +-
 tests/ansi10.test             |    1 +
 tests/ar-lib2.test            |   40 ++++++++++++++++++++
 tests/ar-lib3.test            |   45 ++++++++++++++++++++++
 tests/ar-lib4.test            |   57 ++++++++++++++++++++++++++++
 tests/ar-lib5a.test           |   72 +++++++++++++++++++++++++++++++++++
 tests/ar-lib5b.test           |   83 +++++++++++++++++++++++++++++++++++++++++
 tests/ar-lib6.test            |   38 +++++++++++++++++++
 tests/ar-lib7.test            |   36 ++++++++++++++++++
 tests/ar.test                 |    3 +
 tests/ar2.test                |    2 +-
 tests/ar3.test                |   43 +++++++++++++++++++++
 tests/canon4.test             |    3 +
 tests/compile4.test           |    1 +
 tests/cond13.test             |    3 +
 tests/condlib.test            |    3 +
 tests/defs.in                 |    8 ++++
 tests/depcomp4.test           |    1 +
 tests/depcomp6.test           |    1 +
 tests/depcomp7.test           |    1 +
 tests/fort5.test              |    1 +
 tests/instdir-ltlib.test      |    1 +
 tests/instdir-prog.test       |    1 +
 tests/instfail-libtool.test   |    1 +
 tests/instfail.test           |    1 +
 tests/instspc.test            |    1 +
 tests/ldflags.test            |    2 +
 tests/libobj10.test           |    3 +
 tests/libobj11.test           |    2 +
 tests/libobj12.test           |    2 +
 tests/libobj13.test           |    1 +
 tests/libobj2.test            |    2 +
 tests/libobj7.test            |    2 +
 tests/libobj8.test            |    2 +
 tests/library.test            |    3 +
 tests/libtoo10.test           |    1 +
 tests/libtool2.test           |    1 +
 tests/libtool3.test           |    1 +
 tests/libtool5.test           |    1 +
 tests/libtool6.test           |    1 +
 tests/libtool7.test           |    1 +
 tests/libtool8.test           |    1 +
 tests/libtool9.test           |    1 +
 tests/listval.test            |    2 +
 tests/location.test           |    3 +
 tests/ltcond.test             |    1 +
 tests/ltcond2.test            |    1 +
 tests/ltconv.test             |    1 +
 tests/ltdeps.test             |    2 +
 tests/ltinstloc.test          |    3 +-
 tests/ltlibobjs.test          |    2 +
 tests/ltlibsrc.test           |    1 +
 tests/ltorder.test            |    1 +
 tests/multlib.test            |    2 +
 tests/nobase-libtool.test     |    1 +
 tests/nobase.test             |    1 +
 tests/noinstdir.test          |    3 +
 tests/pr300-lib.test          |    2 +-
 tests/pr300-ltlib.test        |    2 +-
 tests/pr307.test              |    2 +-
 tests/pr401.test              |   10 ++--
 tests/pr401b.test             |   10 ++--
 tests/pr401c.test             |   10 ++--
 tests/pr72.test               |    2 +-
 tests/silent3.test            |    1 +
 tests/silent4.test            |    1 +
 tests/silent9.test            |    1 +
 tests/specflg2.test           |    3 +
 tests/stdlib2.test            |    1 +
 tests/subdir4.test            |    3 +
 tests/subdirbuiltsources.test |    1 +
 tests/subobj10.test           |    1 +
 tests/subobj9.test            |    1 +
 tests/subpkg.test             |    1 +
 tests/subst3.test             |    1 +
 tests/substtarg.test          |    3 +
 tests/suffix10.test           |    1 +
 tests/suffix2.test            |    1 +
 tests/suffix5.test            |    2 +
 tests/suffix8.test            |    1 +
 tests/vala.test               |    1 +
 tests/vala1.test              |    1 +
 92 files changed, 734 insertions(+), 28 deletions(-)
 create mode 100644 m4/ar-lib.m4
 create mode 100755 tests/ar-lib2.test
 create mode 100755 tests/ar-lib3.test
 create mode 100755 tests/ar-lib4.test
 create mode 100755 tests/ar-lib5a.test
 create mode 100755 tests/ar-lib5b.test
 create mode 100755 tests/ar-lib6.test
 create mode 100755 tests/ar-lib7.test
 create mode 100755 tests/ar3.test

diff --git a/ChangeLog b/ChangeLog
index 02f2fcd..aff223a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,70 @@
+2010-09-16  Peter Rosin  <address@hidden>
+           Ralf Wildenhues  <address@hidden>
+           Stefano Lattarini  <address@hidden>
+
+       Add new 'AM_PROG_AR' macro, triggering the 'ar-lib' script.
+       * m4/ar-lib.m4: New macro AM_PROG_AR, which locates an
+       archiver and triggers the auxiliary 'ar-lib' script if needed.
+       * m4/Makefile.am (dist_m4data_DATA): Update.
+       * automake.in ($seen_ar): New variable.
+       (scan_autoconf_traces): Set it.
+       (handle_libraries): Don't set any default value for AR if
+       AM_PROG_AR has been seen.
+       (handle_libraries, handle_ltlibraries): Require AM_PROG_AR for
+       portability.
+       * doc/automake.texi (Public Macros): Mention the new
+       'AM_PROG_AR' macro.
+       (Subpackages): Add AM_PROG_AR to the example.
+       (A Library): Adjust recommendations for AR given the new
+       AM_PROG_AR macro.
+       * tests/aclibobj.test, tests/aclocal4.test, tests/ansi10.test,
+       tests/ar.test, tests/ar2.test, tests/canon4.test,
+       tests/compile4.test, tests/cond13.test, tests/condlib.test,
+       tests/depcomp4.test, tests/depcomp6.test, tests/depcomp7.test,
+       tests/fort5.test, tests/instdir-ltlib.test,
+       tests/instdir-prog.test, tests/instfail-libtool.test,
+       tests/instfail.test, tests/instspc.test, tests/ldflags.test,
+       tests/libobj10.test, tests/libobj11.test, tests/libobj12.test,
+       tests/libobj13.test, tests/libobj2.test, tests/libobj7.test,
+       tests/libobj8.test, tests/library.test, tests/libtoo10.test,
+       tests/libtool2.test, tests/libtool3.test, tests/libtool5.test,
+       tests/libtool6.test, tests/libtool7.test, tests/libtool8.test,
+       tests/libtool9.test, tests/listval.test, tests/location.test,
+       tests/ltcond.test, tests/ltcond2.test, tests/ltconv.test,
+       tests/ltdeps.test, tests/ltinstloc.test, tests/ltlibobjs.test,
+       tests/ltlibsrc.test, tests/ltorder.test, tests/multlib.test,
+       tests/nobase.test, tests/nobase-libtool.test,
+       tests/noinstdir.test, test/pr72.test, tests/pr300-lib.test,
+       tests/pr300-ltlib.test, tests/pr307.test, tests/pr401.test,
+       tests/pr401b.test, tests/pr401c.test, tests/silent3.test,
+       tests/silent4.test, tests/silent9.test, tests/specflg2.test,
+       tests/stdlib2.test, tests/subdir4.test,
+       tests/subdirbuiltsources.test, tests/subobj9.test,
+       tests/subobj10.test, tests/subpkg.test, tests/subst3.test,
+       tests/substtarg.test, tests/suffix2.test, tests/suffix5.test,
+       tests/suffix8.test, tests/suffix10.test, tests/vala.test,
+       tests/vala1.test: Adjust to new portability requirements due to
+       the new AM_PROG_AR macro.
+       * tests/ar-lib2.test: New test, checking that AM_PROG_AR triggers
+       install of ar-lib.
+       * tests/ar-lib3.test: New test, checking that lib_LIBRARIES
+       requires AM_PROG_AR.
+       * tests/ar-lib4.test: New test, checking that lib_LTLIBRARIES
+       requires AM_PROG_AR.
+       * tests/ar-lib5a.test: New test, checking that AM_PROG_AR triggers
+       use of ar-lib when the archiver is Microsoft lib.
+       * tests/ar-lib5b.test: New test, checking that AM_PROG_AR triggers
+       use of ar-lib when the archiver is a faked lib.
+       * tests/ar-lib6.test: New test, checking the ordering of
+       AM_PROG_AR and LT_INIT.
+       * tests/ar-lib7.test: New test, checking that automake warns
+       if ar-lib is missing.
+       * tests/ar3.test: New test, checking that AR and ARFLAGS may
+       be overridden by the user even if AM_PROG_AR is used.
+       * tests/defs.in: New required entry 'lib'.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
 2010-09-02  Peter Rosin  <address@hidden>
 
        Make ar-lib support backslashed files in archives.
diff --git a/NEWS b/NEWS
index 6971bd7..528c846 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,11 @@ New in 1.11.0a:
   - The `compile' script now converts some options for MSVC for a better
     user experience.  Similarly, the new `ar-lib' script wraps Microsoft lib.
 
+  - New macro AM_PROG_AR that looks for an archiver and wraps it in the new
+    'ar-lib' auxiliary script if the found archiver is Microsoft lib.  This
+    new macro is required for LIBRARIES and LTLIBRARIES when automake is
+    run with -Wportability (or -Wall) and -Werror.
+
 Bugs fixed in 1.11.0a:
 
 * Bugs introduced by 1.11:
diff --git a/automake.in b/automake.in
index 8fd6869..b16ed40 100755
--- a/automake.in
+++ b/automake.in
@@ -396,6 +396,9 @@ my $package_version_location;
 # TRUE if we've seen AM_ENABLE_MULTILIB.
 my $seen_multilib = 0;
 
+# TRUE if we've seen AM_PROG_AR
+my $seen_ar = 0;
+
 # TRUE if we've seen AM_PROG_CC_C_O
 my $seen_cc_c_o = 0;
 
@@ -2718,7 +2721,10 @@ sub handle_libraries
       $var->requires_variables ('library used', 'RANLIB');
     }
 
-  &define_variable ('AR', 'ar', INTERNAL);
+  if (! $seen_ar)
+    {
+      &define_variable ('AR', 'ar', INTERNAL);
+    }
   &define_variable ('ARFLAGS', 'cru', INTERNAL);
   &define_verbose_tagvar ('AR');
 
@@ -2800,6 +2806,13 @@ sub handle_libraries
              &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
            }
        }
+
+      if (! $seen_ar)
+       {
+         msg ('portability', $where,
+              "`$onelib': linking libraries requires "
+              . "`AM_PROG_AR' in `$configure_ac'")
+       }
     }
 }
 
@@ -3037,6 +3050,13 @@ sub handle_ltlibraries
              &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
            }
        }
+
+      if (! $seen_ar)
+       {
+         msg ('portability', $where,
+              "`$onelib': linking libtool libraries requires "
+              . "`AM_PROG_AR' in `$configure_ac'")
+       }
     }
 }
 
@@ -5242,6 +5262,7 @@ sub scan_autoconf_traces ($)
                AM_GNU_GETTEXT_INTL_SUBDIR => 0,
                AM_INIT_AUTOMAKE => 0,
                AM_MAINTAINER_MODE => 0,
+               AM_PROG_AR => 0,
                AM_PROG_CC_C_O => 0,
                AM_SILENT_RULES => 0,
                _AM_SUBST_NOTMAKE => 1,
@@ -5433,6 +5454,10 @@ sub scan_autoconf_traces ($)
        {
          $seen_maint_mode = $where;
        }
+      elsif ($macro eq 'AM_PROG_AR')
+       {
+         $seen_ar = $where;
+       }
       elsif ($macro eq 'AM_PROG_CC_C_O')
        {
          $seen_cc_c_o = $where;
diff --git a/doc/automake.texi b/doc/automake.texi
index 66c5a7e..84727e1 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -3861,6 +3861,15 @@ environment, or use the @option{--with-lispdir} option to
 @command{configure} to explicitly set the correct path (if you're sure
 you have an @command{emacs} that supports Emacs Lisp).
 
address@hidden AM_PROG_AR([ACT_IF_FAIL])
address@hidden AM_PROG_AR
address@hidden AR
+You must use this macro when you use the archiver in your project, if
+you want support for weird archivers such as Microsoft lib.  The
+content of the optional argument is executed if the archiver
+interface is not recognized; the default action is to abort configure
+with an error message.
+
 @item AM_PROG_AS
 @acindex AM_PROG_AS
 @vindex CCAS
@@ -4485,6 +4494,7 @@ AC_INIT([hand], [1.2])
 AC_CONFIG_AUX_DIR([.])
 AM_INIT_AUTOMAKE
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
@@ -4923,11 +4933,12 @@ by invoking @samp{$(AR) $(ARFLAGS)} followed by the 
name of the
 library and the list of objects, and finally by calling
 @samp{$(RANLIB)} on that library.  You should call
 @code{AC_PROG_RANLIB} from your @file{configure.ac} to define
address@hidden (Automake will complain otherwise).  @code{AR} and
address@hidden default to @code{ar} and @code{cru} respectively; you
-can override these two variables my setting them in your
address@hidden, by @code{AC_SUBST}ing them from your
address@hidden, or by defining a per-library @code{maude_AR}
address@hidden (Automake will complain otherwise).  You should also
+call @code{AM_PROG_AR} to define @code{AR}, in order to support weird
+archivers.  @code{ARFLAGS} will default to @code{cru}; you can override
+this variable by setting it in your @file{Makefile.am} or by
address@hidden it from your @file{configure.ac}.  You can override
+the @code{AR} variable by defining a per-library @code{maude_AR}
 variable (@pxref{Program and Library Variables}).
 
 @cindex Empty libraries
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 0cf074b..c801894 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -22,6 +22,7 @@ m4datadir = $(datadir)/aclocal-$(APIVERSION)
 
 dist_m4data_DATA = \
 $(top_srcdir)/m4/amversion.m4 \
+ar-lib.m4 \
 as.m4 \
 auxdir.m4 \
 ccstdc.m4 \
diff --git a/m4/Makefile.in b/m4/Makefile.in
index 270ee91..4cd3e28 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -185,6 +185,7 @@ top_srcdir = @top_srcdir@
 m4datadir = $(datadir)/aclocal-$(APIVERSION)
 dist_m4data_DATA = \
 $(top_srcdir)/m4/amversion.m4 \
+ar-lib.m4 \
 as.m4 \
 auxdir.m4 \
 ccstdc.m4 \
diff --git a/m4/ar-lib.m4 b/m4/ar-lib.m4
new file mode 100644
index 0000000..f468c76
--- /dev/null
+++ b/m4/ar-lib.m4
@@ -0,0 +1,58 @@
+##                                                          -*- Autoconf -*-
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_AR([ACT-IF-FAIL])
+# -------------------------
+# Try to determine the archiver interface, and trigger the ar-lib wrapper
+# if it is needed.  If the detection of archiver interface fails, run
+# ACT-IF-FAIL (default is to abort configure with a proper error message).
+AC_DEFUN([AM_PROG_AR],
+[AC_BEFORE([$0], [LT_INIT])dnl
+AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([ar-lib])dnl
+AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false])
+: ${AR=ar}
+
+AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
+  [am_cv_ar_interface=ar
+   AC_COMPILE_IFELSE([[int some_variable = 0;]],
+     [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([am_ar_try])
+      if test "$ac_status" -eq 0; then
+        am_cv_ar_interface=ar
+      else
+        am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext 
>&AS_MESSAGE_LOG_FD'
+        AC_TRY_EVAL([am_ar_try])
+        if test "$ac_status" -eq 0; then
+          am_cv_ar_interface=lib
+        else
+          m4_default([$1],
+            [AC_MSG_ERROR([could not determine $AR interface])])
+        fi
+      fi
+      rm -f conftest.lib libconftest.a
+     ])
+   ])
+
+case $am_cv_ar_interface in
+ar)
+  ;;
+lib)
+  # Microsoft lib, so override with the ar-lib wrapper script.
+  # FIXME: It is wrong to rewrite AR.
+  # But if we don't then we get into trouble of one sort or another.
+  # A longer-term fix would be to have automake use am__AR in this case,
+  # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something
+  # similar.
+  AR="$am_aux_dir/ar-lib $AR"
+  ;;
+esac
+AC_SUBST([AR])dnl
+])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 01acd76..abb5db7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -89,8 +89,16 @@ ansi8.test \
 ansi9.test \
 ansi10.test \
 ar-lib.test \
+ar-lib2.test \
+ar-lib3.test \
+ar-lib4.test \
+ar-lib5a.test \
+ar-lib5b.test \
+ar-lib6.test \
+ar-lib7.test \
 ar.test \
 ar2.test \
+ar3.test \
 asm.test \
 asm2.test \
 asm3.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index ff547a0..d3fc1a8 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -327,8 +327,16 @@ ansi8.test \
 ansi9.test \
 ansi10.test \
 ar-lib.test \
+ar-lib2.test \
+ar-lib3.test \
+ar-lib4.test \
+ar-lib5a.test \
+ar-lib5b.test \
+ar-lib6.test \
+ar-lib7.test \
 ar.test \
 ar2.test \
+ar3.test \
 asm.test \
 asm2.test \
 asm3.test \
diff --git a/tests/aclibobj.test b/tests/aclibobj.test
index 6ef6f6b..a40baa4 100755
--- a/tests/aclibobj.test
+++ b/tests/aclibobj.test
@@ -20,6 +20,7 @@
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 END
@@ -32,6 +33,7 @@ END
 
 : > maude.c
 : > liver.c
+: > ar-lib
 
 $ACLOCAL
 
diff --git a/tests/aclocal4.test b/tests/aclocal4.test
index 9fa96ec..eab8ca8 100755
--- a/tests/aclocal4.test
+++ b/tests/aclocal4.test
@@ -25,6 +25,7 @@ set -e
 
 cat >>configure.in <<EOF
 AC_PROG_RANLIB
+AM_PROG_AR
 AC_PROG_CC
 MY_MACRO
 AC_CONFIG_FILES([lib/Makefile])
@@ -60,7 +61,7 @@ EOF
 
 $ACLOCAL -I m4
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE --add-missing
 ./configure
 $MAKE check-not-foo
 
diff --git a/tests/ansi10.test b/tests/ansi10.test
index 88b8618..04b23d1 100755
--- a/tests/ansi10.test
+++ b/tests/ansi10.test
@@ -25,6 +25,7 @@ cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CC_STDC
 AM_C_PROTOTYPES
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([hello])
 AC_CONFIG_FILES([dir/Makefile])
diff --git a/tests/ar-lib2.test b/tests/ar-lib2.test
new file mode 100755
index 0000000..7697876
--- /dev/null
+++ b/tests/ar-lib2.test
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if AM_PROG_AR installs ar-lib.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = wish
+wish_SOURCES = a.c
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+# Make sure ar-lib is installed, and that Automake says so.
+grep 'install.*ar-lib' stderr
+test -f ar-lib
+
+:
diff --git a/tests/ar-lib3.test b/tests/ar-lib3.test
new file mode 100755
index 0000000..f3e8aa1
--- /dev/null
+++ b/tests/ar-lib3.test
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if lib_LIBRARIES requests AM_PROG_AR.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+END
+
+cat > Makefile.am << 'END'
+lib_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
+END
+
+$ACLOCAL
+AUTOMAKE_fails
+
+grep 'requires.*AM_PROG_AR' stderr
+
+cat >> configure.in << 'END'
+AM_PROG_AR
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+
+:
diff --git a/tests/ar-lib4.test b/tests/ar-lib4.test
new file mode 100755
index 0000000..4813191
--- /dev/null
+++ b/tests/ar-lib4.test
@@ -0,0 +1,57 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if lib_LTLIBRARIES requests AM_PROG_AR.
+
+required=libtoolize
+. ./defs || Exit 1
+
+set -e
+
+cp configure.in X
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+lib_LTLIBRARIES = libfoo.la
+libfoo_la_SOURCES = foo.c
+END
+
+libtoolize
+$ACLOCAL
+AUTOMAKE_fails
+
+grep 'requires.*AM_PROG_AR' stderr
+
+cp X configure.in
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+
+:
diff --git a/tests/ar-lib5a.test b/tests/ar-lib5a.test
new file mode 100755
index 0000000..3df29ef
--- /dev/null
+++ b/tests/ar-lib5a.test
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if AM_PROG_AR triggers the use of the ar-lib script.
+# This test requires Micrsoft lib.
+# Keep this test in sync with sister test `ar-lib5b.test'.
+
+required=lib
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([auxdir])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+# We want to test the content of am_cv_ar_interface in the Makefile.
+AC_SUBST([am_cv_ar_interface])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+lib_LIBRARIES = libwish.a
+libwish_a_SOURCES = wish.c
+
+check-local:
+       test x'$(am_cv_ar_interface)' = x'lib'
+       test -f ar-lib-worked
+MOSTLYCLEANFILES = ar-lib-worked
+END
+
+cat > wish.c << 'END'
+int wish(void) { return 0; }
+END
+
+mkdir auxdir
+cat > auxdir/ar-lib << 'END'
+# /bin/sh
+:> ar-lib-worked
+END
+chmod +x auxdir/ar-lib
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+# Sanity check: test that is ok to use `am_cv_ar_interface' as we do.
+$FGREP 'am_cv_ar_interface=' configure
+
+./configure AR=lib RANLIB=:
+
+$MAKE check
+$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='AR=lib RANLIB=:'
+
+:
diff --git a/tests/ar-lib5b.test b/tests/ar-lib5b.test
new file mode 100755
index 0000000..351d86c
--- /dev/null
+++ b/tests/ar-lib5b.test
@@ -0,0 +1,83 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if AM_PROG_AR triggers the use of the ar-lib script.
+# This test does not require Micrsoft lib.
+# Keep this test in sync with sister test `ar-lib5b.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([auxdir])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+# We want to test the content of am_cv_ar_interface in the Makefile.
+AC_SUBST([am_cv_ar_interface])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+lib_LIBRARIES = libwish.a
+libwish_a_SOURCES = wish.c
+
+check-local:
+       test x'$(am_cv_ar_interface)' = x'lib'
+       test -f ar-lib-worked
+MOSTLYCLEANFILES = ar-lib-worked
+END
+
+cat > wish.c << 'END'
+int wish(void) { return 0; }
+END
+
+mkdir auxdir
+cat > auxdir/ar-lib << 'END'
+# /bin/sh
+:> ar-lib-worked
+END
+chmod +x auxdir/ar-lib
+
+# Let's fake microsoft lib.
+mkdir bin
+cat > bin/lib << 'END'
+# /bin/sh
+case " $* " in
+  *' -OUT:'*) exit 0;;
+  *' cru '*) exit 1;;
+  *) : > ar-lib-worked;;
+esac
+END
+chmod +x bin/lib
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+# Sanity check: test that it is ok to use `am_cv_ar_interface' as we do.
+$FGREP 'am_cv_ar_interface=' configure
+
+./configure AR=bin/lib RANLIB=:
+
+$MAKE check
+$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="AR=`pwd`/bin/lib RANLIB=:"
+
+:
diff --git a/tests/ar-lib6.test b/tests/ar-lib6.test
new file mode 100755
index 0000000..704af83
--- /dev/null
+++ b/tests/ar-lib6.test
@@ -0,0 +1,38 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test AM_PROG_AR ordering requirements
+
+required=libtoolize
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+m4_ifdef([LT_INIT], [LT_INIT], [AC_PROG_LIBTOOL])
+AM_PROG_AR
+END
+
+libtoolize
+$ACLOCAL
+$AUTOCONF 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+
+$EGREP '(AC_PROG_LIBTOOL|LT_INIT).*before.*AM_PROG_AR' stderr
+
+:
diff --git a/tests/ar-lib7.test b/tests/ar-lib7.test
new file mode 100755
index 0000000..dceb064
--- /dev/null
+++ b/tests/ar-lib7.test
@@ -0,0 +1,36 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if automake warns if ar-lib is missing when AM_PROG_AR is used.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AM_PROG_AR
+END
+
+:> Makefile.am
+
+$ACLOCAL
+AUTOMAKE_fails
+
+grep 'ar-lib.*not found' stderr
+
+$AUTOMAKE --add-missing
+
+:
diff --git a/tests/ar.test b/tests/ar.test
index d68fc54..b7ba080 100755
--- a/tests/ar.test
+++ b/tests/ar.test
@@ -21,6 +21,7 @@
 set -e
 
 cat >> configure.in << 'END'
+AM_PROG_AR
 AC_SUBST([AR], ['echo it works'])
 AC_SUBST([ARFLAGS], ['>'])
 AC_SUBST([RANLIB], ['echo really works >>'])
@@ -32,6 +33,8 @@ lib_LIBRARIES = libfoo.a
 libfoo_a_SOURCES =
 END
 
+:> ar-lib
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
diff --git a/tests/ar2.test b/tests/ar2.test
index f0485ce..be741cd 100755
--- a/tests/ar2.test
+++ b/tests/ar2.test
@@ -33,6 +33,6 @@ libfoo_a_SOURCES = foo.c
 END
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -Wno-portability
 grep 'ARFLAGS =' Makefile.in
 grep 'AR =' Makefile.in
diff --git a/tests/ar3.test b/tests/ar3.test
new file mode 100755
index 0000000..1e38d01
--- /dev/null
+++ b/tests/ar3.test
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure that AR, ARFLAGS, etc. works also when the macro AM_PROG_AR
+# is used.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+EXTRA_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
+END
+
+: > ar-lib
+
+$ACLOCAL
+$AUTOMAKE
+$EGREP '^ARFLAGS =' Makefile.in
+$EGREP '^AR =' Makefile.in
+
+:
diff --git a/tests/canon4.test b/tests/canon4.test
index 52e968d..d98636f 100755
--- a/tests/canon4.test
+++ b/tests/canon4.test
@@ -22,6 +22,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
@@ -30,6 +31,8 @@ noinst_LIBRARIES = libx-y.a
 libx_y_a_SOURCES = xy.c
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE
 
diff --git a/tests/compile4.test b/tests/compile4.test
index 5a0bdf3..0b3e981 100755
--- a/tests/compile4.test
+++ b/tests/compile4.test
@@ -48,6 +48,7 @@ absmainobj=`pwd`/main.obj
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
diff --git a/tests/cond13.test b/tests/cond13.test
index d8c4361..0ae4e09 100755
--- a/tests/cond13.test
+++ b/tests/cond13.test
@@ -24,6 +24,7 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
+AM_PROG_AR
 AC_PROG_RANLIB
 AM_CONDITIONAL(COND1, true)
 AM_CONDITIONAL(COND2, true)
@@ -49,6 +50,8 @@ endif
 libtest_a_SOURCES = $(TESTSOURCES)
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE
 
diff --git a/tests/condlib.test b/tests/condlib.test
index b6c998d..88ef308 100755
--- a/tests/condlib.test
+++ b/tests/condlib.test
@@ -24,6 +24,7 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_RANLIB
 AM_MAINTAINER_MODE
+AM_PROG_AR
 AC_PROG_CC
 END
 
@@ -36,6 +37,8 @@ nodist_librsaref_a_SOURCES = desc.c digit.c
 BUILT_SOURCES = $(nodist_librsaref_a_SOURCES)
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE
 
diff --git a/tests/defs.in b/tests/defs.in
index af4a3cd..074ead6 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -156,6 +156,14 @@ do
       echo "$me: running $CC -V -help"
       ( $CC -V -help ) || exit 77
       ;;
+    lib)
+      AR=lib
+      export AR
+      # Attempting to create an empty archive will actually not
+      # create the archive, but lib will output its version.
+      echo "$me: running $AR -out:defstest.lib"
+      ( $AR -out:defstest.lib ) || exit 77
+      ;;
     makedepend)
       echo "$me: running makedepend -f-"
       ( makedepend -f- ) || exit 77
diff --git a/tests/depcomp4.test b/tests/depcomp4.test
index 7d22894..a7867bf 100755
--- a/tests/depcomp4.test
+++ b/tests/depcomp4.test
@@ -23,6 +23,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/depcomp6.test b/tests/depcomp6.test
index 0b6a7f5..97e926f 100755
--- a/tests/depcomp6.test
+++ b/tests/depcomp6.test
@@ -23,6 +23,7 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_CONFIG_FILES(sub2/Makefile)
 AC_OUTPUT
diff --git a/tests/depcomp7.test b/tests/depcomp7.test
index 67702c7..136a3de 100755
--- a/tests/depcomp7.test
+++ b/tests/depcomp7.test
@@ -24,6 +24,7 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AM_PROG_LIBTOOL
 AC_CONFIG_FILES(sub2/Makefile)
 AC_OUTPUT
diff --git a/tests/fort5.test b/tests/fort5.test
index cd2a7d5..59a3c3e 100755
--- a/tests/fort5.test
+++ b/tests/fort5.test
@@ -56,6 +56,7 @@ AC_PROG_FC
 AC_FC_SRCEXT([f90], [],
   [AC_MSG_FAILURE([$FC compiler cannot create executables], 77)])
 AC_FC_LIBRARY_LDFLAGS
+AM_PROG_AR
 LT_PREREQ([2.0])
 AC_PROG_LIBTOOL
 AC_OUTPUT
diff --git a/tests/instdir-ltlib.test b/tests/instdir-ltlib.test
index 1fb4f37..f400377 100755
--- a/tests/instdir-ltlib.test
+++ b/tests/instdir-ltlib.test
@@ -25,6 +25,7 @@ set -e
 cat >>configure.in <<'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/instdir-prog.test b/tests/instdir-prog.test
index 6a73b75..66a4892 100755
--- a/tests/instdir-prog.test
+++ b/tests/instdir-prog.test
@@ -24,6 +24,7 @@ set -e
 cat >>configure.in <<'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 END
diff --git a/tests/instfail-libtool.test b/tests/instfail-libtool.test
index 1e756a6..2e5e312 100755
--- a/tests/instfail-libtool.test
+++ b/tests/instfail-libtool.test
@@ -25,6 +25,7 @@ required='libtool libtoolize'
 set -e
 
 cat >>configure.in <<END
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/instfail.test b/tests/instfail.test
index 38a1c9c..3fb60b5 100755
--- a/tests/instfail.test
+++ b/tests/instfail.test
@@ -25,6 +25,7 @@ set -e
 
 cat >>configure.in <<END
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AM_PATH_LISPDIR
 AC_OUTPUT
diff --git a/tests/instspc.test b/tests/instspc.test
index 414b3e5..7eded4b 100755
--- a/tests/instspc.test
+++ b/tests/instspc.test
@@ -33,6 +33,7 @@ set -e
 
 cat >> configure.in <<'EOF'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 EOF
diff --git a/tests/ldflags.test b/tests/ldflags.test
index 39ca274..c00f227 100755
--- a/tests/ldflags.test
+++ b/tests/ldflags.test
@@ -21,6 +21,7 @@ required=libtool
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_SUBST([LTLIBOBJS], [q.o])
 AM_CONDITIONAL(USE_SWIG, :)
@@ -37,6 +38,7 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 : > q.c
diff --git a/tests/libobj10.test b/tests/libobj10.test
index 0d24741..97dffec 100755
--- a/tests/libobj10.test
+++ b/tests/libobj10.test
@@ -23,6 +23,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([foo])
 AC_OUTPUT
@@ -33,6 +34,8 @@ noinst_LIBRARIES = libfoo.a
 libfoo_a_LIBADD = @LIBOBJS@
 END
 
+: > ar-lib
+
 $ACLOCAL
 AUTOMAKE_fails
 grep 'Makefile.am:2:.*foo\.c' stderr
diff --git a/tests/libobj11.test b/tests/libobj11.test
index 204ff8b..fc7f173 100755
--- a/tests/libobj11.test
+++ b/tests/libobj11.test
@@ -22,6 +22,7 @@ cat > configure.in << 'END'
 AC_INIT
 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([mountlist])
 AC_OUTPUT(Makefile)
@@ -33,6 +34,7 @@ libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
 END
 
+: > ar-lib
 : > mountlist.c
 
 $ACLOCAL || Exit 1
diff --git a/tests/libobj12.test b/tests/libobj12.test
index 5f1d029..e4522bc 100755
--- a/tests/libobj12.test
+++ b/tests/libobj12.test
@@ -23,6 +23,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([foo])
 AC_LIBOBJ([bar])
@@ -44,6 +45,7 @@ p1_LDADD = @LIBOBJS@
 p2_SOURCES = bar.c
 END
 
+: > ar-lib
 : > foo.c
 : > bar.c
 
diff --git a/tests/libobj13.test b/tests/libobj13.test
index 6ca68c9..fc3112b 100755
--- a/tests/libobj13.test
+++ b/tests/libobj13.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_LIBOBJ([foo])
 AC_OUTPUT
diff --git a/tests/libobj2.test b/tests/libobj2.test
index 81b0e72..36c01b3 100755
--- a/tests/libobj2.test
+++ b/tests/libobj2.test
@@ -24,6 +24,7 @@ cat > configure.in << 'END'
 AC_INIT
 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([fsusage])
 AC_OUTPUT(subdir/Makefile)
@@ -37,6 +38,7 @@ libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
 END
 
+: > ar-lib
 : > subdir/fsusage.c
 
 $ACLOCAL || Exit 1
diff --git a/tests/libobj7.test b/tests/libobj7.test
index 73a8ab0..1ff36c4 100755
--- a/tests/libobj7.test
+++ b/tests/libobj7.test
@@ -22,6 +22,7 @@ cat > configure.in << 'END'
 AC_INIT
 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_REPLACE_FUNCS(basename dirname strsignal)
 AC_OUTPUT(Makefile)
@@ -33,6 +34,7 @@ libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
 END
 
+: > ar-lib
 : > basename.c
 : > dirname.c
 : > strsignal.c
diff --git a/tests/libobj8.test b/tests/libobj8.test
index c06746b..1485ea4 100755
--- a/tests/libobj8.test
+++ b/tests/libobj8.test
@@ -24,6 +24,7 @@ AC_INIT
 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
 AC_PROG_CC
 AC_PROG_CC_STDC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_REPLACE_FUNCS(basename dirname strsignal)
 AM_C_PROTOTYPES
@@ -43,6 +44,7 @@ END
 
 : > ansi2knr.1
 : > ansi2knr.c
+: > ar-lib
 
 $ACLOCAL || Exit 1
 $AUTOMAKE || Exit 1
diff --git a/tests/library.test b/tests/library.test
index 1e2b58b..8adc575 100755
--- a/tests/library.test
+++ b/tests/library.test
@@ -22,6 +22,7 @@ cat >> configure.in << 'END'
 AC_PROG_RANLIB
 AM_MAINTAINER_MODE
 AC_PROG_CC
+AM_PROG_AR
 END
 
 cat > Makefile.am << 'END'
@@ -30,5 +31,7 @@ lib_LIBRARIES = libfoo.a
 libfoo_a_DEPENDENCIES = libzot.a
 END
 
+: > ar-lib
+
 $ACLOCAL || Exit 1
 $AUTOMAKE
diff --git a/tests/libtoo10.test b/tests/libtoo10.test
index 51a68d4..44c0726 100755
--- a/tests/libtoo10.test
+++ b/tests/libtoo10.test
@@ -22,6 +22,7 @@ required=libtoolize
 set -e
 
 cat >> configure.in << 'END'
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/libtool2.test b/tests/libtool2.test
index a50f6a4..0120fa9 100755
--- a/tests/libtool2.test
+++ b/tests/libtool2.test
@@ -24,6 +24,7 @@ AC_INIT
 AM_INIT_AUTOMAKE(mypackage,0.1)
 
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 
 AC_CONFIG_FILES([
diff --git a/tests/libtool3.test b/tests/libtool3.test
index 3427f28..1643f31 100755
--- a/tests/libtool3.test
+++ b/tests/libtool3.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AM_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/libtool5.test b/tests/libtool5.test
index c7f0476..8208388 100755
--- a/tests/libtool5.test
+++ b/tests/libtool5.test
@@ -27,6 +27,7 @@ cat >>configure.in <<'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [false])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/libtool6.test b/tests/libtool6.test
index ad01b14..ea5fd9c 100755
--- a/tests/libtool6.test
+++ b/tests/libtool6.test
@@ -26,6 +26,7 @@ cat >>configure.in <<'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [false])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/libtool7.test b/tests/libtool7.test
index a2f912f..8ebce0a 100755
--- a/tests/libtool7.test
+++ b/tests/libtool7.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_LIBTOOL_DLOPEN
 AM_PROG_LIBTOOL
 AC_OUTPUT
diff --git a/tests/libtool8.test b/tests/libtool8.test
index a1bb88a..ed1b6cf 100755
--- a/tests/libtool8.test
+++ b/tests/libtool8.test
@@ -25,6 +25,7 @@ cat >>configure.in <<'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [false])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/libtool9.test b/tests/libtool9.test
index c0d9688..a27a1da 100755
--- a/tests/libtool9.test
+++ b/tests/libtool9.test
@@ -26,6 +26,7 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_LIBTOOL_DLOPEN
 AM_PROG_LIBTOOL
 AC_OUTPUT
diff --git a/tests/listval.test b/tests/listval.test
index 5ff75db..d7cc884 100755
--- a/tests/listval.test
+++ b/tests/listval.test
@@ -21,6 +21,7 @@ required=libtool
 
 cat >> configure.in << 'END'
 AC_SUBST(LTLIBOBJS)
+AM_PROG_AR
 AC_PROG_LIBTOOL
 END
 
@@ -34,6 +35,7 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 
diff --git a/tests/location.test b/tests/location.test
index 13a2183..6098796 100755
--- a/tests/location.test
+++ b/tests/location.test
@@ -24,6 +24,7 @@ cat >> configure.in << 'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [true])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
@@ -44,6 +45,8 @@ VAR = 1 \
       3
 END
 
+: > ar-lib
+
 $ACLOCAL
 AUTOMAKE_fails
 
diff --git a/tests/ltcond.test b/tests/ltcond.test
index 0350a3d..401572b 100755
--- a/tests/ltcond.test
+++ b/tests/ltcond.test
@@ -27,6 +27,7 @@ AM_CONDITIONAL([WANT_LIBFOO], [true])
 AM_CONDITIONAL([WANT_LIBBAR], [false])
 AC_SUBST([WANTEDLIBS], ['lib1foo.la lib1bar.la'])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/ltcond2.test b/tests/ltcond2.test
index 1687513..898c971 100755
--- a/tests/ltcond2.test
+++ b/tests/ltcond2.test
@@ -23,6 +23,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_SUBST([HELLO_SYSTEM], [hello-generic.lo])
 AM_CONDITIONAL([LINUX], true)
diff --git a/tests/ltconv.test b/tests/ltconv.test
index 0ec2132..a130b94 100755
--- a/tests/ltconv.test
+++ b/tests/ltconv.test
@@ -24,6 +24,7 @@ set -e
 
 cat >>configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_CONFIG_FILES(sub1/Makefile
                sub2/Makefile
diff --git a/tests/ltdeps.test b/tests/ltdeps.test
index 43d0ae3..7ece4d4 100755
--- a/tests/ltdeps.test
+++ b/tests/ltdeps.test
@@ -22,6 +22,7 @@ required=libtool
 set -e
 
 cat >> configure.in << 'END'
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_PROG_CXX
 AM_CONDITIONAL(HACKING_COMPACT_BUILD, whatever)
@@ -51,6 +52,7 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 
diff --git a/tests/ltinstloc.test b/tests/ltinstloc.test
index bb3203a..a4d715e 100755
--- a/tests/ltinstloc.test
+++ b/tests/ltinstloc.test
@@ -24,6 +24,7 @@ set -e
 
 cat >>configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AM_CONDITIONAL([COND], [:])
 AC_OUTPUT
@@ -46,7 +47,7 @@ AUTOMAKE_fails --add-missing
 # libtoolize might have installed config.guess and config.sub already,
 # and autom4te might warn about bugs in Libtool macro files, so filter
 # out warnings about Makefile.am only.  We don't care in this test
-# whether automake installs config.guess and config.sub.
+# whether automake installs config.guess, config.sub and ar-lib.
 
 cat >expected <<'END'
 Makefile.am:5: sub/liba2.la multiply defined in condition COND
diff --git a/tests/ltlibobjs.test b/tests/ltlibobjs.test
index fd66473..2df0017 100755
--- a/tests/ltlibobjs.test
+++ b/tests/ltlibobjs.test
@@ -21,6 +21,7 @@ required=libtool
 
 cat >> configure.in << 'END'
 AC_SUBST(LTLIBOBJS)
+AM_PROG_AR
 AC_PROG_LIBTOOL
 END
 
@@ -32,6 +33,7 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 
diff --git a/tests/ltlibsrc.test b/tests/ltlibsrc.test
index 2c9911d..e8fa6f0 100755
--- a/tests/ltlibsrc.test
+++ b/tests/ltlibsrc.test
@@ -23,6 +23,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/ltorder.test b/tests/ltorder.test
index 0f69211..ef4a5f7 100755
--- a/tests/ltorder.test
+++ b/tests/ltorder.test
@@ -23,6 +23,7 @@ set -e
 
 cat >>configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/multlib.test b/tests/multlib.test
index 5ff19d7..9c66863 100755
--- a/tests/multlib.test
+++ b/tests/multlib.test
@@ -66,6 +66,7 @@ AC_CONFIG_SRCDIR(foo.c)
 AC_CONFIG_AUX_DIR(.)
 AM_INIT_AUTOMAKE
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AM_ENABLE_MULTILIB(Makefile,[..])
 AC_CONFIG_FILES([Makefile])
@@ -89,6 +90,7 @@ AC_INIT(libbar, 0.1, address@hidden)
 AC_CONFIG_AUX_DIR(.)
 AM_INIT_AUTOMAKE
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AM_ENABLE_MULTILIB(Makefile,[..])
 AC_CONFIG_FILES([Makefile sub/Makefile])
diff --git a/tests/nobase-libtool.test b/tests/nobase-libtool.test
index 12b055e..2a0cf68 100755
--- a/tests/nobase-libtool.test
+++ b/tests/nobase-libtool.test
@@ -26,6 +26,7 @@ set -e
 
 cat >> configure.in <<'EOF'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
diff --git a/tests/nobase.test b/tests/nobase.test
index 8b0dc6e..cac8756 100755
--- a/tests/nobase.test
+++ b/tests/nobase.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in <<'EOF'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 EOF
diff --git a/tests/noinstdir.test b/tests/noinstdir.test
index 3f33c32..b04bb0d 100755
--- a/tests/noinstdir.test
+++ b/tests/noinstdir.test
@@ -34,9 +34,12 @@ END
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
+: > ar-lib
+
 $ACLOCAL || Exit 1
 $AUTOMAKE || Exit 1
 
diff --git a/tests/pr300-lib.test b/tests/pr300-lib.test
index 3d2fde5..960b2dc 100755
--- a/tests/pr300-lib.test
+++ b/tests/pr300-lib.test
@@ -45,7 +45,7 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --copy --add-missing
+$AUTOMAKE -Wno-portability --copy --add-missing
 ./configure --prefix "`pwd`/inst"
 $MAKE
 
diff --git a/tests/pr300-ltlib.test b/tests/pr300-ltlib.test
index c6f9a5e..d381672 100755
--- a/tests/pr300-ltlib.test
+++ b/tests/pr300-ltlib.test
@@ -47,7 +47,7 @@ END
 libtoolize
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --copy --add-missing
+$AUTOMAKE -Wno-portability --copy --add-missing
 ./configure --prefix "`pwd`/inst"
 $MAKE V=1 >stdout
 cat stdout
diff --git a/tests/pr307.test b/tests/pr307.test
index 0091415..3b23092 100755
--- a/tests/pr307.test
+++ b/tests/pr307.test
@@ -54,7 +54,7 @@ set -e
 libtoolize --force
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -Wno-portability -a
 
 # Sanity check: make sure the variable we are attempting to force
 # is used by configure
diff --git a/tests/pr401.test b/tests/pr401.test
index 7a092bf..113747f 100755
--- a/tests/pr401.test
+++ b/tests/pr401.test
@@ -80,7 +80,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-portability
 ./configure
 $MAKE distcheck
 
@@ -96,7 +96,7 @@ mv -f configure.int configure.in
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-portability
 ./configure
 test ! -d lib/lib
 $MAKE distcheck
@@ -107,7 +107,7 @@ $MAKE distcheck
 
 mv -f src/Makefile.am src/t
 sed 's/LDADD = .*/LDADD = @LIBOBJS@/' src/t > src/Makefile.am
-AUTOMAKE_fails
+AUTOMAKE_fails -Wno-portability
 grep 'cannot be used outside.*lib' stderr
 mv -f src/t src/Makefile.am
 
@@ -138,7 +138,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-portability --add-missing
 ./configure
 test ! -d src/lib
 test ! -d 'src/$(top_builddir)'
@@ -175,6 +175,6 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-portability
 ./configure
 $MAKE distcheck
diff --git a/tests/pr401b.test b/tests/pr401b.test
index f7f6344..2b31c38 100755
--- a/tests/pr401b.test
+++ b/tests/pr401b.test
@@ -81,7 +81,7 @@ EOF
 libtoolize
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -Wno-portability -a
 ./configure
 $MAKE distcheck
 
@@ -98,7 +98,7 @@ mv -f configure.int configure.in
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -Wno-portability -a
 ./configure
 test ! -d lib/lib
 $MAKE distcheck
@@ -109,7 +109,7 @@ $MAKE distcheck
 
 mv -f src/Makefile.am src/t
 sed 's/LDADD = .*/LDADD = @LTLIBOBJS@/' src/t > src/Makefile.am
-AUTOMAKE_fails
+AUTOMAKE_fails -Wno-portability
 grep 'cannot be used outside.*lib' stderr
 mv -f src/t src/Makefile.am
 
@@ -139,7 +139,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-portability --add-missing
 ./configure
 test ! -d src/lib
 test ! -d 'src/$(top_builddir)'
@@ -176,6 +176,6 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-portability
 ./configure
 $MAKE distcheck
diff --git a/tests/pr401c.test b/tests/pr401c.test
index fc2f5de..5c11138 100755
--- a/tests/pr401c.test
+++ b/tests/pr401c.test
@@ -82,7 +82,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-portability
 ./configure
 $MAKE distcheck
 
@@ -99,7 +99,7 @@ mv -f configure.int configure.in
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-portability
 ./configure
 test ! -d lib/lib
 $MAKE distcheck
@@ -110,7 +110,7 @@ $MAKE distcheck
 
 mv -f src/Makefile.am src/t
 sed 's/LDADD = .*/LDADD = @ALLOCA@/' src/t > src/Makefile.am
-AUTOMAKE_fails
+AUTOMAKE_fails -Wno-portability
 grep 'cannot be used outside.*lib' stderr
 mv -f src/t src/Makefile.am
 
@@ -141,7 +141,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-portability --add-missing
 ./configure
 $MAKE
 test ! -d src/lib
@@ -178,6 +178,6 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-portability
 ./configure
 $MAKE distcheck
diff --git a/tests/pr72.test b/tests/pr72.test
index d67c17b..ef54813 100755
--- a/tests/pr72.test
+++ b/tests/pr72.test
@@ -35,6 +35,6 @@ END
 : > config.sub
 
 $ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$AUTOMAKE -Wno-portability || Exit 1
 
 grep '^LINK ' Makefile.in
diff --git a/tests/silent3.test b/tests/silent3.test
index d0a0131..a1a0197 100755
--- a/tests/silent3.test
+++ b/tests/silent3.test
@@ -29,6 +29,7 @@ cat >>configure.in <<'EOF'
 AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
+AM_PROG_AR
 AM_PROG_CC_C_O
 AC_PROG_LIBTOOL
 AC_OUTPUT
diff --git a/tests/silent4.test b/tests/silent4.test
index c6c1298..e7e3136 100755
--- a/tests/silent4.test
+++ b/tests/silent4.test
@@ -30,6 +30,7 @@ cat >>configure.in <<'EOF'
 AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
+AM_PROG_AR
 AM_PROG_CC_C_O
 AC_PROG_LIBTOOL
 AC_OUTPUT
diff --git a/tests/silent9.test b/tests/silent9.test
index 11375f8..1b17e8a 100755
--- a/tests/silent9.test
+++ b/tests/silent9.test
@@ -30,6 +30,7 @@ AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
diff --git a/tests/specflg2.test b/tests/specflg2.test
index 0dc7fcc..f67fd7b 100755
--- a/tests/specflg2.test
+++ b/tests/specflg2.test
@@ -24,6 +24,7 @@ cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CXX
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
@@ -35,6 +36,8 @@ libfoo_a_CFLAGS = -DBAR
 libfoo_a_CXXFLAGS = -DZOT
 END
 
+: > ar-lib
+
 # Make sure `compile' is required.
 $ACLOCAL
 AUTOMAKE_fails
diff --git a/tests/stdlib2.test b/tests/stdlib2.test
index c5d543c..5da42ad 100755
--- a/tests/stdlib2.test
+++ b/tests/stdlib2.test
@@ -32,6 +32,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/subdir4.test b/tests/subdir4.test
index 7ea10f8..9d4efec 100755
--- a/tests/subdir4.test
+++ b/tests/subdir4.test
@@ -26,6 +26,7 @@ mkdir lib src
 cat >> configure.in << 'END'
 AC_PROG_RANLIB
 AC_PROG_CC
+AM_PROG_AR
 AC_CONFIG_FILES([lib/Makefile src/Makefile])
 AC_OUTPUT
 END
@@ -56,6 +57,8 @@ cat > src/Makefile.am << 'END'
 pkgdata_DATA =
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE --gnu
 
diff --git a/tests/subdirbuiltsources.test b/tests/subdirbuiltsources.test
index a84f28e..a6a0035 100755
--- a/tests/subdirbuiltsources.test
+++ b/tests/subdirbuiltsources.test
@@ -28,6 +28,7 @@ cat >> configure.in << 'END'
 AC_CONFIG_FILES([lib/Makefile])
 AC_PROG_RANLIB
 AC_PROG_CC
+AM_PROG_AR
 AC_OUTPUT
 END
 
diff --git a/tests/subobj10.test b/tests/subobj10.test
index a589e45..0bd3abd 100755
--- a/tests/subobj10.test
+++ b/tests/subobj10.test
@@ -26,6 +26,7 @@ AC_INIT(x, 0, x)
 AM_INIT_AUTOMAKE([subdir-objects])
 
 AM_PROG_AS
+AM_PROG_AR
 AC_PROG_RANLIB
 
 AC_CONFIG_FILES([Makefile])
diff --git a/tests/subobj9.test b/tests/subobj9.test
index 2b331e0..bd70123 100755
--- a/tests/subobj9.test
+++ b/tests/subobj9.test
@@ -24,6 +24,7 @@ AC_INIT(x, 0, x)
 AM_INIT_AUTOMAKE([subdir-objects])
 
 AC_PROG_CXX
+AM_PROG_AR
 AM_PROG_LIBTOOL
 
 AC_CONFIG_FILES([Makefile])
diff --git a/tests/subpkg.test b/tests/subpkg.test
index 3662937..cb85bd4 100755
--- a/tests/subpkg.test
+++ b/tests/subpkg.test
@@ -68,6 +68,7 @@ mkdir lib/src
 cat >lib/configure.ac <<'EOF'
 AC_INIT([lib], [2.3])
 AM_INIT_AUTOMAKE
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_PROG_YACC
 AC_CONFIG_HEADERS([config.h:config.hin])
diff --git a/tests/subst3.test b/tests/subst3.test
index 1bcb170..c7adc8c 100755
--- a/tests/subst3.test
+++ b/tests/subst3.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in <<'EOF'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 if test -n "$doit"; then
   AC_SUBST([basehdr], [sub/base.h])
diff --git a/tests/substtarg.test b/tests/substtarg.test
index d828954..34db19f 100755
--- a/tests/substtarg.test
+++ b/tests/substtarg.test
@@ -25,6 +25,7 @@ set -e
 cat >> configure.in << 'END'
 AC_CONFIG_SOURCE([fakelib.c])
 AC_PROG_CC
+AM_PROG_AR
 RANLIB=:
 AC_SUBST([RANLIB])
 SUBST=hei
@@ -42,6 +43,8 @@ address@hidden@.a: Makefile $(address@hidden@_a_OBJECTS) 
$(address@hidden@_a_DEPEND
        @echo here we do some custom stuff, instead of invoking the linker
 END
 
+: > ar-lib
+
 $ACLOCAL
 AUTOMAKE_fails
 grep 'address@hidden@.a' stderr
diff --git a/tests/suffix10.test b/tests/suffix10.test
index 131359c..bdc4928 100755
--- a/tests/suffix10.test
+++ b/tests/suffix10.test
@@ -25,6 +25,7 @@ set -e
 cat >>configure.in <<EOF
 AC_PROG_CC
 AC_PROG_YACC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
diff --git a/tests/suffix2.test b/tests/suffix2.test
index 405ce90..f55d965 100755
--- a/tests/suffix2.test
+++ b/tests/suffix2.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 END
 
diff --git a/tests/suffix5.test b/tests/suffix5.test
index b3b36aa..2cf0afa 100755
--- a/tests/suffix5.test
+++ b/tests/suffix5.test
@@ -24,6 +24,7 @@ required=libtool
 set -e
 
 cat >> configure.in << 'END'
+AM_PROG_AR
 AC_PROG_LIBTOOL
 END
 
@@ -38,6 +39,7 @@ END
 : > ltmain.sh
 : > config.guess
 : > config.sub
+: > ar-lib
 
 $ACLOCAL
 $AUTOMAKE
diff --git a/tests/suffix8.test b/tests/suffix8.test
index 70ff3a5..d2ba0d4 100755
--- a/tests/suffix8.test
+++ b/tests/suffix8.test
@@ -23,6 +23,7 @@ required='gcc libtoolize'
 set -e
 
 cat >>configure.in <<'END'
+AM_PROG_AR
 AM_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/vala.test b/tests/vala.test
index 3e9ae36..34b71d4 100755
--- a/tests/vala.test
+++ b/tests/vala.test
@@ -28,6 +28,7 @@ set -e
 
 cat >> 'configure.in' << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AM_PROG_VALAC
 AC_OUTPUT
diff --git a/tests/vala1.test b/tests/vala1.test
index d0cc241..b2c9e16 100755
--- a/tests/vala1.test
+++ b/tests/vala1.test
@@ -29,6 +29,7 @@ set -e
 
 cat >> 'configure.in' << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AM_PROG_VALAC
 AC_OUTPUT
-- 
1.7.1




reply via email to

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