dnl Process this file with autoconf to produce a configure script.
AC_REVISION($Revision: 1.132 $)
AC_INIT(src/msgfmt.c)
AC_CONFIG_HEADER(config.h)
AC_PREREQ(2.99)
PACKAGE=gettext
VERSION=0.10.24
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

changequote(,)dnl
case $VERSION in
  [0-9]*.[0-9]*.[0-9]*) DIST_ALPHA="README-alpha";;
  *) DIST_ALPHA=;;
esac
changequote([, ])dnl
AC_SUBST(DIST_ALPHA)

dnl Set of available languages.
ALL_LINGUAS="de es fr ko nl no no@nynorsk pl sl sv"

dnl Checks for programs.
AC_ARG_PROGRAM
AC_PROG_MAKE_SET
AC_PROG_CC
AC_ISC_POSIX
AM_PROG_INSTALL
AC_PROG_MKINSTALLDIRS
AC_PROG_RANLIB
AC_PROG_YACC

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC
AC_HAVE_HEADERS(limits.h malloc.h string.h unistd.h values.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
md_TYPE_PTRDIFF_T

dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([getcwd mblen memcpy strchr strerror uname])
AC_REPLACE_FUNCS([getline memmove memset stpcpy stpncpy strcspn strncasecmp \
strstr strtoul vasprintf])
if test $ac_cv_func_getline != yes; then
  AC_CHECK_FUNCS(getdelim)
fi

AC_CHECK_FUNC(parse_printf_format, gt_cv_func_parse_printf_format=yes,
  gt_cv_func_parse_printf_format=no)
if test $gt_cv_func_parse_printf_format = yes; then
  AC_DEFINE(HAVE_PARSE_PRINTF_FORMAT)
else
  LIBOBJS="$LIBOBJS printf-prs.o"
fi

AC_CACHE_CHECK([for obstacks], gt_cv_func_obstack,
[AC_TRY_LINK([#include "obstack.h"],
[struct obstack *mem;obstack_free(mem,(char *) 0)],
    gt_cv_func_obstack=yes, gt_cv_func_obstack=no)])
if test $gt_cv_func_obstack = yes; then
  AC_DEFINE(HAVE_OBSTACK)
else
  LIBOBJS="$LIBOBJS obstack.o"
fi

AC_CACHE_CHECK([for error], gt_cv_func_error,
[AC_TRY_LINK([#include "error.h"],
[error_at_line (0, 0, "", 0, "")],
    gt_cv_func_error=yes, gt_cv_func_error=no)])
if test $gt_cv_func_error != yes; then
  LIBOBJS="$LIBOBJS error.o"
fi

dnl These are the only lines required to internationalize the package.
dnl (OK, not quite, the AC_OUTPUT has also some parts.)
ud_GNU_GETTEXT

dnl Check for Emacs and where to install .elc files.
ud_PATH_LISPDIR

dnl The reference to <locale.h> in the installed <libintl.h> file
dnl must be resolved because we cannot expect the users of this
dnl to define HAVE_LOCALE_H.
if test $ac_cv_header_locale_h = yes; then
  INCLUDE_LOCALE_H="#include <locale.h>"
else
  INCLUDE_LOCALE_H="\
/* The system does not provide the header <locale.h>.  Take care yourself.  */"
fi
AC_SUBST(INCLUDE_LOCALE_H)

dnl The gettextize script test for the version of the aclocal.m4 file in
dnl user's project.  This must correspond to the number the aclocal.m4
dnl here has.  Extract it.
changequote(,)dnl
ACLOCAL_VERSION=`sed -e 's/.*Last updated for gettext-\([0-9][0-9]*\.[0-9][0-9]*\(\.[0-9][0-9]*\)\).*/\1/p' -e d $srcdir/aclocal.m4`
changequote([, ])dnl
AC_SUBST(ACLOCAL_VERSION)


dnl Generate the version information file in the intl/ directory.
test -d intl || mkdir intl
echo "GNU gettext library from $PACKAGE-$VERSION" > intl/VERSION

AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)

AC_OUTPUT([Makefile lib/Makefile intl/Makefile src/Makefile \
           po/Makefile.in doc/Makefile checks/Makefile \
	   misc/Makefile misc/gettextize intl/intlh.inst],
	  [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
	   echo timestamp > stamp-h ])
