2 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Test if AM_PROG_AR triggers the use of the ar-lib script.
18 # This test does not require Microsoft lib.
19 # Keep this test in sync with sister test 'ar-lib5a.sh'.
23 cat > configure.ac
<< END
25 AC_CONFIG_AUX_DIR([auxdir])
27 AC_CONFIG_FILES([Makefile])
31 # We want to test the content of am_cv_ar_interface in the Makefile.
32 AC_SUBST([am_cv_ar_interface])
36 cat > Makefile.am
<< 'END'
37 lib_LIBRARIES
= libwish.a
38 libwish_a_SOURCES
= wish.c
41 test x
'$(am_cv_ar_interface)' = x
'lib'
43 MOSTLYCLEANFILES
= ar-lib-worked
47 int wish
(void
) { return 0; }
51 cat > auxdir
/ar-lib
<< 'END'
55 chmod +x auxdir
/ar-lib
57 # Let's fake microsoft lib.
59 cat > bin
/lib
<< 'END'
61 echo lib
command line
: $
* >&2 # For debugging.
63 # The '-OUT:' option is used by tests in configure. So don't create
64 # the 'ar-lib-worked' file here, as that might cause spurious passes
65 # of this test; but don't fail either, as that would confuse said
68 # This means that $* looks like a command-line for 'ar'. We have to
69 # exit with failure here, to accommodate the two following ortoghonal
71 # 1. when 'lib' is tested by configure, this will tell that it does
72 # not use the ar(1) interface, so that the 'ar-lib' script will
74 # 2. when 'lib' is called by the Makefile, an ar-style command line
75 # passed to it would mean that the 'ar-lib' script has failed to
76 # properly munge the command line, or hasn't been invoked to do so.
78 # Assume everything else is OK.
79 *) : > ar-lib-worked
;;
83 PATH
=$
(pwd)/bin
$PATH_SEPARATOR$PATH; export PATH
87 $AUTOMAKE --add-missing
89 # Sanity check: test that it is ok to use 'am_cv_ar_interface' as we do.
90 $FGREP 'am_cv_ar_interface=' configure
92 .
/configure AR
=lib RANLIB
=:
95 $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS
="AR=lib RANLIB=:"