You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 lines
6.2 KiB

dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.58)
AC_INIT(OpenSync, 0.22, [], libopensync)
AC_CONFIG_SRCDIR([opensync/opensync.h])
AM_INIT_AUTOMAKE(foreign)
AM_CONFIG_HEADER(config.h)
#### Defaults #####
WITH_DEBUG=yes
WITH_TRACE=yes
ENABLE_ENGINE=yes
ENABLE_TESTS=no
WITH_TOOLS=yes
WITH_PROF=no
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PROG_YACC
OPENSYNC_CONFIGDIR=${datadir}/opensync/defaults
AC_SUBST(OPENSYNC_CONFIGDIR)
OPENSYNC_PLUGINDIR=${libdir}/opensync/plugins
AC_SUBST(OPENSYNC_PLUGINDIR)
OPENSYNC_FORMATSDIR=${libdir}/opensync/formats
AC_SUBST(OPENSYNC_FORMATSDIR)
OPENSYNC_HEADERDIR=${includedir}/opensync-1.0/opensync
AC_SUBST(OPENSYNC_HEADERDIR)
OPENSYNC_ENGINEHEADERDIR=${includedir}/opensync-1.0/osengine
AC_SUBST(OPENSYNC_ENGINEHEADERDIR)
AS_AC_EXPAND(OSPLUGIN, $libexecdir/osplugin)
AC_DEFINE_UNQUOTED(OSPLUGIN, ["${OSPLUGIN}"], [Full path to osplugin binary])
AC_ARG_ENABLE(engine,
AS_HELP_STRING([--enable-engine], [enable building of the opensync engine]),
ENABLE_ENGINE=$enableval)
if test "x${ENABLE_ENGINE}" = "xyes"; then
AC_DEFINE(BUILD_ENGINE,1,[Stress Testing])
fi
AC_SUBST(BUILD_ENGINE)
AM_CONDITIONAL(BUILD_ENGINE, test x$ENABLE_ENGINE = xyes)
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug], [enable debug messages]),
WITH_DEBUG=$enableval)
if test "x${WITH_DEBUG}" = "xyes"; then
AC_DEFINE(ENABLE_DEBUG,1,[Debugging])
AC_SUBST(ENABLE_DEBUG)
fi
AC_ARG_ENABLE(tracing,
AS_HELP_STRING([--enable-tracing], [enable tracing]),
WITH_TRACE=$enableval)
if test "x${WITH_TRACE}" = "xyes"; then
AC_DEFINE(ENABLE_TRACE,1,[Tracing])
AC_SUBST(ENABLE_TRACE)
fi
AC_ARG_ENABLE(profiling,
AS_HELP_STRING([--enable-profiling], [enable code profiling]),
WITH_PROF=$enableval)
if test "x${WITH_PROF}" = "xyes"; then
GCOV_CFLAGS=" -I/usr/lib/tau/include -DPROFILING_ON -DTAU_STDCXXLIB -DTAU_GNU -DTAU_DOT_H_LESS_HEADERS -fPIC -DPTHREADS"
GCOV_LDFLAGS=" -L/usr/lib/tau/i386_linux/lib -ltau-pthread -lstdc++"
AC_DEFINE(ENABLE_PROF,1,[Profiling])
else
GCOV_CFLAGS=""
GCOV_LDFLAGS=""
fi
AC_SUBST(GCOV_CFLAGS)
AC_SUBST(GCOV_LDFLAGS)
AM_CONDITIONAL(ENABLE_PROF, test "x${WITH_PROF}" = "xyes")
AC_ARG_ENABLE(tools,
AS_HELP_STRING([--enable-tools], [enables building of the tools]),
WITH_TOOLS=$enableval)
AM_CONDITIONAL(ENABLE_TOOLS, test "x${WITH_TOOLS}" = "xyes")
#### Check for libxml ####
PKG_CHECK_MODULES(XML, [libxml-2.0])
AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBS)
#### Check for unit tests ####
AC_ARG_ENABLE(unit-tests,
AS_HELP_STRING([--enable-unit-tests], [enable unit tests]),
ENABLE_TESTS=$enableval)
testdir=""
if test "x${ENABLE_TESTS}" = "xyes"; then
AC_CHECK_HEADER(check.h,HAVE_CHECK=1,HAVE_CHECK=0)
if test "x${HAVE_CHECK}" = "x1"; then
AM_PATH_CHECK(0.9.0)
fi
fi
AM_CONDITIONAL(ENABLE_TESTS, test x$HAVE_CHECK = x1)
#### Check for Python and Swig ####
#(need python, python headers, and pyrex)
AC_ARG_ENABLE(python,
AS_HELP_STRING([--enable-python@<:@=minimum_version@:>@], [build python bindings]),
[enable_python=$enableval], [enable_python=auto])
if test x$enable_python = xno; then
have_python=no
else
AC_MSG_NOTICE([Checking to see if we can build Python bindings])
have_python=no
if test x$enable_python != xyes -a x$enable_python != xauto; then
minimum_version=$enable_python
enable_python=yes
else
minimum_version=2.2
fi
AM_PATH_PYTHON($minimum_version)
AM_CHECK_PYTHON_HEADERS([have_python_header=yes], [have_python_header=no])
if test x$have_python_header = xno ; then
if test x$enable_python = xyes ; then
AC_MSG_ERROR([Building python explicitly requested, but can't build python bindings])
fi
else
if test -z "$PYTHON" ; then
AC_MSG_WARN([Python not found])
else
AC_PROG_SWIG(1.3.17)
SWIG_PYTHON
if test x$SWIG_LIB = x; then
have_python=no
else
have_python=yes
fi
fi
if test x$have_python = xno ; then
if test x$enable_python = xyes ; then
AC_MSG_ERROR([Building python explicitly requested, but can't build python bindings])
fi
fi
fi
fi
AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes)
#### Check for glib and sqlite ####
pkg_modules="glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0 sqlite3"
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
AC_SUBST(PACKAGE_CFLAGS)
AC_SUBST(PACKAGE_LIBS)
# Workaround for autoconf 2.58, in which abs_builddir/abs_srcdir are not
# absolute at all.
# These are used in *-uninstalled.pc.in
AC_SUBST(ac_workaround_abs_builddir, $PWD) # builddir is defined as '.'
AC_SUBST(ac_workaround_abs_srcdir, $PWD/$srcdir)
#### Check for Solaris (SunOS) ####
OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
if test "$OS" = "sunos"; then
AC_MSG_NOTICE([OS Solaris detected])
AC_DEFINE([SOLARIS], [], [Compiling on Solaris])
else
if test "$OS" = "linux"; then
AC_MSG_NOTICE([OS Linux detected])
AC_DEFINE([LINUX], [], [Compiling on Linux])
else
AC_MSG_NOTICE([Unknown OS detected])
fi
fi
AC_OUTPUT([
Makefile
opensync/Makefile
tools/Makefile
tests/Makefile
tests/mock-plugin/Makefile
formats/Makefile
formats/vformats-xml/Makefile
osengine/Makefile
osplugin/Makefile
opensync-1.0.pc
opensync-1.0-uninstalled.pc
osengine-1.0.pc
osengine-1.0-uninstalled.pc
Doxyfile
wrapper/Makefile
])
# AC_OPENSYNC_ISENABLED(NAME, VARIABLE, [TESTFOR = yes])
AC_DEFUN([AC_OPENSYNC_ISENABLED],
[
if test "$3"; then
ac_opensync_isenabled_testfor="$3"
else
ac_opensync_isenabled_testfor="yes"
fi
if test "x${$2}" = "x${ac_opensync_isenabled_testfor}"; then
echo "AS_HELP_STRING([$1:], Enabled)"
else
echo "AS_HELP_STRING([$1:], Disabled)"
fi
])
echo ""
echo "========================================"
AC_OPENSYNC_ISENABLED([Python Bindings], have_python)
AC_OPENSYNC_ISENABLED([Unit Tests], ENABLE_TESTS)
AC_OPENSYNC_ISENABLED([Debug messages], WITH_DEBUG)
AC_OPENSYNC_ISENABLED([Tracing], WITH_TRACE)
AC_OPENSYNC_ISENABLED([Profiling], WITH_PROF)
AC_OPENSYNC_ISENABLED([Sync Engine], ENABLE_ENGINE)
AC_OPENSYNC_ISENABLED([Tools], WITH_TOOLS)
echo
echo "Now build opensync and install it."
echo "Afterwards go into the plugins directory"
echo "and build the plugins you need."
echo "========================================"