2015-03-09 04:11:15 -05:00
|
|
|
# -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil -*-
|
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
|
|
|
|
AC_PREREQ([2.69])
|
|
|
|
|
2016-04-10 05:53:06 -05:00
|
|
|
AC_INIT([loolwsd], [1.6.0], [libreoffice@lists.freedesktop.org])
|
2016-04-05 11:41:10 -05:00
|
|
|
LT_INIT([disable-static])
|
2015-03-09 04:11:15 -05:00
|
|
|
|
2015-12-01 21:12:58 -06:00
|
|
|
AM_INIT_AUTOMAKE([1.11 silent-rules subdir-objects])
|
2015-03-09 04:11:15 -05:00
|
|
|
|
2016-04-12 02:39:53 -05:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
|
|
|
|
2015-12-19 12:38:44 -06:00
|
|
|
LOOLWSD_VERSION_MAJOR=`echo $VERSION | awk -F. '{print $1}'`
|
|
|
|
LOOLWSD_VERSION_MINOR=`echo $VERSION | awk -F. '{print $2}'`
|
|
|
|
LOOLWSD_VERSION_MICRO=`echo $VERSION | awk -F. '{print $3}'`
|
|
|
|
LOOLWSD_VERSION="$LOOLWSD_VERSION_MAJOR.$LOOLWSD_VERSION_MINOR.$LOOLWSD_VERSION_MICRO"
|
|
|
|
|
|
|
|
AC_SUBST([LOOLWSD_VERSION_MAJOR])
|
|
|
|
AC_SUBST([LOOLWSD_VERSION_MINOR])
|
|
|
|
AC_SUBST([LOOLWSD_VERSION_MICRO])
|
|
|
|
AC_SUBST([LOOLWSD_VERSION])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([LOOLWSD_VERSION],[["$LOOLWSD_VERSION"]],[LibreOffice On-Line WebSocket server version])
|
|
|
|
|
2015-03-12 07:15:11 -05:00
|
|
|
AC_CONFIG_SRCDIR([LOOLWSD.cpp])
|
2015-03-09 04:11:15 -05:00
|
|
|
|
2016-04-12 03:09:10 -05:00
|
|
|
AC_CONFIG_HEADERS([config.h])
|
|
|
|
|
2015-03-09 04:11:15 -05:00
|
|
|
# Checks for programs.
|
|
|
|
AC_PROG_CXX
|
2015-12-23 08:55:56 -06:00
|
|
|
AC_PROG_CC
|
2015-03-09 04:11:15 -05:00
|
|
|
|
2015-05-11 03:21:07 -05:00
|
|
|
AC_LANG_PUSH([C++])
|
|
|
|
|
2015-05-04 12:17:41 -05:00
|
|
|
AS_IF([test `uname -s` = Linux],
|
|
|
|
[AC_PATH_PROG([SETCAP], setcap,[],[/bin:/usr/bin:/sbin:/usr/sbin])]
|
|
|
|
AS_IF([test -z "$SETCAP"],
|
|
|
|
[AC_MSG_ERROR([The setcap command is needed. It might be in a package called libcap-progs.])]))
|
2015-04-23 08:00:43 -05:00
|
|
|
|
2015-03-09 04:11:15 -05:00
|
|
|
# Declare options
|
|
|
|
AC_ARG_ENABLE([debug],
|
|
|
|
AS_HELP_STRING([--enable-debug],
|
|
|
|
[Enable debugging, link with debugging version of Poco libraries]))
|
|
|
|
|
|
|
|
AC_ARG_WITH([lokit-path],
|
|
|
|
AS_HELP_STRING([--with-lokit-path=<path>],
|
2016-01-06 07:37:21 -06:00
|
|
|
[Path to the "include" directory with the LibreOfficeKit headers]))
|
2015-03-09 04:11:15 -05:00
|
|
|
|
2016-04-05 11:41:10 -05:00
|
|
|
AC_ARG_WITH([lo-path],
|
|
|
|
AS_HELP_STRING([--with-lo-path=<path>],
|
|
|
|
[Path to a working installation directory or instdir of LibreOffice]))
|
|
|
|
|
2015-03-09 04:11:15 -05:00
|
|
|
AC_ARG_WITH([poco-includes],
|
|
|
|
AS_HELP_STRING([--with-poco-includes=<path>],
|
2016-01-06 07:37:21 -06:00
|
|
|
[Path to the "include" directory with the Poco headers]))
|
2015-03-09 04:11:15 -05:00
|
|
|
|
|
|
|
AC_ARG_WITH([poco-libs],
|
|
|
|
AS_HELP_STRING([--with-poco-libs=<path>],
|
2016-01-06 07:37:21 -06:00
|
|
|
[Path to the "lib" directory with the Poco libraries]))
|
2015-03-09 04:11:15 -05:00
|
|
|
|
2015-05-22 04:53:43 -05:00
|
|
|
AC_ARG_WITH([libpng-includes],
|
|
|
|
AS_HELP_STRING([--with-libpng-includes=<path>],
|
2016-01-06 07:37:21 -06:00
|
|
|
[Path to the "include" directory with the libpng headers]))
|
2015-05-22 04:53:43 -05:00
|
|
|
|
|
|
|
AC_ARG_WITH([libpng-libs],
|
|
|
|
AS_HELP_STRING([--with-libpng-libs=<path>],
|
2016-01-06 07:37:21 -06:00
|
|
|
[Path to the "lib" directory with the libpng libraries]))
|
2015-05-22 04:53:43 -05:00
|
|
|
|
2015-10-21 05:01:47 -05:00
|
|
|
AC_ARG_ENABLE([tests],
|
|
|
|
AS_HELP_STRING([--disable-tests],
|
|
|
|
[Build and run unit tests]))
|
|
|
|
|
2016-04-08 04:24:52 -05:00
|
|
|
AC_ARG_ENABLE([ssl],
|
|
|
|
AS_HELP_STRING([--disable-ssl],
|
|
|
|
[Compile without SSL support]))
|
|
|
|
|
2015-03-09 04:11:15 -05:00
|
|
|
# Handle options
|
2016-01-04 02:16:22 -06:00
|
|
|
AS_IF([test "$enable_debug" = yes -a -n "$with_poco_libs"],
|
2015-03-09 04:11:15 -05:00
|
|
|
[POCO_DEBUG_SUFFIX=d],
|
|
|
|
[POCO_DEBUG_SUFFIX=])
|
|
|
|
|
2015-05-13 05:24:05 -05:00
|
|
|
AS_IF([test "$enable_debug" = yes],
|
2016-04-11 12:21:16 -05:00
|
|
|
[AC_DEFINE([ENABLE_DEBUG],1,[Whether to compile in some extra debugging support code and disable some security pieces ])])
|
2015-05-13 05:24:05 -05:00
|
|
|
|
2016-04-11 16:11:38 -05:00
|
|
|
debug_msg="secure mode: product build"
|
|
|
|
if test "$enable_debug" = yes; then
|
|
|
|
debug_msg="low security debugging mode"
|
|
|
|
fi
|
|
|
|
|
2015-03-09 04:11:15 -05:00
|
|
|
# Test for build environment
|
|
|
|
|
|
|
|
CXXFLAGS="$CXXFLAGS -std=c++11"
|
2015-10-28 10:36:57 -05:00
|
|
|
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Werror"
|
2016-01-14 01:51:42 -06:00
|
|
|
CFLAGS="$CFLAGS -Wall -Wextra -Werror"
|
2015-10-28 10:36:57 -05:00
|
|
|
AS_IF([test -z "$with_poco_libs"],
|
|
|
|
[CXXFLAGS="$CXXFLAGS -Wshadow"])
|
2015-03-09 04:11:15 -05:00
|
|
|
|
2016-01-06 07:37:21 -06:00
|
|
|
with_lokit_path=`readlink -f $with_lokit_path`
|
2015-03-09 04:11:15 -05:00
|
|
|
AS_IF([test -n "$with_lokit_path"],
|
|
|
|
[CPPFLAGS="$CPPFLAGS -I${with_lokit_path}"])
|
2016-04-05 11:41:10 -05:00
|
|
|
lokit_msg="$with_lokit_path"
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl lo_path is not required; but useful for testing.
|
|
|
|
dnl
|
|
|
|
LO_PATH=
|
2016-04-11 12:21:16 -05:00
|
|
|
JAIL_PATH=not-set
|
|
|
|
SYSTEMPLATE_PATH=not-set
|
2016-04-05 11:41:10 -05:00
|
|
|
have_lo_path=false
|
|
|
|
AC_MSG_CHECKING([whether to run tests against a LibreOffice])
|
|
|
|
if test -n "$with_lo_path"; then
|
|
|
|
version_file="$with_lo_path/program/versionrc"
|
|
|
|
if test -f $version_file; then
|
|
|
|
LO_PATH="$with_lo_path"
|
2016-04-11 12:21:16 -05:00
|
|
|
JAILS_PATH="\${abs_top_builddir}/jails"
|
|
|
|
SYSTEMPLATE_PATH="\${abs_top_builddir}/systemplate"
|
2016-04-05 11:41:10 -05:00
|
|
|
have_lo_path=true
|
|
|
|
lo_msg="test against $LO_PATH"
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([LibreOffice install looks dodgy, missing $version_file])
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
lo_msg="no integration tests"
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
AC_SUBST(LO_PATH)
|
2016-04-11 12:21:16 -05:00
|
|
|
AC_SUBST(JAILS_PATH)
|
|
|
|
AC_SUBST(SYSTEMPLATE_PATH)
|
2016-04-05 11:41:10 -05:00
|
|
|
AM_CONDITIONAL(HAVE_LO_PATH,[test "$have_lo_path" = "true"])
|
2015-03-09 04:11:15 -05:00
|
|
|
|
|
|
|
AS_IF([test -n "$with_poco_includes"],
|
|
|
|
[CPPFLAGS="$CPPFLAGS -I${with_poco_includes}"])
|
|
|
|
|
|
|
|
AS_IF([test -n "$with_poco_libs"],
|
2015-05-04 12:52:05 -05:00
|
|
|
[LDFLAGS="$LDFLAGS -L${with_poco_libs}"])
|
|
|
|
|
2015-05-22 04:53:43 -05:00
|
|
|
AS_IF([test -n "$with_libpng_includes"],
|
|
|
|
[CPPFLAGS="$CPPFLAGS -I${with_libpng_includes}"])
|
|
|
|
|
|
|
|
AS_IF([test -n "$with_libpng_libs"],
|
|
|
|
[LDFLAGS="$LDFLAGS -L${with_libpng_libs}"])
|
|
|
|
|
2015-05-04 12:52:05 -05:00
|
|
|
AS_IF([test `uname -s` = Linux],
|
|
|
|
[AS_IF([test -n "$with_poco_libs"],
|
|
|
|
[LDFLAGS="$LDFLAGS -Wl,-rpath,${with_poco_libs}"])])
|
2015-03-09 04:11:15 -05:00
|
|
|
|
2015-03-09 06:40:27 -05:00
|
|
|
AS_IF([test `uname -s` != Darwin],
|
|
|
|
[AC_SEARCH_LIBS([dlopen],
|
|
|
|
[dl dld],
|
2015-03-09 07:11:39 -05:00
|
|
|
[],
|
2015-03-09 06:40:27 -05:00
|
|
|
[AC_MSG_ERROR([dlopen not found])])])
|
2015-03-09 04:11:15 -05:00
|
|
|
|
|
|
|
AC_SEARCH_LIBS([png_create_write_struct],
|
2015-03-09 06:40:27 -05:00
|
|
|
[png],
|
|
|
|
[],
|
|
|
|
[AC_MSG_ERROR([libpng not available?])])
|
2015-03-09 04:11:15 -05:00
|
|
|
|
2015-05-04 12:17:41 -05:00
|
|
|
AS_IF([test `uname -s` = Linux],
|
|
|
|
[AC_SEARCH_LIBS([cap_get_proc],
|
|
|
|
[cap],
|
|
|
|
[],
|
|
|
|
[AC_MSG_ERROR([libcap not available?])])])
|
2015-04-27 13:55:36 -05:00
|
|
|
|
2015-10-21 05:01:47 -05:00
|
|
|
AS_IF([test "$enable_tests" != "no"],
|
|
|
|
[PKG_CHECK_MODULES([CPPUNIT], [cppunit])])
|
|
|
|
|
2016-04-08 04:24:52 -05:00
|
|
|
AS_IF([test "$enable_ssl" != "no"],
|
2016-04-08 06:35:17 -05:00
|
|
|
[AC_DEFINE([ENABLE_SSL],1,[Enable SSL])])
|
2016-04-08 04:24:52 -05:00
|
|
|
|
2016-04-11 16:11:38 -05:00
|
|
|
if test "$enable_ssl" != "no"; then
|
|
|
|
ssl_msg="ssl enabled"
|
|
|
|
else
|
|
|
|
ssl_msg="insecure: ssl disabled"
|
|
|
|
fi
|
|
|
|
|
2016-03-21 03:37:39 -05:00
|
|
|
LIBS="$LIBS -lPocoNet${POCO_DEBUG_SUFFIX} -lPocoUtil${POCO_DEBUG_SUFFIX} -lPocoJSON${POCO_DEBUG_SUFFIX} -lPocoFoundation${POCO_DEBUG_SUFFIX} -lPocoXML${POCO_DEBUG_SUFFIX} -lPocoNetSSL${POCO_DEBUG_SUFFIX} -lPocoCrypto${POCO_DEBUG_SUFFIX}"
|
2015-03-09 04:11:15 -05:00
|
|
|
|
|
|
|
AC_CHECK_HEADERS([LibreOfficeKit/LibreOfficeKit.h],
|
|
|
|
[],
|
|
|
|
[AC_MSG_ERROR([header LibreOfficeKit/LibreOfficeKit.h not found, perhaps you want to use --with-lokit-path])])
|
|
|
|
AC_CHECK_HEADERS([Poco/Net/WebSocket.h],
|
|
|
|
[],
|
|
|
|
[AC_MSG_ERROR([header Poco/Net/WebSocket.h not found, perhaps you want to use --with-poco-includes])])
|
|
|
|
|
2015-05-11 03:21:07 -05:00
|
|
|
AC_MSG_CHECKING([POCO version])
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
|
|
|
#include <Poco/Version.h>
|
2016-03-21 09:28:33 -05:00
|
|
|
#if POCO_VERSION < 0x01070100
|
|
|
|
#error Require Poco 1.7.1 or newer
|
2015-05-11 03:21:07 -05:00
|
|
|
#endif
|
|
|
|
])],
|
|
|
|
[AC_MSG_RESULT([OK])],
|
|
|
|
[AC_MSG_ERROR([The POCO version is too old])])
|
|
|
|
|
2015-05-15 06:36:01 -05:00
|
|
|
# If poco is built with --unbundled, it uses the system pcre library
|
|
|
|
AC_MSG_CHECKING([If we need to link with -lpcre])
|
|
|
|
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
|
|
|
#include <Poco/RegularExpression.h>
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
Poco::RegularExpression e("abc.[def]");
|
|
|
|
Poco::RegularExpression::Match m;
|
|
|
|
return e.match(argv[[1]], m);
|
|
|
|
}
|
|
|
|
])],
|
|
|
|
[AC_MSG_RESULT([No])],
|
|
|
|
[AC_MSG_RESULT([Yes])
|
|
|
|
LIBS="$LIBS -lpcre"])
|
2015-03-09 04:11:15 -05:00
|
|
|
|
2015-03-12 10:25:25 -05:00
|
|
|
test "$prefix" = NONE && prefix=$ac_default_prefix
|
2015-03-17 18:56:15 -05:00
|
|
|
LOOLWSD_CACHEDIR=${localstatedir}/cache/${PACKAGE}
|
2015-03-12 10:25:25 -05:00
|
|
|
while :; do
|
2015-03-17 18:56:15 -05:00
|
|
|
oldvalue=$LOOLWSD_CACHEDIR
|
|
|
|
LOOLWSD_CACHEDIR=`eval echo $LOOLWSD_CACHEDIR`
|
|
|
|
test $LOOLWSD_CACHEDIR = $oldvalue && break
|
2015-03-12 10:25:25 -05:00
|
|
|
done
|
|
|
|
|
2015-03-17 18:56:15 -05:00
|
|
|
AC_DEFINE_UNQUOTED([LOOLWSD_CACHEDIR],["$LOOLWSD_CACHEDIR"],[Cache folder])
|
|
|
|
AC_SUBST(LOOLWSD_CACHEDIR)
|
2015-03-09 10:31:47 -05:00
|
|
|
|
2016-03-24 04:37:17 -05:00
|
|
|
# FIXME
|
|
|
|
# LOOLWSD_CONFIGDIR=${sysconfdir}/${PACKAGE} -> #define LOOLWSD_CONFIGDIR "${prefix}/etc/loolwsd" in config.h ???
|
|
|
|
LOOLWSD_CONFIGDIR=/etc/${PACKAGE}
|
|
|
|
AC_DEFINE_UNQUOTED([LOOLWSD_CONFIGDIR],["$LOOLWSD_CONFIGDIR"],[Config folder])
|
|
|
|
AC_SUBST(LOOLWSD_CONFIGDIR)
|
|
|
|
|
2015-05-20 12:10:17 -05:00
|
|
|
AC_CONFIG_FILES([Makefile
|
2015-10-21 05:01:47 -05:00
|
|
|
test/Makefile
|
2015-05-20 12:10:17 -05:00
|
|
|
loolwsd.spec])
|
2016-04-11 12:21:16 -05:00
|
|
|
AC_CONFIG_FILES([test/run_unit.sh],[chmod +x test/run_unit.sh])
|
|
|
|
AC_CONFIG_FILES([test/run_test.sh],[chmod +x test/run_test.sh])
|
|
|
|
|
2015-03-09 04:11:15 -05:00
|
|
|
AC_OUTPUT
|
2015-05-11 03:21:07 -05:00
|
|
|
|
|
|
|
AC_LANG_POP
|
2015-10-21 05:01:47 -05:00
|
|
|
|
2016-04-05 11:41:10 -05:00
|
|
|
echo "
|
|
|
|
Configuration:
|
|
|
|
LOKit path ${lokit_msg}
|
|
|
|
LO integration tests ${lo_msg}
|
2016-04-11 16:11:38 -05:00
|
|
|
SSL support $ssl_msg
|
|
|
|
Debug & low security $debug_msg
|
2016-04-11 12:21:16 -05:00
|
|
|
|
2016-04-11 16:11:38 -05:00
|
|
|
\$ make # to compile"
|
|
|
|
if test -n "$with_lo_path"; then
|
|
|
|
echo " \$ make run # to start loolwsd
|
2016-04-05 11:41:10 -05:00
|
|
|
"
|
2016-04-11 16:11:38 -05:00
|
|
|
fi
|
2016-04-05 11:41:10 -05:00
|
|
|
|
2015-10-21 05:01:47 -05:00
|
|
|
dnl vim:set shiftwidth=4 softtabstop=4 expandtab:
|