AC_INIT(grep-dctrl.c)

AC_CHECK_PROG(have_dpkg_pc, dpkg-parsechangelog, yes, no)
if test "$have_dpkg_pc" = "yes"
then
    vers=`dpkg-parsechangelog | grep '^Version' | cut -b10-`
else
    vers="1.x"
    AC_MSG_WARN([cannot determine package version!])
fi

AM_INIT_AUTOMAKE(grep-dctrl,$vers)

AC_PROG_CC

AC_CHECK_LIB(pub, getaline,,[AC_MSG_ERROR(you need publib)])

dnl PACKAGE=grep-dctrl
dnl VERSION=`dpkg-parsechangelog | grep Version | cut -b10-`
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

ALL_LINGUAS="fi"
AM_GNU_GETTEXT

AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPTLONG),
              [EXTRASRC="$EXTRASRC \$(srcdir)/getopt.c \$(srcdir)/getopt1.c"
               EXTRAOBJ="$EXTRAOBJ getopt.o getopt1.o"])

COPYING=\"/usr/share/common-licenses/GPL\"
AC_ARG_ENABLE(copying, [  --enable-copying=FNAME    tell the program that the file COPYING is FNAME],[
 if test "$enableval" = no
 then
   COPYING=\"/usr/share/common-licenses/GPL\"
 else
   COPYING=\"$enableval\"
 fi
])
AC_DEFINE_UNQUOTED(COPYING, $COPYING)


AC_OUTPUT(Makefile intl/Makefile po/Makefile.in)
