tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / ar-lib5a.sh
blobabfe513942eb6bc14b93b042032d94174f5c5140
1 #! /bin/sh
2 # Copyright (C) 2011-2012 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)
7 # any later version.
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 requires Microsoft lib.
19 # Keep this test in sync with sister test 'ar-lib5b.test'.
21 required=lib
22 . ./defs || exit 1
24 cat > configure.ac << END
25 AC_INIT([$me], [1.0])
26 AC_CONFIG_AUX_DIR([auxdir])
27 AM_INIT_AUTOMAKE
28 AC_CONFIG_FILES([Makefile])
29 AC_PROG_CC
30 AM_PROG_AR
31 AC_PROG_RANLIB
32 # We want to test the content of am_cv_ar_interface in the Makefile.
33 AC_SUBST([am_cv_ar_interface])
34 AC_OUTPUT
35 END
37 cat > Makefile.am << 'END'
38 lib_LIBRARIES = libwish.a
39 libwish_a_SOURCES = wish.c
41 check-local:
42 test x'$(am_cv_ar_interface)' = x'lib'
43 test -f ar-lib-worked
44 test -f libwish.a
45 MOSTLYCLEANFILES = ar-lib-worked
46 END
48 cat > wish.c << 'END'
49 int wish(void) { return 0; }
50 END
52 mkdir auxdir
53 cat - "$am_scriptdir/ar-lib" > auxdir/ar-lib << 'END'
54 #! /bin/sh
55 :> ar-lib-worked
56 END
57 chmod +x auxdir/ar-lib
59 $ACLOCAL
60 $AUTOCONF
61 $AUTOMAKE --add-missing
63 # Sanity check: test that it is ok to use 'am_cv_ar_interface' as we do.
64 $FGREP 'am_cv_ar_interface=' configure
66 ./configure AR=lib RANLIB=:
68 $MAKE check
69 $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='AR=lib RANLIB=:'