2012-03-14 22:54:31 +00:00
|
|
|
dnl Process this file with autoconf to produce a configure script.
|
2012-07-27 02:14:20 +00:00
|
|
|
AC_INIT(servald, 0.9)
|
2012-09-12 05:51:50 +00:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2016-09-06 07:57:02 +00:00
|
|
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
2012-05-21 02:52:50 +00:00
|
|
|
|
2012-04-23 05:58:00 +00:00
|
|
|
dnl Set $host_os, which is needed by javac detection.
|
|
|
|
AC_CANONICAL_SYSTEM
|
|
|
|
|
2015-11-23 02:48:30 +00:00
|
|
|
dnl Various GCC function and variable attributes
|
2015-12-26 06:59:01 +00:00
|
|
|
AX_GCC_FUNC_ATTRIBUTE(aligned)
|
|
|
|
AX_GCC_FUNC_ATTRIBUTE(alloc_size)
|
|
|
|
AX_GCC_FUNC_ATTRIBUTE(error)
|
|
|
|
AX_GCC_FUNC_ATTRIBUTE(format)
|
|
|
|
AX_GCC_FUNC_ATTRIBUTE(malloc)
|
|
|
|
AX_GCC_FUNC_ATTRIBUTE(unused)
|
|
|
|
AX_GCC_FUNC_ATTRIBUTE(used)
|
|
|
|
AX_GCC_VAR_ATTRIBUTE(section)
|
2016-01-18 10:46:01 +00:00
|
|
|
AX_GCC_VAR_ATTRIBUTE(section_seg)
|
2015-11-23 02:48:30 +00:00
|
|
|
|
2012-04-24 03:48:00 +00:00
|
|
|
dnl Init pkg-config
|
2012-04-23 10:47:11 +00:00
|
|
|
PKG_PROG_PKG_CONFIG()
|
|
|
|
|
2014-02-25 04:16:10 +00:00
|
|
|
dnl Specify default instance path
|
|
|
|
AC_ARG_VAR([INSTANCE_PATH], [default instance path for servald])
|
|
|
|
AS_IF([test "x$INSTANCE_PATH" != x], [AC_DEFINE_UNQUOTED([INSTANCE_PATH], ["$INSTANCE_PATH"], [default instance path])])
|
|
|
|
|
2014-03-26 05:05:43 +00:00
|
|
|
dnl Specify default Serval config directory
|
|
|
|
AC_ARG_VAR([SERVAL_ETC_PATH], [default Serval config directory])
|
|
|
|
AS_IF([test "x$SERVAL_ETC_PATH" != x], [AC_DEFINE_UNQUOTED([SERVAL_ETC_PATH], ["$SERVAL_ETC_PATH"], [default config directory])])
|
|
|
|
|
|
|
|
dnl Specify default Serval run directory
|
|
|
|
AC_ARG_VAR([SERVAL_RUN_PATH], [default Serval run directory])
|
|
|
|
AS_IF([test "x$SERVAL_RUN_PATH" != x], [AC_DEFINE_UNQUOTED([SERVAL_RUN_PATH], ["$SERVAL_RUN_PATH"], [default run directory])])
|
|
|
|
|
|
|
|
dnl Specify default Serval log directory
|
|
|
|
AC_ARG_VAR([SERVAL_LOG_PATH], [default Serval log directory])
|
|
|
|
AS_IF([test "x$SERVAL_LOG_PATH" != x], [AC_DEFINE_UNQUOTED([SERVAL_LOG_PATH], ["$SERVAL_LOG_PATH"], [default log directory])])
|
|
|
|
|
|
|
|
dnl Specify default system log directory
|
|
|
|
AC_ARG_VAR([SYSTEM_LOG_PATH], [default system log directory])
|
|
|
|
AS_IF([test "x$SYSTEM_LOG_PATH" != x], [AC_DEFINE_UNQUOTED([SYSTEM_LOG_PATH], ["$SYSTEM_LOG_PATH"], [default system log directory])])
|
|
|
|
|
|
|
|
dnl Specify default Serval tmp directory
|
|
|
|
AC_ARG_VAR([SERVAL_TMP_PATH], [default Serval tmp directory])
|
|
|
|
AS_IF([test "x$SERVAL_TMP_PATH" != x], [AC_DEFINE_UNQUOTED([SERVAL_TMP_PATH], ["$SERVAL_TMP_PATH"], [default Serval tmp directory])])
|
|
|
|
|
|
|
|
dnl Specify default Rhizome store directory
|
|
|
|
AC_ARG_VAR([RHIZOME_STORE_PATH], [default Rhizome store directory])
|
|
|
|
AS_IF([test "x$RHIZOME_STORE_PATH" != x], [AC_DEFINE_UNQUOTED([RHIZOME_STORE_PATH], ["$RHIZOME_STORE_PATH"], [default Rhizome store directory])])
|
|
|
|
|
2012-04-23 02:35:00 +00:00
|
|
|
dnl Check for programs.
|
2012-03-14 22:54:31 +00:00
|
|
|
AC_PROG_CC
|
2012-04-23 02:35:00 +00:00
|
|
|
|
2016-09-19 02:51:57 +00:00
|
|
|
dnl Check for compiler options
|
|
|
|
AX_APPEND_COMPILE_FLAGS(
|
|
|
|
-Wno-empty-body \
|
|
|
|
-Wno-unused-value \
|
|
|
|
-Wno-unused-function \
|
|
|
|
-Wno-unused-parameter \
|
|
|
|
-Wno-unused-variable \
|
|
|
|
-Wno-unused-but-set-variable \
|
|
|
|
-Wno-missing-field-initializers \
|
|
|
|
-Wno-deprecated-declarations,
|
|
|
|
[CFLAGS_SQLITE], [-Werror])
|
|
|
|
AC_SUBST([CFLAGS_SQLITE])
|
|
|
|
|
2012-04-23 10:47:11 +00:00
|
|
|
dnl Math library functions for spandsp
|
|
|
|
AC_CHECK_HEADERS([math.h], [INSERT_MATH_HEADER="#include <math.h>"])
|
|
|
|
AC_CHECK_HEADERS([float.h])
|
|
|
|
|
2012-04-23 02:35:00 +00:00
|
|
|
dnl Check for a working Java compiler, keep going if unsuccessful.
|
2012-04-24 03:48:00 +00:00
|
|
|
dnl *** Kludge: override AC_MSG_ERROR because AC_PROG_JAVAC does not have
|
|
|
|
dnl *** [if-found] and [if-not-found] action parameters.
|
2012-04-23 02:35:00 +00:00
|
|
|
pushdef([AC_MSG_ERROR], defn([AC_MSG_WARN]))
|
2012-04-20 07:27:36 +00:00
|
|
|
AC_PROG_JAVAC
|
2012-04-23 02:35:00 +00:00
|
|
|
popdef([AC_MSG_ERROR])
|
2012-04-23 08:55:26 +00:00
|
|
|
AC_SUBST([JAVAC])
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2012-04-23 02:35:00 +00:00
|
|
|
dnl Check for JNI includes, keep going if not present.
|
2012-04-23 08:55:26 +00:00
|
|
|
if test -n "$JAVAC"; then
|
2012-04-24 03:48:00 +00:00
|
|
|
dnl *** Kludge: override AC_MSG_ERROR because AC_JNI_INCLUDE_DIR does not have
|
|
|
|
dnl *** [if-found] and [if-not-found] action parameters.
|
2012-04-23 08:55:26 +00:00
|
|
|
pushdef([AC_MSG_ERROR], defn([AC_MSG_WARN]))
|
|
|
|
AC_JNI_INCLUDE_DIR
|
|
|
|
for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS; do
|
2016-09-06 07:57:02 +00:00
|
|
|
CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR"
|
2012-04-23 08:55:26 +00:00
|
|
|
done
|
|
|
|
popdef([AC_MSG_ERROR])
|
|
|
|
fi
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2012-09-05 09:23:22 +00:00
|
|
|
dnl XXX Isn't this pointless? we are always linked against libc
|
2012-04-23 02:35:00 +00:00
|
|
|
AC_CHECK_LIB(c,srandomdev)
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2016-09-05 07:17:46 +00:00
|
|
|
AC_CHECK_LIB(m,sqrtf,[LDFLAGS="$LDFLAGS -lm"])
|
|
|
|
AC_CHECK_LIB(nsl,callrpc,[LDFLAGS="$LDFLAGS -lnsl"])
|
|
|
|
AC_CHECK_LIB(dl,dlopen,[LDFLAGS="$LDFLAGS -ldl"])
|
|
|
|
|
2012-09-05 09:23:22 +00:00
|
|
|
dnl Solaris hides nanosleep here
|
|
|
|
AC_CHECK_LIB(rt,nanosleep)
|
|
|
|
|
2014-02-17 04:03:32 +00:00
|
|
|
AC_CHECK_FUNCS([getpeereid bcopy bzero bcmp lseek64])
|
|
|
|
AC_CHECK_TYPES([off64_t], [have_off64_t=1], [have_off64_t=0])
|
|
|
|
AC_CHECK_SIZEOF([off_t])
|
|
|
|
|
|
|
|
dnl There must be a 64-bit seek(2) system call of some kind
|
2014-02-25 02:15:55 +00:00
|
|
|
AS_IF([test "x$have_lseek64_t" = "xno" -a "x$ac_cv_sizeof_off_t" != x8 ], [
|
2014-02-17 04:03:32 +00:00
|
|
|
AC_MSG_ERROR([Missing lseek64(2) system call])
|
|
|
|
])
|
2012-09-05 09:23:22 +00:00
|
|
|
|
2012-05-10 08:59:27 +00:00
|
|
|
AC_CHECK_HEADERS(
|
|
|
|
stdio.h \
|
|
|
|
errno.h \
|
|
|
|
stdlib.h \
|
|
|
|
strings.h \
|
|
|
|
unistd.h \
|
|
|
|
string.h \
|
|
|
|
arpa/inet.h \
|
|
|
|
sys/socket.h \
|
|
|
|
sys/mman.h \
|
|
|
|
sys/time.h \
|
2012-05-21 02:52:50 +00:00
|
|
|
sys/ucred.h \
|
2014-06-23 01:38:01 +00:00
|
|
|
sys/statvfs.h \
|
2014-06-26 02:47:36 +00:00
|
|
|
sys/stat.h \
|
2014-06-23 01:38:01 +00:00
|
|
|
sys/vfs.h \
|
2012-05-10 08:59:27 +00:00
|
|
|
poll.h \
|
|
|
|
netdb.h \
|
2012-05-21 02:52:50 +00:00
|
|
|
linux/ioctl.h \
|
2012-05-10 08:59:27 +00:00
|
|
|
linux/netlink.h \
|
|
|
|
linux/rtnetlink.h \
|
|
|
|
net/if.h \
|
|
|
|
netinet/in.h \
|
|
|
|
ifaddrs.h \
|
|
|
|
net/route.h \
|
|
|
|
signal.h \
|
|
|
|
jni.h \
|
2012-09-05 09:23:22 +00:00
|
|
|
ucred.h \
|
|
|
|
sys/filio.h \
|
|
|
|
sys/endian.h \
|
|
|
|
sys/byteorder.h \
|
2013-09-19 07:56:06 +00:00
|
|
|
sys/sockio.h \
|
|
|
|
sys/socket.h
|
2012-05-10 08:59:27 +00:00
|
|
|
)
|
2013-09-19 07:56:06 +00:00
|
|
|
AC_CHECK_HEADERS(
|
|
|
|
linux/if.h
|
|
|
|
,,, [
|
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#endif
|
|
|
|
])
|
2012-04-20 07:27:36 +00:00
|
|
|
|
2016-09-06 07:57:02 +00:00
|
|
|
dnl libsodium
|
|
|
|
|
|
|
|
m4_define([LIBSODIUM_MESSAGE], [
|
|
|
|
*** If your platform provides a libsodium development package, then
|
|
|
|
*** install it and try again, eg, on Debian/Ubuntu:
|
|
|
|
*** sudo apt-get install libsodium-dev
|
|
|
|
*** If using a libsodium built locally from source, ensure that the
|
|
|
|
*** $1 environment variable is set, eg, with the command:
|
|
|
|
*** . libsodium/settings.sh
|
|
|
|
*** See INSTALL.md and doc/Development.md for more information.
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_CHECK_HEADERS(
|
|
|
|
sodium.h,, [AC_MSG_ERROR([missing sodium.h LIBSODIUM_MESSAGE([C_INCLUDE_PATH])])]
|
|
|
|
)
|
|
|
|
|
|
|
|
AC_CHECK_LIB(sodium, sodium_init,, [AC_MSG_ERROR([missing libsodium LIBSODIUM_MESSAGE([LIBRARY_PATH])])])
|
|
|
|
|
2012-07-30 01:49:25 +00:00
|
|
|
dnl Lazy way of checking for Linux
|
2013-09-19 07:56:06 +00:00
|
|
|
AS_IF([test "x$ac_cv_header_linux_if_h" = xyes], [AC_DEFINE([USE_ABSTRACT_NAMESPACE])])
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2014-02-25 04:17:00 +00:00
|
|
|
AC_CACHE_CHECK([linker -z relro option], libc_cv_z_relro, [dnl
|
2014-02-17 03:41:00 +00:00
|
|
|
libc_cv_z_relro=no
|
2014-02-25 04:17:00 +00:00
|
|
|
AS_IF([AC_TRY_COMMAND([${CC-cc} -v --help 2>&1 | grep "z relro" 1>&AS_MESSAGE_LOG_FD])], [
|
|
|
|
AS_IF([AC_TRY_COMMAND([${CC-cc} -Wl,--verbose 2>&1 | grep DATA_SEGMENT_RELRO_END 1>&AS_MESSAGE_LOG_FD])], [
|
2014-02-17 03:41:00 +00:00
|
|
|
libc_cv_z_relro=yes
|
2014-02-18 03:29:57 +00:00
|
|
|
LDFLAGS="$LDFLAGS -Wl,-z,relro"
|
2014-02-25 04:17:00 +00:00
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl Stack smashing protection is not available on all platforms
|
|
|
|
AC_MSG_CHECKING([for SSP support])
|
|
|
|
have_ssp=0
|
|
|
|
save_cflags="$CFLAGS"
|
|
|
|
CFLAGS="$CFLAGS -fstack-protector --param=ssp-buffer-size=4"
|
|
|
|
AC_LANG([C])
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [
|
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([])], [
|
|
|
|
have_ssp=1
|
|
|
|
])
|
|
|
|
])
|
|
|
|
AS_IF([test x"$have_ssp" = "x1"], [
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_SUBST([HAVE_SSP],1)
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
CFLAGS="$save_cflags"
|
2014-02-18 03:29:57 +00:00
|
|
|
])
|
2014-02-17 03:41:00 +00:00
|
|
|
|
2012-04-23 10:47:11 +00:00
|
|
|
dnl Some platforms still seem to lack the basic single precision trig and power related function.
|
|
|
|
AC_SEARCH_LIBS([sinf], [m], AC_DEFINE([HAVE_SINF], [1], [Define to 1 if you have the sinf() function.]))
|
|
|
|
AC_SEARCH_LIBS([cosf], [m], AC_DEFINE([HAVE_COSF], [1], [Define to 1 if you have the cosf() function.]))
|
|
|
|
AC_SEARCH_LIBS([tanf], [m], AC_DEFINE([HAVE_TANF], [1], [Define to 1 if you have the tanf() function.]))
|
|
|
|
AC_SEARCH_LIBS([asinf], [m], AC_DEFINE([HAVE_ASINF], [1], [Define to 1 if you have the asinf() function.]))
|
|
|
|
AC_SEARCH_LIBS([acosf], [m], AC_DEFINE([HAVE_ACOSF], [1], [Define to 1 if you have the acosf() function.]))
|
|
|
|
AC_SEARCH_LIBS([atanf], [m], AC_DEFINE([HAVE_ATANF], [1], [Define to 1 if you have the atanf() function.]))
|
|
|
|
AC_SEARCH_LIBS([atan2f], [m], AC_DEFINE([HAVE_ATAN2F], [1], [Define to 1 if you have the atan2f() function.]))
|
|
|
|
AC_SEARCH_LIBS([ceilf], [m], AC_DEFINE([HAVE_CEILF], [1], [Define to 1 if you have the ceilf() function.]))
|
|
|
|
AC_SEARCH_LIBS([floorf], [m], AC_DEFINE([HAVE_FLOORF], [1], [Define to 1 if you have the floorf() function.]))
|
|
|
|
AC_SEARCH_LIBS([powf], [m], AC_DEFINE([HAVE_POWF], [1], [Define to 1 if you have the powf() function.]))
|
|
|
|
AC_SEARCH_LIBS([expf], [m], AC_DEFINE([HAVE_EXPF], [1], [Define to 1 if you have the expf() function.]))
|
|
|
|
AC_SEARCH_LIBS([logf], [m], AC_DEFINE([HAVE_LOGF], [1], [Define to 1 if you have the logf() function.]))
|
|
|
|
AC_SEARCH_LIBS([log10f], [m], AC_DEFINE([HAVE_LOG10F], [1], [Define to 1 if you have the log10f() function.]))
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2012-08-13 08:52:17 +00:00
|
|
|
dnl Check for strlcpy (eg Ubuntu)
|
|
|
|
AC_SEARCH_LIBS([strlcpy], [], AC_DEFINE([HAVE_STRLCPY], [1], [Define to 1 if you have the strlcpy() function.]))
|
|
|
|
|
2012-04-23 08:55:26 +00:00
|
|
|
AC_OUTPUT([
|
|
|
|
Makefile
|
|
|
|
testconfig.sh
|
|
|
|
])
|