blob: 9a744b102f2609c5ea199846be35f8b0c093fd63 [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 Welte495fe262012-09-10 16:28:17 +020085AC_ARG_ENABLE([pcsc], [AS_HELP_STRING([--disable-pcsc], [Build without PC/SC support])],
86 [
Holger Hans Peter Freyther18bcc8a2014-11-14 15:06:09 +010087 enable_pcsc=$enableval
Harald Welte495fe262012-09-10 16:28:17 +020088 ],
89 [
Holger Hans Peter Freyther18bcc8a2014-11-14 15:06:09 +010090 enable_pcsc="yes"
Harald Welte495fe262012-09-10 16:28:17 +020091 ])
Holger Hans Peter Freyther18bcc8a2014-11-14 15:06:09 +010092if test "x$enable_pcsc" = "xyes" ; then
93 PKG_CHECK_MODULES(PCSC, libpcsclite)
94fi
95AM_CONDITIONAL(ENABLE_PCSC, test "x$enable_pcsc" = "xyes")
Harald Welte495fe262012-09-10 16:28:17 +020096
Harald Weltecbb29f72010-03-07 20:24:30 +010097AC_ARG_ENABLE(talloc,
Sylvain Munautf23abab2010-07-25 16:16:42 +020098 [AS_HELP_STRING(
99 [--disable-talloc],
100 [Disable building talloc memory allocator]
101 )],
job36b4a202011-08-21 17:18:23 +0200102 [enable_talloc=$enableval], [enable_talloc="yes"])
103AM_CONDITIONAL(ENABLE_TALLOC, [test x"$enable_talloc" = x"yes"])
Harald Weltecbb29f72010-03-07 20:24:30 +0100104
Harald Welteb9ce51c2010-06-30 19:43:11 +0200105AC_ARG_ENABLE(plugin,
Sylvain Munautf23abab2010-07-25 16:16:42 +0200106 [AS_HELP_STRING(
107 [--disable-plugin],
108 [Disable support for dlopen plugins],
109 )],
job36b4a202011-08-21 17:18:23 +0200110 [enable_plugin=$enableval], [enable_plugin="yes"])
111AM_CONDITIONAL(ENABLE_PLUGIN, test x"$enable_plugin" = x"yes")
Harald Welteb9ce51c2010-06-30 19:43:11 +0200112
Harald Welte1067e8c2010-06-25 03:00:58 +0200113AC_ARG_ENABLE(vty,
Sylvain Munautf23abab2010-07-25 16:16:42 +0200114 [AS_HELP_STRING(
115 [--disable-vty],
116 [Disable building VTY telnet interface]
117 )],
job36b4a202011-08-21 17:18:23 +0200118 [enable_vty=$enableval], [enable_vty="yes"])
119AM_CONDITIONAL(ENABLE_VTY, test x"$enable_vty" = x"yes")
Harald Welte54403772010-05-29 11:49:51 +0200120
Sylvain Munautac3e61a2010-07-25 18:08:54 +0200121AC_ARG_ENABLE(panic_infloop,
122 [AS_HELP_STRING(
123 [--enable-panic-infloop],
124 [Trigger infinite loop on panic rather than fprintf/abort]
125 )],
job36b4a202011-08-21 17:18:23 +0200126 [panic_infloop=$enableval], [panic_infloop="no"])
127if test x"$panic_infloop" = x"yes"
Sylvain Munautac3e61a2010-07-25 18:08:54 +0200128then
129 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
130fi
131
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800132AC_ARG_ENABLE(bsc_fd_check,
133 [AS_HELP_STRING(
134 [--enable-bsc-fd-check],
135 [Instrument bsc_register_fd to check that the fd is registered]
136 )],
job36b4a202011-08-21 17:18:23 +0200137 [fd_check=$enableval], [fd_check="no"])
138if test x"$fd_check" = x"no"
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800139then
140 AC_DEFINE([BSC_FD_CHECK],[1],[Instrument the bsc_register_fd])
141fi
142
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800143AC_ARG_ENABLE(msgfile,
144 [AS_HELP_STRING(
145 [--disable-msgfile],
146 [Disable support for the msgfile],
147 )],
job36b4a202011-08-21 17:18:23 +0200148 [enable_msgfile=$enableval], [enable_msgfile="yes"])
149AM_CONDITIONAL(ENABLE_MSGFILE, test x"$enable_msgfile" = x"yes")
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800150
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200151AC_ARG_ENABLE(serial,
152 [AS_HELP_STRING(
153 [--disable-serial],
154 [Disable support for the serial helpers],
155 )],
156 [enable_serial=$enableval], [enable_serial="yes"])
157AM_CONDITIONAL(ENABLE_SERIAL, test x"$enable_serial" = x"yes")
158
job8e4deb62011-08-21 17:18:24 +0200159AC_ARG_ENABLE(utilities,
160 [AS_HELP_STRING(
161 [--disable-utilities],
162 [Disable building utility programs],
163 )],
164 [enable_utilities=$enableval], [enable_utilities="yes"])
165AM_CONDITIONAL(ENABLE_UTILITIES, test x"$enable_utilities" = x"yes")
166
Harald Weltee3a10b62012-09-08 22:18:43 +0200167AC_ARG_ENABLE(gb,
168 [AS_HELP_STRING(
169 [--disable-gb],
170 [Disable building Gb library],
171 )],
172 [enable_gb=$enableval], [enable_gb="yes"])
173AM_CONDITIONAL(ENABLE_GB, test x"$enable_gb" = x"yes")
174
job8e4deb62011-08-21 17:18:24 +0200175AC_ARG_ENABLE(embedded,
176 [AS_HELP_STRING(
177 [--enable-embedded],
178 [Enable building for embedded use and disable unsupported features]
179 )],
180 [embedded=$enableval], [embedded="no"])
181if test x"$embedded" = x"yes"
182then
183 AC_DEFINE([EMBEDDED],[1],[Select building for embedded use])
job8e4deb62011-08-21 17:18:24 +0200184 AM_CONDITIONAL(ENABLE_PLUGIN, false)
185 AM_CONDITIONAL(ENABLE_MSGFILE, false)
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200186 AM_CONDITIONAL(ENABLE_SERIAL, false)
job8e4deb62011-08-21 17:18:24 +0200187 AM_CONDITIONAL(ENABLE_VTY, false)
188 AM_CONDITIONAL(ENABLE_TALLOC, false)
189 AM_CONDITIONAL(ENABLE_UTILITIES, false)
Harald Weltee3a10b62012-09-08 22:18:43 +0200190 AM_CONDITIONAL(ENABLE_GB, false)
job8e4deb62011-08-21 17:18:24 +0200191 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
192fi
Harald Welte54403772010-05-29 11:49:51 +0200193
Holger Hans Peter Freytherf9eda742011-11-13 01:02:54 +0100194
Harald Welte3cae0392010-02-20 21:09:24 +0100195AC_OUTPUT(
196 libosmocore.pc
Sylvain Munautb99b9302010-10-24 18:23:10 +0200197 libosmocodec.pc
Harald Weltee352c522010-05-19 19:42:32 +0200198 libosmovty.pc
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100199 libosmogsm.pc
Harald Welte641f7ce2012-06-17 23:05:26 +0800200 libosmogb.pc
Harald Welte3ff81b12014-08-20 19:58:40 +0200201 libosmoctrl.pc
Harald Welted54c2ee2012-01-17 18:25:50 +0100202 libosmosim.pc
Harald Welte3cae0392010-02-20 21:09:24 +0100203 include/Makefile
204 src/Makefile
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200205 src/vty/Makefile
Sylvain Munaut1a4ea5b2010-10-08 15:09:16 +0200206 src/codec/Makefile
Harald Welted54c2ee2012-01-17 18:25:50 +0100207 src/sim/Makefile
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100208 src/gsm/Makefile
Harald Welte641f7ce2012-06-17 23:05:26 +0800209 src/gb/Makefile
Harald Welte3ff81b12014-08-20 19:58:40 +0200210 src/ctrl/Makefile
Harald Welte3cae0392010-02-20 21:09:24 +0100211 tests/Makefile
Harald Welteeeb78dd2011-08-02 13:44:54 +0200212 utils/Makefile
Harald Weltec7859ed2011-08-20 12:54:17 +0200213 Doxyfile.core
Harald Welte49e10562011-08-17 19:21:07 +0200214 Doxyfile.gsm
215 Doxyfile.vty
216 Doxyfile.codec
Harald Welte3cae0392010-02-20 21:09:24 +0100217 Makefile)