dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.53)

AC_INIT(src)

AM_MAINTAINER_MODE

AM_INIT_AUTOMAKE(gpr, 0.9)

AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR([config.h.in])

dnl AC_PROG_INTLTOOL([0.25])

GETTEXT_PACKAGE=gpr
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Define to the Gettext package name])

dnl Add the languages which your application supports here.
ALL_LINGUAS=""
AM_GNU_GETTEXT([external]) 

# Checks for programs.
AC_PROG_CC
AC_ISC_POSIX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AM_PROG_LIBTOOL


dnl  AM_PROG_CC_STDC
# Checks for typedefs, structures, and compiler characteristics.
dnl AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T

dnl warnings

WARNS=""
AC_ARG_ENABLE(debug, 
  [  --enable-debug turn on debugging (assumes gcc/gdb) [default=no]],
WARNS="-W -Wall -Wundef -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wshadow -O0 -ggdb3")
AC_SUBST(WARNS)

AC_ARG_ENABLE(local-libppd, 
  [ --enable-local-libppd specify the local paths to libppd],
  [ # This is passed into the automake process 
    LIBPPD_LIBS="${enableval}/libppd.la"
    LIBPPD_INCLUDES="-I${enableval}"
  ],[
    LIBPPD_LIBS=""
  ]
)
AC_SUBST(LIBPPD_LIBS)
AC_SUBST(LIBPPD_INCLUDES)


dnl Pick up the Gnome macros.
dnl AM_ACLOCAL_INCLUDE(macros)
dnl GNOME_INIT
dnl GNOME_COMPILE_WARNINGS
dnl GNOME_X_CHECKS


dnl Set PACKAGE_LOCALE_DIR in config.h.
dnl Subst PACKAGE_PIXMAPS_DIR.
dnl Subst PACKAGE_SCRIPTS_DIR.
if test "x${prefix}" = "xNONE"; then
  kjwerojgr="${ac_default_prefix}/${DATADIRNAME}/locale"
 else
  kjwerojgr= "${prefix}/${DATADIRNAME}/locale"
fi
AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR,"$kjwerojgr" ,[fixme])

AC_DEFINE([HAVE_LIBSM], [], [fixme])

dnl Check for libraries
# if the --enable-local-snmpkit was passed in assume that the 
# the person who is building this knows what they are doing and
# skip the test to make sure that the header file and lib is 
# actually installed.
if test -z "${LIBPPD_LIBS}"; then
  AC_CHECK_HEADERS(ppd.h,,[
    AC_MSG_ERROR(Must have ppd.h header to compile gpr)])
  AC_CHECK_LIB(ppd,ppd_file_new,,[
    AC_MSG_ERROR(Must have libppd installed to compiler gpr)])
fi
AC_CHECK_LIB(xml,xmlGetProp,,[
  AC_MSG_ERROR(Must have libxml installed to compile gpr)])

dnl loads in the magic pixie dust for the m4 files
dnl TESTSCRIPTS=`cd src/tests && echo *.m4 | sed "s/m4/sh/g"`
dnl AC_SUBST(TESTSCRIPTS)

dnl macros/Makefile

AC_OUTPUT([ 
m4/Makefile
po/Makefile.in 
Makefile
gpr.spec
src/Makefile
pixmaps/Makefile
])

