1#! /bin/sh
2# Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>.
16
17# Try to find the libtool '.m4' files and make them easily accessed
18# to the test cases requiring them.
19# See also automake bug#9807.
20
21. test-init.sh
22
23echo "# Automatically generated by $me." > get.sh
24echo : >> get.sh
25
26# The 'libtoolize' script will look into Makefile.am.
27echo ACLOCAL_AMFLAGS = -I m4 > Makefile.am
28
29if libtoolize --copy --install && test -f m4/libtool.m4; then
30  echo "ACLOCAL_PATH='$(pwd)/m4':\$ACLOCAL_PATH" >> get.sh
31  echo "export ACLOCAL_PATH" >> get.sh
32else
33  # Libtoolize from libtool < 2.0 didn't support the '--install' option,
34  # but this doesn't mean the user hasn't made the libtool macros
35  # available, e.g., by properly setting ACLOCAL_PATH.
36  rm -rf m4
37  mkdir m4
38  echo AC_PROG_LIBTOOL >> configure.ac
39  # See below for an explanation about the use the of '-Wno-syntax'.
40  if $ACLOCAL -Wno-syntax -I m4 --install && test -f m4/libtool.m4; then
41    : # Libtool macros already accessible by default.
42  else
43    echo "skip_all_ \"couldn't find or get libtool macros\"" >> get.sh
44  fi
45fi
46
47. ./get.sh
48
49$ACLOCAL --force -I m4 || cat >> get.sh <<'END'
50# We need to use '-Wno-syntax', since we do not want our test suite
51# to fail merely because some third-party '.m4' file is underquoted.
52ACLOCAL="$ACLOCAL -Wno-syntax"
53END
54
55# The file libtoolize might have just copied in the 'm4' subdirectory of
56# the test directory are going to be needed by other tests, so we must
57# not remove the test directory.
58keep_testdirs=yes
59
60:
61