Blob Blame History Raw
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test for sanity checks.

: ${AUTOCONF=autoconf}
${AUTOCONF} --version >/dev/null 2>/dev/null \
  || { echo "Skipping test: autoconf not found"; exit 77; }

cat <<\EOF >configure.ac
AC_PREREQ([2.60])
EOF

${AUTOCONF} >/dev/null 2>/dev/null \
  || { echo "Skipping test: autoconf version too old"; exit 77; }

rm -f configure.ac

gettext_datadir=$top_builddir/misc
export gettext_datadir

# Check if sanity checks are actually working.

# no configure.ac
$gettext_datadir/autopoint 2>&1 | grep 'Missing configure.in or configure.ac' 2>&1 >/dev/null \
    || exit 1

test ! -d intl || exit 1
test ! -d m4 || exit 1
test ! -d po || exit 1

# configure.ac without AM_GNU_GETTEXT_VERSION
cat <<\EOF >configure.ac
AC_INIT
AC_CONFIG_SRCDIR(hello.c)

AC_PROG_CC

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

$gettext_datadir/autopoint 2>&1 | grep 'Missing version' 2>&1 >/dev/null \
    || exit 1

test ! -d intl || exit 1
test ! -d m4 || exit 1
test ! -d po || exit 1

# VERSION specified through intl/VERSION file, but in wrong format
cat <<\EOF >configure.ac
AC_INIT
AC_CONFIG_SRCDIR(hello.c)

AC_PROG_CC

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

test -d intl || mkdir intl
echo bogus-version > intl/VERSION

$gettext_datadir/autopoint 2>&1 | grep 'Missing version' 2>&1 >/dev/null \
    || exit 1

test ! -d m4 || exit 1
test ! -d po || exit 1

# VERSION specified through intl/VERSION file
cat <<\EOF >configure.ac
AC_INIT
AC_CONFIG_SRCDIR(hello.c)

AC_PROG_CC

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

test -d intl || mkdir intl

echo gettext-0.15 > intl/VERSION

# For further investigation, autopoint keeps autopoint.diff in $TMPDIR
# if there is a mismatch.  Set TMPDIR not to pollute /tmp.
TMPDIR="$PWD" $gettext_datadir/autopoint 2>&1 | grep 'locally modified' 2>&1 >/dev/null || exit 1

test ! -d m4 || exit 1
test ! -d po || exit 1

echo 'GNU gettext library from gettext-0.15' > intl/VERSION

TMPDIR="$PWD" $gettext_datadir/autopoint 2>&1 || exit 1

rm -fr intl

exit 0