blob: 16eb732b63ad12f4c9dd1496d3f4acd3f27990c8 [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 Freythera8dffc12010-07-30 02:53:14 +080022
23AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])],
24 [
Harald Welte90e5eae2010-08-03 15:11:51 +020025 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
Holger Hans Peter Freythera8dffc12010-07-30 02:53:14 +080026 osmo_ac_build_nat="yes"
27 ],
28 [
29 osmo_ac_build_nat="no"
30 ])
31AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes")
Holger Hans Peter Freyther34abf212012-01-09 22:53:04 +010032AC_SUBST(osmo_ac_build_nat)
Holger Hans Peter Freythera8dffc12010-07-30 02:53:14 +080033
Harald Welte90e5eae2010-08-03 15:11:51 +020034AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])],
Holger Hans Peter Freythera8dffc12010-07-30 02:53:14 +080035 [
Holger Hans Peter Freyther80381e82011-06-04 16:59:37 +020036 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.6)
Holger Hans Peter Freythera8dffc12010-07-30 02:53:14 +080037 osmo_ac_build_bsc="yes"
38 ],
39 [
40 osmo_ac_build_bsc="no"
41 ])
42AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
43
Harald Welte3d8a8fd2011-06-26 14:48:11 +020044PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.2)
Harald Welte4d109ff2011-05-08 09:41:45 +020045PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
46PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.0)
Harald Welte3386bdc2011-10-10 09:11:29 +020047PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.1.0)
Harald Welte9c38ed62010-02-20 17:29:27 +010048
Sylvain Munautf4b4e8f2011-10-18 13:27:00 +020049found_libgtp=yes
50PKG_CHECK_MODULES(LIBGTP, libgtp, , found_libgtp=no)
51AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes)
52
Harald Welte2b944cf2008-12-23 21:01:25 +000053dnl checks for header files
54AC_HEADER_STDC
Harald Weltec7841cc2011-02-05 15:13:27 +010055AC_CHECK_HEADERS(dahdi/user.h,,AC_MSG_WARN(DAHDI input driver will not be built))
Pablo Neira Ayusof58692f2011-03-08 13:38:49 +010056AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Harald Weltec7841cc2011-02-05 15:13:27 +010057
Harald Welte2b944cf2008-12-23 21:01:25 +000058
59dnl Checks for typedefs, structures and compiler characteristics
60
Holger Freyther64026e92009-06-08 10:32:54 +000061# The following test is taken from WebKit's webkit.m4
62saved_CFLAGS="$CFLAGS"
63CFLAGS="$CFLAGS -fvisibility=hidden "
64AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemer93ae2d62011-05-24 15:16:54 +020065AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther64026e92009-06-08 10:32:54 +000066 [ AC_MSG_RESULT([yes])
67 SYMBOL_VISIBILITY="-fvisibility=hidden"],
68 AC_MSG_RESULT([no]))
69CFLAGS="$saved_CFLAGS"
70AC_SUBST(SYMBOL_VISIBILITY)
71
Holger Hans Peter Freyther16bdb142010-11-15 18:37:57 +010072# Coverage build taken from WebKit's configure.in
73AC_MSG_CHECKING([whether to enable code coverage support])
74AC_ARG_ENABLE(coverage,
75 AC_HELP_STRING([--enable-coverage],
76 [enable code coverage support [default=no]]),
77 [],[enable_coverage="no"])
78AC_MSG_RESULT([$enable_coverage])
79if test "$enable_coverage" = "yes"; then
80 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
81 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
82 AC_SUBST([COVERAGE_CFLAGS])
83 AC_SUBST([COVERAGE_LDFLAGS])
84fi
85
Harald Welteeaf4a522012-04-08 16:59:24 +020086AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
87 AC_CACHE_CHECK(
88 [whether struct tm has tm_gmtoff member],
89 osmo_cv_tm_includes_tm_gmtoff,
90 [AC_LINK_IFELSE([
91 AC_LANG_PROGRAM([
92 #include <time.h>
93 ], [
94 time_t t = time(NULL);
95 struct tm* lt = localtime(&t);
96 int off = lt->tm_gmtoff;
97 ])
98 ],
99 osmo_cv_tm_includes_tm_gmtoff=yes,
100 osmo_cv_tm_includes_tm_gmtoff=no
101 )]
102 )
103 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
104 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
105 [Define if struct tm has tm_gmtoff member.])
106 fi
107])
108
109CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther64026e92009-06-08 10:32:54 +0000110
111dnl Generate the output
112AM_CONFIG_HEADER(bscconfig.h)
113
Holger Freyther1bad6012008-12-27 09:42:59 +0000114AC_OUTPUT(
Holger Freytherb27d8452009-06-08 10:32:39 +0000115 openbsc.pc
Holger Freyther1bad6012008-12-27 09:42:59 +0000116 include/openbsc/Makefile
117 include/Makefile
118 src/Makefile
Harald Welte3d1aaac2011-03-04 13:18:30 +0100119 src/libtrau/Makefile
Harald Welte3d1aaac2011-03-04 13:18:30 +0100120 src/libbsc/Makefile
Daniel Willmann27da2442010-10-21 15:00:36 +0200121 src/libctrl/Makefile
Harald Welte3d1aaac2011-03-04 13:18:30 +0100122 src/libmsc/Makefile
123 src/libmgcp/Makefile
124 src/libcommon/Makefile
Harald Welte4f272cc2011-03-03 23:29:05 +0100125 src/osmo-nitb/Makefile
126 src/osmo-bsc/Makefile
Harald Welteacdcfea2011-03-03 23:36:48 +0100127 src/osmo-bsc_nat/Makefile
128 src/osmo-bsc_mgcp/Makefile
Harald Welte4f272cc2011-03-03 23:29:05 +0100129 src/ipaccess/Makefile
130 src/utils/Makefile
Harald Welte3d1aaac2011-03-04 13:18:30 +0100131 src/libgb/Makefile
Harald Welte4f272cc2011-03-03 23:29:05 +0100132 src/gprs/Makefile
Holger Freyther1bad6012008-12-27 09:42:59 +0000133 tests/Makefile
Holger Hans Peter Freyther34abf212012-01-09 22:53:04 +0100134 tests/atlocal
Holger Freytherc95546b2008-12-27 12:03:07 +0000135 tests/debug/Makefile
Holger Freytherec5b1d82008-12-28 21:55:40 +0000136 tests/gsm0408/Makefile
Holger Freytherc1e11922008-12-31 23:25:05 +0000137 tests/db/Makefile
Holger Hans Peter Freytherf8584a12009-06-10 12:36:38 +0200138 tests/channel/Makefile
Holger Hans Peter Freyther4dfa08d2010-06-15 20:21:44 +0800139 tests/bsc-nat/Makefile
Holger Hans Peter Freytherf0bc0752011-01-06 19:32:52 +0100140 tests/mgcp/Makefile
Holger Hans Peter Freyther6721a082011-06-23 17:53:27 -0400141 tests/gprs/Makefile
Harald Welte2d6f49d2011-05-11 22:11:28 +0200142 doc/Makefile
143 doc/examples/Makefile
Holger Freyther1bad6012008-12-27 09:42:59 +0000144 Makefile)