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