diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 209 |
1 files changed, 191 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac index 7de495bc..6c7126f5 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,8 @@ AC_CONFIG_AUX_DIR([.]) AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6 subdir-objects]) AC_CONFIG_TESTDIR(tests) +CFLAGS="$CFLAGS -std=gnu11" + dnl kernel style compile messages m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) @@ -51,18 +53,23 @@ case $host in *) LTLDFLAGS_OSMOGB='-Wl,--version-script=$(srcdir)/libosmogb.map' LTLDFLAGS_OSMOGSM='-Wl,--version-script=$(srcdir)/libosmogsm.map' + LTLDFLAGS_OSMOISDN='-Wl,--version-script=$(srcdir)/libosmoisdn.map' LTLDFLAGS_OSMOCODING='-Wl,--version-script=$(srcdir)/libosmocoding.map' + LTLDFLAGS_OSMOCORE='-Wl,--version-script=$(srcdir)/libosmocore.map' LTLDFLAGS_OSMOCTRL='-Wl,--version-script=$(srcdir)/libosmoctrl.map' ;; esac AC_SUBST(LTLDFLAGS_OSMOGB) AC_SUBST(LTLDFLAGS_OSMOGSM) +AC_SUBST(LTLDFLAGS_OSMOISDN) AC_SUBST(LTLDFLAGS_OSMOCODING) +AC_SUBST(LTLDFLAGS_OSMOCORE) AC_SUBST(LTLDFLAGS_OSMOCTRL) dnl checks for header files AC_HEADER_STDC -AC_CHECK_HEADERS(execinfo.h poll.h sys/select.h sys/socket.h sys/signalfd.h sys/timerfd.h syslog.h ctype.h netinet/tcp.h netinet/in.h) +AC_CHECK_HEADERS(execinfo.h poll.h sys/select.h sys/socket.h sys/signalfd.h sys/eventfd.h sys/timerfd.h syslog.h ctype.h netinet/tcp.h netinet/in.h) +AC_CHECK_DECL(HAVE_SYS_SOCKET_H, AC_SUBST(HAVE_SYS_SOCKET_H, 1), AC_SUBST(HAVE_SYS_SOCKET_H, 0)) # for src/conv.c AC_FUNC_ALLOCA AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DLOPEN="$LIBS";LIBS=""]) @@ -76,6 +83,24 @@ AC_SUBST(BACKTRACE_LIB) # check for pthread (PTHREAD_CFLAGS, PTHREAD_LIBS) AX_PTHREAD +AC_MSG_CHECKING(for pthread_getname_np(pthread_t, char*, size_t)) +saved_CFLAGS="$CFLAGS" +saved_LIBS="$LIBS" +CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +LIBS="$LIBS $PTHREAD_LIBS" +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#define _GNU_SOURCE + #include <pthread.h>], + [pthread_getname_np(pthread_self(),"example",0)])], + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PTHREAD_GETNAME_NP,1, + [Have function pthread_setname_np(const char*)])], + [AC_MSG_RESULT(no)]) +CFLAGS="$saved_CFLAGS" +LIBS="$saved_LIBS" + + # check for old glibc < 2.17 to get clock_gettime AC_SEARCH_LIBS([clock_gettime], [rt posix4], [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if clock_gettime is available]) @@ -132,13 +157,37 @@ AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [ CHECK_TM_INCLUDES_TM_GMTOFF +# Check if gettid is available (despite not being documented in glibc doc, +# it requires __USE_GNU on some systems) +# C compiler is used since __USE_GNU seems to be always defined for g++. +save_CPPFLAGS=$CPPFLAGS +AC_LANG_PUSH(C) +CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" +AC_CHECK_FUNCS([gettid]) +AC_LANG_POP(C) +CPPFLAGS=$save_CPPFLAGS + dnl Check if We need to apply workaround for TLS bug on ARM platform for GCC < 7.3.0: ARG_ENABLE_DETECT_TLS_GCC_ARM_BUG dnl Generate the output AC_CONFIG_HEADER(config.h) -PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1]) +PKG_CHECK_MODULES(TALLOC, [talloc >= 2.1.0]) + +AC_ARG_ENABLE([uring], [AS_HELP_STRING([--disable-uring], [Build without io_uring support])], + [ + ENABLE_URING=$enableval + ], + [ + ENABLE_URING="yes" + ]) +AS_IF([test "x$ENABLE_URING" = "xyes"], [ + PKG_CHECK_MODULES(URING, [liburing >= 0.7]) + AC_DEFINE([HAVE_URING],[1],[Build with io_uring support]) +]) +AM_CONDITIONAL(ENABLE_URING, test "x$ENABLE_URING" = "xyes") +AC_SUBST(ENABLE_URING) AC_ARG_ENABLE([pcsc], [AS_HELP_STRING([--disable-pcsc], [Build without PC/SC support])], [ @@ -194,26 +243,50 @@ AS_IF([test "x$systemd_logging" = "xyes"], [ AM_CONDITIONAL(ENABLE_SYSTEMD_LOGGING, test "x$systemd_logging" = "xyes") AC_SUBST(ENABLE_SYSTEMD_LOGGING) +AC_ARG_ENABLE([libmnl], + [AS_HELP_STRING( + [--disable-libmnl], + [Build without netlink socket support via libmnl] + )], + [mnl=$enableval], [mnl="yes"]) +AS_IF([test "x$mnl" = "xyes"], [ + PKG_CHECK_MODULES(LIBMNL, libmnl, [AC_SUBST(LIBMNL_PC, [libmnl])]) + AC_DEFINE([ENABLE_LIBMNL], [1], [Enable netlink socket support via libmnl]) +]) +AM_CONDITIONAL(ENABLE_LIBMNL, test "x$mnl" = "xyes") +AC_SUBST(ENABLE_LIBMNL) + AC_ARG_ENABLE([libsctp], [AS_HELP_STRING([--disable-libsctp], [Do not enable socket multiaddr APIs requiring libsctp])], [ENABLE_LIBSCTP=$enableval], [ENABLE_LIBSCTP="yes"]) AM_CONDITIONAL(ENABLE_LIBSCTP, test x"$ENABLE_LIBSCTP" = x"yes") AS_IF([test "x$ENABLE_LIBSCTP" = "xyes"], [ - old_LIBS=$LIBS - AC_SEARCH_LIBS([sctp_bindx], [sctp], [ - AC_DEFINE(HAVE_LIBSCTP, 1, [Define 1 to enable SCTP support]) - AC_SUBST(HAVE_LIBSCTP, [1]) - if test -n "$ac_lib"; then - AC_SUBST(LIBSCTP_LIBS, [-l$ac_lib]) - fi - ], [ - AC_MSG_ERROR([sctp_bindx not found in searched libs])]) - LIBS=$old_LIBS + AC_DEFINE(HAVE_LIBSCTP, 1, [Define 1 to enable SCTP support]) + # Attempt finding .pc, otherwise set manually (<1.0.17 have no .pc file) + PKG_CHECK_MODULES(LIBSCTP, libsctp, + [AC_SUBST(LIBSCTP_PC, [libsctp])], + [ + AC_MSG_NOTICE([libsctp.pc not found (building against <1.0.17 ?), attempting manual lib lookup]) + old_LIBS=$LIBS + AC_SEARCH_LIBS([sctp_bindx], [sctp], [ + AC_SUBST(HAVE_LIBSCTP, [1]) + if test -n "$ac_lib"; then + AC_SUBST(LIBSCTP_LIBS, [-l$ac_lib]) + fi + ], [ + AC_MSG_ERROR([sctp_bindx not found in searched libs])]) + LIBS=$old_LIBS + ]) ]) AC_ARG_ENABLE([sctp-tests], [AS_HELP_STRING([--disable-sctp-tests], [Do not run socket tests requiring system SCTP support])], [ENABLE_SCTP_TESTS=$enableval], [ENABLE_SCTP_TESTS="yes"]) AM_CONDITIONAL(ENABLE_SCTP_TESTS, test x"$ENABLE_SCTP_TESTS" = x"yes") +AC_ARG_ENABLE([uring-tests], [AS_HELP_STRING([--disable-uring-tests], [Do not run io_uring tests])], + [ENABLE_URING_TESTS=$enableval], [ENABLE_URING_TESTS="yes"]) +AM_CONDITIONAL(ENABLE_URING_TESTS, test x"$ENABLE_URING_TESTS" = x"yes") +AC_SUBST(ENABLE_URING_TESTS) + AC_ARG_ENABLE(plugin, [AS_HELP_STRING( [--disable-plugin], @@ -243,13 +316,13 @@ fi AC_ARG_ENABLE(bsc_fd_check, [AS_HELP_STRING( - [--enable-bsc-fd-check], + [--enable-ofd-check], [Instrument osmo_fd_register to check that the fd is registered] )], [fd_check=$enableval], [fd_check="no"]) -if test x"$fd_check" = x"no" +if test x"$fd_check" = x"yes" then - AC_DEFINE([OSMO_FD_CHECK],[1],[Instrument the osmo_fd_register]) + AC_DEFINE([OSMO_FD_CHECK], [1], [Instrument the osmo_fd_register]) fi AC_ARG_ENABLE([force_io_select], @@ -259,7 +332,7 @@ AC_ARG_ENABLE([force_io_select], )], [force_io_select=$enableval], [force_io_select="no"]) AS_IF([test "x$force_io_select" = "xyes"], [ - AC_DEFINE([FORCE_IO_SELECT], [1], [Force the use of select() instaed of poll()]) + AC_DEFINE([FORCE_IO_SELECT], [1], [Force the use of select() instead of poll()]) ]) AC_ARG_ENABLE(msgfile, @@ -331,9 +404,11 @@ then AM_CONDITIONAL(ENABLE_CTRL, false) AM_CONDITIONAL(ENABLE_UTILITIES, false) AM_CONDITIONAL(ENABLE_GB, false) - AM_CONDITIONAL(ENABLE_GNUTLS, false) + AM_CONDITIONAL(ENABLE_LIBMNL, false) AM_CONDITIONAL(ENABLE_LIBSCTP, false) + AM_CONDITIONAL(ENABLE_LIBUSB, false) AM_CONDITIONAL(ENABLE_PCSC, false) + AM_CONDITIONAL(ENABLE_URING, false) AM_CONDITIONAL(ENABLE_PSEUDOTALLOC, true) AM_CONDITIONAL(ENABLE_SERCOM_STUB, true) AM_CONDITIONAL(EMBEDDED, true) @@ -341,6 +416,17 @@ then AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort]) fi +AC_ARG_ENABLE(log_macros, + [AS_HELP_STRING( + [--disable-log-macros], + [Disable logging macros that are also used internally to print information] + )], + [log_macros="yes"], [log_macros="no"]) +if test x"$log_macros" == x"yes" +then + AC_DEFINE([LIBOSMOCORE_NO_LOGGING],[1],[Disable logging macros]) +fi + AC_ARG_ENABLE(sanitize, [AS_HELP_STRING( [--enable-sanitize], @@ -365,6 +451,7 @@ AC_ARG_ENABLE(werror, if test x"$werror" = x"yes" then WERROR_FLAGS="-Werror" + WERROR_FLAGS+=" -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition" WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" CFLAGS="$CFLAGS $WERROR_FLAGS" @@ -379,7 +466,7 @@ if test "x$enable_ext_tests" = "xyes" ; then AM_PATH_PYTHON AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmo_verify_transcript_vty.py,yes) if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then - AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.]) + AC_MSG_ERROR([Please install https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests to run the VTY/CTRL tests.]) fi fi AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) @@ -411,10 +498,45 @@ AC_ARG_ENABLE(neon, [Enable ARM NEON instructions support [default=no]] )], [neon=$enableval], [neon="no"]) +AS_IF([test "x$neon" = "xyes"], [ + AC_DEFINE([HAVE_NEON],, [Support ARM NEON instructions]) +]) AC_MSG_CHECKING([whether to enable ARM NEON instructions support]) AC_MSG_RESULT([$neon]) AM_CONDITIONAL(HAVE_NEON, [test "x$neon" != "xno"]) +# +# SystemTap support +# +AC_MSG_CHECKING([whether to include systemtap tracing support]) +AC_ARG_ENABLE([systemtap], + [AS_HELP_STRING([--enable-systemtap], + [Enable inclusion of systemtap trace support])], + [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no']) +AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes]) +AC_MSG_RESULT(${ENABLE_SYSTEMTAP}) + +if test "x${ENABLE_SYSTEMTAP}" = xyes; then + # Additional configuration for --enable-systemtap is HERE + AC_CHECK_PROGS(DTRACE, dtrace) + if test -z "$DTRACE"; then + AC_MSG_ERROR([dtrace not found]) + fi + AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'], + [SDT_H_FOUND='no'; + AC_MSG_ERROR([systemtap support needs sys/sdt.h header])]) + AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using SystemTap probes.]) + AC_ARG_WITH([tapset-install-dir], + [AS_HELP_STRING([--with-tapset-install-dir], + [The absolute path where the tapset dir will be installed])], + [if test "x${withval}" = x; then + ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset" + else + ABS_TAPSET_DIR="${withval}" + fi], [ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"]) + AC_SUBST(ABS_TAPSET_DIR) +fi + OSMO_AC_CODE_COVERAGE @@ -445,6 +567,35 @@ dnl Check if the compiler supports runtime SIMD detection CHECK_BUILTIN_SUPPORT([__builtin_cpu_supports], [Runtime SIMD detection will be disabled]) +dnl There are some members in struct tcp_info that might not exist on all linux versions +AC_CHECK_MEMBER([struct tcp_info.tcpi_notsent_bytes], + AC_DEFINE([HAVE_TCP_INFO_TCPI_NOTSENT_BYTES], + [1], + [Define to 1 if your <linux/tcp.h> header file have the tcpi_notsent_bytes member in struct tcp_info]), + [], + [#include <linux/tcp.h>]) + +AC_CHECK_MEMBER([struct tcp_info.tcpi_rwnd_limited], + AC_DEFINE([HAVE_TCP_INFO_TCPI_RWND_LIMITED], + [1], + [Define to 1 if your <linux/tcp.h> header file have the tcpi_rwnd_limited member in struct tcp_info]), + [], + [#include <linux/tcp.h>]) + +AC_CHECK_MEMBER([struct tcp_info.tcpi_sndbuf_limited], + AC_DEFINE([HAVE_TCP_INFO_TCPI_SNDBUF_LIMITED], + [1], + [Define to 1 if your <linux/tcp.h> header file have the tcpi_sndbuf_limited member in struct tcp_info]), + [], + [#include <linux/tcp.h>]) + +AC_CHECK_MEMBER([struct tcp_info.tcpi_reord_seen], + AC_DEFINE([HAVE_TCP_INFO_TCPI_REORD_SEEN], + [1], + [Define to 1 if your <linux/tcp.h> header file have the tcpi_reord_seen member in struct tcp_info]), + [], + [#include <linux/tcp.h>]) + AC_MSG_RESULT([CFLAGS="$CFLAGS"]) AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) @@ -454,30 +605,52 @@ AC_OUTPUT( libosmocoding.pc libosmovty.pc libosmogsm.pc + libosmoisdn.pc libosmogb.pc libosmoctrl.pc libosmosim.pc libosmousb.pc include/Makefile + include/osmocom/Makefile + include/osmocom/codec/Makefile + include/osmocom/coding/Makefile + include/osmocom/core/Makefile + include/osmocom/crypt/Makefile + include/osmocom/ctrl/Makefile + include/osmocom/gprs/Makefile + include/osmocom/gprs/protocol/Makefile + include/osmocom/gsm/Makefile + include/osmocom/gsm/protocol/Makefile + include/osmocom/isdn/Makefile + include/osmocom/sim/Makefile + include/osmocom/usb/Makefile + include/osmocom/vty/Makefile src/Makefile + src/core/Makefile src/vty/Makefile src/codec/Makefile src/coding/Makefile src/sim/Makefile src/usb/Makefile src/gsm/Makefile + src/isdn/Makefile src/gb/Makefile src/ctrl/Makefile src/pseudotalloc/Makefile + tapset/Makefile tests/Makefile tests/atlocal utils/Makefile + utils/osmo-stat-dummy/Makefile Doxyfile.core Doxyfile.gsm + Doxyfile.isdn Doxyfile.vty Doxyfile.codec Doxyfile.coding Doxyfile.gb Doxyfile.ctrl + Doxyfile.sim + Doxyfile.usb Makefile contrib/libosmocore.spec) |