dnl Process this file with autoconf to create configure.
AC_INIT(intltoolize.in)
INTLTOOL_VERSION=0.33

AM_INIT_AUTOMAKE(intltool, $INTLTOOL_VERSION)

pkgdatadir='${datadir}'"/${PACKAGE}"
AC_SUBST(pkgdatadir) dnl automake does not need this, but libtoolize does
aclocaldir='${datadir}'/aclocal
AC_SUBST(aclocaldir)

AC_PATH_PROG(PERL, perl)
if test -z "$PERL"; then
   AC_MSG_ERROR([perl not found])
fi
if test -z "`$PERL -v | fgrep 'v5.' 2> /dev/null`" -a -z "`$PERL -v | fgrep 'version 5.' 2> /dev/null`"; then
   AC_MSG_ERROR([perl 5.x required for intltool])
fi
AC_MSG_CHECKING([for XML::Parser])
if `$PERL -e "require XML::Parser" 2>/dev/null`; then
   AC_MSG_RESULT([ok])
else
   AC_MSG_ERROR([XML::Parser perl module is required for intltool])
fi

AC_PATH_PROG(INTLTOOL_ICONV, iconv, iconv)
AC_PATH_PROG(INTLTOOL_MSGFMT, msgfmt, msgfmt)
AC_PATH_PROG(INTLTOOL_MSGMERGE, msgmerge, msgmerge)
AC_PATH_PROG(INTLTOOL_XGETTEXT, xgettext, xgettext)

# find the actual value for $prefix that we'll end up with
# i think there's a better way to do this...
REAL_PREFIX=
if test "x$exec_prefix" = "xNONE"; then
  if test "x$prefix" = "xNONE"; then
    REAL_PREFIX=$ac_default_prefix
  else
    REAL_PREFIX=$prefix
  fi
else
  REAL_PREFIX=$exec_prefix
fi

LIBDIR_TMP="$libdir"
old_exec_prefix=$exec_prefix
exec_prefix=$REAL_PREFIX
EXPANDED_LIBDIR=`eval echo $LIBDIR_TMP`
exec_prefix=$old_exec_prefix
AC_SUBST(EXPANDED_LIBDIR)

DATADIR_TMP="$datadir"
old_exec_prefix=$exec_prefix
exec_prefix=$REAL_PREFIX
EXPANDED_DATADIR=`eval echo $DATADIR_TMP`
exec_prefix=$old_exec_prefix
AC_SUBST(EXPANDED_DATADIR)


AC_OUTPUT([
Makefile
doc/Makefile
intltool-extract.in
intltool-merge.in
intltool-prepare
intltool-unicodify
intltool-update.in
intltool.spec
intltoolize
tests/Makefile
tests/cases/Makefile
tests/results/Makefile
tests/selftest.pl
])
