dnl Process this file with autoconf to produce a configure script.

AC_INIT(src/evtrec.c)

dnl ***************************************************************************
dnl definitions

PACKAGE="eventlog"
VERSION="`cat $srcdir/VERSION`"

dnl ***************************************************************************
dnl Initial setup

if test -r $srcdir/dist.conf; then
        # read defaults, dist.conf does not change
        # values for parameters that are already set
        source $srcdir/dist.conf
fi

if test "`uname -s`" = "Linux";then
        CURRDATE=`date -R`
else
        CURRDATE=`date +"%a, %d %b %Y %H:%M:%S %Z"`
fi

AM_INIT_AUTOMAKE($PACKAGE, $VERSION, 1)
if test -n "$SNAPSHOT_VERSION"; then
        VERSION=$VERSION+$SNAPSHOT_VERSION
fi

AC_CONFIG_MACRO_DIR([m4])

AM_CONFIG_HEADER(config.h)


AC_ARG_ENABLE(dlsym-wrapper,
	[  --enable-dlsym-wrapper	Enable dlsym based syslog wrapper],
	enable_dlsym_wrapper=yes)

AC_ARG_ENABLE(debug,
	[  --enable-debug	Enable debug information],
	enable_debug=yes,
        enable_debug=no)

dnl Checks for programs.
AC_PROG_CC
AM_PROG_LIBTOOL

dnl Checks for libraries.

dnl Checks for header files.

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

dnl Checks for library functions.
AC_CHECK_FUNCS(strdup strerror)

if test "x$ac_compiler_gnu" = "xyes"; then
	CFLAGS="${CFLAGS} -Wall"
	if test "x$enable_debug" = "xyes"; then
		CFLAGS="-Wall -g"
	fi
	CPPFLAGS="-D_GNU_SOURCE"
fi

if test x$enable_dlsym_wrapper = xyes; then
	AC_CHECK_LIB(dl, dlsym)
	AC_DEFINE(ENABLE_DLSYM_WRAPPER, 1, [enable DLSYM wrapper])
fi

AC_SUBST(CURRDATE)
AC_SUBST(RELEASE_TAG)
AC_SUBST(SNAPSHOT_VERSION)
AC_SUBST(SOURCE_REVISION)


AC_OUTPUT(Makefile 
        src/Makefile 
        tests/Makefile
        tgzbuild/Makefile
        tgz2build/Makefile
        eventlog.pc 
        eventlog.spec.bb 
        solbuild/Makefile
        winbuild/Makefile
        )
