Blame tests/foreign.at

Packit 47b4ca
#							-*- Autotest -*-
Packit 47b4ca
Packit 47b4ca
AT_BANNER([Compatibility with other tools.])
Packit 47b4ca
Packit 47b4ca
# Copyright (C) 2000-2007, 2009-2012 Free Software Foundation, Inc.
Packit 47b4ca
#
Packit 47b4ca
# This program is free software: you can redistribute it and/or modify
Packit 47b4ca
# it under the terms of the GNU General Public License as published by
Packit 47b4ca
# the Free Software Foundation, either version 3 of the License, or
Packit 47b4ca
# (at your option) any later version.
Packit 47b4ca
#
Packit 47b4ca
# This program is distributed in the hope that it will be useful,
Packit 47b4ca
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 47b4ca
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 47b4ca
# GNU General Public License for more details.
Packit 47b4ca
#
Packit 47b4ca
# You should have received a copy of the GNU General Public License
Packit 47b4ca
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 47b4ca
Packit 47b4ca
Packit 47b4ca
## --------- ##
Packit 47b4ca
## Libtool.  ##
Packit 47b4ca
## --------- ##
Packit 47b4ca
Packit 47b4ca
AT_SETUP([Libtool])
Packit 47b4ca
Packit 47b4ca
# Skip this test if there is no libtoolize.
Packit 47b4ca
AT_CHECK([libtoolize --version || exit 77],
Packit 47b4ca
	 [ignore], [ignore], [ignore])
Packit 47b4ca
# Modern Libtool has further tests for compatibility with older autoconf;
Packit 47b4ca
# from the Autoconf side, we will merely assume newer libtool.
Packit 47b4ca
AT_CHECK([[
Packit 47b4ca
case `libtoolize --version |
Packit 47b4ca
      sed -n '/^.* \([0-9][0-9.a-z]*\)$/{
Packit 47b4ca
		s//\1/
Packit 47b4ca
		p
Packit 47b4ca
		q
Packit 47b4ca
	}'` in
Packit 47b4ca
  0.*    ) exit 77;;
Packit 47b4ca
  1.*    ) exit 77;;
Packit 47b4ca
esac]],
Packit 47b4ca
	 [ignore], [ignore], [ignore])
