Skip to content
configure.ac 2.45 KiB
Newer Older
Seblu's avatar
Seblu committed
#   This file is part of SLS.
#   Copyright (C) 2008 Sebastien LUTTRINGER <contact@seblu.net>

#   SLS is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
Seblu's avatar
Seblu committed
#   the Free Software Foundation; version 2 of the License.
Seblu's avatar
Seblu committed

#   SLS is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.

#   You should have received a copy of the GNU General Public License
#   along with SLS; if not, write to the Free Software
#   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Seblu's avatar
Seblu committed
# Require a recent version of autotools
AC_PREREQ(2.59)

# Auto conf init
Seblu's avatar
Seblu committed
AC_INIT([sls],[1.0],[contact@seblu.net],[sls])
Seblu's avatar
Seblu committed

# Define configure generator directory
AC_CONFIG_AUX_DIR([build])

# Auto Make init
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip subdir-objects])
Seblu's avatar
Seblu committed

# 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]
)
Seblu's avatar
Seblu committed

# 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]
)
Seblu's avatar
Seblu committed

# with-efence arg
AC_ARG_WITH([efence],
Seblu's avatar
Seblu committed
  [AS_HELP_STRING([--with-efence], [Link with Electric-Fence library])],
  [],
  [with_efence=no]
)
Seblu's avatar
Seblu committed

# Default CXX Flags
Seblu's avatar
Seblu committed
CXXFLAGS='-Wall -W -ansi -pedantic -D_XOPEN_SOURCE=600 -pipe'
Seblu's avatar
Seblu committed

# Set Error flags
AS_IF([test "x$with_error" != xno],[CXXFLAGS="$CXXFLAGS -Werror"])
Seblu's avatar
Seblu committed

# Set Debug flags
Seblu's avatar
Seblu committed
AS_IF([test "x$with_debug" != xyes],[CXXFLAGS="$CXXFLAGS -DNDEBUG -O3"], [CXXFLAGS="$CXXFLAGS -g"])
Seblu's avatar
Seblu committed

# Check for C++ compiler
AC_LANG([C++])
AC_PROG_CXX
Seblu's avatar
Seblu committed

# Check for Make
AC_PROG_MAKE_SET
Seblu's avatar
Seblu committed

# 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!])])
Seblu's avatar
Seblu committed
AC_CHECK_LIB([pthread], [pthread_create],,[AC_MSG_ERROR([Library pthread not found!])])
Seblu's avatar
Seblu committed

# Set efence library
AS_IF([test "x$with_efence" = "xyes" ],
      [AC_CHECK_LIB([efence], [malloc],
Seblu's avatar
Seblu committed
		    [],
		    [AC_MSG_ERROR([Electric-Fence library not found!])])])
Seblu's avatar
Seblu committed


AC_SUBST([CXXFLAGS])
AC_SUBST([LDFLAGS])

AC_HEADER_STDC

AC_CONFIG_HEADERS([config.h])
AC_CHECK_HEADERS([stdlib.h])

# define Autoconf config files
AC_CONFIG_FILES([
	Makefile
])

AC_OUTPUT