3 dnl This file is part of linux-call-router
4 dnl Copyright (C) 2007 Joerg Habenicht (j.habenicht@gmx.de)
5 dnl Copyright (C) 2008 Peter Schlaile (peter -at- schlaile.de)
6 dnl Copyright (C) 2010 Andreas Eversberg (jolly@eversberg.eu)
8 dnl This program is free software; you can redistribute it and/or
9 dnl modify it under the terms of the GNU General Public License as
10 dnl published by the Free Software Foundation; either
11 dnl version 2 of the License, or (at your option) any later version.
13 dnl This program is distributed in the hope that it will be useful,
14 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 dnl GNU General Public License for more details.
18 dnl You should have received a copy of the GNU General Public License
19 dnl along with this library; see the file COPYING. If not, write to
20 dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 dnl Boston, MA 02110-1301, USA.
25 dnl This keeps being the first instruction.
26 dnl Change the 2nd argument if the version increases
27 dnl 1st + 2nd argument is used for distribution package name
28 AC_INIT(lcr, 1.8, andreas@eversberg.eu)
30 AC_CONFIG_SRCDIR([main.c])
31 AM_CONFIG_HEADER(config.h)
33 # fix warnings from autoconf + automake
35 # AC_USE_SYSTEM_EXTENSIONS
36 AM_INIT_AUTOMAKE(lcr,1.8)
40 # Checks for programs.
46 dnl required, if per binary CFLAGS are used
50 # site specific configs
51 dnl enable this to have all special options on one place
52 dnl AC_PRESERVE_HELP_ORDER
55 AC_ARG_WITH([asterisk],
56 [AS_HELP_STRING([--with-asterisk],
57 [compile with built-in Asterisk channel driver @<:@default=check@:>@])
60 [with_asterisk="check"])
62 AS_IF([test "x$with_asterisk" != xno],
63 [AC_CHECK_HEADERS([asterisk/compiler.h],
64 [with_asterisk="yes"],
65 [if test "x$with_asterisk" != xcheck ; then
67 [--with-asterisk was given, but test for header-file asterisk/compiler.h failed])
72 if test "x$with_asterisk" = "xyes"; then
76 AC_MSG_CHECKING([for struct tone_zone_sound in asterisk/indications.h])
80 [[#include <asterisk.h>],
81 [#include <asterisk/linkedlists.h>],
82 [#include <asterisk/indications.h>]],
83 [[struct tone_zone_sound * ts = NULL; (void) ts->data;]])],
84 [tzs_test_result=yes])
85 AC_MSG_RESULT([$tzs_test_result])
87 if test "x$tzs_test_result" = "xyes"; then
88 ast_tone_zone_sound=tone_zone_sound
91 if test "x$ast_tone_zone_sound" = "x"; then
92 AC_MSG_CHECKING([for struct ast_tone_zone_sound in asterisk/indications.h])
96 [[#include <asterisk.h>],
97 [#include <asterisk/linkedlists.h>],
98 [#include <asterisk/indications.h>]],
99 [[struct ast_tone_zone_sound * ts = NULL; (void) ts->name;]])],
100 [tzs_test_result=yes])
101 AC_MSG_RESULT([$tzs_test_result])
103 if test "x$tzs_test_result" = "xyes"; then
104 ast_tone_zone_sound=ast_tone_zone_sound
108 if test "x$ast_tone_zone_sound" = "x"; then
109 AC_MSG_FAILURE([No ast_tone_zone_sound, confused...])
112 AC_MSG_CHECKING([for struct ast_party_caller in asterisk/channel.h])
116 [[#include <asterisk.h>],
117 [#include <asterisk/channel.h>]],
118 [[struct ast_party_caller * caller = NULL; (void) caller->id;]])],
119 [apc_test_result=yes])
120 AC_MSG_RESULT([$apc_test_result])
122 if test "x$apc_test_result" = "xyes"; then
123 ast_1_8_or_higher="-DAST_1_8_OR_HIGHER"
126 AST_CFLAGS="-Dtone_zone_sound=$ast_tone_zone_sound $ast_1_8_or_higher"
128 AC_SUBST([AST_CFLAGS])
131 AM_CONDITIONAL(ENABLE_ASTERISK_CHANNEL_DRIVER, test "x$with_asterisk" == "xyes" )
135 [AS_HELP_STRING([--with-ssl],
136 [compile with ssl support (libcrypto) @<:@default=check@:>@])
141 AS_IF([test "x$with_ssl" != xno],
142 [AC_CHECK_HEADERS([openssl/rsa.h])
143 AC_CHECK_LIB([crypto], [main],
144 [AC_SUBST([LIBCRYPTO], ["-lcrypto"])
145 AC_DEFINE([HAVE_LIBCRYPTO], [1],
146 [Define if you have libcrypto])
148 [if test "x$with_ssl" != xcheck ; then
150 [--with-ssl was given, but test for libcrypto failed])
159 AC_ARG_WITH([gsm-bs],
160 [AS_HELP_STRING([--with-gsm-bs],
161 [compile with OpenBSC support @<:@default=check@:>@])
164 [with_gsm_bs="check"])
166 AS_IF([test "x$with_gsm_bs" != xno],
167 [AC_MSG_CHECKING(openbsc/include/openbsc/gsm_data.h)
168 if test -e openbsc/include/openbsc/gsm_data.h; then
171 elif test "x$with_gsm_bs" != xcheck ; then
172 AC_MSG_FAILURE([--with-gsm-bs was given, but openbsc/include/openbsc/gsm_data.h was not found! Please link OpenBSC and libosmocore source directory to LCR source directory: ln -s path_to_openbsc/openbsc/ openbsc ; ln -s patch_to_libosmocore libosmocore])
178 AM_CONDITIONAL(ENABLE_GSM_BS, test "x$with_gsm_bs" == "xyes" )
181 AC_ARG_WITH([gsm-ms],
182 [AS_HELP_STRING([--with-gsm-ms],
183 [compile with Osmocom-bb support @<:@default=check@:>@])
186 [with_gsm_ms="check"])
188 AS_IF([test "x$with_gsm_ms" != xno],
189 [AC_MSG_CHECKING(layer23/include/osmocom/bb/common/osmocom_data.h)
190 if test -e layer23/include/osmocom/bb/common/osmocom_data.h; then
193 elif test "x$with_gsm_ms" != xcheck ; then
194 AC_MSG_FAILURE([--with-gsm-ms was given, but layer23/include/osmocom/bb/common/osmocom_data.h was not found! Please link Osmocom-BB and libosmocore source directory to LCR source directory: ln -s path_to_osmocom-bb/src/host/layer23/ layer23 ; ln -s path_to_libosmocore libosmocore])
200 AM_CONDITIONAL(ENABLE_GSM_MS, test "x$with_gsm_ms" == "xyes" )
202 AM_CONDITIONAL(ENABLE_GSM, test "x$with_gsm_bs" == "xyes" -o "x$with_gsm_ms" == "xyes")
206 [AS_HELP_STRING([--with-ss5],
207 [compile with CCITT No. 5 support @<:@default=no@:>@])
212 AM_CONDITIONAL(ENABLE_SS5, test "x$with_ss5" == "xyes" )
214 # Checks for libraries.
215 AC_CHECK_LIB([m], [main])
216 AC_CHECK_LIB([ncurses], [main])
217 AC_CHECK_LIB([pthread], [main])
219 # Checks for header files.
223 AC_CHECK_HEADERS([fcntl.h netinet/in.h stdlib.h string.h sys/file.h sys/ioctl.h sys/socket.h sys/time.h unistd.h ctype.h assert.h mISDNuser/mbuffer.h assert.h])
225 # Checks for typedefs, structures, and compiler characteristics.
233 # Checks for library functions.
235 AC_PROG_GCC_TRADITIONAL
237 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
244 AC_CHECK_FUNCS([gettimeofday memmove memset mkdir socket strcasecmp strchr strerror strncasecmp strstr strtol strtoul])
247 AC_CONFIG_FILES([Makefile])