blob: e3752b4e2a94610703b916ad88d95a9ec7de9837 [file] [log] [blame]
Harald Welte4cd3d8a2010-03-23 00:30:19 +08001AC_INIT([libosmocore],
2 m4_esyscmd([./git-version-gen .tarball-version]),
Holger Hans Peter Freyther8db70202012-03-26 16:34:37 +02003 [openbsc@lists.osmocom.org])
Harald Welte3cae0392010-02-20 21:09:24 +01004
Neels Hofmeyrcbdfa652016-09-30 23:45:28 +02005dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
6AC_CONFIG_AUX_DIR([.])
7
Sylvain Munaut69b1b8b2015-08-19 11:15:14 +02008AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6 subdir-objects])
Holger Hans Peter Freytherf9eda742011-11-13 01:02:54 +01009AC_CONFIG_TESTDIR(tests)
Harald Welte3cae0392010-02-20 21:09:24 +010010
11dnl kernel style compile messages
12m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
13
14dnl checks for programs
15AC_PROG_MAKE_SET
Diego Elio Pettenòd471a212012-06-29 13:01:19 -070016AC_PROG_MKDIR_P
Harald Welte3cae0392010-02-20 21:09:24 +010017AC_PROG_CC
18AC_PROG_INSTALL
Jan Engelhardtc2ddc4f2015-09-16 14:32:31 +020019LT_INIT([pic-only disable-static])
Harald Welte3cae0392010-02-20 21:09:24 +010020
Harald Welte4cd3d8a2010-03-23 00:30:19 +080021AC_CONFIG_MACRO_DIR([m4])
22
Neels Hofmeyrfef2fa22016-08-08 15:38:35 +020023dnl check for pkg-config
24dnl * If pkg-config is missing, we get a "syntax error" for PKG_CHECK_MODULES.
25dnl Instead, we want to say that pkg-config and pkg.m4 are missing.
26dnl * The proper way is PKG_PROG_PKG_CONFIG() but unfortunately that does not
27dnl produce an intelligible error message if pkg-config is missing entirely
28dnl ("syntax error near unexpected token `0.20'").
29dnl * To produce a hint that pkg-config is missing, check for the pkg-config
30dnl binary; but AC_PATH_PROG breaks if the distribution provides only
31dnl prefixed (<arch>-pkg-config) versions, so just print a warning.
32AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
33if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
34 AC_MSG_WARN([You need to install pkg-config])
35fi
36PKG_PROG_PKG_CONFIG([0.20])
37
Tobias Engel597460f2012-10-24 17:52:52 +020038dnl check os: some linker flags not available on osx
39case $host in
40*-darwin*)
41 ;;
42*)
43 LTLDFLAGS_OSMOGB='-Wl,--version-script=$(srcdir)/libosmogb.map'
44 LTLDFLAGS_OSMOGSM='-Wl,--version-script=$(srcdir)/libosmogsm.map'
45 ;;
46esac
47AC_SUBST(LTLDFLAGS_OSMOGB)
48AC_SUBST(LTLDFLAGS_OSMOGSM)
49
Harald Welte3cae0392010-02-20 21:09:24 +010050dnl checks for header files
51AC_HEADER_STDC
Harald Weltee15ac062014-12-04 14:15:36 +010052AC_CHECK_HEADERS(execinfo.h sys/select.h sys/socket.h syslog.h ctype.h netinet/tcp.h)
Holger Hans Peter Freyther47723482011-11-09 11:26:15 +010053# for src/conv.c
54AC_FUNC_ALLOCA
55AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
56AC_SUBST(LIBRARY_DL)
Holger Hans Peter Freytherc2c042d2014-04-17 23:19:10 +020057# for src/backtrace.c
58AC_CHECK_LIB(execinfo, backtrace, BACKTRACE_LIB=-lexecinfo, BACKTRACE_LIB=)
59AC_SUBST(BACKTRACE_LIB)
Harald Welte3cae0392010-02-20 21:09:24 +010060
Harald Welte21e73c22011-08-17 19:33:06 +020061AC_PATH_PROG(DOXYGEN,doxygen,false)
62AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
63
Harald Welte3cae0392010-02-20 21:09:24 +010064# The following test is taken from WebKit's webkit.m4
65saved_CFLAGS="$CFLAGS"
66CFLAGS="$CFLAGS -fvisibility=hidden "
67AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemer3d79f532011-05-24 15:16:13 +020068AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Harald Welte3cae0392010-02-20 21:09:24 +010069 [ AC_MSG_RESULT([yes])
70 SYMBOL_VISIBILITY="-fvisibility=hidden"],
71 AC_MSG_RESULT([no]))
72CFLAGS="$saved_CFLAGS"
73AC_SUBST(SYMBOL_VISIBILITY)
74
Harald Welte7c8e2cc2012-08-29 16:47:30 +020075AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
76 AC_CACHE_CHECK(
77 [whether struct tm has tm_gmtoff member],
78 osmo_cv_tm_includes_tm_gmtoff,
79 [AC_LINK_IFELSE([
80 AC_LANG_PROGRAM([
81 #include <time.h>
82 ], [
83 time_t t = time(NULL);
84 struct tm* lt = localtime(&t);
85 int off = lt->tm_gmtoff;
86 ])
87 ],
88 osmo_cv_tm_includes_tm_gmtoff=yes,
89 osmo_cv_tm_includes_tm_gmtoff=no
90 )]
91 )
92 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
93 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
94 [Define if struct tm has tm_gmtoff member.])
95 fi
96])
97
98CHECK_TM_INCLUDES_TM_GMTOFF
99
Harald Welte3cae0392010-02-20 21:09:24 +0100100dnl Generate the output
Christian Vogel854debc2013-01-05 20:30:41 +0100101AC_CONFIG_HEADER(config.h)
Harald Welte3cae0392010-02-20 21:09:24 +0100102
Harald Welte90e614f2015-12-05 23:38:18 +0100103PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1])
104
Harald Welte495fe262012-09-10 16:28:17 +0200105AC_ARG_ENABLE([pcsc], [AS_HELP_STRING([--disable-pcsc], [Build without PC/SC support])],
106 [
Holger Hans Peter Freyther18bcc8a2014-11-14 15:06:09 +0100107 enable_pcsc=$enableval
Harald Welte495fe262012-09-10 16:28:17 +0200108 ],
109 [
Holger Hans Peter Freyther18bcc8a2014-11-14 15:06:09 +0100110 enable_pcsc="yes"
Harald Welte495fe262012-09-10 16:28:17 +0200111 ])
Harald Welted086f212015-11-21 11:38:09 +0100112AS_IF([test "x$enable_pcsc" = "xyes"], [
Holger Hans Peter Freyther18bcc8a2014-11-14 15:06:09 +0100113 PKG_CHECK_MODULES(PCSC, libpcsclite)
Harald Welted086f212015-11-21 11:38:09 +0100114])
Holger Hans Peter Freyther18bcc8a2014-11-14 15:06:09 +0100115AM_CONDITIONAL(ENABLE_PCSC, test "x$enable_pcsc" = "xyes")
Harald Welte495fe262012-09-10 16:28:17 +0200116
Harald Welteb9ce51c2010-06-30 19:43:11 +0200117AC_ARG_ENABLE(plugin,
Sylvain Munautf23abab2010-07-25 16:16:42 +0200118 [AS_HELP_STRING(
119 [--disable-plugin],
120 [Disable support for dlopen plugins],
121 )],
job36b4a202011-08-21 17:18:23 +0200122 [enable_plugin=$enableval], [enable_plugin="yes"])
123AM_CONDITIONAL(ENABLE_PLUGIN, test x"$enable_plugin" = x"yes")
Harald Welteb9ce51c2010-06-30 19:43:11 +0200124
Harald Welte1067e8c2010-06-25 03:00:58 +0200125AC_ARG_ENABLE(vty,
Sylvain Munautf23abab2010-07-25 16:16:42 +0200126 [AS_HELP_STRING(
127 [--disable-vty],
128 [Disable building VTY telnet interface]
129 )],
job36b4a202011-08-21 17:18:23 +0200130 [enable_vty=$enableval], [enable_vty="yes"])
131AM_CONDITIONAL(ENABLE_VTY, test x"$enable_vty" = x"yes")
Harald Welte54403772010-05-29 11:49:51 +0200132
Sylvain Munautac3e61a2010-07-25 18:08:54 +0200133AC_ARG_ENABLE(panic_infloop,
134 [AS_HELP_STRING(
135 [--enable-panic-infloop],
136 [Trigger infinite loop on panic rather than fprintf/abort]
137 )],
job36b4a202011-08-21 17:18:23 +0200138 [panic_infloop=$enableval], [panic_infloop="no"])
139if test x"$panic_infloop" = x"yes"
Sylvain Munautac3e61a2010-07-25 18:08:54 +0200140then
141 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
142fi
143
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800144AC_ARG_ENABLE(bsc_fd_check,
145 [AS_HELP_STRING(
146 [--enable-bsc-fd-check],
147 [Instrument bsc_register_fd to check that the fd is registered]
148 )],
job36b4a202011-08-21 17:18:23 +0200149 [fd_check=$enableval], [fd_check="no"])
150if test x"$fd_check" = x"no"
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800151then
152 AC_DEFINE([BSC_FD_CHECK],[1],[Instrument the bsc_register_fd])
153fi
154
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800155AC_ARG_ENABLE(msgfile,
156 [AS_HELP_STRING(
157 [--disable-msgfile],
158 [Disable support for the msgfile],
159 )],
job36b4a202011-08-21 17:18:23 +0200160 [enable_msgfile=$enableval], [enable_msgfile="yes"])
161AM_CONDITIONAL(ENABLE_MSGFILE, test x"$enable_msgfile" = x"yes")
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800162
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200163AC_ARG_ENABLE(serial,
164 [AS_HELP_STRING(
165 [--disable-serial],
166 [Disable support for the serial helpers],
167 )],
168 [enable_serial=$enableval], [enable_serial="yes"])
169AM_CONDITIONAL(ENABLE_SERIAL, test x"$enable_serial" = x"yes")
170
job8e4deb62011-08-21 17:18:24 +0200171AC_ARG_ENABLE(utilities,
172 [AS_HELP_STRING(
173 [--disable-utilities],
174 [Disable building utility programs],
175 )],
176 [enable_utilities=$enableval], [enable_utilities="yes"])
177AM_CONDITIONAL(ENABLE_UTILITIES, test x"$enable_utilities" = x"yes")
178
Harald Weltee3a10b62012-09-08 22:18:43 +0200179AC_ARG_ENABLE(gb,
180 [AS_HELP_STRING(
181 [--disable-gb],
182 [Disable building Gb library],
183 )],
184 [enable_gb=$enableval], [enable_gb="yes"])
185AM_CONDITIONAL(ENABLE_GB, test x"$enable_gb" = x"yes")
186
job8e4deb62011-08-21 17:18:24 +0200187AC_ARG_ENABLE(embedded,
188 [AS_HELP_STRING(
189 [--enable-embedded],
190 [Enable building for embedded use and disable unsupported features]
191 )],
192 [embedded=$enableval], [embedded="no"])
193if test x"$embedded" = x"yes"
194then
195 AC_DEFINE([EMBEDDED],[1],[Select building for embedded use])
job8e4deb62011-08-21 17:18:24 +0200196 AM_CONDITIONAL(ENABLE_PLUGIN, false)
197 AM_CONDITIONAL(ENABLE_MSGFILE, false)
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200198 AM_CONDITIONAL(ENABLE_SERIAL, false)
job8e4deb62011-08-21 17:18:24 +0200199 AM_CONDITIONAL(ENABLE_VTY, false)
job8e4deb62011-08-21 17:18:24 +0200200 AM_CONDITIONAL(ENABLE_UTILITIES, false)
Harald Weltee3a10b62012-09-08 22:18:43 +0200201 AM_CONDITIONAL(ENABLE_GB, false)
job8e4deb62011-08-21 17:18:24 +0200202 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
203fi
Harald Welte54403772010-05-29 11:49:51 +0200204
Harald Welte3cae0392010-02-20 21:09:24 +0100205AC_OUTPUT(
206 libosmocore.pc
Sylvain Munautb99b9302010-10-24 18:23:10 +0200207 libosmocodec.pc
Harald Weltee352c522010-05-19 19:42:32 +0200208 libosmovty.pc
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100209 libosmogsm.pc
Harald Welte641f7ce2012-06-17 23:05:26 +0800210 libosmogb.pc
Harald Welte3ff81b12014-08-20 19:58:40 +0200211 libosmoctrl.pc
Harald Welted54c2ee2012-01-17 18:25:50 +0100212 libosmosim.pc
Harald Welte3cae0392010-02-20 21:09:24 +0100213 include/Makefile
214 src/Makefile
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200215 src/vty/Makefile
Sylvain Munaut1a4ea5b2010-10-08 15:09:16 +0200216 src/codec/Makefile
Harald Welted54c2ee2012-01-17 18:25:50 +0100217 src/sim/Makefile
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100218 src/gsm/Makefile
Harald Welte641f7ce2012-06-17 23:05:26 +0800219 src/gb/Makefile
Harald Welte3ff81b12014-08-20 19:58:40 +0200220 src/ctrl/Makefile
Harald Welte3cae0392010-02-20 21:09:24 +0100221 tests/Makefile
Harald Welteeeb78dd2011-08-02 13:44:54 +0200222 utils/Makefile
Harald Weltec7859ed2011-08-20 12:54:17 +0200223 Doxyfile.core
Harald Welte49e10562011-08-17 19:21:07 +0200224 Doxyfile.gsm
225 Doxyfile.vty
226 Doxyfile.codec
Harald Welte3cae0392010-02-20 21:09:24 +0100227 Makefile)