blob: 24ddd0c7547dbc4ff52651c343c725378308aa65 [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)
Harald Welte3cae0392010-02-20 21:09:24 +010039
Harald Welte21e73c22011-08-17 19:33:06 +020040AC_PATH_PROG(DOXYGEN,doxygen,false)
41AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
42
Harald Welte3cae0392010-02-20 21:09:24 +010043# The following test is taken from WebKit's webkit.m4
44saved_CFLAGS="$CFLAGS"
45CFLAGS="$CFLAGS -fvisibility=hidden "
46AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemer3d79f532011-05-24 15:16:13 +020047AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Harald Welte3cae0392010-02-20 21:09:24 +010048 [ AC_MSG_RESULT([yes])
49 SYMBOL_VISIBILITY="-fvisibility=hidden"],
50 AC_MSG_RESULT([no]))
51CFLAGS="$saved_CFLAGS"
52AC_SUBST(SYMBOL_VISIBILITY)
53
Harald Welte7c8e2cc2012-08-29 16:47:30 +020054AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
55 AC_CACHE_CHECK(
56 [whether struct tm has tm_gmtoff member],
57 osmo_cv_tm_includes_tm_gmtoff,
58 [AC_LINK_IFELSE([
59 AC_LANG_PROGRAM([
60 #include <time.h>
61 ], [
62 time_t t = time(NULL);
63 struct tm* lt = localtime(&t);
64 int off = lt->tm_gmtoff;
65 ])
66 ],
67 osmo_cv_tm_includes_tm_gmtoff=yes,
68 osmo_cv_tm_includes_tm_gmtoff=no
69 )]
70 )
71 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
72 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
73 [Define if struct tm has tm_gmtoff member.])
74 fi
75])
76
77CHECK_TM_INCLUDES_TM_GMTOFF
78
Harald Welte3cae0392010-02-20 21:09:24 +010079dnl Generate the output
80AM_CONFIG_HEADER(config.h)
81
Harald Weltecbb29f72010-03-07 20:24:30 +010082AC_ARG_ENABLE(talloc,
Sylvain Munautf23abab2010-07-25 16:16:42 +020083 [AS_HELP_STRING(
84 [--disable-talloc],
85 [Disable building talloc memory allocator]
86 )],
job36b4a202011-08-21 17:18:23 +020087 [enable_talloc=$enableval], [enable_talloc="yes"])
88AM_CONDITIONAL(ENABLE_TALLOC, [test x"$enable_talloc" = x"yes"])
Harald Weltecbb29f72010-03-07 20:24:30 +010089
Harald Welteb9ce51c2010-06-30 19:43:11 +020090AC_ARG_ENABLE(plugin,
Sylvain Munautf23abab2010-07-25 16:16:42 +020091 [AS_HELP_STRING(
92 [--disable-plugin],
93 [Disable support for dlopen plugins],
94 )],
job36b4a202011-08-21 17:18:23 +020095 [enable_plugin=$enableval], [enable_plugin="yes"])
96AM_CONDITIONAL(ENABLE_PLUGIN, test x"$enable_plugin" = x"yes")
Harald Welteb9ce51c2010-06-30 19:43:11 +020097
Harald Welte1067e8c2010-06-25 03:00:58 +020098AC_ARG_ENABLE(vty,
Sylvain Munautf23abab2010-07-25 16:16:42 +020099 [AS_HELP_STRING(
100 [--disable-vty],
101 [Disable building VTY telnet interface]
102 )],
job36b4a202011-08-21 17:18:23 +0200103 [enable_vty=$enableval], [enable_vty="yes"])
104AM_CONDITIONAL(ENABLE_VTY, test x"$enable_vty" = x"yes")
Harald Welte54403772010-05-29 11:49:51 +0200105
Sylvain Munautac3e61a2010-07-25 18:08:54 +0200106AC_ARG_ENABLE(panic_infloop,
107 [AS_HELP_STRING(
108 [--enable-panic-infloop],
109 [Trigger infinite loop on panic rather than fprintf/abort]
110 )],
job36b4a202011-08-21 17:18:23 +0200111 [panic_infloop=$enableval], [panic_infloop="no"])
112if test x"$panic_infloop" = x"yes"
Sylvain Munautac3e61a2010-07-25 18:08:54 +0200113then
114 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
115fi
116
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800117AC_ARG_ENABLE(bsc_fd_check,
118 [AS_HELP_STRING(
119 [--enable-bsc-fd-check],
120 [Instrument bsc_register_fd to check that the fd is registered]
121 )],
job36b4a202011-08-21 17:18:23 +0200122 [fd_check=$enableval], [fd_check="no"])
123if test x"$fd_check" = x"no"
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800124then
125 AC_DEFINE([BSC_FD_CHECK],[1],[Instrument the bsc_register_fd])
126fi
127
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800128AC_ARG_ENABLE(msgfile,
129 [AS_HELP_STRING(
130 [--disable-msgfile],
131 [Disable support for the msgfile],
132 )],
job36b4a202011-08-21 17:18:23 +0200133 [enable_msgfile=$enableval], [enable_msgfile="yes"])
134AM_CONDITIONAL(ENABLE_MSGFILE, test x"$enable_msgfile" = x"yes")
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800135
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200136AC_ARG_ENABLE(serial,
137 [AS_HELP_STRING(
138 [--disable-serial],
139 [Disable support for the serial helpers],
140 )],
141 [enable_serial=$enableval], [enable_serial="yes"])
142AM_CONDITIONAL(ENABLE_SERIAL, test x"$enable_serial" = x"yes")
143
job8e4deb62011-08-21 17:18:24 +0200144AC_ARG_ENABLE(utilities,
145 [AS_HELP_STRING(
146 [--disable-utilities],
147 [Disable building utility programs],
148 )],
149 [enable_utilities=$enableval], [enable_utilities="yes"])
150AM_CONDITIONAL(ENABLE_UTILITIES, test x"$enable_utilities" = x"yes")
151
Harald Weltee3a10b62012-09-08 22:18:43 +0200152AC_ARG_ENABLE(gb,
153 [AS_HELP_STRING(
154 [--disable-gb],
155 [Disable building Gb library],
156 )],
157 [enable_gb=$enableval], [enable_gb="yes"])
158AM_CONDITIONAL(ENABLE_GB, test x"$enable_gb" = x"yes")
159
job8e4deb62011-08-21 17:18:24 +0200160AC_ARG_ENABLE(embedded,
161 [AS_HELP_STRING(
162 [--enable-embedded],
163 [Enable building for embedded use and disable unsupported features]
164 )],
165 [embedded=$enableval], [embedded="no"])
166if test x"$embedded" = x"yes"
167then
168 AC_DEFINE([EMBEDDED],[1],[Select building for embedded use])
job8e4deb62011-08-21 17:18:24 +0200169 AM_CONDITIONAL(ENABLE_PLUGIN, false)
170 AM_CONDITIONAL(ENABLE_MSGFILE, false)
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200171 AM_CONDITIONAL(ENABLE_SERIAL, false)
job8e4deb62011-08-21 17:18:24 +0200172 AM_CONDITIONAL(ENABLE_VTY, false)
173 AM_CONDITIONAL(ENABLE_TALLOC, false)
174 AM_CONDITIONAL(ENABLE_UTILITIES, false)
Harald Weltee3a10b62012-09-08 22:18:43 +0200175 AM_CONDITIONAL(ENABLE_GB, false)
job8e4deb62011-08-21 17:18:24 +0200176 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
177fi
Harald Welte54403772010-05-29 11:49:51 +0200178
Holger Hans Peter Freytherf9eda742011-11-13 01:02:54 +0100179
Harald Welte3cae0392010-02-20 21:09:24 +0100180AC_OUTPUT(
181 libosmocore.pc
Sylvain Munautb99b9302010-10-24 18:23:10 +0200182 libosmocodec.pc
Harald Weltee352c522010-05-19 19:42:32 +0200183 libosmovty.pc
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100184 libosmogsm.pc
Harald Welte641f7ce2012-06-17 23:05:26 +0800185 libosmogb.pc
Harald Welte3cae0392010-02-20 21:09:24 +0100186 include/Makefile
187 src/Makefile
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200188 src/vty/Makefile
Sylvain Munaut1a4ea5b2010-10-08 15:09:16 +0200189 src/codec/Makefile
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100190 src/gsm/Makefile
Harald Welte641f7ce2012-06-17 23:05:26 +0800191 src/gb/Makefile
Harald Welte3cae0392010-02-20 21:09:24 +0100192 tests/Makefile
Harald Welteeeb78dd2011-08-02 13:44:54 +0200193 utils/Makefile
Harald Weltec7859ed2011-08-20 12:54:17 +0200194 Doxyfile.core
Harald Welte49e10562011-08-17 19:21:07 +0200195 Doxyfile.gsm
196 Doxyfile.vty
197 Doxyfile.codec
Harald Welte3cae0392010-02-20 21:09:24 +0100198 Makefile)