-# Gettext.
-AM_GNU_GETTEXT(external, need-ngettext)
-AM_GNU_GETTEXT_VERSION(0.11.5)
+# gnulib and gettext.
+GNULIB_AUTOCONF_SNIPPET
+# We use po/Makevars, so we need at least gettext 0.12.
+AM_GNU_GETTEXT_VERSION([0.12])
+BISON_I18N
+
+# Internationalized parsers.
+AC_CONFIG_FILES([runtime-po/Makefile.in])
+# Autoconf macros for packages using internationalized parsers.
+aclocaldir='${datadir}/aclocal'
+AC_SUBST([aclocaldir])
+
+# Initialize the test suite.
+AC_CONFIG_TESTDIR(tests)
+AC_CONFIG_FILES([tests/Makefile tests/atlocal])
+AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
+AC_CHECK_PROGS([VALGRIND], [valgrind])
+AC_PROG_CXX
+BISON_TEST_FOR_WORKING_CXX_COMPILER
+AM_MISSING_PROG([AUTOM4TE], [autom4te])
+# Needed by tests/atlocal.in.
+AC_SUBST([GCC])
+O0CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]] *//'`
+AC_SUBST([O0CFLAGS])
+O0CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'`
+AC_SUBST([O0CXXFLAGS])