AC_PREREQ(2.59)
AC_INIT(l7vsd)
PACKAGENAME=ultramonkeyl7-mod-simple-1.0.0
VERSION=1.0.0

AM_INIT_AUTOMAKE($PACKAGENAME, $VERSION, no-define )
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADER([config.h])

# Checks for programs.
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

# Checks for libraries.
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(log4cxx, main, :,
	[AC_MSG_ERROR( l7vsd require log4cxx library. )] )
AC_CHECK_LIB(rt, main, :,
	[AC_MSG_ERROR( l7vsd require rt library. )] )
AC_CHECK_LIB(boost_thread-mt, main, :,
	[AC_MSG_ERROR( l7vsd require boost library. )] )
AC_CHECK_LIB(boost_system-mt, main, :,
	[AC_MSG_ERROR( l7vsd require boost library. )] )

# Checks for header files.
AC_CHECK_HEADERS([limits.h unistd.h])

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

# Checks for library functions.
AC_HEADER_STDC
AC_FUNC_MKTIME
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([gethostname localtime_r memset])

# application-specific option
if test `uname -m` == "x86_64"; then
	AC_SUBST( libdir, [/usr/lib64] )
else
	AC_SUBST( libdir, [/usr/lib] )
	AC_SUBST( CXXFLAGS, -march=i686 )
fi
AC_SUBST( includedir, [/usr/include] )

AC_ARG_WITH(
	l7vs-moddir,
	[	--with-l7vs-moddir=DIR	l7vs module is to be installed in DIR.
								[default=LIBDIR/l7vs] ],
	[	l7vs_moddir="$withval" ],
	[	l7vs_moddir="${libdir}/l7vs" ]
)

AC_ARG_WITH(
	l7vs-includedir,
	[	--with-l7vs-includedir=DIR	l7vs headerfile is to be installed in DIR.
								[default=INCLUDEDIR/l7vs] ],
	[	l7vs_includedir="$withval" ],
	[	l7vs_includedir="${includedir}/l7vs" ]
)

AC_ARG_WITH(
	l7vs-buffer-size,
	[	--with-l7vs-buffer-size=NUM	l7vsd using heap buffer size.
									[default=4096] ],
	[	l7vs_max_buffer_size="$withval" ],
	[	l7vs_max_buffer_size=4096 ]
)


AC_SUBST(CC,g++)
AC_SUBST(exec_prefix, [/usr] )
AC_SUBST(l7vs_moddir)
AC_SUBST(l7vs_includedir)
AC_SUBST(l7vs_max_buffer_size)
AC_SUBST(MANDIR)
AC_SUBST(ultramonkeyl7_version,ultramonkeyl7-$VERSION)

AC_CONFIG_FILES([Makefile])

AC_OUTPUT
