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.14, andreas@eversberg.eu)
30 AC_CONFIG_AUX_DIR([build-aux])
31 AC_CONFIG_SRCDIR([main.c])
32 AC_CONFIG_HEADER([config.h])
34 # fix warnings from autoconf + automake
36 dnl AC_USE_SYSTEM_EXTENSIONS
37 AM_INIT_AUTOMAKE([foreign subdir-objects])
41 # Checks for programs.
49 dnl required, if per binary CFLAGS are used
53 # site specific configs
54 dnl enable this to have all special options on one place
55 dnl AC_PRESERVE_HELP_ORDER
59 [AS_HELP_STRING([--with-misdn],
60 [compile with mISDN driver @<:@default=check@:>@])
65 AS_IF([test "x$with_misdn" != xno],
66 [AC_CHECK_HEADERS([mISDN/mbuffer.h],
68 [if test "x$with_misdn" != xcheck ; then
70 [--with-misdn was given, but test for header-file mISDN/mbuffer.h failed])
75 AM_CONDITIONAL(ENABLE_MISDN, test "x$with_misdn" == "xyes" )
78 AC_ARG_WITH([asterisk],
79 [AS_HELP_STRING([--with-asterisk],
80 [compile with built-in Asterisk channel driver @<:@default=check@:>@])
83 [with_asterisk="check"])
85 AS_IF([test "x$with_asterisk" != xno],
86 [AC_CHECK_HEADERS([asterisk/compiler.h],
87 [with_asterisk="yes"],
88 [if test "x$with_asterisk" != xcheck ; then
90 [--with-asterisk was given, but test for header-file asterisk/compiler.h failed])
95 if test "x$with_asterisk" = "xyes"; then
96 dnl detect whether asterisk/indications.h defines ast_tone_zone_sound (1.6.2
97 dnl and later), ind_tone_zone_sound (1.6.0) or tone_zone_sound (1.4)
102 AC_CHECK_TYPE([struct ast_tone_zone_sound],
103 [ast_tone_zone_sound=ast_tone_zone_sound], [], [
104 #include <asterisk.h>
105 #include <asterisk/linkedlists.h>
106 #include <asterisk/indications.h>])
108 AS_IF([test "x$ast_tone_zone_sound" = "x"],
109 [AC_CHECK_TYPE([struct ind_tone_zone_sound],
110 [ast_tone_zone_sound=ind_tone_zone_sound], [], [
111 #include <asterisk.h>
112 #include <asterisk/linkedlists.h>
113 #include <asterisk/indications.h>])])
114 AS_IF([test "x$ast_tone_zone_sound" = "x"],
115 [AC_CHECK_TYPE([struct tone_zone_sound],
116 [ast_tone_zone_sound=tone_zone_sound], [], [
117 #include <asterisk.h>
118 #include <asterisk/indications.h>])])
120 if test "x$ast_tone_zone_sound" = "x"; then
121 AC_MSG_FAILURE([No ast_tone_zone_sound, confused...])
125 AC_CHECK_TYPE([struct ast_party_caller],
126 [apc_test_result=yes], [], [
127 #include <asterisk.h>
128 #include <asterisk/channel.h>])
130 if test "x$apc_test_result" = "xyes"; then
131 ast_1_8_or_higher="-DAST_1_8_OR_HIGHER"
134 AST_CFLAGS="-Dast_tone_zone_sound=$ast_tone_zone_sound $ast_1_8_or_higher"
136 AC_SUBST([AST_CFLAGS])
139 AM_CONDITIONAL(ENABLE_ASTERISK_CHANNEL_DRIVER, test "x$with_asterisk" == "xyes" )
143 [AS_HELP_STRING([--with-ssl],
144 [compile with ssl support (libcrypto) @<:@default=check@:>@])
149 AS_IF([test "x$with_ssl" != xno],
150 [AC_CHECK_HEADERS([openssl/rsa.h])
151 AC_CHECK_LIB([crypto], [main],
152 [AC_SUBST([LIBCRYPTO], ["-lcrypto"])
153 AC_DEFINE([HAVE_LIBCRYPTO], [1],
154 [Define if you have libcrypto])
156 [if test "x$with_ssl" != xcheck ; then
158 [--with-ssl was given, but test for libcrypto failed])
167 AC_ARG_WITH([gsm-bs],
168 [AS_HELP_STRING([--with-gsm-bs],
169 [compile with OpenBSC support @<:@default=no@:>@])
172 [with_gsm_bs="check"])
174 AM_CONDITIONAL(ENABLE_GSM_BS, test "x$with_gsm_bs" == "xyes" )
177 AC_ARG_WITH([gsm-ms],
178 [AS_HELP_STRING([--with-gsm-ms],
179 [compile with Osmocom-bb support @<:@default=no@:>@])
182 [with_gsm_ms="check"])
184 AM_CONDITIONAL(ENABLE_GSM_MS, test "x$with_gsm_ms" == "xyes" )
186 AM_CONDITIONAL(ENABLE_GSM, test "x$with_gsm_bs" == "xyes" -o "x$with_gsm_ms" == "xyes")
188 # check for opencore-amrnb for AMR and EFR decoding
189 found_opencore_amrnb=yes
190 PKG_CHECK_MODULES(OPENCORE_AMRNB, opencore-amrnb >= 0.1.0, , found_opencore_amrnb=no)
191 AM_CONDITIONAL(ENABLE_GSMAMR, test "$found_opencore_amrnb" = "yes")
192 if test "$found_opencore_amrnb" = yes; then
193 AC_DEFINE(HAVE_OPENCORE_AMRNB, 1, [Define to 1 if OpenCore AMR-NB library is available])
200 [Enable support for GSM HR codec using reference code]
202 [enable_gsmhr=1], [enable_gsmhr=0])
203 AM_CONDITIONAL(ENABLE_GSMHR, test "x$enable_gsmhr" = "x1")
204 if test "x$enable_gsmhr" = "x1"; then
205 AM_PATH_PYTHON([2.4])
206 AC_DEFINE(HAVE_LIBGSMHR, 1, [Define to 1 if libgsmhr is available])
211 [AS_HELP_STRING([--with-ss5],
212 [compile with CCITT No. 5 support @<:@default=no@:>@])
217 AM_CONDITIONAL(ENABLE_SS5, test "x$with_ss5" == "xyes" )
221 [AS_HELP_STRING([--with-sip],
222 [compile with SIP support (sofia-sip is required) @<:@default=no@:>@])
227 AM_CONDITIONAL(ENABLE_SIP, test "x$with_sip" == "xyes" )
229 AS_IF([test "x$with_sip" == xyes -o "x$with_sip" == xyes], [
230 PKG_CHECK_MODULES(SOFIA, sofia-sip-ua >= 1.12)
233 # Checks for libraries.
234 AC_CHECK_LIB([m], [main])
235 AC_CHECK_LIB([ncurses], [main])
236 AC_CHECK_LIB([pthread], [main])
238 # Checks for header files.
242 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 assert.h])
244 # Checks for typedefs, structures, and compiler characteristics.
252 # Checks for library functions.
254 AC_PROG_GCC_TRADITIONAL
256 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
263 AC_CHECK_FUNCS([gettimeofday memmove memset mkdir socket strcasecmp strchr strerror strncasecmp strstr strtol strtoul])
266 AC_CONFIG_FILES([Makefile include/Makefile include/gsmhr/Makefile libgsmhr/Makefile])
270 AS_IF([test "x$with_misdn" == xyes],[AC_MSG_NOTICE( Compiled with mISDN support )],[AC_MSG_NOTICE( Not compiled with mISDN support)])
271 AS_IF([test "x$with_gsm_bs" == xyes],[AC_MSG_NOTICE( Compiled with GSM network side support )],[AC_MSG_NOTICE( Not compiled with GSM network side support)])
272 AS_IF([test "x$with_gsm_ms" == xyes],[AC_MSG_NOTICE( Compiled with GSM mobile side support )],[AC_MSG_NOTICE( Not compiled with GSM mobile side support)])
273 AS_IF([test "x$enable_gsmhr" == x1],[AC_MSG_NOTICE( Compiled with GSM half rate codec support )],[AC_MSG_NOTICE( Not compiled with GSM half rate codec support)])
274 AS_IF([test "x$found_opencore_amrnb" == xyes],[AC_MSG_NOTICE( Compiled with GSM AMR codec support )],[AC_MSG_NOTICE( Not compiled with GSM AMR codec support)])
275 AS_IF([test "x$with_asterisk" == xyes],[AC_MSG_NOTICE( Compiled with Asterisk channel driver support )],[AC_MSG_NOTICE( Not compiled with Asterisk channel driver support)])
276 AS_IF([test "x$with_ss5" == xyes],[AC_MSG_NOTICE( Compiled with CCITT No.5 support )],[AC_MSG_NOTICE( Not compiled with CCITT No.5 support)])
277 AS_IF([test "x$with_sip" == xyes],[AC_MSG_NOTICE( Compiled with SIP support )],[AC_MSG_NOTICE( Not compiled with SIP support)])