blob: 5c077ee396d0f13cbe045486325abec29ad16e9e [file] [log] [blame]
Harald Welte2b944cf2008-12-23 21:01:25 +00001dnl Process this file with autoconf to produce a configure script
Harald Weltefa13cad2010-03-23 00:09:32 +08002AC_INIT([openbsc],
3 m4_esyscmd([./git-version-gen .tarball-version]),
4 [openbsc-devel@lists.openbsc.org])
Harald Welte2b944cf2008-12-23 21:01:25 +00005
Harald Weltefa13cad2010-03-23 00:09:32 +08006AM_INIT_AUTOMAKE([dist-bzip2])
Holger Hans Peter Freytherfee826b2012-01-06 15:16:12 +01007AC_CONFIG_TESTDIR(tests)
Harald Welte2b944cf2008-12-23 21:01:25 +00008
Holger Hans Peter Freytherc746e682009-10-27 03:34:49 +01009dnl kernel style compile messages
10m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11
Harald Welte2b944cf2008-12-23 21:01:25 +000012dnl checks for programs
13AC_PROG_MAKE_SET
14AC_PROG_CC
15AC_PROG_INSTALL
Holger Freyther91f49f62009-02-20 18:33:00 +000016AC_PROG_RANLIB
Harald Welte2b944cf2008-12-23 21:01:25 +000017
18dnl checks for libraries
Holger Freyther559bb712009-06-08 10:32:28 +000019AC_SEARCH_LIBS(crypt, crypt,
20 [LIBCRYPT="-lcrypt"; AC_DEFINE([VTY_CRYPT_PW], [], [Use crypt functionality of vty.])])
Harald Welte2b944cf2008-12-23 21:01:25 +000021
Holger Hans Peter Freyther5b574132013-10-15 13:29:06 +020022PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.6.4)
Harald Welte4d109ff2011-05-08 09:41:45 +020023PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
Harald Weltef243cb92013-03-13 15:29:27 +010024PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.6.0)
Harald Welte3386bdc2011-10-10 09:11:29 +020025PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.1.0)
Holger Hans Peter Freyther5b574132013-10-15 13:29:06 +020026PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4)
Harald Welte9c38ed62010-02-20 17:29:27 +010027
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010028# Enabke/disable the NAT?
29AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])],
30 [osmo_ac_build_nat="$enableval"],[osmo_ac_build_nat="no"])
31if test "$osmo_ac_build_nat" = "yes" ; then
32 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
33fi
34AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes")
35AC_SUBST(osmo_ac_build_nat)
36
37# Enable/disable the BSC?
38AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])],
Jacob Erlbeckcc0d8842013-09-17 13:59:29 +020039 [osmo_ac_build_bsc="$enableval"],[osmo_ac_build_bsc="no"])
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010040if test "$osmo_ac_build_bsc" = "yes" ; then
41 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.6)
42fi
43AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
Jacob Erlbeckcc0d8842013-09-17 13:59:29 +020044AC_SUBST(osmo_ac_build_bsc)
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010045
46# Enable/disable smpp support in the nitb?
47AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freyther5292edc2013-07-13 17:09:56 +020048 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010049if test "$osmo_ac_build_smpp" = "yes" ; then
50 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.10)
51 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
52fi
53AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freyther5292edc2013-07-13 17:09:56 +020054AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010055
56
Sylvain Munautf4b4e8f2011-10-18 13:27:00 +020057found_libgtp=yes
58PKG_CHECK_MODULES(LIBGTP, libgtp, , found_libgtp=no)
59AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes)
60
Harald Welte2b944cf2008-12-23 21:01:25 +000061dnl checks for header files
62AC_HEADER_STDC
Harald Weltec7841cc2011-02-05 15:13:27 +010063AC_CHECK_HEADERS(dahdi/user.h,,AC_MSG_WARN(DAHDI input driver will not be built))
Pablo Neira Ayusof58692f2011-03-08 13:38:49 +010064AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Harald Weltec7841cc2011-02-05 15:13:27 +010065
Harald Welte2b944cf2008-12-23 21:01:25 +000066
67dnl Checks for typedefs, structures and compiler characteristics
68
Holger Freyther64026e92009-06-08 10:32:54 +000069# The following test is taken from WebKit's webkit.m4
70saved_CFLAGS="$CFLAGS"
71CFLAGS="$CFLAGS -fvisibility=hidden "
72AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemer93ae2d62011-05-24 15:16:54 +020073AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther64026e92009-06-08 10:32:54 +000074 [ AC_MSG_RESULT([yes])
75 SYMBOL_VISIBILITY="-fvisibility=hidden"],
76 AC_MSG_RESULT([no]))
77CFLAGS="$saved_CFLAGS"
78AC_SUBST(SYMBOL_VISIBILITY)
79
Holger Hans Peter Freyther16bdb142010-11-15 18:37:57 +010080# Coverage build taken from WebKit's configure.in
81AC_MSG_CHECKING([whether to enable code coverage support])
82AC_ARG_ENABLE(coverage,
83 AC_HELP_STRING([--enable-coverage],
84 [enable code coverage support [default=no]]),
85 [],[enable_coverage="no"])
86AC_MSG_RESULT([$enable_coverage])
87if test "$enable_coverage" = "yes"; then
88 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
89 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
90 AC_SUBST([COVERAGE_CFLAGS])
91 AC_SUBST([COVERAGE_LDFLAGS])
92fi
93
Harald Welteeaf4a522012-04-08 16:59:24 +020094AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
95 AC_CACHE_CHECK(
96 [whether struct tm has tm_gmtoff member],
97 osmo_cv_tm_includes_tm_gmtoff,
98 [AC_LINK_IFELSE([
99 AC_LANG_PROGRAM([
100 #include <time.h>
101 ], [
102 time_t t = time(NULL);
103 struct tm* lt = localtime(&t);
104 int off = lt->tm_gmtoff;
105 ])
106 ],
107 osmo_cv_tm_includes_tm_gmtoff=yes,
108 osmo_cv_tm_includes_tm_gmtoff=no
109 )]
110 )
111 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
112 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
113 [Define if struct tm has tm_gmtoff member.])
114 fi
115])
116
117CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther64026e92009-06-08 10:32:54 +0000118
Katerina Barone-Adesiad5fb002013-04-05 17:36:09 +0200119AC_ARG_ENABLE([vty_tests],
120 AC_HELP_STRING([--enable-vty-tests],
121 [Include the VTY tests in make check [default=no]]),
122 [enable_vty_tests="$enableval"],[enable_vty_tests="no"])
123if test "x$enable_vty_tests" = "xyes" ; then
124 AM_PATH_PYTHON
125 AC_CHECK_PROG(OSMOTESTVTY_CHECK,osmotestvty.py,yes)
126 if test "x$OSMOTESTVTY_CHECK" != "xyes" ; then
127 AC_MSG_ERROR([Please install osmocom-python to run the vty tests.])
128 fi
129fi
130AC_MSG_CHECKING([whether to enable VTY tests])
131AC_MSG_RESULT([$enable_vty_tests])
132AM_CONDITIONAL(ENABLE_VTY_TESTS, test "x$enable_vty_tests" = "xyes")
133
Holger Freyther64026e92009-06-08 10:32:54 +0000134dnl Generate the output
135AM_CONFIG_HEADER(bscconfig.h)
136
Holger Freyther1bad6012008-12-27 09:42:59 +0000137AC_OUTPUT(
Holger Freytherb27d8452009-06-08 10:32:39 +0000138 openbsc.pc
Holger Freyther1bad6012008-12-27 09:42:59 +0000139 include/openbsc/Makefile
140 include/Makefile
141 src/Makefile
Harald Welte3d1aaac2011-03-04 13:18:30 +0100142 src/libtrau/Makefile
Harald Welte3d1aaac2011-03-04 13:18:30 +0100143 src/libbsc/Makefile
Daniel Willmann27da2442010-10-21 15:00:36 +0200144 src/libctrl/Makefile
Harald Welte3d1aaac2011-03-04 13:18:30 +0100145 src/libmsc/Makefile
146 src/libmgcp/Makefile
147 src/libcommon/Makefile
Harald Welte4f272cc2011-03-03 23:29:05 +0100148 src/osmo-nitb/Makefile
149 src/osmo-bsc/Makefile
Harald Welteacdcfea2011-03-03 23:36:48 +0100150 src/osmo-bsc_nat/Makefile
151 src/osmo-bsc_mgcp/Makefile
Harald Welte4f272cc2011-03-03 23:29:05 +0100152 src/ipaccess/Makefile
153 src/utils/Makefile
154 src/gprs/Makefile
Holger Freyther1bad6012008-12-27 09:42:59 +0000155 tests/Makefile
Holger Hans Peter Freyther34abf212012-01-09 22:53:04 +0100156 tests/atlocal
Holger Freytherec5b1d82008-12-28 21:55:40 +0000157 tests/gsm0408/Makefile
Holger Freytherc1e11922008-12-31 23:25:05 +0000158 tests/db/Makefile
Holger Hans Peter Freytherf8584a12009-06-10 12:36:38 +0200159 tests/channel/Makefile
Jacob Erlbeckcc0d8842013-09-17 13:59:29 +0200160 tests/bsc/Makefile
Holger Hans Peter Freyther4dfa08d2010-06-15 20:21:44 +0800161 tests/bsc-nat/Makefile
Holger Hans Peter Freytheraaa3d082013-06-14 19:10:28 +0200162 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freytherf0bc0752011-01-06 19:32:52 +0100163 tests/mgcp/Makefile
Holger Hans Peter Freyther6721a082011-06-23 17:53:27 -0400164 tests/gprs/Makefile
Holger Hans Peter Freythera9e7de62012-10-13 12:38:54 +0200165 tests/si/Makefile
Holger Hans Peter Freyther23e80002012-11-22 14:59:46 +0100166 tests/abis/Makefile
Holger Hans Peter Freyther5292edc2013-07-13 17:09:56 +0200167 tests/smpp/Makefile
Harald Welte2d6f49d2011-05-11 22:11:28 +0200168 doc/Makefile
169 doc/examples/Makefile
Holger Freyther1bad6012008-12-27 09:42:59 +0000170 Makefile)