blob: ca98fc2c8a1a434f2a574524650a128542c72553 [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
Harald Welte3cae0392010-02-20 21:09:24 +010020dnl checks for header files
21AC_HEADER_STDC
Harald Weltee4764422011-05-22 12:25:57 +020022AC_CHECK_HEADERS(execinfo.h sys/select.h sys/socket.h syslog.h ctype.h)
Holger Hans Peter Freyther47723482011-11-09 11:26:15 +010023# for src/conv.c
24AC_FUNC_ALLOCA
25AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
26AC_SUBST(LIBRARY_DL)
Harald Welte3cae0392010-02-20 21:09:24 +010027
Harald Welte21e73c22011-08-17 19:33:06 +020028AC_PATH_PROG(DOXYGEN,doxygen,false)
29AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
30
Harald Welte3cae0392010-02-20 21:09:24 +010031# The following test is taken from WebKit's webkit.m4
32saved_CFLAGS="$CFLAGS"
33CFLAGS="$CFLAGS -fvisibility=hidden "
34AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemer3d79f532011-05-24 15:16:13 +020035AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Harald Welte3cae0392010-02-20 21:09:24 +010036 [ AC_MSG_RESULT([yes])
37 SYMBOL_VISIBILITY="-fvisibility=hidden"],
38 AC_MSG_RESULT([no]))
39CFLAGS="$saved_CFLAGS"
40AC_SUBST(SYMBOL_VISIBILITY)
41
Harald Welte7c8e2cc2012-08-29 16:47:30 +020042AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
43 AC_CACHE_CHECK(
44 [whether struct tm has tm_gmtoff member],
45 osmo_cv_tm_includes_tm_gmtoff,
46 [AC_LINK_IFELSE([
47 AC_LANG_PROGRAM([
48 #include <time.h>
49 ], [
50 time_t t = time(NULL);
51 struct tm* lt = localtime(&t);
52 int off = lt->tm_gmtoff;
53 ])
54 ],
55 osmo_cv_tm_includes_tm_gmtoff=yes,
56 osmo_cv_tm_includes_tm_gmtoff=no
57 )]
58 )
59 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
60 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
61 [Define if struct tm has tm_gmtoff member.])
62 fi
63])
64
65CHECK_TM_INCLUDES_TM_GMTOFF
66
Harald Welte3cae0392010-02-20 21:09:24 +010067dnl Generate the output
68AM_CONFIG_HEADER(config.h)
69
Harald Weltecbb29f72010-03-07 20:24:30 +010070AC_ARG_ENABLE(talloc,
Sylvain Munautf23abab2010-07-25 16:16:42 +020071 [AS_HELP_STRING(
72 [--disable-talloc],
73 [Disable building talloc memory allocator]
74 )],
job36b4a202011-08-21 17:18:23 +020075 [enable_talloc=$enableval], [enable_talloc="yes"])
76AM_CONDITIONAL(ENABLE_TALLOC, [test x"$enable_talloc" = x"yes"])
Harald Weltecbb29f72010-03-07 20:24:30 +010077
Harald Welteb9ce51c2010-06-30 19:43:11 +020078AC_ARG_ENABLE(plugin,
Sylvain Munautf23abab2010-07-25 16:16:42 +020079 [AS_HELP_STRING(
80 [--disable-plugin],
81 [Disable support for dlopen plugins],
82 )],
job36b4a202011-08-21 17:18:23 +020083 [enable_plugin=$enableval], [enable_plugin="yes"])
84AM_CONDITIONAL(ENABLE_PLUGIN, test x"$enable_plugin" = x"yes")
Harald Welteb9ce51c2010-06-30 19:43:11 +020085
Harald Welte1067e8c2010-06-25 03:00:58 +020086AC_ARG_ENABLE(vty,
Sylvain Munautf23abab2010-07-25 16:16:42 +020087 [AS_HELP_STRING(
88 [--disable-vty],
89 [Disable building VTY telnet interface]
90 )],
job36b4a202011-08-21 17:18:23 +020091 [enable_vty=$enableval], [enable_vty="yes"])
92AM_CONDITIONAL(ENABLE_VTY, test x"$enable_vty" = x"yes")
Harald Welte54403772010-05-29 11:49:51 +020093
Sylvain Munautac3e61a2010-07-25 18:08:54 +020094AC_ARG_ENABLE(panic_infloop,
95 [AS_HELP_STRING(
96 [--enable-panic-infloop],
97 [Trigger infinite loop on panic rather than fprintf/abort]
98 )],
job36b4a202011-08-21 17:18:23 +020099 [panic_infloop=$enableval], [panic_infloop="no"])
100if test x"$panic_infloop" = x"yes"
Sylvain Munautac3e61a2010-07-25 18:08:54 +0200101then
102 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
103fi
104
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800105AC_ARG_ENABLE(bsc_fd_check,
106 [AS_HELP_STRING(
107 [--enable-bsc-fd-check],
108 [Instrument bsc_register_fd to check that the fd is registered]
109 )],
job36b4a202011-08-21 17:18:23 +0200110 [fd_check=$enableval], [fd_check="no"])
111if test x"$fd_check" = x"no"
Holger Hans Peter Freyther43558312010-08-06 06:48:43 +0800112then
113 AC_DEFINE([BSC_FD_CHECK],[1],[Instrument the bsc_register_fd])
114fi
115
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800116AC_ARG_ENABLE(msgfile,
117 [AS_HELP_STRING(
118 [--disable-msgfile],
119 [Disable support for the msgfile],
120 )],
job36b4a202011-08-21 17:18:23 +0200121 [enable_msgfile=$enableval], [enable_msgfile="yes"])
122AM_CONDITIONAL(ENABLE_MSGFILE, test x"$enable_msgfile" = x"yes")
Holger Hans Peter Freytherc87f2662010-10-07 00:00:15 +0800123
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200124AC_ARG_ENABLE(serial,
125 [AS_HELP_STRING(
126 [--disable-serial],
127 [Disable support for the serial helpers],
128 )],
129 [enable_serial=$enableval], [enable_serial="yes"])
130AM_CONDITIONAL(ENABLE_SERIAL, test x"$enable_serial" = x"yes")
131
job8e4deb62011-08-21 17:18:24 +0200132AC_ARG_ENABLE(utilities,
133 [AS_HELP_STRING(
134 [--disable-utilities],
135 [Disable building utility programs],
136 )],
137 [enable_utilities=$enableval], [enable_utilities="yes"])
138AM_CONDITIONAL(ENABLE_UTILITIES, test x"$enable_utilities" = x"yes")
139
140AC_ARG_ENABLE(embedded,
141 [AS_HELP_STRING(
142 [--enable-embedded],
143 [Enable building for embedded use and disable unsupported features]
144 )],
145 [embedded=$enableval], [embedded="no"])
146if test x"$embedded" = x"yes"
147then
148 AC_DEFINE([EMBEDDED],[1],[Select building for embedded use])
job8e4deb62011-08-21 17:18:24 +0200149 AM_CONDITIONAL(ENABLE_PLUGIN, false)
150 AM_CONDITIONAL(ENABLE_MSGFILE, false)
Sylvain Munautfe28ded2011-09-02 22:18:24 +0200151 AM_CONDITIONAL(ENABLE_SERIAL, false)
job8e4deb62011-08-21 17:18:24 +0200152 AM_CONDITIONAL(ENABLE_VTY, false)
153 AM_CONDITIONAL(ENABLE_TALLOC, false)
154 AM_CONDITIONAL(ENABLE_UTILITIES, false)
155 AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
156fi
Harald Welte54403772010-05-29 11:49:51 +0200157
Holger Hans Peter Freytherf9eda742011-11-13 01:02:54 +0100158
Harald Welte3cae0392010-02-20 21:09:24 +0100159AC_OUTPUT(
160 libosmocore.pc
Sylvain Munautb99b9302010-10-24 18:23:10 +0200161 libosmocodec.pc
Harald Weltee352c522010-05-19 19:42:32 +0200162 libosmovty.pc
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100163 libosmogsm.pc
Harald Welte641f7ce2012-06-17 23:05:26 +0800164 libosmogb.pc
Harald Welte3cae0392010-02-20 21:09:24 +0100165 include/Makefile
166 src/Makefile
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200167 src/vty/Makefile
Sylvain Munaut1a4ea5b2010-10-08 15:09:16 +0200168 src/codec/Makefile
Pablo Neira Ayusofba495e2011-03-23 18:08:08 +0100169 src/gsm/Makefile
Harald Welte641f7ce2012-06-17 23:05:26 +0800170 src/gb/Makefile
Harald Welte3cae0392010-02-20 21:09:24 +0100171 tests/Makefile
Harald Welteeeb78dd2011-08-02 13:44:54 +0200172 utils/Makefile
Harald Weltec7859ed2011-08-20 12:54:17 +0200173 Doxyfile.core
Harald Welte49e10562011-08-17 19:21:07 +0200174 Doxyfile.gsm
175 Doxyfile.vty
176 Doxyfile.codec
Harald Welte3cae0392010-02-20 21:09:24 +0100177 Makefile)