Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / ar-lib5a.test
1 #! /bin/sh
2 # Copyright (C) 2011 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
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'.
20
21 required=lib
22 . ./defs || Exit 1
23
24 set -e
25
26 cat > configure.in << END
27 AC_INIT([$me], [1.0])
28 AC_CONFIG_AUX_DIR([auxdir])
29 AM_INIT_AUTOMAKE
30 AC_CONFIG_FILES([Makefile])
31 AC_PROG_CC
32 AM_PROG_AR
33 AC_PROG_RANLIB
34 # We want to test the content of am_cv_ar_interface in the Makefile.
35 AC_SUBST([am_cv_ar_interface])
36 AC_OUTPUT
37 END
38
39 cat > Makefile.am << 'END'
40 lib_LIBRARIES = libwish.a
41 libwish_a_SOURCES = wish.c
42
43 check-local:
44         test x'$(am_cv_ar_interface)' = x'lib'
45         test -f ar-lib-worked
46         test -f libwish.a
47 MOSTLYCLEANFILES = ar-lib-worked
48 END
49
50 cat > wish.c << 'END'
51 int wish(void) { return 0; }
52 END
53
54 mkdir auxdir
55 # FIXME: make this "installcheck-aware" once we are merged into the
56 #        'testsuite-work' branch.
57 cat - "$testsrcdir"/../lib/ar-lib > auxdir/ar-lib << 'END'
58 #! /bin/sh
59 :> ar-lib-worked
60 END
61 chmod +x auxdir/ar-lib
62
63 $ACLOCAL
64 $AUTOCONF
65 $AUTOMAKE --add-missing
66
67 # Sanity check: test that it is ok to use `am_cv_ar_interface' as we do.
68 $FGREP 'am_cv_ar_interface=' configure
69
70 ./configure AR=lib RANLIB=:
71
72 $MAKE check
73 $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='AR=lib RANLIB=:'
74
75 :