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 | |
| 14 | dnl checks for programs |
| 15 | AC_PROG_MAKE_SET |
Diego Elio Pettenò | d471a21 | 2012-06-29 13:01:19 -0700 | [diff] [blame] | 16 | AC_PROG_MKDIR_P |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 17 | AC_PROG_CC |
| 18 | AC_PROG_INSTALL |
Jan Engelhardt | c2ddc4f | 2015-09-16 14:32:31 +0200 | [diff] [blame] | 19 | LT_INIT([pic-only disable-static]) |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 20 | |
Harald Welte | 4cd3d8a | 2010-03-23 00:30:19 +0800 | [diff] [blame] | 21 | AC_CONFIG_MACRO_DIR([m4]) |
| 22 | |
Neels Hofmeyr | fef2fa2 | 2016-08-08 15:38:35 +0200 | [diff] [blame] | 23 | dnl check for pkg-config |
| 24 | dnl * If pkg-config is missing, we get a "syntax error" for PKG_CHECK_MODULES. |
| 25 | dnl Instead, we want to say that pkg-config and pkg.m4 are missing. |
| 26 | dnl * The proper way is PKG_PROG_PKG_CONFIG() but unfortunately that does not |
| 27 | dnl produce an intelligible error message if pkg-config is missing entirely |
| 28 | dnl ("syntax error near unexpected token `0.20'"). |
| 29 | dnl * To produce a hint that pkg-config is missing, check for the pkg-config |
| 30 | dnl binary; but AC_PATH_PROG breaks if the distribution provides only |
| 31 | dnl prefixed (<arch>-pkg-config) versions, so just print a warning. |
| 32 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 33 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 34 | AC_MSG_WARN([You need to install pkg-config]) |
| 35 | fi |
| 36 | PKG_PROG_PKG_CONFIG([0.20]) |
| 37 | |
Tobias Engel | 597460f | 2012-10-24 17:52:52 +0200 | [diff] [blame] | 38 | dnl check os: some linker flags not available on osx |
| 39 | case $host in |
| 40 | *-darwin*) |
| 41 | ;; |
| 42 | *) |
| 43 | LTLDFLAGS_OSMOGB='-Wl,--version-script=$(srcdir)/libosmogb.map' |
| 44 | LTLDFLAGS_OSMOGSM='-Wl,--version-script=$(srcdir)/libosmogsm.map' |
Vadim Yanitskiy | 3262f82 | 2016-09-23 01:48:59 +0700 | [diff] [blame] | 45 | LTLDFLAGS_OSMOCODING='-Wl,--version-script=$(srcdir)/libosmocoding.map' |
Tobias Engel | 597460f | 2012-10-24 17:52:52 +0200 | [diff] [blame] | 46 | ;; |
| 47 | esac |
| 48 | AC_SUBST(LTLDFLAGS_OSMOGB) |
| 49 | AC_SUBST(LTLDFLAGS_OSMOGSM) |
| 50 | |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 51 | dnl checks for header files |
| 52 | AC_HEADER_STDC |
Harald Welte | e15ac06 | 2014-12-04 14:15:36 +0100 | [diff] [blame] | 53 | AC_CHECK_HEADERS(execinfo.h sys/select.h sys/socket.h syslog.h ctype.h netinet/tcp.h) |
Holger Hans Peter Freyther | 4772348 | 2011-11-09 11:26:15 +0100 | [diff] [blame] | 54 | # for src/conv.c |
| 55 | AC_FUNC_ALLOCA |
| 56 | AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""]) |
| 57 | AC_SUBST(LIBRARY_DL) |
Holger Hans Peter Freyther | c2c042d | 2014-04-17 23:19:10 +0200 | [diff] [blame] | 58 | # for src/backtrace.c |
| 59 | AC_CHECK_LIB(execinfo, backtrace, BACKTRACE_LIB=-lexecinfo, BACKTRACE_LIB=) |
| 60 | AC_SUBST(BACKTRACE_LIB) |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 61 | |
Harald Welte | 21e73c2 | 2011-08-17 19:33:06 +0200 | [diff] [blame] | 62 | AC_PATH_PROG(DOXYGEN,doxygen,false) |
| 63 | AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false) |
| 64 | |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 65 | # The following test is taken from WebKit's webkit.m4 |
| 66 | saved_CFLAGS="$CFLAGS" |
| 67 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 68 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
Alexander Huemer | 3d79f53 | 2011-05-24 15:16:13 +0200 | [diff] [blame] | 69 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 70 | [ AC_MSG_RESULT([yes]) |
| 71 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 72 | AC_MSG_RESULT([no])) |
| 73 | CFLAGS="$saved_CFLAGS" |
| 74 | AC_SUBST(SYMBOL_VISIBILITY) |
| 75 | |
Harald Welte | 7c8e2cc | 2012-08-29 16:47:30 +0200 | [diff] [blame] | 76 | AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [ |
| 77 | AC_CACHE_CHECK( |
| 78 | [whether struct tm has tm_gmtoff member], |
| 79 | osmo_cv_tm_includes_tm_gmtoff, |
| 80 | [AC_LINK_IFELSE([ |
| 81 | AC_LANG_PROGRAM([ |
| 82 | #include <time.h> |
| 83 | ], [ |
| 84 | time_t t = time(NULL); |
| 85 | struct tm* lt = localtime(&t); |
| 86 | int off = lt->tm_gmtoff; |
| 87 | ]) |
| 88 | ], |
| 89 | osmo_cv_tm_includes_tm_gmtoff=yes, |
| 90 | osmo_cv_tm_includes_tm_gmtoff=no |
| 91 | )] |
| 92 | ) |
| 93 | if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then |
| 94 | AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1, |
| 95 | [Define if struct tm has tm_gmtoff member.]) |
| 96 | fi |
| 97 | ]) |
| 98 | |
| 99 | CHECK_TM_INCLUDES_TM_GMTOFF |
| 100 | |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 101 | dnl Generate the output |
Christian Vogel | 854debc | 2013-01-05 20:30:41 +0100 | [diff] [blame] | 102 | AC_CONFIG_HEADER(config.h) |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 103 | |
Harald Welte | 90e614f | 2015-12-05 23:38:18 +0100 | [diff] [blame] | 104 | PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1]) |
| 105 | |
Harald Welte | 495fe26 | 2012-09-10 16:28:17 +0200 | [diff] [blame] | 106 | AC_ARG_ENABLE([pcsc], [AS_HELP_STRING([--disable-pcsc], [Build without PC/SC support])], |
| 107 | [ |
Neels Hofmeyr | 9683104 | 2016-11-15 17:31:14 +0100 | [diff] [blame] | 108 | ENABLE_PCSC=$enableval |
Harald Welte | 495fe26 | 2012-09-10 16:28:17 +0200 | [diff] [blame] | 109 | ], |
| 110 | [ |
Neels Hofmeyr | 9683104 | 2016-11-15 17:31:14 +0100 | [diff] [blame] | 111 | ENABLE_PCSC="yes" |
Harald Welte | 495fe26 | 2012-09-10 16:28:17 +0200 | [diff] [blame] | 112 | ]) |
Neels Hofmeyr | 9683104 | 2016-11-15 17:31:14 +0100 | [diff] [blame] | 113 | AS_IF([test "x$ENABLE_PCSC" = "xyes"], [ |
Holger Hans Peter Freyther | 18bcc8a | 2014-11-14 15:06:09 +0100 | [diff] [blame] | 114 | PKG_CHECK_MODULES(PCSC, libpcsclite) |
Harald Welte | d086f21 | 2015-11-21 11:38:09 +0100 | [diff] [blame] | 115 | ]) |
Neels Hofmeyr | 9683104 | 2016-11-15 17:31:14 +0100 | [diff] [blame] | 116 | AM_CONDITIONAL(ENABLE_PCSC, test "x$ENABLE_PCSC" = "xyes") |
| 117 | AC_SUBST(ENABLE_PCSC) |
Harald Welte | 495fe26 | 2012-09-10 16:28:17 +0200 | [diff] [blame] | 118 | |
Harald Welte | b9ce51c | 2010-06-30 19:43:11 +0200 | [diff] [blame] | 119 | AC_ARG_ENABLE(plugin, |
Sylvain Munaut | f23abab | 2010-07-25 16:16:42 +0200 | [diff] [blame] | 120 | [AS_HELP_STRING( |
| 121 | [--disable-plugin], |
| 122 | [Disable support for dlopen plugins], |
| 123 | )], |
job | 36b4a20 | 2011-08-21 17:18:23 +0200 | [diff] [blame] | 124 | [enable_plugin=$enableval], [enable_plugin="yes"]) |
| 125 | AM_CONDITIONAL(ENABLE_PLUGIN, test x"$enable_plugin" = x"yes") |
Harald Welte | b9ce51c | 2010-06-30 19:43:11 +0200 | [diff] [blame] | 126 | |
Harald Welte | 1067e8c | 2010-06-25 03:00:58 +0200 | [diff] [blame] | 127 | AC_ARG_ENABLE(vty, |
Sylvain Munaut | f23abab | 2010-07-25 16:16:42 +0200 | [diff] [blame] | 128 | [AS_HELP_STRING( |
| 129 | [--disable-vty], |
| 130 | [Disable building VTY telnet interface] |
| 131 | )], |
job | 36b4a20 | 2011-08-21 17:18:23 +0200 | [diff] [blame] | 132 | [enable_vty=$enableval], [enable_vty="yes"]) |
| 133 | AM_CONDITIONAL(ENABLE_VTY, test x"$enable_vty" = x"yes") |
Harald Welte | 5440377 | 2010-05-29 11:49:51 +0200 | [diff] [blame] | 134 | |
Sylvain Munaut | ac3e61a | 2010-07-25 18:08:54 +0200 | [diff] [blame] | 135 | AC_ARG_ENABLE(panic_infloop, |
| 136 | [AS_HELP_STRING( |
| 137 | [--enable-panic-infloop], |
| 138 | [Trigger infinite loop on panic rather than fprintf/abort] |
| 139 | )], |
job | 36b4a20 | 2011-08-21 17:18:23 +0200 | [diff] [blame] | 140 | [panic_infloop=$enableval], [panic_infloop="no"]) |
| 141 | if test x"$panic_infloop" = x"yes" |
Sylvain Munaut | ac3e61a | 2010-07-25 18:08:54 +0200 | [diff] [blame] | 142 | then |
| 143 | AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort]) |
| 144 | fi |
| 145 | |
Holger Hans Peter Freyther | 4355831 | 2010-08-06 06:48:43 +0800 | [diff] [blame] | 146 | AC_ARG_ENABLE(bsc_fd_check, |
| 147 | [AS_HELP_STRING( |
| 148 | [--enable-bsc-fd-check], |
| 149 | [Instrument bsc_register_fd to check that the fd is registered] |
| 150 | )], |
job | 36b4a20 | 2011-08-21 17:18:23 +0200 | [diff] [blame] | 151 | [fd_check=$enableval], [fd_check="no"]) |
| 152 | if test x"$fd_check" = x"no" |
Holger Hans Peter Freyther | 4355831 | 2010-08-06 06:48:43 +0800 | [diff] [blame] | 153 | then |
| 154 | AC_DEFINE([BSC_FD_CHECK],[1],[Instrument the bsc_register_fd]) |
| 155 | fi |
| 156 | |
Holger Hans Peter Freyther | c87f266 | 2010-10-07 00:00:15 +0800 | [diff] [blame] | 157 | AC_ARG_ENABLE(msgfile, |
| 158 | [AS_HELP_STRING( |
| 159 | [--disable-msgfile], |
| 160 | [Disable support for the msgfile], |
| 161 | )], |
job | 36b4a20 | 2011-08-21 17:18:23 +0200 | [diff] [blame] | 162 | [enable_msgfile=$enableval], [enable_msgfile="yes"]) |
| 163 | AM_CONDITIONAL(ENABLE_MSGFILE, test x"$enable_msgfile" = x"yes") |
Holger Hans Peter Freyther | c87f266 | 2010-10-07 00:00:15 +0800 | [diff] [blame] | 164 | |
Sylvain Munaut | fe28ded | 2011-09-02 22:18:24 +0200 | [diff] [blame] | 165 | AC_ARG_ENABLE(serial, |
| 166 | [AS_HELP_STRING( |
| 167 | [--disable-serial], |
| 168 | [Disable support for the serial helpers], |
| 169 | )], |
| 170 | [enable_serial=$enableval], [enable_serial="yes"]) |
| 171 | AM_CONDITIONAL(ENABLE_SERIAL, test x"$enable_serial" = x"yes") |
| 172 | |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 173 | AC_ARG_ENABLE(utilities, |
| 174 | [AS_HELP_STRING( |
| 175 | [--disable-utilities], |
| 176 | [Disable building utility programs], |
| 177 | )], |
| 178 | [enable_utilities=$enableval], [enable_utilities="yes"]) |
| 179 | AM_CONDITIONAL(ENABLE_UTILITIES, test x"$enable_utilities" = x"yes") |
| 180 | |
Harald Welte | e3a10b6 | 2012-09-08 22:18:43 +0200 | [diff] [blame] | 181 | AC_ARG_ENABLE(gb, |
| 182 | [AS_HELP_STRING( |
| 183 | [--disable-gb], |
| 184 | [Disable building Gb library], |
| 185 | )], |
| 186 | [enable_gb=$enableval], [enable_gb="yes"]) |
| 187 | AM_CONDITIONAL(ENABLE_GB, test x"$enable_gb" = x"yes") |
| 188 | |
Harald Welte | 1c67e75 | 2017-01-15 17:52:30 +0100 | [diff] [blame] | 189 | AC_ARG_ENABLE(ctrl, |
| 190 | [AS_HELP_STRING( |
| 191 | [--disable-ctrl], |
| 192 | [Disable building CTRL library], |
| 193 | )], |
| 194 | [enable_ctrl=$enableval], [enable_ctrl="yes"]) |
| 195 | AM_CONDITIONAL(ENABLE_CTRL, test x"$enable_ctrl" = x"yes") |
| 196 | |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 197 | AC_ARG_ENABLE(embedded, |
| 198 | [AS_HELP_STRING( |
| 199 | [--enable-embedded], |
| 200 | [Enable building for embedded use and disable unsupported features] |
| 201 | )], |
| 202 | [embedded=$enableval], [embedded="no"]) |
| 203 | if test x"$embedded" = x"yes" |
| 204 | then |
| 205 | AC_DEFINE([EMBEDDED],[1],[Select building for embedded use]) |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 206 | AM_CONDITIONAL(ENABLE_PLUGIN, false) |
| 207 | AM_CONDITIONAL(ENABLE_MSGFILE, false) |
Sylvain Munaut | fe28ded | 2011-09-02 22:18:24 +0200 | [diff] [blame] | 208 | AM_CONDITIONAL(ENABLE_SERIAL, false) |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 209 | AM_CONDITIONAL(ENABLE_VTY, false) |
Harald Welte | 1c67e75 | 2017-01-15 17:52:30 +0100 | [diff] [blame] | 210 | AM_CONDITIONAL(ENABLE_CTRL, false) |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 211 | AM_CONDITIONAL(ENABLE_UTILITIES, false) |
Harald Welte | e3a10b6 | 2012-09-08 22:18:43 +0200 | [diff] [blame] | 212 | AM_CONDITIONAL(ENABLE_GB, false) |
Harald Welte | 1a7d64c | 2017-01-15 17:53:23 +0100 | [diff] [blame] | 213 | AM_CONDITIONAL(ENABLE_PCSC, false) |
job | 8e4deb6 | 2011-08-21 17:18:24 +0200 | [diff] [blame] | 214 | AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort]) |
| 215 | fi |
Harald Welte | 5440377 | 2010-05-29 11:49:51 +0200 | [diff] [blame] | 216 | |
Neels Hofmeyr | a238176 | 2016-09-30 01:25:45 +0200 | [diff] [blame] | 217 | AC_ARG_ENABLE(sanitize, |
| 218 | [AS_HELP_STRING( |
| 219 | [--enable-sanitize], |
| 220 | [Compile with address sanitizer enabled], |
| 221 | )], |
| 222 | [sanitize=$enableval], [sanitize="no"]) |
| 223 | if test x"$sanitize" = x"yes" |
| 224 | then |
| 225 | CFLAGS+=" -fsanitize=address -fsanitize=undefined" |
| 226 | CPPFLAGS+=" -fsanitize=address -fsanitize=undefined" |
| 227 | fi |
| 228 | |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 229 | AC_OUTPUT( |
| 230 | libosmocore.pc |
Sylvain Munaut | b99b930 | 2010-10-24 18:23:10 +0200 | [diff] [blame] | 231 | libosmocodec.pc |
Vadim Yanitskiy | 3262f82 | 2016-09-23 01:48:59 +0700 | [diff] [blame] | 232 | libosmocoding.pc |
Harald Welte | e352c52 | 2010-05-19 19:42:32 +0200 | [diff] [blame] | 233 | libosmovty.pc |
Pablo Neira Ayuso | fba495e | 2011-03-23 18:08:08 +0100 | [diff] [blame] | 234 | libosmogsm.pc |
Harald Welte | 641f7ce | 2012-06-17 23:05:26 +0800 | [diff] [blame] | 235 | libosmogb.pc |
Harald Welte | 3ff81b1 | 2014-08-20 19:58:40 +0200 | [diff] [blame] | 236 | libosmoctrl.pc |
Harald Welte | d54c2ee | 2012-01-17 18:25:50 +0100 | [diff] [blame] | 237 | libosmosim.pc |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 238 | include/Makefile |
| 239 | src/Makefile |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 240 | src/vty/Makefile |
Sylvain Munaut | 1a4ea5b | 2010-10-08 15:09:16 +0200 | [diff] [blame] | 241 | src/codec/Makefile |
Vadim Yanitskiy | 3262f82 | 2016-09-23 01:48:59 +0700 | [diff] [blame] | 242 | src/coding/Makefile |
Harald Welte | d54c2ee | 2012-01-17 18:25:50 +0100 | [diff] [blame] | 243 | src/sim/Makefile |
Pablo Neira Ayuso | fba495e | 2011-03-23 18:08:08 +0100 | [diff] [blame] | 244 | src/gsm/Makefile |
Harald Welte | 641f7ce | 2012-06-17 23:05:26 +0800 | [diff] [blame] | 245 | src/gb/Makefile |
Harald Welte | 3ff81b1 | 2014-08-20 19:58:40 +0200 | [diff] [blame] | 246 | src/ctrl/Makefile |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 247 | tests/Makefile |
Neels Hofmeyr | 9683104 | 2016-11-15 17:31:14 +0100 | [diff] [blame] | 248 | tests/atlocal |
Harald Welte | eeb78dd | 2011-08-02 13:44:54 +0200 | [diff] [blame] | 249 | utils/Makefile |
Harald Welte | c7859ed | 2011-08-20 12:54:17 +0200 | [diff] [blame] | 250 | Doxyfile.core |
Harald Welte | 49e1056 | 2011-08-17 19:21:07 +0200 | [diff] [blame] | 251 | Doxyfile.gsm |
| 252 | Doxyfile.vty |
| 253 | Doxyfile.codec |
Vadim Yanitskiy | 3262f82 | 2016-09-23 01:48:59 +0700 | [diff] [blame] | 254 | Doxyfile.coding |
Harald Welte | 3cae039 | 2010-02-20 21:09:24 +0100 | [diff] [blame] | 255 | Makefile) |