2 # Copyright (C) 2011 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.test'.
25 cat > configure.in << END
27 AC_CONFIG_AUX_DIR([auxdir])
29 AC_CONFIG_FILES([Makefile])
33 # We want to test the content of am_cv_ar_interface in the Makefile.
34 AC_SUBST([am_cv_ar_interface])
38 cat > Makefile.am << 'END'
39 lib_LIBRARIES = libwish.a
40 libwish_a_SOURCES = wish.c
43 test x'$(am_cv_ar_interface)' = x'lib'
45 MOSTLYCLEANFILES = ar-lib-worked
49 int wish(void) { return 0; }
53 cat > auxdir/ar-lib << 'END'
57 chmod +x auxdir/ar-lib
59 # Let's fake microsoft lib.
61 cat > bin/lib << 'END'
63 echo lib command line: $* >&2 # For debugging.
65 # The `-OUT:' option is used by tests in configure. So don't create
66 # the `ar-lib-worked' file here, as that might cause spurious passes
67 # of this test; but don't fail either, as that would confuse said
70 # This means that $* looks like a command-line for `ar'. We have to
71 # exit with failure here, to accomodate the two following ortoghonal
73 # 1. when `lib' is tested by configure, this will tell that it does
74 # not use the ar(1) interface, so that the `ar-lib' script will
76 # 2. when `lib' is called by the Makefile, an ar-style command line
77 # passed to it would mean that the `ar-lib' script has failed to
78 # properly munge the command line, or hasn't been invoked to do so.
80 # Assume everything else is OK.
81 *) : > ar-lib-worked;;
85 PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
89 $AUTOMAKE --add-missing
91 # Sanity check: test that it is ok to use `am_cv_ar_interface' as we do.
92 $FGREP 'am_cv_ar_interface=' configure
94 ./configure AR=lib RANLIB=:
97 $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="AR=lib RANLIB=:"