1#! /bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3 4# Test the autopoint program, without Automake. 5 6: ${AUTOCONF=autoconf} 7${AUTOCONF} --version >/dev/null 2>/dev/null \ 8 || { echo "Skipping test: autoconf not found"; Exit 77; } 9 10cat <<\EOF >configure.ac 11AC_PREREQ([2.60]) 12EOF 13 14${AUTOCONF} >/dev/null 2>/dev/null \ 15 || { echo "Skipping test: autoconf version too old"; Exit 77; } 16 17rm -f configure.ac 18 19gettext_datadir=$top_builddir/misc 20export gettext_datadir 21 22# Check for not copying libintl source. 23cat <<EOF >configure.ac 24AC_INIT 25AC_CONFIG_SRCDIR(hello.c) 26AC_CONFIG_AUX_DIR([build-aux]) 27 28AC_PROG_CC 29AM_GNU_GETTEXT([external]) 30AM_GNU_GETTEXT_VERSION([$ARCHIVE_VERSION]) 31 32AC_CONFIG_FILES([Makefile]) 33AC_CONFIG_FILES([po/Makefile.in]) 34AC_OUTPUT 35EOF 36 37$gettext_datadir/autopoint >/dev/null 2>autopoint.err 38test $? = 0 || { cat autopoint.err; Exit 1; } 39 40test ! -d intl || Exit 1 41test -d m4 || Exit 1 42test -d po || Exit 1 43test -d build-aux || Exit 1 44 45test -f m4/po.m4 || Exit 1 46test -f po/Makefile.in.in || Exit 1 47test -f build-aux/config.rpath || Exit 1 48 49rm -fr m4 po ABOUT-NLS build-aux/config.rpath 50 51# Check for copying libintl source of the current version. 52cat <<EOF >configure.ac 53AC_INIT 54AC_CONFIG_SRCDIR(hello.c) 55 56AC_PROG_CC 57AM_GNU_GETTEXT 58AM_GNU_GETTEXT_VERSION([$ARCHIVE_VERSION]) 59 60AC_CONFIG_FILES([Makefile]) 61AC_CONFIG_FILES([po/Makefile.in]) 62AC_OUTPUT 63EOF 64 65$gettext_datadir/autopoint >/dev/null 2>autopoint.err 66test $? = 1 || { cat autopoint.err; Exit 1; } 67 68rm -fr intl m4 po ABOUT-NLS config.rpath 69 70# Check for copying libintl source of an older version. 71cat <<EOF >configure.ac 72AC_INIT 73AC_CONFIG_SRCDIR(hello.c) 74 75AC_PROG_CC 76AM_GNU_GETTEXT 77AM_GNU_GETTEXT_VERSION([0.19]) 78 79AC_CONFIG_FILES([Makefile]) 80AC_CONFIG_FILES([po/Makefile.in]) 81AC_OUTPUT 82EOF 83 84$gettext_datadir/autopoint >/dev/null 2>autopoint.err 85test $? = 0 || { cat autopoint.err; Exit 1; } 86 87test -d intl || Exit 1 88test -d m4 || Exit 1 89test -d po || Exit 1 90 91test -f intl/VERSION || Exit 1 92test -f m4/po.m4 || Exit 1 93test -f po/Makefile.in.in || Exit 1 94 95rm -fr intl m4 po ABOUT-NLS config.rpath 96 97# Check for custom macro directory. 98cat <<EOF >configure.ac 99AC_INIT 100AC_CONFIG_SRCDIR(hello.c) 101 102AC_PROG_CC 103AM_GNU_GETTEXT([external]) 104AM_GNU_GETTEXT_VERSION([$ARCHIVE_VERSION]) 105 106# first macro directory, in which po.m4, etc. belong 107AC_CONFIG_MACRO_DIR([gettext-m4]) 108 109# second macro directory 110AC_CONFIG_MACRO_DIR([m4]) 111 112AC_CONFIG_FILES([Makefile]) 113AC_CONFIG_FILES([po/Makefile.in]) 114AC_OUTPUT 115EOF 116 117$gettext_datadir/autopoint >/dev/null 2>autopoint.err 118test $? = 0 || { cat autopoint.err; Exit 1; } 119 120test ! -d intl || Exit 1 121test ! -d m4 || Exit 1 122test -d gettext-m4 || Exit 1 123test -d po || Exit 1 124 125test -f gettext-m4/po.m4 || Exit 1 126test -f po/Makefile.in.in || Exit 1 127 128rm -fr gettext-m4 po ABOUT-NLS config.rpath 129 130# Check for multiple arguments to AM_GNU_GETTEXT 131# <https://savannah.gnu.org/bugs/?40082> 132cat <<EOF >configure.ac 133AC_INIT 134AC_CONFIG_SRCDIR(hello.c) 135 136AC_PROG_CC 137AM_GNU_GETTEXT([external], [need-formatstring-macros]) 138AM_GNU_GETTEXT_VERSION([$ARCHIVE_VERSION]) 139 140AC_CONFIG_FILES([Makefile]) 141AC_CONFIG_FILES([po/Makefile.in]) 142AC_OUTPUT 143EOF 144 145$gettext_datadir/autopoint >/dev/null 2>autopoint.err 146test $? = 0 || { cat autopoint.err; Exit 1; } 147 148test ! -d intl || Exit 1 149test -d m4 || Exit 1 150test -d po || Exit 1 151 152test -f m4/po.m4 || Exit 1 153test -f po/Makefile.in.in || Exit 1 154 155rm -fr m4 po ABOUT-NLS config.rpath 156 157# Check for certain built-in macros are not in effect when tracing: 158# <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764580> 159cat <<EOF >configure.ac 160AC_INIT 161AC_CONFIG_SRCDIR(hello.c) 162 163dnl m4_shiftn internally calls m4_assert, which is disabled by autopoint 164m4_define([_gt_recurse], 165[m4_ifblank([\$1], , [_gt_recurse(m4_shiftn(1, \$@))])]) 166_gt_recurse([a], [b], , [c]) 167 168AC_PROG_CC 169AM_GNU_GETTEXT([external]) 170AM_GNU_GETTEXT_VERSION([$ARCHIVE_VERSION]) 171 172AC_CONFIG_FILES([Makefile]) 173AC_CONFIG_FILES([po/Makefile.in]) 174AC_OUTPUT 175EOF 176 177$gettext_datadir/autopoint >/dev/null 2>autopoint.err 178test $? = 0 || { cat autopoint.err; Exit 1; } 179 180test ! -d intl || Exit 1 181test -d m4 || Exit 1 182test -d po || Exit 1 183 184test -f m4/po.m4 || Exit 1 185test -f po/Makefile.in.in || Exit 1 186 187rm -fr m4 po ABOUT-NLS config.rpath 188 189# Check for AM_GNU_GETTEXT_REQUIRE_VERSION. 190cat <<EOF >configure.ac 191AC_INIT 192AC_CONFIG_SRCDIR(hello.c) 193 194AC_PROG_CC 195AM_GNU_GETTEXT_REQUIRE_VERSION([0.19]) 196AM_GNU_GETTEXT([external]) 197 198AC_CONFIG_FILES([Makefile]) 199AC_CONFIG_FILES([po/Makefile.in]) 200AC_OUTPUT 201EOF 202 203$gettext_datadir/autopoint >/dev/null 2>autopoint.err 204test $? = 0 || { cat autopoint.err; Exit 1; } 205 206test ! -d intl || Exit 1 207test -d m4 || Exit 1 208test -d po || Exit 1 209 210test -f m4/po.m4 || Exit 1 211test -f po/Makefile.in.in || Exit 1 212 213# Check for the case where both AM_GNU_GETTEXT_REQUIRE_VERSION and 214# AM_GNU_GETTEXT_VERSION are used. Once with libintl source. 215cat <<EOF >configure.ac 216AC_INIT 217AC_CONFIG_SRCDIR(hello.c) 218 219AC_PROG_CC 220AM_GNU_GETTEXT 221AM_GNU_GETTEXT_REQUIRE_VERSION([0.19]) 222# This shall be ignored when AM_GNU_GETTEXT_REQUIRE_VERSION is defined 223AM_GNU_GETTEXT_VERSION([0.19]) 224 225AC_CONFIG_MACRO_DIR([m4]) 226 227AC_CONFIG_FILES([Makefile]) 228AC_CONFIG_FILES([po/Makefile.in]) 229AC_OUTPUT 230EOF 231 232$gettext_datadir/autopoint >autopoint.out 2>autopoint.err 233test $? = 1 || { cat autopoint.err; Exit 1; } 234 235# Check for the case where both AM_GNU_GETTEXT_REQUIRE_VERSION and 236# AM_GNU_GETTEXT_VERSION are used. Once without libintl source. 237cat <<EOF >configure.ac 238AC_INIT 239AC_CONFIG_SRCDIR(hello.c) 240 241AC_PROG_CC 242AM_GNU_GETTEXT([external]) 243AM_GNU_GETTEXT_REQUIRE_VERSION([0.19]) 244# This shall be ignored when AM_GNU_GETTEXT_REQUIRE_VERSION is defined 245AM_GNU_GETTEXT_VERSION([0.19]) 246 247AC_CONFIG_MACRO_DIR([m4]) 248 249AC_CONFIG_FILES([Makefile]) 250AC_CONFIG_FILES([po/Makefile.in]) 251AC_OUTPUT 252EOF 253 254$gettext_datadir/autopoint >autopoint.out 2>autopoint.err 255test $? = 0 || { cat autopoint.err; Exit 1; } 256 257grep 'using AM_GNU_GETTEXT_REQUIRE_VERSION' autopoint.out 2>&1 >/dev/null || Exit 1 258 259test ! -d intl || Exit 1 260test -d m4 || Exit 1 261test -d po || Exit 1 262 263test -f m4/po.m4 || Exit 1 264test -f po/Makefile.in.in || Exit 1 265