blob: deaa8bf74fe751cd84145d089ad130724e8a21a0 [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
Diego Elio Pettenò8dd81fa2012-06-29 13:01:22 -07005AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6])
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
Diego Elio Pettenòc5f055f2012-06-29 13:01:29 -070016LT_INIT([pic-only])
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 Weltee4764422011-05-22 12:25:57 +020034AC_CHECK_HEADERS(execinfo.h sys/select.h sys/socket.h syslog.h ctype.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 Weltecbb29f72010-03-07 20:24:30 +010085AC_ARG_ENABLE(talloc,
Sylvain Munautf23abab2010-07-25 16:16:42 +020086 [AS_HELP_STRING(
87 [--disable-talloc],
88 [Disable building talloc memory allocator]
89 )],
job36b4a202011-08-21 17:18:23 +020090 [enable_talloc=$enableval], [enable_talloc="yes"])
91AM_CONDITIONAL(ENABLE_TALLOC, [test x"$enable_talloc" = x"yes"])
Harald Weltecbb29f72010-03-07 20:24:30 +010092
Harald Welteb9ce51c2010-06-30 19:43:11 +020093AC_ARG_ENABLE(plugin,
Sylvain Munautf23abab2010-07-25 16:16:42 +020094 [AS_HELP_STRING(
95 [--disable-plugin],
96 [Disable support for dlopen plugins],
97 )],
job36b4a202011-08-21 17:18:23 +020098 [enable_plugin=$enableval], [enable_plugin="yes"])
99AM_CONDITIONAL(ENABLE_PLUGIN, test x"$enable_plugin" = x"yes")
Harald Welteb9ce51c2010-06-30 19:43:11 +0200100
Harald Welte1067e8c2010-06-25 03:00:58 +0200101AC_ARG_ENABLE(vty,
Sylvain Munautf23abab2010-07-25 16:16:42 +0200102 [AS_HELP_STRING(
103 [--disable-vty],
104 [Disable building VTY telnet interface]
105 )],
job36b4a202011-08-21 17:18:23 +0200106 [enable_vty=$enableval], [enable_vty="yes"])
107AM_CONDITIONAL(ENABLE_VTY, test x"$enable_vty" = x"yes")
Harald Welte54403772010-05-29 11:49:51 +0200108
Sylvain Munautac3e61a2010-07-25 18:08:54 +0200109AC_ARG_ENABLE(panic_infloop,
110 [AS_HELP_STRING(
111 [--enable-panic-infloop],
112 [Trigger infinite loop on panic rather than fprintf/abort]
113 )],
job36b4a202011-08-21 17:18:23 +0200114 [panic_infloop=$enableval], [panic_infloop="no"])
115if test x"$panic_infloop" = x"yes"
Sylvain Munautac3e61a2010-07-25 18:08:54 +0200116then
117 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
118fi
119
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800120AC_ARG_ENABLE(bsc_fd_check,
121 [AS_HELP_STRING(
122 [--enable-bsc-fd-check],
123 [Instrument bsc_register_fd to check that the fd is registered]
124 )],
job36b4a202011-08-21 17:18:23 +0200125 [fd_check=$enableval], [fd_check="no"])
126if test x"$fd_check" = x"no"
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800127then
128 AC_DEFINE([BSC_FD_CHECK],[1],[Instrument the bsc_register_fd])
129fi
130
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800131AC_ARG_ENABLE(msgfile,
132 [AS_HELP_STRING(
133 [--disable-msgfile],
134 [Disable support for the msgfile],
135 )],
job36b4a202011-08-21 17:18:23 +0200136 [enable_msgfile=$enableval], [enable_msgfile="yes"])
137AM_CONDITIONAL(ENABLE_MSGFILE, test x"$enable_msgfile" = x"yes")
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800138
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200139AC_ARG_ENABLE(serial,
140 [AS_HELP_STRING(
141 [--disable-serial],
142 [Disable support for the serial helpers],
143 )],
144 [enable_serial=$enableval], [enable_serial="yes"])
145AM_CONDITIONAL(ENABLE_SERIAL, test x"$enable_serial" = x"yes")
146
job8e4deb62011-08-21 17:18:24 +0200147AC_ARG_ENABLE(utilities,
148 [AS_HELP_STRING(
149 [--disable-utilities],
150 [Disable building utility programs],
151 )],
152 [enable_utilities=$enableval], [enable_utilities="yes"])
153AM_CONDITIONAL(ENABLE_UTILITIES, test x"$enable_utilities" = x"yes")
154
Harald Weltee3a10b62012-09-08 22:18:43 +0200155AC_ARG_ENABLE(gb,
156 [AS_HELP_STRING(
157 [--disable-gb],
158 [Disable building Gb library],
159 )],
160 [enable_gb=$enableval], [enable_gb="yes"])
161AM_CONDITIONAL(ENABLE_GB, test x"$enable_gb" = x"yes")
162
job8e4deb62011-08-21 17:18:24 +0200163AC_ARG_ENABLE(embedded,
164 [AS_HELP_STRING(
165 [--enable-embedded],
166 [Enable building for embedded use and disable unsupported features]
167 )],
168 [embedded=$enableval], [embedded="no"])
169if test x"$embedded" = x"yes"
170then
171 AC_DEFINE([EMBEDDED],[1],[Select building for embedded use])
job8e4deb62011-08-21 17:18:24 +0200172 AM_CONDITIONAL(ENABLE_PLUGIN, false)
173 AM_CONDITIONAL(ENABLE_MSGFILE, false)
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200174 AM_CONDITIONAL(ENABLE_SERIAL, false)
job8e4deb62011-08-21 17:18:24 +0200175 AM_CONDITIONAL(ENABLE_VTY, false)
176 AM_CONDITIONAL(ENABLE_TALLOC, false)
177 AM_CONDITIONAL(ENABLE_UTILITIES, false)
Harald Weltee3a10b62012-09-08 22:18:43 +0200178 AM_CONDITIONAL(ENABLE_GB, false)
job8e4deb62011-08-21 17:18:24 +0200179 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
180fi
Harald Welte54403772010-05-29 11:49:51 +0200181
Holger Hans Peter Freytherf9eda742011-11-13 01:02:54 +0100182
Harald Welte3cae0392010-02-20 21:09:24 +0100183AC_OUTPUT(
184 libosmocore.pc
Sylvain Munautb99b9302010-10-24 18:23:10 +0200185 libosmocodec.pc
Harald Weltee352c522010-05-19 19:42:32 +0200186 libosmovty.pc
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100187 libosmogsm.pc
Harald Welte641f7ce2012-06-17 23:05:26 +0800188 libosmogb.pc
Harald Welte3ff81b12014-08-20 19:58:40 +0200189 libosmoctrl.pc
Harald Welte3cae0392010-02-20 21:09:24 +0100190 include/Makefile
191 src/Makefile
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200192 src/vty/Makefile
Sylvain Munaut1a4ea5b2010-10-08 15:09:16 +0200193 src/codec/Makefile
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100194 src/gsm/Makefile
Harald Welte641f7ce2012-06-17 23:05:26 +0800195 src/gb/Makefile
Harald Welte3ff81b12014-08-20 19:58:40 +0200196 src/ctrl/Makefile
Harald Welte3cae0392010-02-20 21:09:24 +0100197 tests/Makefile
Harald Welteeeb78dd2011-08-02 13:44:54 +0200198 utils/Makefile
Harald Weltec7859ed2011-08-20 12:54:17 +0200199 Doxyfile.core
Harald Welte49e10562011-08-17 19:21:07 +0200200 Doxyfile.gsm
201 Doxyfile.vty
202 Doxyfile.codec
Harald Welte3cae0392010-02-20 21:09:24 +0100203 Makefile)