2 # Copyright (C) 2011-2017 Free Software Foundation, Inc.
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)
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.
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/>.
17 # Try to find the gettext '.m4' files and make them easily accessed
18 # to the test cases requiring them.
19 # See also automake bug#9807.
23 extract_program_version
()
25 "$1" --version |
sed 1q |
$PERL -ne '/(\d(?:\.\d+)+)/ and print "$1\n"'
28 echo "# Automatically generated by $me." > get.sh
31 # The 'autopoint' script will look into Makefile.am.
32 echo AUTOMAKE_OPTIONS
= -Wno-obsolete > Makefile.am
33 echo ACLOCAL_AMFLAGS
= -I m4 >> Makefile.am
35 # Prefer autopoint to gettextize, since the latter unconditionally
36 # requires user interaction to complete; yes, this means confirmation
37 # from /dev/tty (!) -- see:
38 # <https://lists.gnu.org/archive/html/bug-gettext/2011-12/msg00000.html>
40 # We will need to specify the correct autopoint version in the
41 # AM_GNU_GETTEXT_VERSION call in configure.ac if we want autopoint to
42 # setup the correct infrastructure -- in particular, for what concerns
43 # us, to bring in all the required .m4 files.
44 autopoint_version
=$
(extract_program_version autopoint
) \
45 && test -n "$autopoint_version" \
46 || autopoint_version
=0.10.35
48 cat > configure.ac
<<END
51 # Both required by autopoint.
53 AM_GNU_GETTEXT_VERSION([$autopoint_version])
56 if autopoint
--force && test -f m
4/gettext.
m4; then
57 echo "ACLOCAL_PATH='$(pwd)/m4':\$ACLOCAL_PATH" >> get.sh
58 echo "export ACLOCAL_PATH" >> get.sh
60 # Older versions of gettext might not have an autopoint program
61 # available, but this doesn't mean the user hasn't made the gettext
62 # macros available, e.g., by properly setting ACLOCAL_PATH.
65 # See below for an explanation about the use the of '-Wno-syntax'.
66 if $ACLOCAL -Wno-syntax -I m4 --install && test -f m
4/gettext.
m4; then
67 : # Gettext macros already accessible by default.
69 echo "skip_all_ \"couldn't find or get gettext macros\"" >> get.sh
74 # Even recent versions of gettext used the now-obsolete 'AM_PROG_MKDIR_P'
75 # m4 macro. So we need the following to avoid spurious errors.
76 ACLOCAL="$ACLOCAL -Wno-obsolete"
77 AUTOMAKE="$AUTOMAKE -Wno-obsolete"
82 $ACLOCAL --force -I m4 ||
cat >> get.sh
<<'END'
83 # We need to use '-Wno-syntax', since we do not want our test suite
84 # to fail merely because some third-party '.m4' file is underquoted.
85 ACLOCAL="$ACLOCAL -Wno-syntax"
88 # Remove any Makefile.in possibly created by autopoint, to avoid spurious
89 # maintainer-check failures.
90 rm -f $
(find .
-name Makefile.
in)
92 # The file autopoint might have copied in the 'm4' subdirectory of the
93 # test directory are going to be needed by other tests, so we must not
94 # remove the test directory.