Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

359 lines (326 sloc) 12.097 kb
dnl
dnl configuration script for hamsterdb
dnl
dnl Copyright (C) 2005-2011 Christoph Rupp (chris@crupp.de).
dnl All rights reserved. See file LICENSE for licence and copyright
dnl information
dnl
dnl Initialize autoconf/automake
AC_INIT(hamsterdb, 2.0.2)
AC_CANONICAL_HOST
AC_CONFIG_SRCDIR(src/hamsterdb.cc)
AC_CONFIG_MACRO_DIR(m4)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
AC_COPYRIGHT([
Copyright (C) 2005-2012 Christoph Rupp (chris@crupp.de)
])
AC_PROG_CC
AC_PROG_CC_STDC
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CXX
LT_INIT # replaces AC_PROG_RANLIB
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_SED
AC_HEADER_STDC
AC_C_CONST
AC_TYPE_SIZE_T
AC_CHECK_FUNCS(mmap munmap getpagesize fdatasync fsync writev)
AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h)
AC_TYPE_OFF_T
AC_FUNC_MMAP
BOOST_REQUIRE()
# ARM emulators w/ qemu: disable pread/pwrite; the functions exist, but
# seem to be buggy
case $host in
arm-*-linux-gnu)
;;
*)
AC_CHECK_FUNCS(pread pwrite)
;;
esac
# A string describing all enabled/disabled settings
settings=""
# Default settings: -Wall
CFLAGS="${CFLAGS} -Wall"
# -------------------------------------------------------------------------
# Enable debug mode?
# -------------------------------------------------------------------------
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[Build with diagnostics and debug symbols (slow!)]))
if test "$enable_debug" = "yes"
then
CFLAGS=`echo "$CFLAGS" | sed 's/-O. / /g'`
CFLAGS="${CFLAGS} -g -DHAM_DEBUG"
settings="$settings (debug)"
fi
# -------------------------------------------------------------------------
# Overwrite JDK path; if $JDK is empty then fallback to $JAVA_HOME
# -------------------------------------------------------------------------
AC_ARG_WITH(jdk, [ --with-jdk=[PATH] set JDK path])
if test "$with_jdk" != ""
then
JDK="$with_jdk"
fi
if test -d "$JDK"
then
printf ""
else
JDK="$JAVA_HOME"
fi
# -------------------------------------------------------------------------
# Disable java wrapper?
# -------------------------------------------------------------------------
AC_ARG_ENABLE(java,
AC_HELP_STRING([--disable-java],
[Do not build the Java wrapper]))
if test "$enable_java" = "no"; then
settings="$settings (no java)"
else
if test "$JDK" = ""; then
settings="$settings (no java)"
enable_java="no"
fi
fi
AM_CONDITIONAL(ENABLE_JAVA, test "x$enable_java" != "xno")
if test "x$enable_java" != "xno"
then
if test -d "$JDK"
then
AC_MSG_RESULT(["Found JDK at $JDK"])
else
AC_MSG_ERROR(["JDK not found - please either set JDK or JAVA_HOME, or use the switch --with-jdk=PATH"])
exit -1
fi
CFLAGS="${CFLAGS} -I$JDK/include -I$JDK/include/linux -I$JDK/include/solaris -I$JDK/include/mac"
settings="$settings (java)"
fi
# -------------------------------------------------------------------------
# Enable profiling mode
# -------------------------------------------------------------------------
AC_ARG_ENABLE(profile,
AC_HELP_STRING([--enable-profile],
[Build with profiling information (gprof)]))
if test "$enable_profile" = "yes"
then
CFLAGS="${CFLAGS} -pg"
settings="$settings (profile)"
fi
# -------------------------------------------------------------------------
# Enable test coverage
# -------------------------------------------------------------------------
AC_ARG_ENABLE(gcov,
AC_HELP_STRING([--enable-gcov],
[Build with test coverage information (gconf)]))
if test "$enable_gcov" = "yes"
then
CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
settings="$settings (test-coverage)"
fi
# -------------------------------------------------------------------------
# Enable internal functions (obsolete)
# -------------------------------------------------------------------------
AC_ARG_ENABLE(internal,
AC_HELP_STRING([--enable-internal],
[obsolete; internal functions are now enabled by default]))
# -------------------------------------------------------------------------
# Disable AES encryption
# -------------------------------------------------------------------------
AC_ARG_ENABLE(encryption,
AC_HELP_STRING([--disable-encryption],
[Disable AES encryption (ham_enable_encryption)]))
if test "$enable_encryption" = "no"; then
CFLAGS="${CFLAGS} -DHAM_DISABLE_ENCRYPTION"
settings="$settings (no encryption)"
fi
AM_CONDITIONAL(ENABLE_ENCRYPTION, test "x$enable_encryption" != "xno")
# -------------------------------------------------------------------------
# Disable zlib compression
# -------------------------------------------------------------------------
AC_ARG_ENABLE(compression,
AC_HELP_STRING([--disable-compression],
[Disable zlib compression (ham_enable_compression)]))
if test "$enable_compression" = "no"; then
CFLAGS="${CFLAGS} -DHAM_DISABLE_COMPRESSION"
settings="$settings (no compression)"
fi
AM_CONDITIONAL(ENABLE_COMPRESSION, test "x$enable_compression" != "xno")
# -------------------------------------------------------------------------
# Disable server
# -------------------------------------------------------------------------
AC_ARG_ENABLE(server,
AC_HELP_STRING([--disable-server],
[Disable build of the server (hamsvr)]))
if test "$enable_server" = "no"; then
settings="$settings (no server)"
fi
AM_CONDITIONAL(ENABLE_SERVER, test "x$enable_server" != "xno")
# -------------------------------------------------------------------------
# Use system zlib
# -------------------------------------------------------------------------
AC_ARG_ENABLE(system-zlib,
AC_HELP_STRING([--enable-system-zlib],
[Use an already installed zlib]))
if test "$enable_system_zlib" = "yes"
then
CFLAGS="${CFLAGS} -DHAM_USE_SYSTEM_ZLIB"
settings="$settings (system-zlib)"
fi
AM_CONDITIONAL(SYSTEM_ZLIB, test "x$enable_system_zlib" == "xyes")
# -------------------------------------------------------------------------
# Check for little endian/big endian
# -------------------------------------------------------------------------
AC_C_BIGENDIAN(
ac_big_endian=yes,
ac_big_endian=no,
ac_big_endian=no)
if test $ac_big_endian = yes; then
CFLAGS="${CFLAGS} -DHAM_BIG_ENDIAN"
settings="$settings (big endian)"
else
CFLAGS="${CFLAGS} -DHAM_LITTLE_ENDIAN"
settings="$settings (little endian)"
fi
# -------------------------------------------------------------------------
# Check for __FUNCTION__ macro
# -------------------------------------------------------------------------
AC_CACHE_CHECK(whether the compiler supports __FUNCTION__ macro,
ac_cv_FUNCTION1,
[AC_TRY_RUN([
int main(void) {
char *p=__FUNCTION__;
return 0;
}],ac_cv_FUNCTION1=yes,ac_cv_FUNCTION1=no,ac_cv_FUNCTION1=no)])
if test $ac_cv_FUNCTION1 = yes; then
AC_DEFINE(HAVE_FUNCTION_MACRO,1,[__FUNCTION__ is supported])
fi
# -------------------------------------------------------------------------
# Check if we use gcc >= 4.3 - if yes, disable some optimizations
# -------------------------------------------------------------------------
AC_CACHE_CHECK(whether we need -fno-tree-vectorize,
ac_cv_FUNCTION2,
[AC_TRY_RUN([
int main(void) {
#if !(__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
#error "this gcc is ok"
#endif
return 0;
}],ac_cv_FUNCTION2=yes,ac_cv_FUNCTION2=no,ac_cv_FUNCTION2=no)])
if test $ac_cv_FUNCTION2 = yes; then
CFLAGS="${CFLAGS} -fno-tree-vectorize"
fi
# -------------------------------------------------------------------------
# Check for O_LARGEFILE
# -------------------------------------------------------------------------
AC_CACHE_CHECK(for support of the O_LARGEFILE flag,ac_cv_largefile,
[AC_TRY_RUN([
#define _GNU_SOURCE 1 /* for O_LARGEFILE */
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
int main(void) {
int i=(int)O_LARGEFILE;
return 0;
}],ac_cv_largefile=yes,ac_cv_largefile=no,ac_cv_largefile=no)])
if test $ac_cv_largefile = yes; then
AC_DEFINE(HAVE_O_LARGEFILE,1,[flag O_LARGEFILE is supported])
CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
fi
# -------------------------------------------------------------------------
# Check for O_NOATIME
# -------------------------------------------------------------------------
AC_CACHE_CHECK(for support of the O_NOATIME flag,ac_cv_noatime,
[AC_TRY_RUN([
#define _GNU_SOURCE 1 /* for O_NOATIME */
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
int main(void) {
int i=(int)O_NOATIME;
return i;
}],ac_cv_noatime=yes,ac_cv_noatime=no,ac_cv_noatime=no)])
if test $ac_cv_noatime = yes; then
AC_DEFINE(HAVE_O_NOATIME,1,[flag O_NOATIME is supported])
fi
# -------------------------------------------------------------------------
# Check if protocol buffers are installed
# -------------------------------------------------------------------------
AC_LANG(C++)
AC_CACHE_CHECK(if google protocol buffers are installed,ac_cv_protobuf,
[AC_TRY_RUN([
#include <google/protobuf/message.h>
int main(void) {
return 0;
}],ac_cv_protobuf=yes,ac_cv_protobuf=no,ac_cv_protobuf=no)])
if test "x$enable_remote" != "xno"; then
if test "x$ac_cv_protobuf" = "xno"; then
settings="$settings (protobuf missing - remote disabled)"
enable_remote="no"
fi
fi
AC_LANG(C)
# -------------------------------------------------------------------------
# Check if libcurl is installed
# -------------------------------------------------------------------------
AC_CACHE_CHECK(if libcurl is installed,ac_cv_libcurl,
[AC_TRY_RUN([
#include <curl/curl.h>
int main(void) {
return 0;
}],ac_cv_libcurl=yes,ac_cv_libcurl=no,ac_cv_libcurl=no)])
if test "x$enable_remote" != "xno"; then
if test "x$ac_cv_libcurl" = "xno"; then
settings="$settings (libcurl missing - remote disabled)"
enable_remote="no"
fi
fi
# -------------------------------------------------------------------------
# Disable remote client
# -------------------------------------------------------------------------
AC_ARG_ENABLE(remote,
AC_HELP_STRING([--disable-remote],
[Disable access to remote databases]))
if test "$enable_remote" = "no"; then
settings="$settings (no remote access)"
fi
AM_CONDITIONAL(ENABLE_REMOTE, test "x$enable_remote" != "xno")
# -------------------------------------------------------------------------
# Solaris: add a flag
# -------------------------------------------------------------------------
case $host in
*-solaris*)
CFLAGS="${CFLAGS} -DHAM_SOLARIS"
;;
*)
;;
esac
CXXFLAGS=${CFLAGS}
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
AC_CONFIG_FILES(Makefile src/Makefile src/protocol/Makefile include/Makefile include/ham/Makefile samples/Makefile unittests/Makefile 3rdparty/Makefile 3rdparty/aes/Makefile 3rdparty/zlib/Makefile 3rdparty/json/Makefile 3rdparty/mongoose/Makefile tools/Makefile src/server/Makefile java/Makefile java/java/Makefile java/src/Makefile java/unittests/Makefile)
AC_OUTPUT
# Messages
printf '#================================================================\n'
printf "# Configuring hamsterdb version $PACKAGE_VERSION\n"
printf "# Settings:$settings\n"
if test "x$enable_remote" = "xno"; then
printf "#\n"
printf "# The remote functionality is disabled because you specified\n"
printf "# --disable-remote or because of missing dependencies!\n"
fi
if test "x$enable_java" = "xno"; then
printf "#\n"
printf "# The Java API is not built because you specified\n"
printf "# --disable-java or because \$JDK is not set\n"
fi
printf '#================================================================\n'
# build protobuf files
if test "x$enable_remote" != "xno"; then
cd src/protocol && make proto
fi
Jump to Line
Something went wrong with that request. Please try again.