2016-07-01 05:04:00 +02:00
|
|
|
AC_PREREQ(2.63)
|
2016-07-25 02:33:26 +02:00
|
|
|
AUTOMAKE_OPTIONS = 1.11
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2018-09-06 08:33:43 +02:00
|
|
|
AC_INIT([construct], [1.0-dev])
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_GNU_SOURCE
|
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
2018-08-12 20:56:53 +02:00
|
|
|
AC_PREFIX_DEFAULT([/])
|
2018-09-18 02:19:31 +02:00
|
|
|
AC_CONFIG_MACRO_DIR([tools/m4])
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_PATH_PROG(AUTOMAKE, automake)
|
|
|
|
AC_PATH_PROG(ACLOCAL, aclocal)
|
|
|
|
AC_PATH_PROG(AUTOHEADER, autoheader)
|
|
|
|
AC_PATH_PROG(AS, as)
|
|
|
|
AC_PATH_PROG(RM, rm)
|
|
|
|
AC_PATH_PROG(CP, cp)
|
|
|
|
AC_PATH_PROG(MV, mv)
|
|
|
|
AC_PATH_PROG(LN, ln)
|
|
|
|
AC_PATH_PROG(TOUCH, touch)
|
|
|
|
|
|
|
|
LT_INIT([dlopen shared disable-static])
|
|
|
|
LT_LANG([C++])
|
2016-07-01 05:04:00 +02:00
|
|
|
|
2018-03-24 10:52:40 +01:00
|
|
|
CXXFLAGS="-pipe"
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_PROG_CXX
|
|
|
|
AC_PROG_CXX_C_O
|
2018-02-18 08:59:17 +01:00
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
AC_PROG_MAKE_SET
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_LANG(C++)
|
2016-11-29 16:23:38 +01:00
|
|
|
AC_CONFIG_HEADER(include/ircd/config.h)
|
2019-02-25 20:30:27 +01:00
|
|
|
AX_CXX_COMPILE_STDCXX([17], [gnu], [mandatory], 201703)
|
2016-07-20 20:55:46 +02:00
|
|
|
|
2016-07-01 05:04:00 +02:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl ***************************************************************************
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl Makefile tree
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl These (and Makefile.in) are generated from a Makefile.am in the same dir.
|
|
|
|
dnl
|
2016-07-01 05:04:00 +02:00
|
|
|
|
|
|
|
AC_CONFIG_FILES(\
|
|
|
|
Makefile \
|
2016-08-15 04:44:16 +02:00
|
|
|
include/ircd/Makefile \
|
2018-02-22 22:33:53 +01:00
|
|
|
construct/Makefile \
|
2016-07-13 07:17:21 +02:00
|
|
|
ircd/Makefile \
|
2016-07-01 05:04:00 +02:00
|
|
|
modules/Makefile \
|
2018-09-14 05:59:52 +02:00
|
|
|
share/Makefile \
|
2016-07-01 05:04:00 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
AM_INIT_AUTOMAKE([subdir-objects])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
2017-10-05 01:37:07 +02:00
|
|
|
dnl
|
|
|
|
dnl Initialization of variables exported to Makefile.am.
|
|
|
|
dnl These will be further composed throughout this file...
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_SUBST(CC)
|
|
|
|
AC_SUBST(CXX)
|
|
|
|
AC_SUBST(CXXFLAGS)
|
|
|
|
AC_SUBST(CPPFLAGS)
|
|
|
|
AC_SUBST(LDFLAGS)
|
|
|
|
AC_SUBST(LIBS)
|
|
|
|
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl Preprocessor define macros
|
|
|
|
dnl
|
|
|
|
dnl Use RB_DEFINE() et al to generate defines in config.h
|
|
|
|
dnl Use CPPDEFINE() to generate defines on the command line if required
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_DEFUN([RB_DEFINE],
|
|
|
|
[
|
|
|
|
AC_DEFINE([RB_$1], [$2], [$3])
|
2016-07-13 07:17:21 +02:00
|
|
|
])
|
2016-07-01 05:04:00 +02:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_DEFUN([RB_DEFINE_UNQUOTED],
|
|
|
|
[
|
|
|
|
AC_DEFINE_UNQUOTED([RB_$1], [$2], [$3])
|
|
|
|
])
|
2016-07-01 05:04:00 +02:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_DEFUN([IRCD_DEFINE],
|
|
|
|
[
|
|
|
|
AC_DEFINE([IRCD_$1], [$2], [$3])
|
|
|
|
])
|
2016-07-01 05:04:00 +02:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_DEFUN([IRCD_DEFINE_UNQUOTED],
|
|
|
|
[
|
|
|
|
AC_DEFINE_UNQUOTED([IRCD_$1], [$2], [$3])
|
|
|
|
])
|
2016-07-13 07:17:21 +02:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_DEFUN([CPPDEFINE],
|
|
|
|
[
|
|
|
|
if [[ -z "$2" ]]; then
|
2016-08-14 00:08:24 +02:00
|
|
|
CPPFLAGS="-D$1 $CPPFLAGS"
|
2016-07-20 20:55:46 +02:00
|
|
|
else
|
|
|
|
CPPFLAGS="-D$1=$2 $CPPFLAGS"
|
|
|
|
fi
|
|
|
|
])
|
2016-07-01 05:04:00 +02:00
|
|
|
|
2018-06-02 19:25:50 +02:00
|
|
|
dnl ***************************************************************************
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2018-06-02 19:25:50 +02:00
|
|
|
dnl Platform
|
|
|
|
dnl
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Recursive local targets (clean-local is implied)
|
|
|
|
dnl
|
|
|
|
|
|
|
|
#AM_EXTRA_RECURSIVE_TARGETS([
|
|
|
|
# mrproper
|
|
|
|
#])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Coarse compiler test macros
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AM_CONDITIONAL([GCC], [[[[ $CXX = g\+\+* ]]]])
|
|
|
|
AM_CONDITIONAL([CLANG], [[[[ $CXX = clang* ]]]])
|
|
|
|
|
|
|
|
RB_DEFINE_UNQUOTED([CXX], ["$CXX"], [CXX Compiler])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Coarse operating system test macros
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AM_CONDITIONAL([LINUX], [[[[ $host_os = *linux* ]]]])
|
|
|
|
AM_CONDITIONAL([NETBSD], [[[[ $host_os = *netbsd* ]]]])
|
|
|
|
AM_CONDITIONAL([FREEBSD], [[[[ $host_os = *freebsd* ]]]])
|
|
|
|
AM_CONDITIONAL([MINGW], [[[[ $host_os = *mingw* ]] || [[ $host_os = *msys* ]]]])
|
|
|
|
AM_CONDITIONAL([CYGWIN], [[[[ $host_os = *cygwin* ]]]])
|
|
|
|
AM_CONDITIONAL([INTERIX], [[[[ $host_os = *interix* ]]]])
|
|
|
|
AM_CONDITIONAL([SOLARIS], [[[[ $host_os = *solaris* ]]]])
|
|
|
|
|
|
|
|
RB_DEFINE_UNQUOTED([OS], ["$host_os"], [Host operating system])
|
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl ***************************************************************************
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2017-09-30 08:00:16 +02:00
|
|
|
dnl Developer options
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
|
2017-09-30 08:00:16 +02:00
|
|
|
dnl
|
|
|
|
dnl Debugging mode
|
|
|
|
dnl
|
|
|
|
|
2018-05-18 02:37:04 +02:00
|
|
|
AC_MSG_CHECKING(whether to enable debugging)
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging suite for development.]),
|
|
|
|
[
|
2018-05-18 02:34:37 +02:00
|
|
|
AC_MSG_RESULT([yes])
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_SUBST(DEBUG, 1)
|
|
|
|
RB_DEFINE_UNQUOTED([DEBUG], [1], [Not configured for release when lit.])
|
2017-10-05 01:32:12 +02:00
|
|
|
RB_DEFINE_UNQUOTED([DEBUG_LEVEL], [1], [Defined to 0 for release; or > 0 otherwise])
|
2016-07-20 20:55:46 +02:00
|
|
|
], [
|
2018-05-18 02:34:37 +02:00
|
|
|
AC_MSG_RESULT([no])
|
2017-10-05 01:32:12 +02:00
|
|
|
RB_DEFINE_UNQUOTED([DEBUG_LEVEL], [0], [Defined to 0 for release])
|
2016-07-20 20:55:46 +02:00
|
|
|
])
|
|
|
|
|
2017-09-12 18:54:10 +02:00
|
|
|
AM_CONDITIONAL([DEBUG], [[[[ "$DEBUG" = "1" ]]]])
|
|
|
|
|
2018-05-22 01:56:20 +02:00
|
|
|
dnl
|
2018-05-16 21:36:31 +02:00
|
|
|
dnl Explicit assert switch for still using assert() without --enable-debug
|
2018-05-22 01:56:20 +02:00
|
|
|
dnl
|
2018-05-16 21:36:31 +02:00
|
|
|
|
2018-05-18 02:37:04 +02:00
|
|
|
AC_MSG_CHECKING(whether to explicitly enable assertions)
|
2018-05-16 21:36:31 +02:00
|
|
|
AC_ARG_ENABLE(assert, AC_HELP_STRING([--enable-assert], [Enable assertions without --enable-debug]),
|
|
|
|
[
|
2018-05-18 02:34:37 +02:00
|
|
|
AC_MSG_RESULT([yes])
|
2018-05-16 21:36:31 +02:00
|
|
|
AC_SUBST(ASSERT, 1)
|
|
|
|
], [
|
2018-05-18 02:34:37 +02:00
|
|
|
AM_COND_IF(DEBUG,
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([no, but assertions are enabled anyway])
|
|
|
|
AC_SUBST(ASSERT, 1)
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
2018-05-16 21:36:31 +02:00
|
|
|
])
|
|
|
|
|
|
|
|
AM_CONDITIONAL([ASSERT], [[[[ "$ASSERT" = "1" ]]]])
|
|
|
|
|
|
|
|
AM_COND_IF(ASSERT,
|
|
|
|
[
|
2019-01-22 22:24:35 +01:00
|
|
|
assert="yes"
|
2018-05-16 21:36:31 +02:00
|
|
|
], [
|
2019-01-22 22:24:35 +01:00
|
|
|
assert="no"
|
2018-05-16 21:36:31 +02:00
|
|
|
CPPDEFINE([NDEBUG])
|
|
|
|
])
|
|
|
|
|
2018-05-22 01:56:20 +02:00
|
|
|
dnl
|
2018-05-16 21:36:31 +02:00
|
|
|
dnl Explicit optimize switch for enabling optimization when using --enable-debug
|
2018-05-22 01:56:20 +02:00
|
|
|
dnl
|
2018-05-16 21:36:31 +02:00
|
|
|
|
2018-05-18 02:37:04 +02:00
|
|
|
AC_MSG_CHECKING(whether to explicitly enable optimized build)
|
2018-05-16 21:36:31 +02:00
|
|
|
AC_ARG_ENABLE(optimize, AC_HELP_STRING([--enable-optimize], [Enable optimization even with --enable-debug]),
|
|
|
|
[
|
2018-05-18 02:34:37 +02:00
|
|
|
AC_MSG_RESULT([yes])
|
2018-05-16 21:36:31 +02:00
|
|
|
AC_SUBST(OPTIMIZE, 1)
|
|
|
|
], [
|
2018-05-18 02:34:37 +02:00
|
|
|
AM_COND_IF(DEBUG,
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT([no, but optimized build is enabled anyway])
|
|
|
|
AC_SUBST(OPTIMIZE, 1)
|
|
|
|
])
|
2018-05-16 21:36:31 +02:00
|
|
|
])
|
|
|
|
|
|
|
|
AM_CONDITIONAL([OPTIMIZE], [[[[ "$OPTIMIZE" = "1" ]]]])
|
|
|
|
|
2019-01-22 22:13:36 +01:00
|
|
|
dnl
|
|
|
|
dnl Explicit link-time-optimization switch
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(whether to enable link-time optimization)
|
|
|
|
AC_ARG_ENABLE(lto, AC_HELP_STRING([--enable-lto], [Enable link-time optimization]),
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_SUBST(LTO, 1)
|
|
|
|
], [
|
|
|
|
AM_COND_IF(DEBUG,
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT([no, link-time optimization is explicit-only at this time])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
AM_CONDITIONAL([LTO], [[[[ "$LTO" = "1" ]]]])
|
|
|
|
|
2018-05-28 11:45:34 +02:00
|
|
|
dnl
|
|
|
|
dnl Explicit optimization level switch
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(whether to explicitly set the optimization level)
|
|
|
|
AC_ARG_WITH(optimize-level, AC_HELP_STRING([--with-optimize-level[[[=3]]]], [Explicitly set the optimize level]),
|
|
|
|
[
|
|
|
|
optimize_level=$withval
|
|
|
|
AC_MSG_RESULT([yes, enabling optimization level -O$optimize_level])
|
|
|
|
AC_SUBST(OPTMIZE_LEVEL, $optimize_level)
|
|
|
|
RB_DEFINE_UNQUOTED([OPTIMIZE_LEVEL], [$optimize_level], [User configured optimization level])
|
|
|
|
], [
|
|
|
|
AM_COND_IF(OPTIMIZE,
|
|
|
|
[
|
|
|
|
optimize_level="3"
|
|
|
|
AC_MSG_RESULT([no, but --enable-optimize has implied level -O$optimize_level])
|
|
|
|
AC_SUBST(OPTIMIZE_LEVEL, $optimize_level)
|
|
|
|
RB_DEFINE_UNQUOTED([OPTIMIZE_LEVEL], [$optimize_level], [Explicitly set release mode optimization])
|
|
|
|
], [
|
|
|
|
AM_COND_IF(DEBUG,
|
|
|
|
[
|
|
|
|
optimize_level="g"
|
|
|
|
AC_MSG_RESULT([no, but --enable-debug has implied level -O$optimize_level])
|
|
|
|
AC_SUBST(OPTIMIZE_LEVEL, $optimize_level)
|
2018-12-22 02:19:37 +01:00
|
|
|
RB_DEFINE_UNQUOTED([OPTIMIZE_LEVEL], ['$optimize_level'], [Debug mode optimization level])
|
2018-05-28 11:45:34 +02:00
|
|
|
], [
|
|
|
|
optimize_level="3"
|
|
|
|
AC_MSG_RESULT([no, but release mode has implied level -O$optimize_level])
|
|
|
|
AC_SUBST(OPTIMIZE_LEVEL, $optimize_level)
|
|
|
|
RB_DEFINE_UNQUOTED([OPTIMIZE_LEVEL], [$optimize_level], [Release mode optimization])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2018-05-22 01:55:10 +02:00
|
|
|
dnl
|
|
|
|
dnl Explicit log level
|
|
|
|
dnl
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl NOTE: Log levels here must be manually sync'ed with ircd/logger.h
|
|
|
|
dnl
|
2018-05-22 01:55:10 +02:00
|
|
|
|
|
|
|
AC_MSG_CHECKING(whether to explicitly set the logging level ceiling)
|
|
|
|
AC_ARG_WITH(log-level, AC_HELP_STRING([--with-log-level[[[=INFO]]]], [Explicitly set the log level ceiling]),
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([yes, enabling log level $withval and below])
|
|
|
|
|
|
|
|
level=4
|
|
|
|
if [[ $withval = "DEBUG" ]]; then
|
|
|
|
level=7
|
|
|
|
elif [[ $withval = "DWARNING" ]]; then
|
|
|
|
level=6
|
|
|
|
elif [[ $withval = "DERROR" ]]; then
|
|
|
|
level=5
|
|
|
|
elif [[ $withval = "INFO" ]]; then
|
|
|
|
level=4
|
|
|
|
elif [[ $withval = "NOTICE" ]]; then
|
|
|
|
level=3
|
|
|
|
elif [[ $withval = "WARNING" ]]; then
|
|
|
|
level=2
|
|
|
|
elif [[ $withval = "ERROR" ]]; then
|
|
|
|
level=1
|
|
|
|
elif [[ $withval = "CRITICAL" ]]; then
|
|
|
|
level=0
|
|
|
|
elif [[ $withval = "-1" ]]; then
|
|
|
|
level=-1
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(LOG_LEVEL, $level)
|
|
|
|
RB_DEFINE_UNQUOTED([LOG_LEVEL], [$level], [Log messages for user configured level and below.])
|
|
|
|
], [
|
|
|
|
AM_COND_IF(DEBUG,
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([no, but debug mode enables all log levels through DEBUG])
|
|
|
|
AC_SUBST(LOG_LEVEL, 7)
|
|
|
|
RB_DEFINE_UNQUOTED([LOG_LEVEL], [7], [Log message level default for DEBUG mode])
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
AC_SUBST(LOG_LEVEL, 4)
|
|
|
|
RB_DEFINE_UNQUOTED([LOG_LEVEL], [4], [Log message level default for release mode])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2017-09-30 08:00:16 +02:00
|
|
|
dnl
|
|
|
|
dnl Profiling mode
|
|
|
|
dnl
|
|
|
|
|
2018-05-18 02:37:04 +02:00
|
|
|
AC_MSG_CHECKING(whether to do a profile build)
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_ARG_ENABLE(profile, AC_HELP_STRING([--enable-profile], [Enable profiling]),
|
|
|
|
[
|
|
|
|
if test "$ac_cv_c_compiler_gnu" = yes; then
|
|
|
|
AC_MSG_RESULT([yes, adding -pg])
|
2017-09-30 08:00:16 +02:00
|
|
|
CXXFLAGS+=" -pg"
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no, profile builds only work with gcc])
|
|
|
|
fi
|
|
|
|
], [
|
|
|
|
])
|
|
|
|
|
2017-09-30 08:00:16 +02:00
|
|
|
dnl
|
|
|
|
dnl Precompiled headers
|
|
|
|
dnl
|
|
|
|
|
2018-05-18 02:37:04 +02:00
|
|
|
AC_MSG_CHECKING(whether to disable precompiled headers)
|
2016-07-24 03:42:24 +02:00
|
|
|
AC_ARG_ENABLE(pch, AC_HELP_STRING([--disable-pch], [Disable precompiled header generation]),
|
|
|
|
[
|
|
|
|
build_pch="no"
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
], [
|
|
|
|
build_pch="yes"
|
2016-08-13 04:41:59 +02:00
|
|
|
CPPDEFINE([PCH])
|
2016-07-24 03:42:24 +02:00
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
])
|
|
|
|
|
|
|
|
AM_CONDITIONAL([BUILD_PCH], [[[[ "$build_pch" = "yes" ]]]])
|
|
|
|
|
2018-07-06 08:52:29 +02:00
|
|
|
dnl
|
|
|
|
dnl Generic Mode compilation
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(whether to enable generic mode or tune for this host)
|
|
|
|
AC_ARG_ENABLE(generic, AC_HELP_STRING([--enable-generic], [Emit more generic code for pkg binaries.]),
|
|
|
|
[
|
|
|
|
enable_generic="yes"
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
RB_DEFINE([GENERIC], [1], [Building binary tuned for generic architectures])
|
|
|
|
], [
|
|
|
|
enable_generic="no"
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
|
|
|
|
|
|
|
AM_CONDITIONAL([GENERIC], [[[[ "$enable_generic" = "yes" ]]]])
|
|
|
|
|
|
|
|
AM_COND_IF([GENERIC],
|
|
|
|
[
|
|
|
|
CXXFLAGS+=" -mtune=generic"
|
|
|
|
], [
|
|
|
|
CXXFLAGS+=" -march=native"
|
|
|
|
])
|
|
|
|
|
2018-11-13 03:50:09 +01:00
|
|
|
dnl !!! Experimental !!!
|
|
|
|
dnl
|
|
|
|
dnl Allows a signal handler to throw a C++ exception if the signal is from
|
|
|
|
dnl a CPU trap on an instruction (ex. SIGFPE from a floating point divide
|
|
|
|
dnl by zero). This allows the signal handler to transfer control to the
|
|
|
|
dnl catch block wrapping the area which errored, thereby aborting any further
|
|
|
|
dnl execution after the signal was received which would have to manually check
|
|
|
|
dnl for such an error after each floating point operation and throw.
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(asyncexcept, AC_HELP_STRING([--enable-asyncexcept], [Enable experimental asynchronous exceptions]),
|
|
|
|
[
|
|
|
|
asyncexcept="yes"
|
|
|
|
], [
|
|
|
|
asyncexcept="no"
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl CHARYBDIS_C_GCC_TRY_FLAGS([-fnon-call-exceptions], charybdis_cv_c_gcc_f_non_call_exceptions)
|
|
|
|
|
|
|
|
if test "$asyncexcept" = "yes"; then
|
|
|
|
IRCD_DEFINE(USE_ASYNC_EXCEPTIONS, [1], [Experimental asynchronous exceptions are supported])
|
|
|
|
CXXFLAGS+=" -fasynchronous-unwind-tables"
|
|
|
|
CXXFLAGS+=" -fnon-call-exceptions"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AM_CONDITIONAL([ASYNCEXCEPT], [[[[ $asyncexcept = "yes" ]]]])
|
|
|
|
|
|
|
|
|
2018-02-18 08:59:17 +01:00
|
|
|
dnl
|
|
|
|
dnl Optimization
|
|
|
|
dnl
|
|
|
|
|
2018-12-30 23:33:59 +01:00
|
|
|
CXXFLAGS+=" -O$optimize_level"
|
|
|
|
|
2019-01-22 22:13:36 +01:00
|
|
|
AM_COND_IF([LTO],
|
|
|
|
[
|
|
|
|
lto="yes"
|
|
|
|
CXXFLAGS+=" -flto"
|
|
|
|
], [
|
|
|
|
lto="no"
|
|
|
|
])
|
|
|
|
|
2018-05-16 21:36:31 +02:00
|
|
|
AM_COND_IF([OPTIMIZE],
|
2018-02-18 08:59:17 +01:00
|
|
|
[
|
2019-01-22 22:24:35 +01:00
|
|
|
optimize="yes"
|
2018-02-18 08:59:17 +01:00
|
|
|
CXXFLAGS+=" -fweb"
|
|
|
|
CXXFLAGS+=" -fdata-sections"
|
|
|
|
CXXFLAGS+=" -ffunction-sections"
|
|
|
|
CXXFLAGS+=" -ftree-vectorize"
|
|
|
|
CXXFLAGS+=" -fgcse-sm"
|
|
|
|
CXXFLAGS+=" -fgcse-las"
|
|
|
|
CXXFLAGS+=" -fgcse-after-reload"
|
|
|
|
CXXFLAGS+=" -fsched-stalled-insns=0"
|
|
|
|
CXXFLAGS+=" -frename-registers"
|
2018-03-24 10:52:40 +01:00
|
|
|
CXXFLAGS+=" -fira-hoist-pressure"
|
|
|
|
CXXFLAGS+=" -fbranch-target-load-optimize"
|
|
|
|
CXXFLAGS+=" -frerun-loop-opt"
|
2019-01-18 22:53:37 +01:00
|
|
|
CXXFLAGS+=" -fdevirtualize-at-ltrans"
|
2018-03-24 10:52:40 +01:00
|
|
|
|
2019-01-22 22:13:36 +01:00
|
|
|
dnl Note these flags are unreliable with LTO
|
2018-09-19 04:13:14 +02:00
|
|
|
CXXFLAGS+=" -g"
|
2018-03-24 10:52:40 +01:00
|
|
|
CXXFLAGS+=" -ggdb"
|
2018-05-16 21:36:31 +02:00
|
|
|
], [
|
2019-01-22 22:24:35 +01:00
|
|
|
optimize="no"
|
2018-09-19 04:13:14 +02:00
|
|
|
CXXFLAGS+=" -g"
|
2018-05-16 21:36:31 +02:00
|
|
|
CXXFLAGS+=" -ggdb"
|
2018-12-30 23:33:59 +01:00
|
|
|
CXXFLAGS+=" -fvar-tracking"
|
2018-02-18 08:59:17 +01:00
|
|
|
])
|
|
|
|
|
2017-09-30 08:00:16 +02:00
|
|
|
dnl
|
|
|
|
dnl Compiler intrumentation
|
|
|
|
dnl
|
|
|
|
|
2018-11-13 03:25:45 +01:00
|
|
|
dnl Creates an ELF section in the output which contains a list of
|
|
|
|
dnl the command line arguments used for compilation.
|
|
|
|
CXXFLAGS+=" -frecord-gcc-switches"
|
|
|
|
|
2017-09-30 08:00:16 +02:00
|
|
|
dnl CXXFLAGS+=" -mmpx"
|
|
|
|
dnl CXXFLAGS+=" -fcheck-pointer-bounds"
|
|
|
|
CXXFLAGS+=" -fchkp-instrument-marked-only"
|
|
|
|
CXXFLAGS+=" -fstack-protector-explicit"
|
|
|
|
|
2018-02-18 08:59:17 +01:00
|
|
|
dnl -fvisibility-inlines-hidden - for optimization; note the address of inline
|
|
|
|
dnl functions won't be the same between translation units
|
|
|
|
CXXFLAGS+=" -fvisibility-inlines-hidden"
|
|
|
|
|
2017-09-30 08:00:16 +02:00
|
|
|
dnl
|
|
|
|
dnl Compiler warnings
|
|
|
|
dnl
|
|
|
|
|
2017-09-23 02:24:36 +02:00
|
|
|
STACK_USAGE_WARNING=16384
|
2017-10-05 01:37:07 +02:00
|
|
|
FRAME_SIZE_WARNING=8192
|
2016-07-20 20:55:46 +02:00
|
|
|
CWARNS=""
|
2018-05-18 02:37:04 +02:00
|
|
|
AC_MSG_CHECKING(whether to disable warnings)
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_ARG_ENABLE(warnings,
|
|
|
|
AC_HELP_STRING([--disable-warnings],[Disable all sorts of warnings like a rockstar]),
|
|
|
|
[],
|
|
|
|
[
|
2017-10-25 18:11:21 +02:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wparentheses], charybdis_cv_c_gcc_parentheses)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed)
|
2016-09-27 11:47:35 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wformat-nonliteral], charybdis_cv_c_gcc_w_format)
|
2017-10-05 01:37:07 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-aliasing=2 -Wstrict-overflow=5], charybdis_cv_c_gcc_w_strict)
|
2016-07-20 20:55:46 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wdisabled-optimization], charybdis_cv_c_gcc_w_disabled_optimization)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Winvalid-pch], charybdis_cv_c_gcc_w_invalid_pch)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Winit-self], charybdis_cv_c_gcc_w_init_self)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wuninitialized], charybdis_cv_c_gcc_w_uninitialized)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wunreachable-code], charybdis_cv_c_gcc_w_unreachable_code)
|
2016-08-28 11:34:00 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-overloaded-virtual], charybdis_cv_c_gcc_w_overloaded_virtual)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wnon-virtual-dtor], charybdis_cv_c_gcc_w_non_virtual_dtor)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wnoexcept], charybdis_cv_c_gcc_w_noexcept)
|
2017-09-30 08:00:16 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wchkp], charybdis_cv_c_gcc_w_chkp)
|
2017-10-05 01:37:07 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wsized-deallocation], charybdis_cv_c_gcc_w_sized_deallocation)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wctor-dtor-privacy], charybdis_cv_c_gcc_w_ctor_dtor_privacy)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wsign-promo], charybdis_cv_c_gcc_w_sign_promo)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wsuggest-final-types], charybdis_cv_c_gcc_w_suggest_final_types)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wsuggest-final-methods], charybdis_cv_c_gcc_w_suggest_final_methods)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wsuggest-override], charybdis_cv_c_gcc_w_suggest_override)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wtrampolines], charybdis_cv_c_gcc_w_trampolines)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wduplicate-cond], charybdis_cv_c_gcc_w_duplicate_cond)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wduplicate-branches], charybdis_cv_c_gcc_w_duplicate_branches)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wrestrict], charybdis_cv_c_gcc_w_restrict)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wnull-dereference], charybdis_cv_c_gcc_w_null_dereference)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wplacement-new=2], charybdis_cv_c_gcc_w_placement_new)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef)
|
2018-06-03 19:32:37 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wodr], charybdis_cv_c_gcc_w_odr)
|
2016-07-20 20:55:46 +02:00
|
|
|
|
2019-02-16 21:33:30 +01:00
|
|
|
dnl
|
|
|
|
dnl List of warnings treated as errors
|
|
|
|
dnl
|
|
|
|
|
|
|
|
dnl Uninitialized return values are not useful in this project; forgetting
|
|
|
|
dnl to return from a function is always a developer mistake here.
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Werror=return-type], charybdis_cv_c_gcc_w_error_return_type)
|
|
|
|
|
2017-10-25 18:11:21 +02:00
|
|
|
dnl
|
|
|
|
dnl List of warnings we suppress:
|
|
|
|
dnl
|
|
|
|
|
|
|
|
dnl Missing field initializers should have default init or some zero-extension as per std, this
|
|
|
|
dnl warning is only useful if you want to gauge where that's happening for a specific reason
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-missing-field-initializers], charybdis_cv_c_gcc_w_missing_field_initializers)
|
|
|
|
|
|
|
|
dnl Unused variables, functions, labels, etc are just fine as long as they get optimized
|
|
|
|
dnl away. These warnings can be re-enabled during a code cleanup, otherwise shut up.
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-unused], charybdis_cv_c_gcc_w_unused)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-unused-function], charybdis_cv_c_gcc_w_unused_function)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-unused-label], charybdis_cv_c_gcc_w_unused_label)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-unused-value], charybdis_cv_c_gcc_w_unused_value)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-unused-variable], charybdis_cv_c_gcc_w_unused_variable)
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-unused-parameter], charybdis_cv_c_gcc_w_unused_parameter)
|
|
|
|
|
|
|
|
dnl This warns when the compiler sees a statement that 'throws into a noexcept' which
|
|
|
|
dnl which will certainly terminate the program; it wants us to use std::terminate()
|
|
|
|
dnl rather than the rethrow. Unless throwing into a noexcept that way has UB in an
|
|
|
|
dnl optimized build I really don't care and just want to type `throw;` thx.
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-terminate], charybdis_cv_c_gcc_w_terminate)
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl List of compiler-specific / incompatible warning options
|
|
|
|
dnl
|
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
AM_COND_IF([GCC],
|
|
|
|
[
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wlogical-op], charybdis_cv_c_gcc_w_logical_op)
|
2016-09-27 11:47:35 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat-security], charybdis_cv_c_gcc_w_format_security)
|
2016-07-20 20:55:46 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wsuggest-attribute=format], charybdis_cv_c_gcc_w_suggest_attribute_format)
|
2017-09-23 02:24:36 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wstack-usage=$STACK_USAGE_WARNING], charybdis_cv_c_gcc_w_stack_usage)
|
2017-10-05 01:37:07 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wframe-larger-than=$FRAME_SIZE_WARNING], charybdis_cv_c_gcc_w_frame_larger_than)
|
2016-07-20 20:55:46 +02:00
|
|
|
],[])
|
|
|
|
|
2016-08-16 05:53:43 +02:00
|
|
|
AM_COND_IF([CLANG],
|
|
|
|
[
|
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-mismatched-tags], charybdis_cv_c_gcc_w_mismatched_tags)
|
2016-09-27 11:47:35 +02:00
|
|
|
CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-format-security], charybdis_cv_c_gcc_w_format_security)
|
2016-08-16 05:53:43 +02:00
|
|
|
],[])
|
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
])
|
|
|
|
|
|
|
|
CPPFLAGS+="$CWARNS"
|
|
|
|
|
|
|
|
|
|
|
|
dnl ***************************************************************************
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2017-10-05 01:37:07 +02:00
|
|
|
dnl Philology checks
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_ISC_POSIX
|
|
|
|
AC_C_CONST
|
|
|
|
AC_C_INLINE
|
|
|
|
if test "$ac_cv_header_machine_endian_h" = "no" ; then
|
|
|
|
AC_C_BIGENDIAN
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_TYPE_PID_T
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
AC_TYPE_SSIZE_T
|
|
|
|
AC_TYPE_UID_T
|
|
|
|
AC_TYPE_PID_T
|
|
|
|
|
|
|
|
AC_CHECK_TYPES([intptr_t])
|
|
|
|
AC_CHECK_TYPES([uintptr_t])
|
|
|
|
AC_CHECK_TYPES([__int128])
|
|
|
|
|
|
|
|
AC_CHECK_SIZEOF(char)
|
|
|
|
AC_CHECK_SIZEOF(short)
|
|
|
|
AC_CHECK_SIZEOF(int)
|
|
|
|
AC_CHECK_SIZEOF(long)
|
|
|
|
AC_CHECK_SIZEOF(long long)
|
|
|
|
AC_CHECK_SIZEOF(__int128)
|
|
|
|
|
|
|
|
dnl -fsigned-char ensures 'char' is signed on all platforms
|
|
|
|
CXXFLAGS+=" -fsigned-char"
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Header files
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_DEFUN([RB_CHK_SYSHEADER],
|
2016-07-01 05:04:00 +02:00
|
|
|
[
|
2019-02-19 00:44:59 +01:00
|
|
|
if test -z "$rb_have_sysheader_$2"; then
|
|
|
|
AC_CHECK_HEADER([$1],
|
|
|
|
[
|
|
|
|
rb_have_sysheader_$2=1;
|
|
|
|
AC_DEFINE([HAVE_$2], [1], [ Indication $1 is available. ])
|
|
|
|
RB_DEFINE_UNQUOTED([INC_$2], [$1>], [ The computed-include location of $1. ])
|
|
|
|
], [
|
|
|
|
RB_DEFINE_UNQUOTED([INC_$2], [stddef.h>], [ The dead-header in place of $1. ])
|
|
|
|
])
|
|
|
|
fi
|
2016-07-01 05:04:00 +02:00
|
|
|
])
|
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_HEADER_STDBOOL
|
|
|
|
dnl AC_HEADER_STDC
|
2016-07-13 07:17:21 +02:00
|
|
|
|
2018-01-10 09:46:13 +01:00
|
|
|
dnl libc
|
|
|
|
RB_CHK_SYSHEADER(assert.h, [ASSERT_H])
|
|
|
|
RB_CHK_SYSHEADER(stdarg.h, [STDARG_H])
|
|
|
|
|
|
|
|
dnl libc++
|
|
|
|
RB_CHK_SYSHEADER(cstddef, [CSTDDEF])
|
|
|
|
RB_CHK_SYSHEADER(cstdint, [CSTDINT])
|
|
|
|
RB_CHK_SYSHEADER(limits, [LIMITS])
|
|
|
|
RB_CHK_SYSHEADER(type_traits, [TYPE_TRAITS])
|
|
|
|
RB_CHK_SYSHEADER(typeindex, [TYPEINDEX])
|
|
|
|
RB_CHK_SYSHEADER(variant, [VARIANT])
|
|
|
|
RB_CHK_SYSHEADER(utility, [UTILITY])
|
|
|
|
RB_CHK_SYSHEADER(functional, [FUNCTIONAL])
|
|
|
|
RB_CHK_SYSHEADER(algorithm, [ALGORITHM])
|
|
|
|
RB_CHK_SYSHEADER(numeric, [NUMERIC])
|
|
|
|
RB_CHK_SYSHEADER(cmath, [CMATH])
|
2018-11-12 00:53:25 +01:00
|
|
|
RB_CHK_SYSHEADER(cfenv, [CFENV])
|
2018-01-10 09:46:13 +01:00
|
|
|
RB_CHK_SYSHEADER(memory, [MEMORY])
|
|
|
|
RB_CHK_SYSHEADER(exception, [EXCEPTION])
|
|
|
|
RB_CHK_SYSHEADER(cerrno, [CERRNO])
|
|
|
|
RB_CHK_SYSHEADER(system_error, [SYSTEM_ERROR])
|
|
|
|
RB_CHK_SYSHEADER(map, [MAP])
|
|
|
|
RB_CHK_SYSHEADER(set, [SET])
|
|
|
|
RB_CHK_SYSHEADER(list, [LIST])
|
|
|
|
RB_CHK_SYSHEADER(stack, [STACK])
|
|
|
|
RB_CHK_SYSHEADER(queue, [QUEUE])
|
|
|
|
RB_CHK_SYSHEADER(deque, [DEQUE])
|
|
|
|
RB_CHK_SYSHEADER(array, [ARRAY])
|
|
|
|
RB_CHK_SYSHEADER(vector, [VECTOR])
|
|
|
|
RB_CHK_SYSHEADER(forward_list, [FORWARD_LIST])
|
|
|
|
RB_CHK_SYSHEADER(unordered_map, [UNORDERED_MAP])
|
|
|
|
RB_CHK_SYSHEADER(string, [STRING])
|
|
|
|
RB_CHK_SYSHEADER(cstring, [CSTRING])
|
|
|
|
RB_CHK_SYSHEADER(locale, [LOCALE])
|
|
|
|
RB_CHK_SYSHEADER(codecvt, [CODECVT])
|
|
|
|
RB_CHK_SYSHEADER(sstream, [SSTREAM])
|
|
|
|
RB_CHK_SYSHEADER(fstream, [FSTREAM])
|
|
|
|
RB_CHK_SYSHEADER(iostream, [IOSTREAM])
|
2018-07-01 23:10:07 +02:00
|
|
|
RB_CHK_SYSHEADER(iosfwd, [IOSFWD])
|
2018-01-10 09:46:13 +01:00
|
|
|
RB_CHK_SYSHEADER(iomanip, [IOMANIP])
|
|
|
|
RB_CHK_SYSHEADER(cstdio, [CSTDIO])
|
|
|
|
RB_CHK_SYSHEADER(chrono, [CHRONO])
|
|
|
|
RB_CHK_SYSHEADER(ctime, [CTIME])
|
|
|
|
RB_CHK_SYSHEADER(atomic, [ATOMIC])
|
|
|
|
RB_CHK_SYSHEADER(thread, [THREAD])
|
|
|
|
RB_CHK_SYSHEADER(mutex, [MUTEX])
|
|
|
|
RB_CHK_SYSHEADER(shared_mutex, [SHARED_MUTEX])
|
|
|
|
RB_CHK_SYSHEADER(condition_variable, [CONDITION_VARIABLE])
|
|
|
|
RB_CHK_SYSHEADER(random, [RANDOM])
|
|
|
|
RB_CHK_SYSHEADER(bitset, [BITSET])
|
|
|
|
RB_CHK_SYSHEADER(string_view, [STRING_VIEW])
|
|
|
|
RB_CHK_SYSHEADER(optional, [OPTIONAL])
|
2018-01-18 06:35:10 +01:00
|
|
|
RB_CHK_SYSHEADER(new, [NEW])
|
2018-02-18 06:29:02 +01:00
|
|
|
RB_CHK_SYSHEADER(regex, [REGEX])
|
2018-01-10 09:46:13 +01:00
|
|
|
|
|
|
|
dnl unix platform
|
|
|
|
RB_CHK_SYSHEADER(unistd.h, [UNISTD_H])
|
2018-11-13 03:50:09 +01:00
|
|
|
RB_CHK_SYSHEADER(signal.h, [SIGNAL_H])
|
2018-01-10 09:46:13 +01:00
|
|
|
RB_CHK_SYSHEADER(sys/time.h, [SYS_TIME_H])
|
2018-10-18 18:26:04 +02:00
|
|
|
RB_CHK_SYSHEADER(sys/stat.h, [SYS_STAT_H])
|
2019-01-02 01:29:11 +01:00
|
|
|
RB_CHK_SYSHEADER(sys/statfs.h, [SYS_STATFS_H])
|
2018-10-18 18:26:04 +02:00
|
|
|
RB_CHK_SYSHEADER(sys/statvfs.h, [SYS_STATVFS_H])
|
2018-01-10 09:46:13 +01:00
|
|
|
RB_CHK_SYSHEADER(sys/resource.h, [SYS_RESOURCE_H])
|
|
|
|
RB_CHK_SYSHEADER(sys/syscall.h, [SYS_SYSCALL_H])
|
2018-01-21 11:09:13 +01:00
|
|
|
RB_CHK_SYSHEADER(sys/utsname.h, [SYS_UTSNAME_H])
|
2016-08-24 03:36:20 +02:00
|
|
|
|
2018-01-10 01:48:05 +01:00
|
|
|
dnl linux platform
|
2018-06-09 22:31:22 +02:00
|
|
|
RB_CHK_SYSHEADER(malloc.h, [MALLOC_H])
|
2019-01-17 20:21:57 +01:00
|
|
|
RB_CHK_SYSHEADER(sys/auxv.h, [SYS_AUXV_H])
|
2018-01-10 09:46:13 +01:00
|
|
|
RB_CHK_SYSHEADER(sys/eventfd.h, [SYS_EVENTFD_H])
|
2019-01-06 02:54:03 +01:00
|
|
|
RB_CHK_SYSHEADER(sys/inotify.h, [SYS_INOTIFY_H])
|
2019-02-16 02:25:19 +01:00
|
|
|
RB_CHK_SYSHEADER(sys/sysmacros.h, [SYS_SYSMACROS_H])
|
2018-01-10 09:46:13 +01:00
|
|
|
RB_CHK_SYSHEADER(linux/aio_abi.h, [LINUX_AIO_ABI_H])
|
2019-01-02 01:29:11 +01:00
|
|
|
RB_CHK_SYSHEADER(linux/magic.h, [LINUX_MAGIC_H])
|
2018-01-10 09:46:13 +01:00
|
|
|
|
|
|
|
dnl windows platform
|
|
|
|
RB_CHK_SYSHEADER(windows.h, [WINDOWS_H])
|
|
|
|
RB_CHK_SYSHEADER(winsock2.h, [WINSOCK2_H])
|
|
|
|
RB_CHK_SYSHEADER(ws2tcpip.h, [WS2TCPIP_H])
|
|
|
|
RB_CHK_SYSHEADER(iphlpapi.h, [IPHLPAPI_H])
|
2018-01-10 01:48:05 +01:00
|
|
|
|
2018-02-05 19:47:46 +01:00
|
|
|
dnl x86 platform
|
|
|
|
RB_CHK_SYSHEADER(x86intrin.h, [X86INTRIN_H])
|
|
|
|
|
2017-12-28 21:41:13 +01:00
|
|
|
dnl experimental
|
2018-01-10 09:46:13 +01:00
|
|
|
RB_CHK_SYSHEADER(experimental/string_view, [EXPERIMENTAL_STRING_VIEW])
|
|
|
|
RB_CHK_SYSHEADER(experimental/optional, [EXPERIMENTAL_OPTIONAL])
|
2016-07-01 05:04:00 +02:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
2017-10-05 01:37:07 +02:00
|
|
|
dnl Specific function checks
|
|
|
|
dnl
|
2016-07-01 05:04:00 +02:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_CHECK_FUNCS([ \
|
|
|
|
strlcpy \
|
|
|
|
strlcat \
|
|
|
|
strnlen \
|
|
|
|
snprintf \
|
2018-11-02 09:30:15 +01:00
|
|
|
vsnprintf \
|
|
|
|
posix_fadvise \
|
2016-07-20 20:55:46 +02:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_SEARCH_LIBS(dlinfo, dl, AC_DEFINE(HAVE_DLINFO, 1, [Define if you have dlinfo]))
|
|
|
|
AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep]))
|
2016-02-06 23:25:58 +01:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
2016-07-01 05:04:00 +02:00
|
|
|
dnl Networking Functions
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
2016-03-20 08:07:06 +01:00
|
|
|
|
2016-11-29 16:23:38 +01:00
|
|
|
AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6], [Disable IPv6 support]),
|
|
|
|
[
|
|
|
|
ipv6=$enableval
|
|
|
|
], [
|
|
|
|
ipv6=yes
|
2016-07-01 05:04:00 +02:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl TODO: IPV6 CHECKS
|
|
|
|
|
|
|
|
if test x$ipv6 = "Xyes"; then
|
|
|
|
AC_DEFINE([HAVE_IPV6], [1], [IPv6 is supported])
|
|
|
|
fi
|
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
|
|
|
|
dnl ***************************************************************************
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
|
|
|
dnl Miscellaneous operating system specific
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
|
|
|
|
AM_COND_IF(MINGW,
|
|
|
|
[
|
2016-07-01 05:04:00 +02:00
|
|
|
AC_DEFINE(HAVE_WIN32, [1], [Define to 1 if you are on windows])
|
2016-07-20 20:55:46 +02:00
|
|
|
LIBS="$LIBS -lws2_32 -liphlpapi"
|
|
|
|
],[])
|
|
|
|
|
|
|
|
|
|
|
|
AM_COND_IF(INTERIX,
|
|
|
|
[
|
|
|
|
CPPDEFINE([_ALL_SOURCE])
|
|
|
|
CPPDEFINE([_XOPEN_SOURCE], [500])
|
|
|
|
CPPDEFINE([_POSIX_PTHREAD_SEMANTICS])
|
|
|
|
CPPDEFINE([_XPG4_2])
|
|
|
|
],[])
|
|
|
|
|
2018-01-11 06:30:31 +01:00
|
|
|
dnl
|
|
|
|
dnl Linux AIO support
|
|
|
|
dnl
|
|
|
|
|
2018-01-10 01:48:05 +01:00
|
|
|
AM_COND_IF(LINUX,
|
|
|
|
[
|
2018-01-11 06:30:31 +01:00
|
|
|
AC_ARG_ENABLE(aio, AC_HELP_STRING([--disable-aio], [Disable kernel AIO support]),
|
2018-01-10 01:48:05 +01:00
|
|
|
[
|
2018-01-11 06:30:31 +01:00
|
|
|
aio=$enableval
|
2018-08-12 20:56:53 +02:00
|
|
|
], [
|
2018-01-11 06:30:31 +01:00
|
|
|
aio=yes
|
|
|
|
])
|
|
|
|
], [])
|
|
|
|
|
|
|
|
if test "$aio" = "yes"; then
|
|
|
|
IRCD_DEFINE(USE_AIO, [1], [Linux AIO is supported and will be used])
|
|
|
|
fi
|
2018-01-10 01:48:05 +01:00
|
|
|
|
2018-02-06 07:42:40 +01:00
|
|
|
AM_CONDITIONAL([AIO], [[[[ $aio = yes ]]]])
|
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
|
|
|
|
dnl ***************************************************************************
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl Installation Layout
|
|
|
|
dnl
|
|
|
|
|
|
|
|
PKG_PROG_PKG_CONFIG
|
|
|
|
|
|
|
|
if test "$prefix" = "NONE"; then
|
2018-08-12 20:56:53 +02:00
|
|
|
prefix="$ac_default_prefix"
|
2016-07-20 20:55:46 +02:00
|
|
|
else
|
|
|
|
dnl Don't get bitten by Cygwin's stupidity if the user specified
|
|
|
|
dnl a custom prefix with a trailing slash
|
|
|
|
prefix=`echo $prefix | sed 's/\/$//'`
|
|
|
|
fi
|
|
|
|
|
2018-08-12 20:56:53 +02:00
|
|
|
RB_DEFINE_UNQUOTED(PREFIX, ["$prefix"], [Prefix of IRCd install])
|
|
|
|
AC_SUBST_DIR([prefix])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
|
|
|
dnl
|
2018-08-12 20:56:53 +02:00
|
|
|
dnl bindir
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
|
2018-08-12 20:56:53 +02:00
|
|
|
AC_SUBST_DIR([bindir])
|
2018-09-14 08:05:55 +02:00
|
|
|
RB_DEFINE_UNQUOTED([BIN_DIR], ["$bindir"], [Directory where binary executables are to be found.])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
|
|
|
dnl
|
2018-08-12 20:56:53 +02:00
|
|
|
dnl libdir
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
|
2018-08-12 20:56:53 +02:00
|
|
|
AC_SUBST_DIR([libdir])
|
2018-09-14 08:05:55 +02:00
|
|
|
RB_DEFINE_UNQUOTED([LIB_DIR], ["$libdir"], [Prefix where libs are installed.])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
|
|
|
dnl
|
2018-08-12 20:56:53 +02:00
|
|
|
dnl localstatedir
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
|
2018-08-12 20:56:53 +02:00
|
|
|
dnl Avoid name collisions.
|
|
|
|
AC_SUBST_DIR([localstatedir])
|
2018-09-14 08:05:55 +02:00
|
|
|
RB_DEFINE_UNQUOTED([LOCALSTATE_DIR], ["$localstatedir"], [Prefix where db and logs go.])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
|
|
|
dnl
|
2018-08-12 20:56:53 +02:00
|
|
|
dnl Check for --with-confdir [deprecated, use --sysconfdir instead]
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
|
2018-08-12 20:56:53 +02:00
|
|
|
AC_SUBST_DIR([sysconfdir])
|
2018-09-14 08:05:55 +02:00
|
|
|
RB_DEFINE_UNQUOTED([CONF_DIR], ["$sysconfdir"], [Prefix where config files are installed.])
|
2018-09-14 05:59:52 +02:00
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl datadir
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_SUBST_DIR([datadir])
|
2018-09-14 08:05:55 +02:00
|
|
|
RB_DEFINE_UNQUOTED([DATA_DIR], ["$datadir/${PACKAGE_TARNAME}"], [Directory where read-only assets go.])
|
2018-09-14 05:59:52 +02:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
2018-08-12 20:56:53 +02:00
|
|
|
dnl Check for --with-dbdir
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
|
2018-08-12 20:56:53 +02:00
|
|
|
AC_MSG_CHECKING([whether to modify database directory])
|
|
|
|
AC_ARG_WITH(dbdir, AC_HELP_STRING([--with-dbdir=DIR], [Directory where databases are located]),
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
dbdir=`echo $withval | sed 's/\/$//'`
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
dbdir="${localstatedir}/db/${PACKAGE_TARNAME}"
|
|
|
|
])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
2018-08-12 20:56:53 +02:00
|
|
|
RB_DEFINE_UNQUOTED([DB_DIR], ["$dbdir"], [Directory where databases are located])
|
|
|
|
AC_SUBST_DIR([dbdir])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
|
|
|
dnl
|
2018-08-12 20:56:53 +02:00
|
|
|
dnl Check for --with-logdir
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
|
2018-08-12 20:56:53 +02:00
|
|
|
AC_MSG_CHECKING([whether to modify logdir])
|
|
|
|
AC_ARG_WITH(logdir, AC_HELP_STRING([--with-logdir=DIR], [Directory where to write logfiles.]),
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
logdir=`echo $withval | sed 's/\/$//'`
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
logdir="${localstatedir}/log/${PACKAGE_TARNAME}"
|
|
|
|
])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
2018-08-12 20:56:53 +02:00
|
|
|
RB_DEFINE_UNQUOTED([LOG_DIR], ["$logdir"], [Prefix where to write logfiles.])
|
|
|
|
AC_SUBST_DIR([logdir])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
|
|
|
dnl
|
2018-08-12 20:56:53 +02:00
|
|
|
dnl Check for --with-moduledir
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
|
2018-08-12 20:56:53 +02:00
|
|
|
AC_MSG_CHECKING([whether to modify moduledir])
|
|
|
|
AC_ARG_WITH(moduledir, [AC_HELP_STRING([--with-moduledir=DIR], [Directory to install modules.])],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
moduledir=`echo $withval | sed 's/\/$//'`
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
moduledir="${libdir}/modules/${PACKAGE_TARNAME}"
|
|
|
|
])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
2018-08-12 20:56:53 +02:00
|
|
|
RB_DEFINE_UNQUOTED([MODULE_DIR], ["$moduledir"], [Prefix where modules are installed.])
|
|
|
|
AC_SUBST_DIR([moduledir])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
2018-09-14 05:59:52 +02:00
|
|
|
dnl
|
|
|
|
dnl Check for --with-webappdir
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether to modify webappdir])
|
|
|
|
AC_ARG_WITH(webappdir, [AC_HELP_STRING([--with-webappdir=DIR], [Directory to install served assets])],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
webappdir=`echo $withval | sed 's/\/$//'`
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
webappdir="${datadir}/webapp"
|
|
|
|
])
|
|
|
|
|
|
|
|
RB_DEFINE_UNQUOTED([WEBAPP_DIR], ["$webappdir"], [Prefix where website assets are served from.])
|
|
|
|
AC_SUBST_DIR([webappdir])
|
|
|
|
|
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl ***************************************************************************
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl Third party
|
|
|
|
dnl
|
|
|
|
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2018-06-15 04:58:56 +02:00
|
|
|
dnl
|
|
|
|
dnl libsodium (NaCl) crypto support
|
|
|
|
dnl
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2018-06-15 04:58:56 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_SUBST(SODIUM_CPPFLAGS, [])
|
|
|
|
AC_SUBST(SODIUM_LDFLAGS, [])
|
|
|
|
AC_SUBST(SODIUM_LIBS, [])
|
|
|
|
|
|
|
|
AC_ARG_WITH(sodium-includes,
|
|
|
|
AC_HELP_STRING([--with-sodium-includes=[[[DIR]]]], [Path to sodium include directory]),
|
|
|
|
[
|
|
|
|
SODIUM_CPPFLAGS="-I$withval"
|
|
|
|
], [])
|
|
|
|
|
|
|
|
AC_ARG_WITH(sodium-libs,
|
|
|
|
AC_HELP_STRING([--with-sodium-libs=[[[DIR]]]], [Path to sodium library directory]),
|
|
|
|
[
|
|
|
|
SODIUM_LDFLAGS="-L$withval"
|
|
|
|
], [])
|
2018-06-15 04:58:56 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
RB_CHK_SYSHEADER(sodium.h, [SODIUM_H])
|
|
|
|
AC_CHECK_LIB([sodium], sodium_init,
|
2018-06-15 04:58:56 +02:00
|
|
|
[
|
2019-02-19 22:01:45 +01:00
|
|
|
have_sodium="yes"
|
|
|
|
SODIUM_LIBS="-lsodium"
|
|
|
|
], [
|
|
|
|
have_sodium="no"
|
|
|
|
AC_MSG_ERROR([libsodium is required but not found. Try apt-get install libsodium-dev])
|
2018-06-15 04:58:56 +02:00
|
|
|
])
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AM_CONDITIONAL([SODIUM], [test "x$have_sodium" = "xyes"])
|
2018-06-15 04:58:56 +02:00
|
|
|
|
2018-09-03 12:02:35 +02:00
|
|
|
dnl
|
|
|
|
dnl
|
|
|
|
dnl OpenSSL support
|
|
|
|
dnl
|
|
|
|
dnl
|
|
|
|
|
2019-02-19 21:14:35 +01:00
|
|
|
AC_SUBST(SSL_CPPFLAGS, [])
|
|
|
|
AC_SUBST(SSL_LDFLAGS, [])
|
|
|
|
AC_SUBST(SSL_LIBS, [])
|
|
|
|
|
|
|
|
AC_ARG_WITH(ssl,
|
|
|
|
AC_HELP_STRING([--with-ssl=[[[DIR]]]], [Path to SSL source directory]),
|
2019-02-19 00:45:50 +01:00
|
|
|
[
|
2019-02-19 21:14:35 +01:00
|
|
|
SSL_CPPFLAGS="-I$withval/include"
|
|
|
|
SSL_LDFLAGS="-L$withval"
|
|
|
|
], [])
|
2019-02-19 00:45:50 +01:00
|
|
|
|
2019-02-19 21:14:35 +01:00
|
|
|
AC_ARG_WITH(ssl-includes,
|
|
|
|
AC_HELP_STRING([--with-ssl-includes=[[[DIR]]]], [Path to SSL include directory]),
|
|
|
|
[
|
|
|
|
SSL_CPPFLAGS="-I$withval"
|
|
|
|
], [])
|
|
|
|
|
|
|
|
AC_ARG_WITH(ssl-libs,
|
|
|
|
AC_HELP_STRING([--with-ssl-libs=[[[DIR]]]], [Path to SSL library directory]),
|
|
|
|
[
|
|
|
|
SSL_LDFLAGS="-L$withval"
|
|
|
|
], [])
|
|
|
|
|
|
|
|
RB_CHK_SYSHEADER(openssl/err.h, [OPENSSL_ERR_H])
|
2019-02-27 03:56:29 +01:00
|
|
|
RB_CHK_SYSHEADER(openssl/asn1.h, [OPENSSL_ASN1_H])
|
2019-02-19 21:14:35 +01:00
|
|
|
RB_CHK_SYSHEADER(openssl/sha.h, [OPENSSL_SHA_H])
|
|
|
|
RB_CHK_SYSHEADER(openssl/hmac.h, [OPENSSL_HMAC_H])
|
|
|
|
RB_CHK_SYSHEADER(openssl/ssl.h, [OPENSSL_SSL_H])
|
|
|
|
RB_CHK_SYSHEADER(openssl/ec.h, [OPENSSL_EC_H])
|
|
|
|
RB_CHK_SYSHEADER(openssl/rsa.h, [OPENSSL_RSA_H])
|
|
|
|
RB_CHK_SYSHEADER(openssl/x509.h, [OPENSSL_X509_H])
|
|
|
|
RB_CHK_SYSHEADER(openssl/evp.h, [OPENSSL_EVP_H])
|
|
|
|
RB_CHK_SYSHEADER(openssl/ripemd.h, [OPENSSL_RIPEMD_H])
|
|
|
|
RB_CHK_SYSHEADER(openssl/dh.h, [OPENSSL_DH_H])
|
2018-09-03 12:02:35 +02:00
|
|
|
AC_CHECK_LIB(ssl, SSL_version,
|
|
|
|
[
|
|
|
|
have_ssl="yes"
|
2019-02-19 21:14:35 +01:00
|
|
|
SSL_LIBS="-lssl"
|
2018-09-03 12:02:35 +02:00
|
|
|
], [
|
|
|
|
have_ssl="no"
|
|
|
|
AC_MSG_ERROR([libssl is required but not found. Try apt-get install libssl1.0-dev])
|
|
|
|
])
|
|
|
|
|
|
|
|
AM_CONDITIONAL([SSL], [test "x$have_ssl" = "xyes"])
|
|
|
|
|
2019-02-19 21:14:35 +01:00
|
|
|
AC_SUBST(CRYPTO_CPPFLAGS, [])
|
|
|
|
AC_SUBST(CRYPTO_LDFLAGS, [])
|
|
|
|
AC_SUBST(CRYPTO_LIBS, [])
|
|
|
|
|
2019-02-18 22:38:27 +01:00
|
|
|
AC_CHECK_LIB(crypto, OPENSSL_init,
|
2018-09-03 12:02:35 +02:00
|
|
|
[
|
|
|
|
have_crypto="yes"
|
|
|
|
AC_DEFINE(HAVE_CRYPTO, 1, [Define to 1 if libcrypto (-lcrypto) is available.])
|
2019-02-19 21:14:35 +01:00
|
|
|
CRYPTO_LIBS="-lcrypto"
|
2018-09-03 12:02:35 +02:00
|
|
|
], [
|
|
|
|
have_crypto="no"
|
|
|
|
AC_MSG_ERROR([libcrypto is required but not found.])
|
|
|
|
])
|
|
|
|
|
|
|
|
AM_CONDITIONAL([CRYPTO], [test "x$have_crypto" = "xyes"])
|
|
|
|
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2018-06-15 04:58:56 +02:00
|
|
|
dnl
|
2019-02-19 22:01:45 +01:00
|
|
|
dnl libmagic support
|
2018-06-15 04:58:56 +02:00
|
|
|
dnl
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2018-06-15 04:58:56 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_SUBST(MAGIC_CPPFLAGS, [])
|
|
|
|
AC_SUBST(MAGIC_LDFLAGS, [])
|
|
|
|
AC_SUBST(MAGIC_LIBS, [])
|
2018-06-15 04:58:56 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_ARG_WITH(magic-includes,
|
|
|
|
AC_HELP_STRING([--with-magic-includes=[[[DIR]]]], [Path to magic include directory]),
|
|
|
|
[
|
|
|
|
MAGIC_CPPFLAGS="-I$withval"
|
|
|
|
], [])
|
2018-06-15 04:58:56 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_ARG_WITH(magic-libs,
|
|
|
|
AC_HELP_STRING([--with-magic-libs=[[[DIR]]]], [Path to magic library directory]),
|
|
|
|
[
|
|
|
|
MAGIC_LDFLAGS="-L$withval"
|
|
|
|
], [])
|
2018-06-15 04:58:56 +02:00
|
|
|
|
|
|
|
RB_CHK_SYSHEADER(magic.h, [MAGIC_H])
|
|
|
|
AC_CHECK_LIB(magic, magic_version,
|
|
|
|
[
|
|
|
|
have_magic="yes"
|
2019-02-19 22:01:45 +01:00
|
|
|
MAGIC_LIBS="-lmagic"
|
2018-06-15 04:58:56 +02:00
|
|
|
], [
|
|
|
|
have_magic="no"
|
|
|
|
AC_MSG_ERROR([libmagic is required but not found. Try apt-get install libmagic-dev])
|
|
|
|
])
|
|
|
|
|
|
|
|
AM_CONDITIONAL([MAGIC], [test "x$have_magic" = "xyes"])
|
|
|
|
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2018-06-03 17:29:20 +02:00
|
|
|
dnl
|
|
|
|
dnl zlib support
|
|
|
|
dnl
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2018-06-03 17:29:20 +02:00
|
|
|
|
|
|
|
AC_SUBST(Z_CPPFLAGS)
|
|
|
|
AC_SUBST(Z_LDFLAGS)
|
|
|
|
AC_SUBST(Z_LIBS)
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_ARG_WITH(z-includes,
|
|
|
|
AC_HELP_STRING([--with-z-includes=[[[DIR]]]], [Path to zlib include directory]),
|
2018-06-03 17:29:20 +02:00
|
|
|
[
|
2019-02-19 22:01:45 +01:00
|
|
|
Z_CPPFLAGS="-I$withval"
|
|
|
|
], [])
|
2018-06-03 17:29:20 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_ARG_WITH(z-libs,
|
|
|
|
AC_HELP_STRING([--with-z-libs=[[[DIR]]]], [Path to zlib library directory]),
|
|
|
|
[
|
|
|
|
Z_LDFLAGS="-L$withval"
|
|
|
|
], [])
|
2018-06-03 17:29:20 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
RB_CHK_SYSHEADER(zlib.h, [ZLIB_H])
|
|
|
|
AC_CHECK_LIB(z, zlibVersion,
|
2018-06-03 17:29:20 +02:00
|
|
|
[
|
2019-02-19 22:01:45 +01:00
|
|
|
have_zlib="yes"
|
|
|
|
Z_LIBS="-lz"
|
2018-06-03 17:29:20 +02:00
|
|
|
], [
|
2019-02-19 22:01:45 +01:00
|
|
|
have_zlib="no"
|
2018-06-03 17:29:20 +02:00
|
|
|
])
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AM_CONDITIONAL([ZLIB], [test "x$have_zlib" = "xyes"])
|
|
|
|
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2018-06-03 17:29:20 +02:00
|
|
|
dnl
|
|
|
|
dnl lz4 support
|
|
|
|
dnl
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2018-06-03 17:29:20 +02:00
|
|
|
|
|
|
|
AC_SUBST(LZ4_CPPFLAGS)
|
|
|
|
AC_SUBST(LZ4_LDFLAGS)
|
|
|
|
AC_SUBST(LZ4_LIBS)
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_ARG_WITH(lz4-includes,
|
|
|
|
AC_HELP_STRING([--with-lz4-includes=[[[DIR]]]], [Path to LZ4 include directory]),
|
2018-06-03 17:29:20 +02:00
|
|
|
[
|
2019-02-19 22:01:45 +01:00
|
|
|
LZ4_CPPFLAGS="-I$withval"
|
|
|
|
], [])
|
2018-06-03 17:29:20 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_ARG_WITH(lz4-libs,
|
|
|
|
AC_HELP_STRING([--with-lz4-libs=[[[DIR]]]], [Path to LZ4 library directory]),
|
|
|
|
[
|
|
|
|
LZ4_LDFLAGS="-L$withval"
|
|
|
|
], [])
|
2018-06-03 17:29:20 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
RB_CHK_SYSHEADER(lz4.h, [LZ4_H])
|
|
|
|
AC_CHECK_LIB(lz4, LZ4_versionNumber,
|
2018-06-03 17:29:20 +02:00
|
|
|
[
|
2019-02-19 22:01:45 +01:00
|
|
|
have_lz4="yes"
|
|
|
|
LZ4_LIBS="-llz4"
|
2018-06-03 17:29:20 +02:00
|
|
|
], [
|
2019-02-19 22:01:45 +01:00
|
|
|
have_lz4="no"
|
2018-06-03 17:29:20 +02:00
|
|
|
])
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AM_CONDITIONAL([LZ4], [test "x$have_lz4" = "xyes"])
|
|
|
|
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2018-06-04 23:48:04 +02:00
|
|
|
dnl
|
|
|
|
dnl snappy support
|
|
|
|
dnl
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2018-06-04 23:48:04 +02:00
|
|
|
|
|
|
|
AC_SUBST(SNAPPY_CPPFLAGS)
|
|
|
|
AC_SUBST(SNAPPY_LDFLAGS)
|
|
|
|
AC_SUBST(SNAPPY_LIBS)
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_ARG_WITH(snappy-includes,
|
|
|
|
AC_HELP_STRING([--with-snappy-includes=[[[DIR]]]], [Path to snappy include directory]),
|
2018-06-04 23:48:04 +02:00
|
|
|
[
|
2019-02-19 22:01:45 +01:00
|
|
|
SNAPPY_CPPFLAGS="-I$withval"
|
|
|
|
], [])
|
2018-06-04 23:48:04 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_ARG_WITH(snappy-libs,
|
|
|
|
AC_HELP_STRING([--with-snappy-libs=[[[DIR]]]], [Path to snappy library directory]),
|
|
|
|
[
|
|
|
|
SNAPPY_LDFLAGS="-L$withval"
|
|
|
|
], [])
|
2018-06-04 23:48:04 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
RB_CHK_SYSHEADER(snappy.h, [SNAPPY_H])
|
|
|
|
AC_CHECK_LIB(snappy, snappy_compress,
|
2018-06-04 23:48:04 +02:00
|
|
|
[
|
2019-02-19 22:01:45 +01:00
|
|
|
have_snappy="yes"
|
|
|
|
SNAPPY_LIBS="-lsnappy"
|
2018-06-04 23:48:04 +02:00
|
|
|
], [
|
2019-02-19 22:01:45 +01:00
|
|
|
have_snappy="no"
|
2018-06-04 23:48:04 +02:00
|
|
|
])
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AM_CONDITIONAL([SNAPPY], [test "x$have_snappy" = "xyes"])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl
|
|
|
|
dnl libgmp support
|
|
|
|
dnl
|
|
|
|
dnl
|
|
|
|
|
|
|
|
PKG_CHECK_MODULES(GMP, [gmp], [have_gmp="yes"], [have_gmp="no"])
|
|
|
|
AM_CONDITIONAL([GMP], [test "x$have_gmp" = "xyes"])
|
|
|
|
|
|
|
|
AC_SUBST(GMP_CPPFLAGS, [])
|
|
|
|
AC_SUBST(GMP_LDFLAGS, [])
|
|
|
|
AC_SUBST(GMP_LIBS, ["-lgmp"])
|
|
|
|
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
dnl boost support
|
|
|
|
dnl
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-07-20 20:55:46 +02:00
|
|
|
|
2017-12-29 23:53:39 +01:00
|
|
|
BOOST_VERSION_MIN="1.66"
|
2017-11-30 20:20:47 +01:00
|
|
|
BOOST_VERSION_MIN_PATCH="0"
|
2016-09-05 17:53:36 +02:00
|
|
|
BOOST_BUILT_LIBS="system,filesystem,context,coroutine"
|
2016-08-14 00:08:24 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_SUBST(BOOST_CPPFLAGS, [])
|
|
|
|
AC_SUBST(BOOST_LDFLAGS, [])
|
|
|
|
AC_SUBST(BOOST_LIBS, [])
|
|
|
|
|
|
|
|
AC_ARG_WITH(boost-includes,
|
|
|
|
AC_HELP_STRING([--with-boost-includes=[[[DIR]]]], [Path to boost include directory]),
|
|
|
|
[
|
|
|
|
boost_incdir="$withval"
|
|
|
|
BOOST_CPPFLAGS="-isystem $withval"
|
|
|
|
], [])
|
|
|
|
|
|
|
|
AC_ARG_WITH(boost-libs,
|
|
|
|
AC_HELP_STRING([--with-boost-libs=[[[DIR]]]], [Path to boost library directory]),
|
|
|
|
[
|
|
|
|
boost_libdir="$withval"
|
|
|
|
BOOST_LDFLAGS="-L$withval"
|
|
|
|
], [])
|
|
|
|
|
2016-08-14 00:08:24 +02:00
|
|
|
AC_MSG_CHECKING([whether you asked to use boost sources included here])
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_ARG_WITH(included-boost,
|
2016-07-25 05:31:08 +02:00
|
|
|
AC_HELP_STRING([--with-included-boost[[[=shared]]]], [Use the boost sources from included submodule]),
|
2016-07-20 20:55:46 +02:00
|
|
|
[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_MSG_NOTICE([Bootstrapping boost])
|
|
|
|
|
2018-01-27 18:33:55 +01:00
|
|
|
AM_COND_IF([DEBUG],
|
2016-07-20 20:55:46 +02:00
|
|
|
[
|
2018-12-29 00:47:49 +01:00
|
|
|
dnl boost_variant="debug"
|
|
|
|
boost_variant="release"
|
2016-07-20 20:55:46 +02:00
|
|
|
], [
|
2018-01-27 18:33:55 +01:00
|
|
|
boost_variant="release"
|
2016-07-20 20:55:46 +02:00
|
|
|
])
|
|
|
|
|
2017-08-23 23:29:34 +02:00
|
|
|
AM_COND_IF([MINGW],
|
|
|
|
[
|
2018-01-27 18:33:55 +01:00
|
|
|
BTOOLSET="mingw"
|
2018-01-28 05:46:41 +01:00
|
|
|
boost_libdir="$PWD/deps/boost/stage/lib"
|
2017-08-23 23:29:34 +02:00
|
|
|
], [
|
2018-01-27 18:33:55 +01:00
|
|
|
dnl the CXX may have a space and then arguments so we must chop them
|
|
|
|
BTOOLSET=`echo $CXX | cut -d' ' -f1`
|
2018-01-28 05:46:41 +01:00
|
|
|
boost_libdir="$PWD/deps/boost/lib"
|
2017-08-23 23:29:34 +02:00
|
|
|
])
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
BOOST_LDFLAGS="-L$boost_libdir"
|
|
|
|
BOOST_CPPFLAGS="-isystem $PWD/deps/boost/include"
|
2017-08-23 23:29:34 +02:00
|
|
|
|
2016-08-14 00:08:24 +02:00
|
|
|
AC_MSG_CHECKING([whether to use shared boost])
|
2018-08-25 23:30:55 +02:00
|
|
|
if [[ $withval = "static" ]]; then
|
2016-08-14 00:08:24 +02:00
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
withval="static"
|
2018-08-25 23:30:55 +02:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
BOOST_LDFLAGS+=" -Wl,-rpath=$boost_libdir"
|
|
|
|
withval="shared"
|
2016-08-14 00:08:24 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
boost_linkage="$withval"
|
2017-11-30 20:20:47 +01:00
|
|
|
boost_version="boost-${BOOST_VERSION_MIN}.${BOOST_VERSION_MIN_PATCH}"
|
2018-12-22 02:49:02 +01:00
|
|
|
boost_cxxflags="-std=gnu++17"
|
|
|
|
bash tools/boostrap.sh $BTOOLSET $BOOST_BUILT_LIBS $boost_variant $withval multi $boost_version $boost_cxxflags
|
2018-01-28 05:46:41 +01:00
|
|
|
AS_IF([ test $? != 0 ],
|
|
|
|
[
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_MSG_ERROR([Failed to build included boost.])
|
2018-01-28 05:46:41 +01:00
|
|
|
])
|
2016-07-20 20:55:46 +02:00
|
|
|
|
2016-07-25 05:31:08 +02:00
|
|
|
AC_DEFINE(HAVE_LIB_BOOST_SYSTEM, 1, [Define if you have boost_system])
|
|
|
|
AC_MSG_NOTICE([Bootstrapping boost: done])
|
2016-07-20 20:55:46 +02:00
|
|
|
],[
|
2016-07-25 05:31:08 +02:00
|
|
|
AC_MSG_RESULT([no])
|
2016-08-14 00:08:24 +02:00
|
|
|
AX_BOOST_BASE([$BOOST_VERSION_MIN],
|
|
|
|
[
|
|
|
|
with_included_boost="no"
|
2016-07-20 20:55:46 +02:00
|
|
|
], [
|
2016-08-14 00:08:24 +02:00
|
|
|
with_included_boost="yes"
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_MSG_ERROR([Failed to find boost_system library. (try --with-included-boost)])
|
|
|
|
])
|
2016-08-14 00:08:24 +02:00
|
|
|
|
2016-07-31 02:56:01 +02:00
|
|
|
AX_BOOST_ASIO
|
|
|
|
AX_BOOST_SYSTEM
|
2016-08-26 02:08:05 +02:00
|
|
|
AX_BOOST_FILESYSTEM
|
2019-02-19 22:03:16 +01:00
|
|
|
AX_BOOST_COROUTINE
|
|
|
|
AX_BOOST_CONTEXT
|
2016-08-14 00:08:24 +02:00
|
|
|
boost_linkage="shared"
|
2016-07-20 20:55:46 +02:00
|
|
|
])
|
|
|
|
|
2016-07-25 05:31:08 +02:00
|
|
|
if [[ "$boost_linkage" = "shared" ]]; then
|
|
|
|
AM_COND_IF([MINGW],
|
|
|
|
[
|
2016-09-05 17:53:36 +02:00
|
|
|
AC_SUBST(BOOST_LIBS, ["-lboost_coroutine-mgw53-1_61.dll -lboost_context-mgw53-1_61.dll -lboost_thread-mgw53-1_61.dll -lboost_filesystem-mgw53-1_61.dll -lboost_system-mgw53-1_61.dll"])
|
2016-07-25 05:31:08 +02:00
|
|
|
], [
|
2016-10-25 10:26:24 +02:00
|
|
|
AC_SUBST(BOOST_LIBS, ["-lboost_coroutine -lboost_context -lboost_thread -lboost_filesystem -lboost_system"])
|
2016-07-25 05:31:08 +02:00
|
|
|
])
|
|
|
|
else
|
|
|
|
AM_COND_IF([MINGW],
|
|
|
|
[
|
2016-09-05 17:53:36 +02:00
|
|
|
AC_SUBST(BOOST_LIBS, ["$boost_libdir/libboost_coroutine-mgw53-1_61.dll.a $boost_libdir/libboost_context-mgw53-1_61.dll.a $boost_libdir/libboost_thread-mgw53-1_61.dll.a $boost_libdir/libboost_filesystem-mgw53-1_61.dll.a $boost_libdir/libboost_system-mgw53-1_61.dll.a"])
|
2016-07-25 05:31:08 +02:00
|
|
|
], [
|
2016-11-29 16:23:38 +01:00
|
|
|
AC_SUBST(BOOST_LIBS, ["$boost_libdir/libboost_coroutine.a $boost_libdir/libboost_context.a $boost_libdir/libboost_thread.a $boost_libdir/libboost_filesystem.a $boost_libdir/libboost_system.a"])
|
2016-07-25 05:31:08 +02:00
|
|
|
])
|
|
|
|
fi
|
2016-07-20 20:55:46 +02:00
|
|
|
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-09-24 06:01:57 +02:00
|
|
|
dnl
|
|
|
|
dnl RocksDB support
|
|
|
|
dnl
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-09-24 06:01:57 +02:00
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
ROCKSDB_VERSION_MIN="v5.16.6"
|
|
|
|
|
|
|
|
AC_SUBST(ROCKSDB_CPPFLAGS, [])
|
|
|
|
AC_SUBST(ROCKSDB_LDFLAGS, [])
|
|
|
|
AC_SUBST(ROCKSDB_LIBS, [])
|
|
|
|
|
|
|
|
AC_ARG_WITH(rocksdb-includes,
|
|
|
|
AC_HELP_STRING([--with-rocksdb-includes=[[[DIR]]]], [Path to RocksDB include directory]),
|
|
|
|
[
|
|
|
|
ROCKSDB_CPPFLAGS="-isystem $withval"
|
|
|
|
], [])
|
|
|
|
|
|
|
|
AC_ARG_WITH(rocksdb-libs,
|
|
|
|
AC_HELP_STRING([--with-rocksdb-libs=[[[DIR]]]], [Path to RocksDB library directory]),
|
|
|
|
[
|
|
|
|
ROCKSDB_LDFLAGS="-L$withval"
|
|
|
|
], [])
|
|
|
|
|
2016-09-24 06:01:57 +02:00
|
|
|
AC_MSG_CHECKING([whether you asked to use the RocksDB included here])
|
|
|
|
AC_ARG_WITH(included-rocksdb,
|
|
|
|
AC_HELP_STRING([--with-included-rocksdb[[[=shared]]]], [Use the RocksDB sources from included submodule]),
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
with_included_rocksdb="yes"
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
ROCKSDB_CPPFLAGS="-isystem $PWD/deps/rocksdb/include"
|
|
|
|
ROCKSDB_LDFLAGS="-L$PWD/deps/rocksdb/"
|
2016-09-24 06:01:57 +02:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether to use shared RocksDB])
|
2018-08-25 23:30:55 +02:00
|
|
|
if [[ $withval = "static" ]]; then
|
2016-09-24 06:01:57 +02:00
|
|
|
AC_MSG_RESULT([no])
|
2018-08-25 23:30:55 +02:00
|
|
|
withval="static"
|
2016-09-24 06:01:57 +02:00
|
|
|
rocksdb_linkage="static_lib"
|
|
|
|
AC_MSG_NOTICE([static RocksDB linkage requires multiple dependencies])
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_MSG_NOTICE([| You may need at least: bzip2, zlib, snappy, lz4])
|
|
|
|
ROCKSDB_LIBS="$PWD/deps/rocksdb/librocksdb.a"
|
2018-08-25 23:30:55 +02:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
withval="shared"
|
|
|
|
rocksdb_linkage="shared_lib"
|
|
|
|
AC_MSG_NOTICE([Shared RocksDB linkage requires running charybdis with an intact build directory])
|
|
|
|
ROCKSDB_LDFLAGS+=" -Wl,-rpath=$PWD/deps/rocksdb"
|
2019-02-19 22:01:45 +01:00
|
|
|
ROCKSDB_LIBS="-lrocksdb"
|
2016-09-24 06:01:57 +02:00
|
|
|
fi
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
bash tools/buildrocks.sh $rocksdb_linkage "$ROCKSDB_VERSION_MIN"
|
2018-01-28 05:46:41 +01:00
|
|
|
AS_IF([ test $? != 0 ],
|
|
|
|
[
|
|
|
|
AC_MSG_ERROR([Failed to build RocksDB])
|
|
|
|
])
|
2016-09-24 06:01:57 +02:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
with_included_rocksdb="no"
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
AC_CHECK_LIB(rocksdb, rocksdb_open, [],
|
|
|
|
[
|
2016-09-24 06:01:57 +02:00
|
|
|
AC_MSG_ERROR([Unable to find required RocksDB package. Try apt-get install librocksdb-dev])
|
|
|
|
])
|
|
|
|
|
2019-02-19 22:01:45 +01:00
|
|
|
ROCKSDB_LIBS="-lrocksdb"
|
2016-09-24 06:01:57 +02:00
|
|
|
])
|
|
|
|
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-10-11 06:28:16 +02:00
|
|
|
dnl
|
|
|
|
dnl SpiderMonkey support
|
|
|
|
dnl
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-10-11 06:28:16 +02:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether you asked to use the JS engine included here])
|
|
|
|
AC_ARG_WITH(included-js,
|
|
|
|
AC_HELP_STRING([--with-included-js[[[=shared]]]], [Use the JS engine (SpiderMonkey) sources we include here]),
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
with_included_js="yes"
|
|
|
|
|
|
|
|
AC_SUBST(JS_CPPFLAGS)
|
2018-01-28 05:46:41 +01:00
|
|
|
JS_CPPFLAGS+=" -isystem $PWD/deps/gecko-dev/js/src/build_OPT.OBJ/dist/include"
|
|
|
|
#JS_CPPFLAGS+=" -I$PWD/deps/gecko-dev/js/src/build_OPT.OBJ/dist/include"
|
2016-10-11 06:28:16 +02:00
|
|
|
|
|
|
|
AC_SUBST(JS_LDFLAGS)
|
2018-01-28 05:46:41 +01:00
|
|
|
JS_LDFLAGS+=" -L$PWD/deps/gecko-dev/js/src/build_OPT.OBJ/dist/sdk/lib"
|
|
|
|
JS_LDFLAGS+=" -L$PWD/deps/gecko-dev/js/src/build_OPT.OBJ/intl/icu/target/lib"
|
|
|
|
JS_LDFLAGS+=" -L$PWD/deps/gecko-dev/js/src/build_OPT.OBJ/js/src"
|
2016-10-11 06:28:16 +02:00
|
|
|
|
|
|
|
AC_SUBST(JS_LIBS)
|
2017-08-23 23:25:22 +02:00
|
|
|
JS_LIBS+=" -lmozjs-52"
|
|
|
|
JS_LIBS+=" -lmozglue"
|
2016-10-11 06:28:16 +02:00
|
|
|
|
|
|
|
dnl !!!!
|
|
|
|
dnl HACK BUG-WORKAROUND - Mozilla forgot to include this in their lib?
|
|
|
|
dnl Runtime segfault (unresolved dynamic function address) if this is not specified
|
2018-01-28 05:46:41 +01:00
|
|
|
#JS_LIBS+=" $PWD/deps/gecko-dev/js/src/build_OPT.OBJ/mfbt/Unified_cpp_mfbt0.o"
|
|
|
|
#JS_LIBS+=" $PWD/deps/gecko-dev/js/src/build_OPT.OBJ/mfbt/Unified_cpp_mfbt1.o"
|
|
|
|
JS_LIBS+=" $PWD/deps/gecko-dev/js/src/build_OPT.OBJ/mozglue/misc/TimeStamp.o"
|
2016-10-11 06:28:16 +02:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether to use shared JS engine])
|
|
|
|
if [[ $withval = "shared" ]]; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_MSG_NOTICE([Shared SpiderMonkey linkage requires running charybdis with an intact build directory])
|
|
|
|
js_linkage="shared"
|
2018-01-28 05:46:41 +01:00
|
|
|
JS_LDFLAGS+=" -Wl,-rpath=$PWD/deps/gecko-dev/js/src/build_OPT.OBJ/dist/sdk/lib"
|
|
|
|
JS_LDFLAGS+=" -Wl,-rpath=$PWD/deps/gecko-dev/js/src/build_OPT.OBJ/intl/icu/target/lib"
|
2016-10-11 06:28:16 +02:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
js_linkage="static"
|
|
|
|
JS_LIBS+=" -ljs_static"
|
|
|
|
fi
|
|
|
|
|
2017-08-23 23:25:22 +02:00
|
|
|
js_branch="esr52"
|
2016-11-25 03:22:36 +01:00
|
|
|
|
|
|
|
if [[ $DEBUG ]]; then
|
2017-08-23 23:25:22 +02:00
|
|
|
js_options="--disable-optimize --enable-debug --disable-js-shell"
|
2016-11-25 03:22:36 +01:00
|
|
|
else
|
2017-08-23 23:25:22 +02:00
|
|
|
js_options="--enable-optimize --disable-js-shell"
|
2016-11-25 03:22:36 +01:00
|
|
|
fi
|
|
|
|
|
2018-07-03 23:35:10 +02:00
|
|
|
bash tools/buildjs.sh "$js_branch" "$js_options"
|
2016-11-29 16:23:38 +01:00
|
|
|
|
|
|
|
RB_DEFINE_UNQUOTED([ENABLE_JS], [1], [ Enable JavaScript support. ])
|
|
|
|
RB_DEFINE_UNQUOTED([INC_JSAPI_H], [jsapi.h>], [ SpiderMonkey JavaScript API. ])
|
|
|
|
RB_DEFINE_UNQUOTED([INC_JSFRIENDAPI_H], [jsfriendapi.h>], [ SpiderMonkey JavaScript Extended API. ])
|
|
|
|
RB_DEFINE_UNQUOTED([INC_JS_CONVERSIONS_H], [js/Conversions.h>], [ SpiderMonkey JavaScript Conversions. ])
|
2016-10-11 06:28:16 +02:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
with_included_js="no"
|
|
|
|
|
|
|
|
dnl TODO mumble mumble
|
2017-08-23 23:25:22 +02:00
|
|
|
AC_CHECK_LIB(mozjs-52, _Z11JS_ShutDownv,
|
2016-10-11 06:28:16 +02:00
|
|
|
[
|
|
|
|
|
|
|
|
], [
|
2017-08-23 23:25:22 +02:00
|
|
|
AC_MSG_WARN([Unable to find JS engine (SpiderMonkey 52) package. Try apt-get install libmozjs-dev])
|
2016-10-11 06:28:16 +02:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl TODO
|
2017-08-23 23:25:22 +02:00
|
|
|
dnl AC_SUBST(JS_CPPFLAGS, ["-I/usr/include/mozjs-52"])
|
2016-11-29 16:23:38 +01:00
|
|
|
dnl AC_SUBST(JS_LDFLAGS, [])
|
2017-08-23 23:25:22 +02:00
|
|
|
dnl AC_SUBST(JS_LIBS, ["-lmozjs-52"])
|
2016-10-11 06:28:16 +02:00
|
|
|
])
|
|
|
|
|
2016-11-29 16:23:38 +01:00
|
|
|
dnl TODO use an $enable_js var
|
|
|
|
AM_CONDITIONAL([JS], [[[[ $with_included_js = yes ]]]])
|
|
|
|
|
2018-11-29 21:58:01 +01:00
|
|
|
dnl
|
|
|
|
dnl
|
|
|
|
dnl jemalloc
|
|
|
|
dnl
|
|
|
|
dnl
|
|
|
|
|
|
|
|
RB_CHK_SYSHEADER(jemalloc/jemalloc.h, [JEMALLOC_H])
|
|
|
|
AC_CHECK_LIB(jemalloc, malloc,
|
|
|
|
[
|
|
|
|
jemalloc="yes"
|
|
|
|
], [
|
|
|
|
jemalloc="no"
|
|
|
|
])
|
|
|
|
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-10-25 10:26:24 +02:00
|
|
|
dnl
|
|
|
|
dnl Additional linkages
|
|
|
|
dnl
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-10-25 10:26:24 +02:00
|
|
|
|
2018-11-29 21:39:33 +01:00
|
|
|
AC_SUBST(EXTRA_CPPFLAGS)
|
|
|
|
AC_SUBST(EXTRA_CXXFLAGS)
|
|
|
|
AC_SUBST(EXTRA_LDFLAGS)
|
|
|
|
AC_SUBST(EXTRA_LIBS)
|
|
|
|
|
2016-10-25 10:26:24 +02:00
|
|
|
AM_COND_IF([MINGW],
|
|
|
|
[
|
|
|
|
|
|
|
|
], [
|
2018-11-29 21:39:33 +01:00
|
|
|
EXTRA_CXXFLAGS+=" -pthread"
|
|
|
|
EXTRA_LIBS+="-lpthread -latomic"
|
2016-10-25 10:26:24 +02:00
|
|
|
])
|
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl ***************************************************************************
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl Application settings
|
|
|
|
dnl
|
2011-05-08 15:55:32 +02:00
|
|
|
|
2018-08-12 19:16:00 +02:00
|
|
|
dnl
|
|
|
|
dnl --with-mxid-maxlen
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_ARG_WITH(mxid-maxlen,
|
|
|
|
AC_HELP_STRING([--with-mxid-maxlen=LENGTH],[Set the upper-bound mxid length to LENGTH (default 255, max 511)]),
|
|
|
|
[
|
|
|
|
if ! expr "$withval" + 0 >/dev/null 2>&1; then
|
|
|
|
AC_ERROR([MXID_MAXLEN must be a numeric value])
|
|
|
|
fi
|
|
|
|
if test $withval -gt 511; then
|
|
|
|
MXID_MAXLEN=511
|
|
|
|
AC_MSG_WARN([MXID_MAXLEN has a hard limit of 511. Setting MXID_MAXLEN=511])
|
|
|
|
elif test $withval -lt 4; then
|
|
|
|
MXID_MAXLEN=4
|
|
|
|
AC_MSG_WARN([MXID_MAXLEN has a lower limit of 4. Setting MXID_MAXLEN=4])
|
|
|
|
else
|
|
|
|
MXID_MAXLEN="$withval"
|
|
|
|
fi
|
|
|
|
], [
|
|
|
|
MXID_MAXLEN=255
|
|
|
|
])
|
|
|
|
|
|
|
|
RB_DEFINE_UNQUOTED([MXID_MAXLEN], [$MXID_MAXLEN], [Maximum string length of an MXID (not including null)])
|
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl ***************************************************************************
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl Branding defined in the compilation
|
|
|
|
dnl
|
|
|
|
|
2018-04-03 01:50:51 +02:00
|
|
|
VERSION_COMMIT_CMD="git rev-parse --short HEAD"
|
|
|
|
RB_VERSION_COMMIT=`$VERSION_COMMIT_CMD`
|
|
|
|
RB_DEFINE_UNQUOTED([VERSION_COMMIT], ["$RB_VERSION_COMMIT"], [Git commit at configuration time.])
|
|
|
|
#CPPDEFINE([RB_VERSION_COMMIT], [`$VERSION_COMMIT_CMD`])
|
|
|
|
|
|
|
|
VERSION_BRANCH_CMD="git rev-parse --abbrev-ref HEAD"
|
|
|
|
RB_VERSION_BRANCH=`$VERSION_BRANCH_CMD`
|
|
|
|
RB_DEFINE_UNQUOTED([VERSION_BRANCH], ["$RB_VERSION_BRANCH"], [Git branch at configuration time.])
|
|
|
|
#CPPDEFINE([RB_VERSION_BRANCH], [`$VERSION_BRANCH_CMD`])
|
|
|
|
|
|
|
|
VERSION_TAG_CMD="git describe --tags --abbrev=0 --dirty"
|
|
|
|
RB_VERSION_TAG=`$VERSION_TAG_CMD`
|
|
|
|
RB_DEFINE_UNQUOTED([VERSION_TAG], ["$RB_VERSION_TAG"], [Git tag at configuration time.])
|
|
|
|
#CPPDEFINE([RB_VERSION_TAG], [`$VERSION_TAG_CMD`])
|
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
VERSION_CMD="git describe --tags"
|
|
|
|
RB_VERSION=`$VERSION_CMD`
|
|
|
|
RB_DEFINE_UNQUOTED([VERSION], ["$RB_VERSION"], [Version generated at configuration time.])
|
|
|
|
|
2016-07-31 03:00:19 +02:00
|
|
|
DATESTR_CMD="date"
|
2016-07-20 20:55:46 +02:00
|
|
|
RB_DATESTR=`$DATESTR_CMD`
|
|
|
|
RB_DEFINE_UNQUOTED([DATESTR], ["$RB_DATESTR"], [Readable date string of configuration time.])
|
|
|
|
|
|
|
|
DATECODE_CMD="date +%s"
|
|
|
|
RB_DATECODE=`$DATECODE_CMD`
|
|
|
|
RB_DEFINE_UNQUOTED([DATECODE], [$RB_DATECODE], [UNIX epoch time at configuration time.])
|
|
|
|
|
2016-08-16 00:26:38 +02:00
|
|
|
dnl TODO: XXX: These have better names than the above, rm previous eventually.
|
|
|
|
RB_DEFINE_UNQUOTED([DATE_CONFIGURED], ["$RB_DATESTR"], [Convenience string of RB_TIME_CONFIGURED])
|
2018-09-06 08:32:52 +02:00
|
|
|
CPPDEFINE([RB_TIME_CONFIGURED], [$(date +%s)])
|
2016-08-16 00:26:38 +02:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
dnl --with-custom-branding
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether custom branding is requested])
|
|
|
|
AC_ARG_WITH(custom-branding, AC_HELP_STRING([--with-custom-branding=NAME], [Custom branding name.]),
|
2007-01-25 07:40:21 +01:00
|
|
|
[
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_DEFINE_UNQUOTED(BRANDING_NAME, ["$withval"], [Custom branding name.])
|
|
|
|
AC_DEFINE(CUSTOM_BRANDING, 1, [Define if custom branding is enabled.])
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
],[
|
|
|
|
AC_DEFINE_UNQUOTED(BRANDING_NAME, ["$PACKAGE_NAME"], [Current package])
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl
|
|
|
|
dnl --with-custom-version
|
|
|
|
dnl
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
AC_MSG_CHECKING([whether a custom version is requested])
|
|
|
|
AC_ARG_WITH(custom-version, AC_HELP_STRING([--with-custom-version=NAME], [Custom version branding.]),
|
|
|
|
[
|
|
|
|
AC_DEFINE_UNQUOTED(BRANDING_VERSION, ["$withval"], [Custom branding version.])
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
], [
|
|
|
|
AC_DEFINE_UNQUOTED(BRANDING_VERSION, ["$RB_VERSION"], [Current version])
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
])
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl ***************************************************************************
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl Misc
|
|
|
|
dnl
|
|
|
|
|
|
|
|
dnl ***************************************************************************
|
2018-08-12 18:54:44 +02:00
|
|
|
dnl
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl Output
|
|
|
|
dnl
|
2016-02-06 23:17:48 +01:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
AC_OUTPUT
|
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
if [[ $DEBUG ]]; then
|
|
|
|
debug="yes"
|
|
|
|
else
|
|
|
|
debug="no"
|
|
|
|
fi
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2018-05-22 01:56:20 +02:00
|
|
|
|
2016-07-20 20:55:46 +02:00
|
|
|
dnl Make it look sexay!
|
|
|
|
echo
|
|
|
|
echo "Configured ........................ $PACKAGE_NAME $PACKAGE_VERSION"
|
|
|
|
echo "Version ........................... $RB_VERSION"
|
|
|
|
echo "Configuration time ................ $RB_DATESTR"
|
2018-01-11 06:30:31 +01:00
|
|
|
echo "Host OS ........................... $host_os"
|
2016-07-20 20:55:46 +02:00
|
|
|
echo "Compiler .......................... $CXX"
|
|
|
|
echo "Compiler flags (CXXFLAGS) ......... $CXXFLAGS"
|
|
|
|
echo "Building boost .................... $with_included_boost"
|
2018-07-06 08:52:47 +02:00
|
|
|
echo "Building RocksDB .................. $with_included_rocksdb"
|
2016-10-11 06:28:16 +02:00
|
|
|
echo "Building JS (SpiderMonkey) ........ $with_included_js"
|
2019-02-19 22:01:45 +01:00
|
|
|
echo "Ziplinks (libz) support ........... $have_zlib"
|
|
|
|
echo "LZ4 support ....................... $have_lz4"
|
|
|
|
echo "Snappy support .................... $have_snappy"
|
2017-10-01 09:15:17 +02:00
|
|
|
echo "GNU MP support .................... $have_gmp"
|
2017-10-01 04:14:45 +02:00
|
|
|
echo "Sodium support .................... $have_sodium"
|
2018-09-03 12:02:35 +02:00
|
|
|
echo "SSL support ....................... $have_ssl"
|
|
|
|
echo "Crypto support .................... $have_crypto"
|
2018-07-06 08:52:47 +02:00
|
|
|
echo "Magic support ..................... $have_magic"
|
2018-05-16 21:36:31 +02:00
|
|
|
echo "Linux AIO support ................. $aio"
|
|
|
|
echo "IPv6 support ...................... $ipv6"
|
2016-07-24 03:42:24 +02:00
|
|
|
echo "Precompiled headers ............... $build_pch"
|
2016-07-20 20:55:46 +02:00
|
|
|
echo "Developer debug ................... $debug"
|
2018-05-16 21:36:31 +02:00
|
|
|
echo "Developer assert .................. $assert"
|
|
|
|
echo "Optimized build ................... $optimize"
|
2019-01-22 22:13:36 +01:00
|
|
|
echo "Link-time optimized ............... $lto"
|
2018-05-28 11:45:34 +02:00
|
|
|
echo "Optimization level ................ $optimize_level"
|
2018-07-06 08:52:29 +02:00
|
|
|
echo "Generic binary .................... $enable_generic"
|
2018-05-22 01:55:10 +02:00
|
|
|
echo "Logging level ..................... $LOG_LEVEL"
|
2016-07-20 20:55:46 +02:00
|
|
|
echo "Installing into ................... $prefix"
|
2016-07-01 05:04:00 +02:00
|
|
|
echo
|
2016-07-20 20:55:46 +02:00
|
|
|
echo "* Ready to build $PACKAGE_NAME"
|
|
|
|
echo "* Now run 'make'"
|