Packit 47b4ca
Packit 47b4ca
# Using a configure.ac, have libtoolize confess where libtool.m4 is.
Packit 47b4ca
AT_DATA([configure.ac],
Packit 47b4ca
[[AC_INIT
Packit 47b4ca
# State that we explicitly want auxiliary files here, so libtoolize
Packit 47b4ca
# won't pollute files outside the test directory.
Packit 47b4ca
AC_CONFIG_AUX_DIR([.])
Packit 47b4ca
AC_PROG_LIBTOOL
Packit 47b4ca
]])
Packit 47b4ca
AT_CHECK([libtoolize -i], [0], [stdout], [ignore])
Packit 47b4ca
Packit 47b4ca
# Some broken libtoolize fail to install a functional config.guess.
Packit 47b4ca
AT_CHECK([./config.guess || exit 77], [], [ignore], [ignore])
Packit 47b4ca
Packit 47b4ca
# Make sure at-path contains something valid, and let the test suite
Packit 47b4ca
# display it when verbose.  And fail, skipping would too easily hide
Packit 47b4ca
# problems.
Packit 47b4ca
AT_CHECK([sed -n ["s,^.*\`\\(/[^']*\\)'.*,\\1,p"] stdout], [0], [stdout])
Packit 47b4ca
AT_CHECK([test -f "`sed -n 1p stdout`"])
Packit 47b4ca
Packit 47b4ca
# Older libtoolize installed everything but install-sh...
Packit 47b4ca
AT_CHECK([test -f install-sh || touch install-sh])
Packit 47b4ca
Packit 47b4ca
# Build the concatenation of libtool.m4 and configure.ac.
Packit 47b4ca
AT_CHECK([[sed 's/.*/m4''_include([&])/' stdout]], [0], [stdout])
Packit 47b4ca
AT_CHECK([mv stdout aclocal.m4])
Packit 47b4ca
cat >configure.ac <<_EOF
Packit 47b4ca
AC_INIT
Packit 47b4ca
AC_CONFIG_AUX_DIR([.])
Packit 47b4ca
AC_CANONICAL_SYSTEM
Packit 47b4ca
AC_PROG_LIBTOOL
Packit 47b4ca
_EOF
Packit 47b4ca
Packit 47b4ca
# FIXME: Once Libtool really fixed, stop ignoring stderr.
Packit 47b4ca
AT_CHECK_AUTOCONF([], [], [], [ignore])
Packit 47b4ca
Packit 47b4ca
# Ignore stderr, because ltconfig always loads the cache, which is
Packit 47b4ca
# /dev/null, and some shells choke on this.  For instance with Bash
Packit 47b4ca
# 2.05, you get:
Packit 47b4ca
#
Packit 47b4ca
#   loading cache /dev/null within ltconfig
Packit 47b4ca
#   ./ltconfig: .: /dev/null: not a regular file
Packit 47b4ca
#
Packit 47b4ca
# But the script executes properly.
Packit 47b4ca
AT_CHECK_CONFIGURE([], [], [], [ignore])
Packit 47b4ca
Packit 47b4ca
AT_CLEANUP
Packit 47b4ca
Packit 47b4ca
Packit 47b4ca
AT_SETUP([shtool])
Packit 47b4ca
Packit 47b4ca
AT_DATA([configure.ac],
Packit 47b4ca
[[AC_INIT([shtool test], [1.0])
Packit 47b4ca
AC_CONFIG_AUX_DIR([build-aux])
Packit 47b4ca
AC_PATH_PROG([SHTOOL], [shtool], [false])
Packit 47b4ca
AC_PROG_INSTALL
Packit 47b4ca
AC_SUBST([ac_install_sh])
Packit 47b4ca
AC_CONFIG_FILES([Makefile])
Packit 47b4ca
AC_OUTPUT
Packit 47b4ca
]])
Packit 47b4ca
Packit 47b4ca
AT_DATA([Makefile.in],
Packit 47b4ca
[[SHTOOL = @SHTOOL@
Packit 47b4ca
# fake these, so that we use shtool wherever possible.
Packit 47b4ca
INSTALL_PROGRAM = $(ac_install_sh)
Packit 47b4ca
INSTALL_DATA = $(ac_install_sh) -m 644
Packit 47b4ca
prefix = @prefix@
Packit 47b4ca
ac_install_sh = @ac_install_sh@
Packit 47b4ca
Packit 47b4ca
install:
Packit 47b4ca
	$(INSTALL_PROGRAM) file1 $(prefix)/file1
Packit 47b4ca
	$(INSTALL_DATA) file2 $(prefix)/file2
Packit 47b4ca
Packit 47b4ca
copy-shtool:
Packit 47b4ca
	test '$(SHTOOL)' != false
Packit 47b4ca
	cp '$(SHTOOL)' build-aux
Packit 47b4ca
]])
Packit 47b4ca
Packit 47b4ca
: >file1
Packit 47b4ca
: >file2
Packit 47b4ca
chmod +x file1
Packit 47b4ca
: "${MAKE=make}"
Packit 47b4ca
mkdir build-aux inst
Packit 47b4ca
instdir=`pwd`/inst
Packit 47b4ca
AT_CHECK_AUTOCONF
Packit 47b4ca
cp "$abs_top_srcdir/build-aux/install-sh" build-aux
Packit 47b4ca
AT_CHECK_CONFIGURE
Packit 47b4ca
AT_CHECK([$MAKE copy-shtool], [], [ignore], [ignore],
Packit 47b4ca
	 [AT_CHECK([: >build-aux/shtool])])
Packit 47b4ca
rm -f build-aux/install-sh
Packit 47b4ca
AT_CHECK_CONFIGURE([--prefix="$instdir" ac_cv_path_SHTOOL=false])
Packit 47b4ca
AT_CHECK([grep '^ac_install_sh = .*shtool install -c' Makefile], [], [ignore])
Packit 47b4ca
if test -s build-aux/shtool; then
Packit 47b4ca
  AT_CHECK([$MAKE install], [], [ignore], [ignore])
Packit 47b4ca
  AT_CHECK([test -f inst/file1 && test -f inst/file2 && test -x inst/file1])
Packit 47b4ca
fi
Packit 47b4ca
Packit 47b4ca
AT_CLEANUP