Newer
Older
# Require a recent version of autotools
AC_PREREQ(2.59)
# Auto conf init
AC_INIT([sls],[1.0],[seblu@seblu.net],[sls])
# Define configure generator directory
AC_CONFIG_AUX_DIR([build])
# Auto Make init
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
# Check platform
AC_CANONICAL_HOST
# without-error arg
AC_ARG_WITH([error],
[AS_HELP_STRING([--without-error], [GCC warnings dont make compilation errors])],
[],
[with_error=yes]
)
# with-debug arg
AC_ARG_WITH([debug],
[AS_HELP_STRING([--with-debug], [Use -g and don't use neither -DNDEBUG nor -O3])],
[],
[with_debug=no]
)
# with-efence arg
AC_ARG_WITH([efence],
[AS_HELP_STRING([--with-efence], [Link with efence library])],
[],
[with_efence=no]
)
# Default CXX Flags
CXXFLAGS='-Wall -W -ansi -pedantic -D_XOPEN_SOURCE=600'
# Set Error flags
AS_IF([test "x$with_error" != xno],[CXXFLAGS="$CXXFLAGS -Werror"])
# Set Debug flags
AS_IF([test "x$with_debug" != xyes],[CXXFLAGS="$CXXFLAGS -DNDEBUG -O3"], [CXXFLAGS="$CXXFLAGS -g"])
# Check for C++ compiler
AC_LANG([C++])
AC_PROG_CXX
# Check for libs
AC_CHECK_LIB([sqlite3], [sqlite3_open],,[AC_MSG_ERROR([Library sqlite3 not found!])])
AC_CHECK_LIB([ssl], [SSL_library_init],,[AC_MSG_ERROR([Library ssl not found!])])
# Set efence library
AS_IF([test "x$with_efence" = "xyes" ],
[AC_CHECK_LIB([efence], [malloc],
[LDFLAGS="$LDFLAGS -lefence"; test -r "/usr/include/efence.h" && \
CXXFLAGS="$CXXFLAGS -include stdlib.h -include efence.h"],
[AC_MSG_ERROR([Efence library not found!])])])