Harald Welte | 4cd3d8a | 2010-03-23 00:30:19 +0800 | [diff] [blame] | 1 | AC_INIT([libosmocore], |
| 2 | m4_esyscmd([./git-version-gen .tarball-version]), |
Holger Hans Peter Freyther | 8db7020 | 2012-03-26 16:34:37 +0200 | [diff] [blame] | 3 | [openbsc@lists.osmocom.org]) |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 4 | |
Neels Hofmeyr | cbdfa65 | 2016-09-30 23:45:28 +0200 | [diff] [blame] | 5 | dnl *This* is the root dir, even if an install-sh exists in ../ or ../../ |
| 6 | AC_CONFIG_AUX_DIR([.]) |
| 7 | |
Sylvain Munaut | 69b1b8b | 2015-08-19 11:15:14 +0200 | [diff] [blame] | 8 | AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6 subdir-objects]) |
Holger Hans Peter Freyther | f9eda74 | 2011-11-13 01:02:54 +0100 | [diff] [blame] | 9 | AC_CONFIG_TESTDIR(tests) |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 10 | |
| 11 | dnl kernel style compile messages |
| 12 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 13 | |
Max | ff932bb | 2017-07-04 18:19:38 +0200 | [diff] [blame] | 14 | dnl include release helper |
| 15 | RELMAKE='-include osmo-release.mk' |
| 16 | AC_SUBST([RELMAKE]) |
| 17 | |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 18 | dnl checks for programs |
| 19 | AC_PROG_MAKE_SET |
Diego Elio Pettenò | d471a21 | 2012-06-29 13:01:19 -0700 | [diff] [blame] | 20 | AC_PROG_MKDIR_P |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 21 | AC_PROG_CC |
| 22 | AC_PROG_INSTALL |
Jan Engelhardt | c2ddc4f | 2015-09-16 14:32:31 +0200 | [diff] [blame] | 23 | LT_INIT([pic-only disable-static]) |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 24 | |
Harald Welte | 4cd3d8a | 2010-03-23 00:30:19 +0800 | [diff] [blame] | 25 | AC_CONFIG_MACRO_DIR([m4]) |
| 26 | |
Eric | 099c834 | 2020-04-10 22:10:13 +0200 | [diff] [blame] | 27 | dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang |
| 28 | AS_CASE(["$LD"],[*clang*], |
| 29 | [AS_CASE(["${host_os}"], |
| 30 | [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])]) |
| 31 | |
Neels Hofmeyr | fef2fa2 | 2016-08-08 15:38:35 +0200 | [diff] [blame] | 32 | dnl check for pkg-config |
| 33 | dnl * If pkg-config is missing, we get a "syntax error" for PKG_CHECK_MODULES. |
| 34 | dnl Instead, we want to say that pkg-config and pkg.m4 are missing. |
| 35 | dnl * The proper way is PKG_PROG_PKG_CONFIG() but unfortunately that does not |
| 36 | dnl produce an intelligible error message if pkg-config is missing entirely |
| 37 | dnl ("syntax error near unexpected token `0.20'"). |
| 38 | dnl * To produce a hint that pkg-config is missing, check for the pkg-config |
| 39 | dnl binary; but AC_PATH_PROG breaks if the distribution provides only |
| 40 | dnl prefixed (<arch>-pkg-config) versions, so just print a warning. |
| 41 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 42 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 43 | AC_MSG_WARN([You need to install pkg-config]) |
| 44 | fi |
| 45 | PKG_PROG_PKG_CONFIG([0.20]) |
| 46 | |
Tobias Engel | 597460f | 2012-10-24 17:52:52 +0200 | [diff] [blame] | 47 | dnl check os: some linker flags not available on osx |
| 48 | case $host in |
| 49 | *-darwin*) |
| 50 | ;; |
| 51 | *) |
| 52 | LTLDFLAGS_OSMOGB='-Wl,--version-script=$(srcdir)/libosmogb.map' |
| 53 | LTLDFLAGS_OSMOGSM='-Wl,--version-script=$(srcdir)/libosmogsm.map' |
Vadim Yanitskiy | 3262f82 | 2016-09-23 01:48:59 +0700 | [diff] [blame] | 54 | LTLDFLAGS_OSMOCODING='-Wl,--version-script=$(srcdir)/libosmocoding.map' |
Harald Welte | ed60578 | 2018-05-26 17:07:39 +0200 | [diff] [blame] | 55 | LTLDFLAGS_OSMOCTRL='-Wl,--version-script=$(srcdir)/libosmoctrl.map' |
Tobias Engel | 597460f | 2012-10-24 17:52:52 +0200 | [diff] [blame] | 56 | ;; |
| 57 | esac |
| 58 | AC_SUBST(LTLDFLAGS_OSMOGB) |
| 59 | AC_SUBST(LTLDFLAGS_OSMOGSM) |
Vadim Yanitskiy | 272bd4f | 2017-08-31 17:53:04 +0700 | [diff] [blame] | 60 | AC_SUBST(LTLDFLAGS_OSMOCODING) |
Harald Welte | ed60578 | 2018-05-26 17:07:39 +0200 | [diff] [blame] | 61 | AC_SUBST(LTLDFLAGS_OSMOCTRL) |
Tobias Engel | 597460f | 2012-10-24 17:52:52 +0200 | [diff] [blame] | 62 | |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 63 | dnl checks for header files |
| 64 | AC_HEADER_STDC |
Harald Welte | b904e42 | 2020-10-18 21:24:13 +0200 | [diff] [blame] | 65 | 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) |
Holger Hans Peter Freyther | 4772348 | 2011-11-09 11:26:15 +0100 | [diff] [blame] | 66 | # for src/conv.c |
| 67 | AC_FUNC_ALLOCA |
Pau Espin Pedrol | cacaa4a | 2018-05-04 19:21:58 +0200 | [diff] [blame] | 68 | AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DLOPEN="$LIBS";LIBS=""]) |
| 69 | AC_SUBST(LIBRARY_DLOPEN) |
| 70 | AC_SEARCH_LIBS([dlsym], [dl dld], [LIBRARY_DLSYM="$LIBS";LIBS=""]) |
| 71 | AC_SUBST(LIBRARY_DLSYM) |
Holger Hans Peter Freyther | c2c042d | 2014-04-17 23:19:10 +0200 | [diff] [blame] | 72 | # for src/backtrace.c |
| 73 | AC_CHECK_LIB(execinfo, backtrace, BACKTRACE_LIB=-lexecinfo, BACKTRACE_LIB=) |
| 74 | AC_SUBST(BACKTRACE_LIB) |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 75 | |
Pau Espin Pedrol | d12f698 | 2019-09-17 18:38:58 +0200 | [diff] [blame] | 76 | # check for pthread (PTHREAD_CFLAGS, PTHREAD_LIBS) |
| 77 | AX_PTHREAD |
| 78 | |
Alexander Couzens | a2f696f | 2018-04-24 16:15:23 +0200 | [diff] [blame] | 79 | # check for old glibc < 2.17 to get clock_gettime |
Pau Espin Pedrol | 47eb4e1 | 2020-05-01 16:51:20 +0200 | [diff] [blame] | 80 | AC_SEARCH_LIBS([clock_gettime], [rt posix4], |
| 81 | [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if clock_gettime is available]) |
| 82 | LIBRARY_RT="$LIBS";LIBS="";]) |
Alexander Couzens | a2f696f | 2018-04-24 16:15:23 +0200 | [diff] [blame] | 83 | AC_SUBST(LIBRARY_RT) |
| 84 | |
Pau Espin Pedrol | 639c408 | 2017-07-06 10:45:22 +0200 | [diff] [blame] | 85 | AC_ARG_ENABLE(doxygen, |
| 86 | [AS_HELP_STRING( |
| 87 | [--disable-doxygen], |
| 88 | [Disable generation of documentation using doxygen], |
| 89 | )], |
| 90 | [doxygen=$enableval], [doxygen="yes"]) |
Harald Welte | 21e73c2 | 2011-08-17 19:33:06 +0200 | [diff] [blame] | 91 | AC_PATH_PROG(DOXYGEN,doxygen,false) |
Pau Espin Pedrol | 639c408 | 2017-07-06 10:45:22 +0200 | [diff] [blame] | 92 | AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false && test "x$doxygen" = "xyes") |
Harald Welte | 21e73c2 | 2011-08-17 19:33:06 +0200 | [diff] [blame] | 93 | |
Max | 4b2b0cc | 2017-07-10 14:32:48 +0200 | [diff] [blame] | 94 | # check for syscal fallback on glibc < 2.25 - can be removed once glibc version requirement is bumped |
| 95 | AC_CHECK_DECLS([SYS_getrandom], [], [], [[#include <sys/syscall.h>]]) |
| 96 | |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 97 | # The following test is taken from WebKit's webkit.m4 |
| 98 | saved_CFLAGS="$CFLAGS" |
| 99 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 100 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
Alexander Huemer | 3d79f53 | 2011-05-24 15:16:13 +0200 | [diff] [blame] | 101 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 102 | [ AC_MSG_RESULT([yes]) |
| 103 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 104 | AC_MSG_RESULT([no])) |
| 105 | CFLAGS="$saved_CFLAGS" |
| 106 | AC_SUBST(SYMBOL_VISIBILITY) |
| 107 | |
Pau Espin Pedrol | 47eb4e1 | 2020-05-01 16:51:20 +0200 | [diff] [blame] | 108 | AC_CHECK_FUNCS(localtime_r) |
Harald Welte | 14c4c49 | 2018-06-28 08:28:52 +0200 | [diff] [blame] | 109 | |
Harald Welte | 7c8e2cc | 2012-08-29 16:47:30 +0200 | [diff] [blame] | 110 | AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [ |
| 111 | AC_CACHE_CHECK( |
| 112 | [whether struct tm has tm_gmtoff member], |
| 113 | osmo_cv_tm_includes_tm_gmtoff, |
| 114 | [AC_LINK_IFELSE([ |
| 115 | AC_LANG_PROGRAM([ |
| 116 | #include <time.h> |
| 117 | ], [ |
| 118 | time_t t = time(NULL); |
| 119 | struct tm* lt = localtime(&t); |
| 120 | int off = lt->tm_gmtoff; |
| 121 | ]) |
| 122 | ], |
| 123 | osmo_cv_tm_includes_tm_gmtoff=yes, |
| 124 | osmo_cv_tm_includes_tm_gmtoff=no |
| 125 | )] |
| 126 | ) |
| 127 | if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then |
| 128 | AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1, |
| 129 | [Define if struct tm has tm_gmtoff member.]) |
| 130 | fi |
| 131 | ]) |
| 132 | |
| 133 | CHECK_TM_INCLUDES_TM_GMTOFF |
| 134 | |
Pau Espin Pedrol | e188b8c | 2019-08-05 13:46:33 +0200 | [diff] [blame] | 135 | dnl Check if We need to apply workaround for TLS bug on ARM platform for GCC < 7.3.0: |
Pau Espin Pedrol | afce89d | 2019-08-06 12:46:46 +0200 | [diff] [blame] | 136 | ARG_ENABLE_DETECT_TLS_GCC_ARM_BUG |
Pau Espin Pedrol | e188b8c | 2019-08-05 13:46:33 +0200 | [diff] [blame] | 137 | |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 138 | dnl Generate the output |
Christian Vogel | 854debc | 2013-01-05 20:30:41 +0100 | [diff] [blame] | 139 | AC_CONFIG_HEADER(config.h) |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 140 | |
Harald Welte | 90e614f | 2015-12-05 23:38:18 +0100 | [diff] [blame] | 141 | PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1]) |
| 142 | |
Harald Welte | 495fe26 | 2012-09-10 16:28:17 +0200 | [diff] [blame] | 143 | AC_ARG_ENABLE([pcsc], [AS_HELP_STRING([--disable-pcsc], [Build without PC/SC support])], |
| 144 | [ |
Neels Hofmeyr | 9683104 | 2016-11-15 17:31:14 +0100 | [diff] [blame] | 145 | ENABLE_PCSC=$enableval |
Harald Welte | 495fe26 | 2012-09-10 16:28:17 +0200 | [diff] [blame] | 146 | ], |
| 147 | [ |
Neels Hofmeyr | 9683104 | 2016-11-15 17:31:14 +0100 | [diff] [blame] | 148 | ENABLE_PCSC="yes" |
Harald Welte | 495fe26 | 2012-09-10 16:28:17 +0200 | [diff] [blame] | 149 | ]) |
Neels Hofmeyr | 9683104 | 2016-11-15 17:31:14 +0100 | [diff] [blame] | 150 | AS_IF([test "x$ENABLE_PCSC" = "xyes"], [ |
Holger Hans Peter Freyther | 18bcc8a | 2014-11-14 15:06:09 +0100 | [diff] [blame] | 151 | PKG_CHECK_MODULES(PCSC, libpcsclite) |
Harald Welte | 3c44a64 | 2020-03-15 22:50:06 +0100 | [diff] [blame] | 152 | AC_DEFINE([HAVE_PCSC],[1],[Build with PC/SC support]) |
Harald Welte | d086f21 | 2015-11-21 11:38:09 +0100 | [diff] [blame] | 153 | ]) |
Neels Hofmeyr | 9683104 | 2016-11-15 17:31:14 +0100 | [diff] [blame] | 154 | AM_CONDITIONAL(ENABLE_PCSC, test "x$ENABLE_PCSC" = "xyes") |
| 155 | AC_SUBST(ENABLE_PCSC) |
Harald Welte | 495fe26 | 2012-09-10 16:28:17 +0200 | [diff] [blame] | 156 | |
Harald Welte | da432cd | 2019-12-15 19:13:26 +0100 | [diff] [blame] | 157 | AC_ARG_ENABLE([libusb], [AS_HELP_STRING([--disable-libusb], [Build without libusb support])], |
| 158 | [ |
| 159 | ENABLE_LIBUSB=$enableval |
| 160 | ], |
| 161 | [ |
| 162 | ENABLE_LIBUSB="yes" |
| 163 | ]) |
| 164 | AS_IF([test "x$ENABLE_LIBUSB" = "xyes"], [ |
| 165 | PKG_CHECK_MODULES(LIBUSB, libusb-1.0) |
| 166 | ]) |
| 167 | AM_CONDITIONAL(ENABLE_LIBUSB, test "x$ENABLE_LIBUSB" = "xyes") |
| 168 | AC_SUBST(ENABLE_LIBUSB) |
| 169 | |
Max | ed029df | 2017-10-26 10:56:04 +0200 | [diff] [blame] | 170 | AC_ARG_ENABLE([gnutls], [AS_HELP_STRING([--disable-gnutls], [Do not use GnuTLS fallback for missing getrandom()])], |
| 171 | [ENABLE_GNUTLS=$enableval], [ENABLE_GNUTLS="yes"]) |
| 172 | AM_CONDITIONAL(ENABLE_GNUTLS, test x"$ENABLE_GNUTLS" = x"yes") |
| 173 | AS_IF([test "x$ENABLE_GNUTLS" = "xyes"], [ |
| 174 | PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.12.0]) |
| 175 | ]) |
| 176 | AC_SUBST(ENABLE_GNUTLS) |
| 177 | if test x"$ENABLE_GNUTLS" = x"yes" |
| 178 | then |
| 179 | AC_SUBST([LIBGNUTLS_CFLAGS]) |
| 180 | AC_SUBST([LIBGNUTLS_LIBS]) |
| 181 | AC_DEFINE([USE_GNUTLS], [1], [Use GnuTLS as a fallback for missing getrandom()]) |
| 182 | fi |
| 183 | |
Vadim Yanitskiy | e7bf435 | 2020-09-09 03:36:48 +0700 | [diff] [blame] | 184 | AC_ARG_ENABLE([systemd_logging], |
| 185 | [AS_HELP_STRING( |
| 186 | [--enable-systemd-logging], |
| 187 | [Build with systemd-journal logging support] |
| 188 | )], |
| 189 | [systemd_logging=$enableval], [systemd_logging="no"]) |
| 190 | AS_IF([test "x$systemd_logging" = "xyes"], [ |
| 191 | PKG_CHECK_MODULES(SYSTEMD, libsystemd) |
| 192 | AC_DEFINE([ENABLE_SYSTEMD_LOGGING], [1], [Enable systemd-journal logging target]) |
| 193 | ]) |
| 194 | AM_CONDITIONAL(ENABLE_SYSTEMD_LOGGING, test "x$systemd_logging" = "xyes") |
| 195 | AC_SUBST(ENABLE_SYSTEMD_LOGGING) |
| 196 | |
Pau Espin Pedrol | ea2afb2 | 2019-10-24 15:41:32 +0200 | [diff] [blame] | 197 | AC_ARG_ENABLE([libsctp], [AS_HELP_STRING([--disable-libsctp], [Do not enable socket multiaddr APIs requiring libsctp])], |
| 198 | [ENABLE_LIBSCTP=$enableval], [ENABLE_LIBSCTP="yes"]) |
| 199 | AM_CONDITIONAL(ENABLE_LIBSCTP, test x"$ENABLE_LIBSCTP" = x"yes") |
| 200 | AS_IF([test "x$ENABLE_LIBSCTP" = "xyes"], [ |
| 201 | old_LIBS=$LIBS |
| 202 | AC_SEARCH_LIBS([sctp_bindx], [sctp], [ |
| 203 | AC_DEFINE(HAVE_LIBSCTP, 1, [Define 1 to enable SCTP support]) |
| 204 | AC_SUBST(HAVE_LIBSCTP, [1]) |
| 205 | if test -n "$ac_lib"; then |
| 206 | AC_SUBST(LIBSCTP_LIBS, [-l$ac_lib]) |
| 207 | fi |
| 208 | ], [ |
| 209 | AC_MSG_ERROR([sctp_bindx not found in searched libs])]) |
| 210 | LIBS=$old_LIBS |
| 211 | ]) |
| 212 | |
Pau Espin Pedrol | 16b076c | 2020-08-25 13:56:43 +0200 | [diff] [blame] | 213 | AC_ARG_ENABLE([sctp-tests], [AS_HELP_STRING([--disable-sctp-tests], [Do not run socket tests requiring system SCTP support])], |
| 214 | [ENABLE_SCTP_TESTS=$enableval], [ENABLE_SCTP_TESTS="yes"]) |
| 215 | AM_CONDITIONAL(ENABLE_SCTP_TESTS, test x"$ENABLE_SCTP_TESTS" = x"yes") |
| 216 | |
Harald Welte | b9ce51c | 2010-06-30 19:43:11 +0200 | [diff] [blame] | 217 | AC_ARG_ENABLE(plugin, |
Sylvain Munaut | f23abab | 2010-07-25 16:16:42 +0200 | [diff] [blame] | 218 | [AS_HELP_STRING( |
| 219 | [--disable-plugin], |
| 220 | [Disable support for dlopen plugins], |
| 221 | )], |
job | 36b4a20 | 2011-08-21 17:18:23 +0200 | [diff] [blame] | 222 | [enable_plugin=$enableval], [enable_plugin="yes"]) |
| 223 | AM_CONDITIONAL(ENABLE_PLUGIN, test x"$enable_plugin" = x"yes") |
Harald Welte | b9ce51c | 2010-06-30 19:43:11 +0200 | [diff] [blame] | 224 | |
Harald Welte | 1067e8c | 2010-06-25 03:00:58 +0200 | [diff] [blame] | 225 | AC_ARG_ENABLE(vty, |
Sylvain Munaut | f23abab | 2010-07-25 16:16:42 +0200 | [diff] [blame] | 226 | [AS_HELP_STRING( |
| 227 | [--disable-vty], |
| 228 | [Disable building VTY telnet interface] |
| 229 | )], |
job | 36b4a20 | 2011-08-21 17:18:23 +0200 | [diff] [blame] | 230 | [enable_vty=$enableval], [enable_vty="yes"]) |
| 231 | AM_CONDITIONAL(ENABLE_VTY, test x"$enable_vty" = x"yes") |
Harald Welte | 5440377 | 2010-05-29 11:49:51 +0200 | [diff] [blame] | 232 | |
Sylvain Munaut | ac3e61a | 2010-07-25 18:08:54 +0200 | [diff] [blame] | 233 | AC_ARG_ENABLE(panic_infloop, |
| 234 | [AS_HELP_STRING( |
| 235 | [--enable-panic-infloop], |
| 236 | [Trigger infinite loop on panic rather than fprintf/abort] |
| 237 | )], |
job | 36b4a20 | 2011-08-21 17:18:23 +0200 | [diff] [blame] | 238 | [panic_infloop=$enableval], [panic_infloop="no"]) |
| 239 | if test x"$panic_infloop" = x"yes" |
Sylvain Munaut | ac3e61a | 2010-07-25 18:08:54 +0200 | [diff] [blame] | 240 | then |
| 241 | AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort]) |
| 242 | fi |
| 243 | |
Holger Hans Peter Freyther | 4355831 | 2010-08-06 06:48:43 +0800 | [diff] [blame] | 244 | AC_ARG_ENABLE(bsc_fd_check, |
| 245 | [AS_HELP_STRING( |
| 246 | [--enable-bsc-fd-check], |
Pau Espin Pedrol | d05def0 | 2020-05-09 19:24:21 +0200 | [diff] [blame] | 247 | [Instrument osmo_fd_register to check that the fd is registered] |
Holger Hans Peter Freyther | 4355831 | 2010-08-06 06:48:43 +0800 | [diff] [blame] | 248 | )], |
job | 36b4a20 | 2011-08-21 17:18:23 +0200 | [diff] [blame] | 249 | [fd_check=$enableval], [fd_check="no"]) |
| 250 | if test x"$fd_check" = x"no" |
Holger Hans Peter Freyther | 4355831 | 2010-08-06 06:48:43 +0800 | [diff] [blame] | 251 | then |
Pau Espin Pedrol | d05def0 | 2020-05-09 19:24:21 +0200 | [diff] [blame] | 252 | AC_DEFINE([OSMO_FD_CHECK],[1],[Instrument the osmo_fd_register]) |
Holger Hans Peter Freyther | 4355831 | 2010-08-06 06:48:43 +0800 | [diff] [blame] | 253 | fi |
| 254 | |
Harald Welte | b904e42 | 2020-10-18 21:24:13 +0200 | [diff] [blame] | 255 | AC_ARG_ENABLE([force_io_select], |
| 256 | [AS_HELP_STRING( |
| 257 | [--enable-force-io-select], |
| 258 | [Build with old select I/O instead of poll] |
| 259 | )], |
| 260 | [force_io_select=$enableval], [force_io_select="no"]) |
| 261 | AS_IF([test "x$force_io_select" = "xyes"], [ |
| 262 | AC_DEFINE([FORCE_IO_SELECT], [1], [Force the use of select() instaed of poll()]) |
| 263 | ]) |
| 264 | |
Holger Hans Peter Freyther | c87f266 | 2010-10-07 00:00:15 +0800 | [diff] [blame] | 265 | AC_ARG_ENABLE(msgfile, |
| 266 | [AS_HELP_STRING( |
| 267 | [--disable-msgfile], |
| 268 | [Disable support for the msgfile], |
| 269 | )], |
job | 36b4a20 | 2011-08-21 17:18:23 +0200 | [diff] [blame] | 270 | [enable_msgfile=$enableval], [enable_msgfile="yes"]) |
| 271 | AM_CONDITIONAL(ENABLE_MSGFILE, test x"$enable_msgfile" = x"yes") |
Holger Hans Peter Freyther | c87f266 | 2010-10-07 00:00:15 +0800 | [diff] [blame] | 272 | |
Sylvain Munaut | fe28ded | 2011-09-02 22:18:24 +0200 | [diff] [blame] | 273 | AC_ARG_ENABLE(serial, |
| 274 | [AS_HELP_STRING( |
| 275 | [--disable-serial], |
| 276 | [Disable support for the serial helpers], |
| 277 | )], |
| 278 | [enable_serial=$enableval], [enable_serial="yes"]) |
| 279 | AM_CONDITIONAL(ENABLE_SERIAL, test x"$enable_serial" = x"yes") |
| 280 | |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 281 | AC_ARG_ENABLE(utilities, |
| 282 | [AS_HELP_STRING( |
| 283 | [--disable-utilities], |
| 284 | [Disable building utility programs], |
| 285 | )], |
| 286 | [enable_utilities=$enableval], [enable_utilities="yes"]) |
| 287 | AM_CONDITIONAL(ENABLE_UTILITIES, test x"$enable_utilities" = x"yes") |
| 288 | |
Harald Welte | e3a10b6 | 2012-09-08 22:18:43 +0200 | [diff] [blame] | 289 | AC_ARG_ENABLE(gb, |
| 290 | [AS_HELP_STRING( |
| 291 | [--disable-gb], |
| 292 | [Disable building Gb library], |
| 293 | )], |
| 294 | [enable_gb=$enableval], [enable_gb="yes"]) |
| 295 | AM_CONDITIONAL(ENABLE_GB, test x"$enable_gb" = x"yes") |
| 296 | |
Harald Welte | 1c67e75 | 2017-01-15 17:52:30 +0100 | [diff] [blame] | 297 | AC_ARG_ENABLE(ctrl, |
| 298 | [AS_HELP_STRING( |
| 299 | [--disable-ctrl], |
| 300 | [Disable building CTRL library], |
| 301 | )], |
| 302 | [enable_ctrl=$enableval], [enable_ctrl="yes"]) |
| 303 | AM_CONDITIONAL(ENABLE_CTRL, test x"$enable_ctrl" = x"yes") |
| 304 | |
Harald Welte | 898ffef | 2017-05-15 21:37:34 +0200 | [diff] [blame] | 305 | AC_ARG_ENABLE(pseudotalloc, |
| 306 | [AS_HELP_STRING( |
| 307 | [--enable-pseudotalloc], |
| 308 | [Enable building pseudotalloc library], |
| 309 | )], |
| 310 | [enable_pseudotalloc=$enableval], [enable_pseudotalloc="no"]) |
| 311 | AM_CONDITIONAL(ENABLE_PSEUDOTALLOC, test x"$enable_pseudotalloc" = x"yes") |
| 312 | |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 313 | AC_ARG_ENABLE(embedded, |
| 314 | [AS_HELP_STRING( |
| 315 | [--enable-embedded], |
| 316 | [Enable building for embedded use and disable unsupported features] |
| 317 | )], |
| 318 | [embedded=$enableval], [embedded="no"]) |
Max | 89c8c40 | 2018-01-18 16:05:27 +0100 | [diff] [blame] | 319 | |
Harald Welte | c6a8697 | 2019-12-16 23:14:45 +0100 | [diff] [blame] | 320 | AM_CONDITIONAL(EMBEDDED, false) |
Max | 3da7938 | 2018-01-18 16:50:51 +0100 | [diff] [blame] | 321 | AM_CONDITIONAL(ENABLE_SERCOM_STUB, false) |
Max | 89c8c40 | 2018-01-18 16:05:27 +0100 | [diff] [blame] | 322 | |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 323 | if test x"$embedded" = x"yes" |
| 324 | then |
| 325 | AC_DEFINE([EMBEDDED],[1],[Select building for embedded use]) |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 326 | AM_CONDITIONAL(ENABLE_PLUGIN, false) |
| 327 | AM_CONDITIONAL(ENABLE_MSGFILE, false) |
Sylvain Munaut | fe28ded | 2011-09-02 22:18:24 +0200 | [diff] [blame] | 328 | AM_CONDITIONAL(ENABLE_SERIAL, false) |
Max | ed029df | 2017-10-26 10:56:04 +0200 | [diff] [blame] | 329 | AM_CONDITIONAL(ENABLE_GNUTLS, false) |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 330 | AM_CONDITIONAL(ENABLE_VTY, false) |
Harald Welte | 1c67e75 | 2017-01-15 17:52:30 +0100 | [diff] [blame] | 331 | AM_CONDITIONAL(ENABLE_CTRL, false) |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 332 | AM_CONDITIONAL(ENABLE_UTILITIES, false) |
Harald Welte | e3a10b6 | 2012-09-08 22:18:43 +0200 | [diff] [blame] | 333 | AM_CONDITIONAL(ENABLE_GB, false) |
Max | ed029df | 2017-10-26 10:56:04 +0200 | [diff] [blame] | 334 | AM_CONDITIONAL(ENABLE_GNUTLS, false) |
Pau Espin Pedrol | ea2afb2 | 2019-10-24 15:41:32 +0200 | [diff] [blame] | 335 | AM_CONDITIONAL(ENABLE_LIBSCTP, false) |
Harald Welte | 1a7d64c | 2017-01-15 17:53:23 +0100 | [diff] [blame] | 336 | AM_CONDITIONAL(ENABLE_PCSC, false) |
Harald Welte | 898ffef | 2017-05-15 21:37:34 +0200 | [diff] [blame] | 337 | AM_CONDITIONAL(ENABLE_PSEUDOTALLOC, true) |
Max | 3da7938 | 2018-01-18 16:50:51 +0100 | [diff] [blame] | 338 | AM_CONDITIONAL(ENABLE_SERCOM_STUB, true) |
Harald Welte | c6a8697 | 2019-12-16 23:14:45 +0100 | [diff] [blame] | 339 | AM_CONDITIONAL(EMBEDDED, true) |
Max | ed029df | 2017-10-26 10:56:04 +0200 | [diff] [blame] | 340 | AC_DEFINE([USE_GNUTLS], [0]) |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 341 | AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort]) |
| 342 | fi |
Harald Welte | 5440377 | 2010-05-29 11:49:51 +0200 | [diff] [blame] | 343 | |
Neels Hofmeyr | a238176 | 2016-09-30 01:25:45 +0200 | [diff] [blame] | 344 | AC_ARG_ENABLE(sanitize, |
| 345 | [AS_HELP_STRING( |
| 346 | [--enable-sanitize], |
| 347 | [Compile with address sanitizer enabled], |
| 348 | )], |
| 349 | [sanitize=$enableval], [sanitize="no"]) |
| 350 | if test x"$sanitize" = x"yes" |
| 351 | then |
Pau Espin Pedrol | 1349249 | 2017-06-23 11:18:04 +0200 | [diff] [blame] | 352 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 353 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
Neels Hofmeyr | a238176 | 2016-09-30 01:25:45 +0200 | [diff] [blame] | 354 | fi |
| 355 | |
Neels Hofmeyr | 09ecbb7 | 2018-03-05 20:40:05 +0100 | [diff] [blame] | 356 | AC_ARG_ENABLE(werror, |
| 357 | [AS_HELP_STRING( |
| 358 | [--enable-werror], |
| 359 | [Turn all compiler warnings into errors, with exceptions: |
| 360 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 361 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 362 | ] |
| 363 | )], |
| 364 | [werror=$enableval], [werror="no"]) |
| 365 | if test x"$werror" = x"yes" |
| 366 | then |
| 367 | WERROR_FLAGS="-Werror" |
| 368 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 369 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 370 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 371 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 372 | fi |
| 373 | |
Neels Hofmeyr | 3a9ff11 | 2018-09-10 17:18:28 +0200 | [diff] [blame] | 374 | AC_ARG_ENABLE([external_tests], |
| 375 | AC_HELP_STRING([--enable-external-tests], |
| 376 | [Include the VTY/CTRL tests in make check [default=no]]), |
| 377 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
| 378 | if test "x$enable_ext_tests" = "xyes" ; then |
| 379 | AM_PATH_PYTHON |
| 380 | AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmo_verify_transcript_vty.py,yes) |
| 381 | if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then |
| 382 | AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.]) |
| 383 | fi |
| 384 | fi |
| 385 | AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) |
| 386 | AC_MSG_RESULT([$enable_ext_tests]) |
| 387 | AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") |
| 388 | |
Pau Espin Pedrol | 1349249 | 2017-06-23 11:18:04 +0200 | [diff] [blame] | 389 | CFLAGS="$CFLAGS -DBUILDING_LIBOSMOCORE -Wall" |
| 390 | CPPFLAGS="$CPPFLAGS -DBUILDING_LIBOSMOCORE -Wall" |
Pau Espin Pedrol | 69dfe5a | 2017-06-17 23:18:11 +0200 | [diff] [blame] | 391 | |
Vadim Yanitskiy | 2c3066e | 2017-04-30 19:41:56 +0700 | [diff] [blame] | 392 | AC_ARG_ENABLE(simd, |
| 393 | [AS_HELP_STRING( |
| 394 | [--disable-simd], |
| 395 | [Disable SIMD support] |
| 396 | )], |
| 397 | [simd=$enableval], [simd="yes"]) |
| 398 | if test x"$simd" = x"yes" |
| 399 | then |
| 400 | # Find and define supported SIMD extensions |
| 401 | AX_CHECK_SIMD |
| 402 | else |
| 403 | AM_CONDITIONAL(HAVE_AVX2, false) |
Harald Welte | b93f60f | 2017-11-17 11:41:34 +0100 | [diff] [blame] | 404 | AM_CONDITIONAL(HAVE_SSSE3, false) |
Vadim Yanitskiy | 2c3066e | 2017-04-30 19:41:56 +0700 | [diff] [blame] | 405 | AM_CONDITIONAL(HAVE_SSE4_1, false) |
| 406 | fi |
| 407 | |
Eric | 3afc1d1 | 2020-07-23 02:16:46 +0200 | [diff] [blame] | 408 | AC_ARG_ENABLE(neon, |
| 409 | [AS_HELP_STRING( |
| 410 | [--enable-neon], |
Vadim Yanitskiy | 325d9b3 | 2020-08-07 03:53:40 +0700 | [diff] [blame] | 411 | [Enable ARM NEON instructions support [default=no]] |
Eric | 3afc1d1 | 2020-07-23 02:16:46 +0200 | [diff] [blame] | 412 | )], |
| 413 | [neon=$enableval], [neon="no"]) |
Vadim Yanitskiy | 7dbae9e | 2020-08-07 04:01:12 +0700 | [diff] [blame] | 414 | AC_MSG_CHECKING([whether to enable ARM NEON instructions support]) |
| 415 | AC_MSG_RESULT([$neon]) |
Eric | 3afc1d1 | 2020-07-23 02:16:46 +0200 | [diff] [blame] | 416 | AM_CONDITIONAL(HAVE_NEON, [test "x$neon" != "xno"]) |
| 417 | |
| 418 | |
Vasil Velichkov | 499510b | 2019-04-03 02:32:37 +0300 | [diff] [blame] | 419 | OSMO_AC_CODE_COVERAGE |
| 420 | |
Vadim Yanitskiy | a8a5819 | 2017-05-08 00:07:21 +0700 | [diff] [blame] | 421 | dnl Check if the compiler supports specified GCC's built-in function |
| 422 | AC_DEFUN([CHECK_BUILTIN_SUPPORT], [ |
| 423 | AC_CACHE_CHECK( |
| 424 | [whether ${CC} has $1 built-in], |
| 425 | [osmo_cv_cc_has_builtin], [ |
| 426 | AC_LINK_IFELSE([ |
| 427 | AC_LANG_PROGRAM([], [ |
| 428 | __builtin_cpu_supports("sse"); |
| 429 | ]) |
| 430 | ], |
| 431 | [AS_VAR_SET([osmo_cv_cc_has_builtin], [yes])], |
| 432 | [AS_VAR_SET([osmo_cv_cc_has_builtin], [no])]) |
| 433 | ] |
| 434 | ) |
| 435 | |
| 436 | AS_IF([test yes = AS_VAR_GET([osmo_cv_cc_has_builtin])], [ |
| 437 | AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1), 1, |
| 438 | [Define to 1 if compiler has the '$1' built-in function]) |
| 439 | ], [ |
| 440 | AC_MSG_WARN($2) |
| 441 | ]) |
| 442 | ]) |
| 443 | |
| 444 | dnl Check if the compiler supports runtime SIMD detection |
| 445 | CHECK_BUILTIN_SUPPORT([__builtin_cpu_supports], |
| 446 | [Runtime SIMD detection will be disabled]) |
| 447 | |
Neels Hofmeyr | 09ecbb7 | 2018-03-05 20:40:05 +0100 | [diff] [blame] | 448 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 449 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 450 | |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 451 | AC_OUTPUT( |
| 452 | libosmocore.pc |
Sylvain Munaut | b99b930 | 2010-10-24 18:23:10 +0200 | [diff] [blame] | 453 | libosmocodec.pc |
Vadim Yanitskiy | 3262f82 | 2016-09-23 01:48:59 +0700 | [diff] [blame] | 454 | libosmocoding.pc |
Harald Welte | e352c52 | 2010-05-19 19:42:32 +0200 | [diff] [blame] | 455 | libosmovty.pc |
Pablo Neira Ayuso | fba495e | 2011-03-23 18:08:08 +0100 | [diff] [blame] | 456 | libosmogsm.pc |
Harald Welte | 641f7ce | 2012-06-17 23:05:26 +0800 | [diff] [blame] | 457 | libosmogb.pc |
Harald Welte | 3ff81b1 | 2014-08-20 19:58:40 +0200 | [diff] [blame] | 458 | libosmoctrl.pc |
Harald Welte | d54c2ee | 2012-01-17 18:25:50 +0100 | [diff] [blame] | 459 | libosmosim.pc |
Harald Welte | da432cd | 2019-12-15 19:13:26 +0100 | [diff] [blame] | 460 | libosmousb.pc |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 461 | include/Makefile |
| 462 | src/Makefile |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 463 | src/vty/Makefile |
Sylvain Munaut | 1a4ea5b | 2010-10-08 15:09:16 +0200 | [diff] [blame] | 464 | src/codec/Makefile |
Vadim Yanitskiy | 3262f82 | 2016-09-23 01:48:59 +0700 | [diff] [blame] | 465 | src/coding/Makefile |
Harald Welte | d54c2ee | 2012-01-17 18:25:50 +0100 | [diff] [blame] | 466 | src/sim/Makefile |
Harald Welte | da432cd | 2019-12-15 19:13:26 +0100 | [diff] [blame] | 467 | src/usb/Makefile |
Pablo Neira Ayuso | fba495e | 2011-03-23 18:08:08 +0100 | [diff] [blame] | 468 | src/gsm/Makefile |
Harald Welte | 641f7ce | 2012-06-17 23:05:26 +0800 | [diff] [blame] | 469 | src/gb/Makefile |
Harald Welte | 3ff81b1 | 2014-08-20 19:58:40 +0200 | [diff] [blame] | 470 | src/ctrl/Makefile |
Harald Welte | 898ffef | 2017-05-15 21:37:34 +0200 | [diff] [blame] | 471 | src/pseudotalloc/Makefile |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 472 | tests/Makefile |
Neels Hofmeyr | 9683104 | 2016-11-15 17:31:14 +0100 | [diff] [blame] | 473 | tests/atlocal |
Harald Welte | eeb78dd | 2011-08-02 13:44:54 +0200 | [diff] [blame] | 474 | utils/Makefile |
Harald Welte | c7859ed | 2011-08-20 12:54:17 +0200 | [diff] [blame] | 475 | Doxyfile.core |
Harald Welte | 49e1056 | 2011-08-17 19:21:07 +0200 | [diff] [blame] | 476 | Doxyfile.gsm |
| 477 | Doxyfile.vty |
| 478 | Doxyfile.codec |
Vadim Yanitskiy | 3262f82 | 2016-09-23 01:48:59 +0700 | [diff] [blame] | 479 | Doxyfile.coding |
Neels Hofmeyr | 249fb71 | 2017-06-20 02:52:38 +0200 | [diff] [blame] | 480 | Doxyfile.gb |
Harald Welte | b418682 | 2018-05-26 17:25:11 +0200 | [diff] [blame] | 481 | Doxyfile.ctrl |
Oliver Smith | 6370f5d | 2020-05-14 11:27:08 +0200 | [diff] [blame] | 482 | Makefile |
| 483 | contrib/libosmocore.spec) |