1#							-*- Autotest -*-
2
3AT_BANNER([Compatibility with other tools.])
4
5# Copyright (C) 2000-2007, 2009-2012 Free Software Foundation, Inc.
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20
21## --------- ##
22## Libtool.  ##
23## --------- ##
24
25AT_SETUP([Libtool])
26
27# Skip this test if there is no libtoolize.
28AT_CHECK([libtoolize --version || exit 77],
29	 [ignore], [ignore], [ignore])
30# Modern Libtool has further tests for compatibility with older autoconf;
31# from the Autoconf side, we will merely assume newer libtool.
32AT_CHECK([[
33case `libtoolize --version |
34      sed -n '/^.* \([0-9][0-9.a-z]*\)$/{
35		s//\1/
36		p
37		q
38	}'` in
39  0.*    ) exit 77;;
40  1.*    ) exit 77;;
41esac]],
42	 [ignore], [ignore], [ignore])
43
44# Using a configure.ac, have libtoolize confess where libtool.m4 is.
45AT_DATA([configure.ac],
46[[AC_INIT
47# State that we explicitly want auxiliary files here, so libtoolize
48# won't pollute files outside the test directory.
49AC_CONFIG_AUX_DIR([.])
50AC_PROG_LIBTOOL
51]])
52AT_CHECK([libtoolize -i], [0], [stdout], [ignore])
53
54# Some broken libtoolize fail to install a functional config.guess.
55AT_CHECK([./config.guess || exit 77], [], [ignore], [ignore])
56
57# Make sure at-path contains something valid, and let the test suite
58# display it when verbose.  And fail, skipping would too easily hide
59# problems.
60AT_CHECK([sed -n ["s,^.*\`\\(/[^']*\\)'.*,\\1,p"] stdout], [0], [stdout])
61AT_CHECK([test -f "`sed -n 1p stdout`"])
62
63# Older libtoolize installed everything but install-sh...
64AT_CHECK([test -f install-sh || touch install-sh])
65
66# Build the concatenation of libtool.m4 and configure.ac.
67AT_CHECK([[sed 's/.*/m4''_include([&])/' stdout]], [0], [stdout])
68AT_CHECK([mv stdout aclocal.m4])
69cat >configure.ac <<_EOF
70AC_INIT
71AC_CONFIG_AUX_DIR([.])
72AC_CANONICAL_SYSTEM
73AC_PROG_LIBTOOL
74_EOF
75
76# FIXME: Once Libtool really fixed, stop ignoring stderr.
77AT_CHECK_AUTOCONF([], [], [], [ignore])
78
79# Ignore stderr, because ltconfig always loads the cache, which is
80# /dev/null, and some shells choke on this.  For instance with Bash
81# 2.05, you get:
82#
83#   loading cache /dev/null within ltconfig
84#   ./ltconfig: .: /dev/null: not a regular file
85#
86# But the script executes properly.
87AT_CHECK_CONFIGURE([], [], [], [ignore])
88
89AT_CLEANUP
90
91
92AT_SETUP([shtool])
93
94AT_DATA([configure.ac],
95[[AC_INIT([shtool test], [1.0])
96AC_CONFIG_AUX_DIR([build-aux])
97AC_PATH_PROG([SHTOOL], [shtool], [false])
98AC_PROG_INSTALL
99AC_SUBST([ac_install_sh])
100AC_CONFIG_FILES([Makefile])
101AC_OUTPUT
102]])
103
104AT_DATA([Makefile.in],
105[[SHTOOL = @SHTOOL@
106# fake these, so that we use shtool wherever possible.
107INSTALL_PROGRAM = $(ac_install_sh)
108INSTALL_DATA = $(ac_install_sh) -m 644
109prefix = @prefix@
110ac_install_sh = @ac_install_sh@
111
112install:
113	$(INSTALL_PROGRAM) file1 $(prefix)/file1
114	$(INSTALL_DATA) file2 $(prefix)/file2
115
116copy-shtool:
117	test '$(SHTOOL)' != false
118	cp '$(SHTOOL)' build-aux
119]])
120
121: >file1
122: >file2
123chmod +x file1
124: "${MAKE=make}"
125mkdir build-aux inst
126instdir=`pwd`/inst
127AT_CHECK_AUTOCONF
128cp "$abs_top_srcdir/build-aux/install-sh" build-aux
129AT_CHECK_CONFIGURE
130AT_CHECK([$MAKE copy-shtool], [], [ignore], [ignore],
131	 [AT_CHECK([: >build-aux/shtool])])
132rm -f build-aux/install-sh
133AT_CHECK_CONFIGURE([--prefix="$instdir" ac_cv_path_SHTOOL=false])
134AT_CHECK([grep '^ac_install_sh = .*shtool install -c' Makefile], [], [ignore])
135if test -s build-aux/shtool; then
136  AT_CHECK([$MAKE install], [], [ignore], [ignore])
137  AT_CHECK([test -f inst/file1 && test -f inst/file2 && test -x inst/file1])
138fi
139
140AT_CLEANUP
141