blob: 33c9b5c253d7ac78fc31b0fef05824f446af7ec7 [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
Sylvain Munaut69b1b8b2015-08-19 11:15:14 +02005AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6 subdir-objects])
Holger Hans Peter Freytherf9eda742011-11-13 01:02:54 +01006AC_CONFIG_TESTDIR(tests)
Harald Welte3cae0392010-02-20 21:09:24 +01007
8dnl kernel style compile messages
9m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
10
11dnl checks for programs
12AC_PROG_MAKE_SET
Diego Elio Pettenòd471a212012-06-29 13:01:19 -070013AC_PROG_MKDIR_P
Harald Welte3cae0392010-02-20 21:09:24 +010014AC_PROG_CC
15AC_PROG_INSTALL
Jan Engelhardtc2ddc4f2015-09-16 14:32:31 +020016LT_INIT([pic-only disable-static])
Harald Welte3cae0392010-02-20 21:09:24 +010017
Harald Welte4cd3d8a2010-03-23 00:30:19 +080018AC_CONFIG_MACRO_DIR([m4])
19
Tobias Engel597460f2012-10-24 17:52:52 +020020dnl check os: some linker flags not available on osx
21case $host in
22*-darwin*)
23 ;;
24*)
25 LTLDFLAGS_OSMOGB='-Wl,--version-script=$(srcdir)/libosmogb.map'
26 LTLDFLAGS_OSMOGSM='-Wl,--version-script=$(srcdir)/libosmogsm.map'
27 ;;
28esac
29AC_SUBST(LTLDFLAGS_OSMOGB)
30AC_SUBST(LTLDFLAGS_OSMOGSM)
31
Harald Welte3cae0392010-02-20 21:09:24 +010032dnl checks for header files
33AC_HEADER_STDC
Harald Weltee15ac062014-12-04 14:15:36 +010034AC_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 +010035# for src/conv.c
36AC_FUNC_ALLOCA
37AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
38AC_SUBST(LIBRARY_DL)
Holger Hans Peter Freytherc2c042d2014-04-17 23:19:10 +020039# for src/backtrace.c
40AC_CHECK_LIB(execinfo, backtrace, BACKTRACE_LIB=-lexecinfo, BACKTRACE_LIB=)
41AC_SUBST(BACKTRACE_LIB)
Harald Welte3cae0392010-02-20 21:09:24 +010042
Harald Welte21e73c22011-08-17 19:33:06 +020043AC_PATH_PROG(DOXYGEN,doxygen,false)
44AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
45
Harald Welte3cae0392010-02-20 21:09:24 +010046# The following test is taken from WebKit's webkit.m4
47saved_CFLAGS="$CFLAGS"
48CFLAGS="$CFLAGS -fvisibility=hidden "
49AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemer3d79f532011-05-24 15:16:13 +020050AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Harald Welte3cae0392010-02-20 21:09:24 +010051 [ AC_MSG_RESULT([yes])
52 SYMBOL_VISIBILITY="-fvisibility=hidden"],
53 AC_MSG_RESULT([no]))
54CFLAGS="$saved_CFLAGS"
55AC_SUBST(SYMBOL_VISIBILITY)
56
Harald Welte7c8e2cc2012-08-29 16:47:30 +020057AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
58 AC_CACHE_CHECK(
59 [whether struct tm has tm_gmtoff member],
60 osmo_cv_tm_includes_tm_gmtoff,
61 [AC_LINK_IFELSE([
62 AC_LANG_PROGRAM([
63 #include <time.h>
64 ], [
65 time_t t = time(NULL);
66 struct tm* lt = localtime(&t);
67 int off = lt->tm_gmtoff;
68 ])
69 ],
70 osmo_cv_tm_includes_tm_gmtoff=yes,
71 osmo_cv_tm_includes_tm_gmtoff=no
72 )]
73 )
74 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
75 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
76 [Define if struct tm has tm_gmtoff member.])
77 fi
78])
79
80CHECK_TM_INCLUDES_TM_GMTOFF
81
Harald Welte3cae0392010-02-20 21:09:24 +010082dnl Generate the output
Christian Vogel854debc2013-01-05 20:30:41 +010083AC_CONFIG_HEADER(config.h)
Harald Welte3cae0392010-02-20 21:09:24 +010084
Harald Welte90e614f2015-12-05 23:38:18 +010085PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1])
86
Harald Welte495fe262012-09-10 16:28:17 +020087AC_ARG_ENABLE([pcsc], [AS_HELP_STRING([--disable-pcsc], [Build without PC/SC support])],
88 [
Holger Hans Peter Freyther18bcc8a2014-11-14 15:06:09 +010089 enable_pcsc=$enableval
Harald Welte495fe262012-09-10 16:28:17 +020090 ],
91 [
Holger Hans Peter Freyther18bcc8a2014-11-14 15:06:09 +010092 enable_pcsc="yes"
Harald Welte495fe262012-09-10 16:28:17 +020093 ])
Harald Welted086f212015-11-21 11:38:09 +010094AS_IF([test "x$enable_pcsc" = "xyes"], [
Holger Hans Peter Freyther18bcc8a2014-11-14 15:06:09 +010095 PKG_CHECK_MODULES(PCSC, libpcsclite)
Harald Welted086f212015-11-21 11:38:09 +010096])
Holger Hans Peter Freyther18bcc8a2014-11-14 15:06:09 +010097AM_CONDITIONAL(ENABLE_PCSC, test "x$enable_pcsc" = "xyes")
Harald Welte495fe262012-09-10 16:28:17 +020098
Harald Welteb9ce51c2010-06-30 19:43:11 +020099AC_ARG_ENABLE(plugin,
Sylvain Munautf23abab2010-07-25 16:16:42 +0200100 [AS_HELP_STRING(
101 [--disable-plugin],
102 [Disable support for dlopen plugins],
103 )],
job36b4a202011-08-21 17:18:23 +0200104 [enable_plugin=$enableval], [enable_plugin="yes"])
105AM_CONDITIONAL(ENABLE_PLUGIN, test x"$enable_plugin" = x"yes")
Harald Welteb9ce51c2010-06-30 19:43:11 +0200106
Harald Welte1067e8c2010-06-25 03:00:58 +0200107AC_ARG_ENABLE(vty,
Sylvain Munautf23abab2010-07-25 16:16:42 +0200108 [AS_HELP_STRING(
109 [--disable-vty],
110 [Disable building VTY telnet interface]
111 )],
job36b4a202011-08-21 17:18:23 +0200112 [enable_vty=$enableval], [enable_vty="yes"])
113AM_CONDITIONAL(ENABLE_VTY, test x"$enable_vty" = x"yes")
Harald Welte54403772010-05-29 11:49:51 +0200114
Sylvain Munautac3e61a2010-07-25 18:08:54 +0200115AC_ARG_ENABLE(panic_infloop,
116 [AS_HELP_STRING(
117 [--enable-panic-infloop],
118 [Trigger infinite loop on panic rather than fprintf/abort]
119 )],
job36b4a202011-08-21 17:18:23 +0200120 [panic_infloop=$enableval], [panic_infloop="no"])
121if test x"$panic_infloop" = x"yes"
Sylvain Munautac3e61a2010-07-25 18:08:54 +0200122then
123 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
124fi
125
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800126AC_ARG_ENABLE(bsc_fd_check,
127 [AS_HELP_STRING(
128 [--enable-bsc-fd-check],
129 [Instrument bsc_register_fd to check that the fd is registered]
130 )],
job36b4a202011-08-21 17:18:23 +0200131 [fd_check=$enableval], [fd_check="no"])
132if test x"$fd_check" = x"no"
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800133then
134 AC_DEFINE([BSC_FD_CHECK],[1],[Instrument the bsc_register_fd])
135fi
136
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800137AC_ARG_ENABLE(msgfile,
138 [AS_HELP_STRING(
139 [--disable-msgfile],
140 [Disable support for the msgfile],
141 )],
job36b4a202011-08-21 17:18:23 +0200142 [enable_msgfile=$enableval], [enable_msgfile="yes"])
143AM_CONDITIONAL(ENABLE_MSGFILE, test x"$enable_msgfile" = x"yes")
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800144
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200145AC_ARG_ENABLE(serial,
146 [AS_HELP_STRING(
147 [--disable-serial],
148 [Disable support for the serial helpers],
149 )],
150 [enable_serial=$enableval], [enable_serial="yes"])
151AM_CONDITIONAL(ENABLE_SERIAL, test x"$enable_serial" = x"yes")
152
job8e4deb62011-08-21 17:18:24 +0200153AC_ARG_ENABLE(utilities,
154 [AS_HELP_STRING(
155 [--disable-utilities],
156 [Disable building utility programs],
157 )],
158 [enable_utilities=$enableval], [enable_utilities="yes"])
159AM_CONDITIONAL(ENABLE_UTILITIES, test x"$enable_utilities" = x"yes")
160
Harald Weltee3a10b62012-09-08 22:18:43 +0200161AC_ARG_ENABLE(gb,
162 [AS_HELP_STRING(
163 [--disable-gb],
164 [Disable building Gb library],
165 )],
166 [enable_gb=$enableval], [enable_gb="yes"])
167AM_CONDITIONAL(ENABLE_GB, test x"$enable_gb" = x"yes")
168
job8e4deb62011-08-21 17:18:24 +0200169AC_ARG_ENABLE(embedded,
170 [AS_HELP_STRING(
171 [--enable-embedded],
172 [Enable building for embedded use and disable unsupported features]
173 )],
174 [embedded=$enableval], [embedded="no"])
175if test x"$embedded" = x"yes"
176then
177 AC_DEFINE([EMBEDDED],[1],[Select building for embedded use])
job8e4deb62011-08-21 17:18:24 +0200178 AM_CONDITIONAL(ENABLE_PLUGIN, false)
179 AM_CONDITIONAL(ENABLE_MSGFILE, false)
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200180 AM_CONDITIONAL(ENABLE_SERIAL, false)
job8e4deb62011-08-21 17:18:24 +0200181 AM_CONDITIONAL(ENABLE_VTY, false)
job8e4deb62011-08-21 17:18:24 +0200182 AM_CONDITIONAL(ENABLE_UTILITIES, false)
Harald Weltee3a10b62012-09-08 22:18:43 +0200183 AM_CONDITIONAL(ENABLE_GB, false)
job8e4deb62011-08-21 17:18:24 +0200184 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
185fi
Harald Welte54403772010-05-29 11:49:51 +0200186
Harald Welte3cae0392010-02-20 21:09:24 +0100187AC_OUTPUT(
188 libosmocore.pc
Sylvain Munautb99b9302010-10-24 18:23:10 +0200189 libosmocodec.pc
Harald Weltee352c522010-05-19 19:42:32 +0200190 libosmovty.pc
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100191 libosmogsm.pc
Harald Welte641f7ce2012-06-17 23:05:26 +0800192 libosmogb.pc
Harald Welte3ff81b12014-08-20 19:58:40 +0200193 libosmoctrl.pc
Harald Welted54c2ee2012-01-17 18:25:50 +0100194 libosmosim.pc
Harald Welte3cae0392010-02-20 21:09:24 +0100195 include/Makefile
196 src/Makefile
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200197 src/vty/Makefile
Sylvain Munaut1a4ea5b2010-10-08 15:09:16 +0200198 src/codec/Makefile
Harald Welted54c2ee2012-01-17 18:25:50 +0100199 src/sim/Makefile
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100200 src/gsm/Makefile
Harald Welte641f7ce2012-06-17 23:05:26 +0800201 src/gb/Makefile
Harald Welte3ff81b12014-08-20 19:58:40 +0200202 src/ctrl/Makefile
Harald Welte3cae0392010-02-20 21:09:24 +0100203 tests/Makefile
Harald Welteeeb78dd2011-08-02 13:44:54 +0200204 utils/Makefile
Harald Weltec7859ed2011-08-20 12:54:17 +0200205 Doxyfile.core
Harald Welte49e10562011-08-17 19:21:07 +0200206 Doxyfile.gsm
207 Doxyfile.vty
208 Doxyfile.codec
Harald Welte3cae0392010-02-20 21:09:24 +0100209 Makefile)