Removed ast_log again for testing. Seems that it also causes dead-locks when it is...
[lcr.git] / configure.ac
1 ##   -*- autoconf -*-
2
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
7 dnl    This program is free software; you can redistribute it and/or
8 dnl    modify it under the terms of the GNU General Public License as
9 dnl    published by the Free Software Foundation; either
10 dnl    version 2 of the License, or (at your option) any later version.
11
12 dnl    This program is distributed in the hope that it will be useful,
13 dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 dnl    GNU General Public License for more details.
16
17 dnl    You should have received a copy of the GNU General Public License
18 dnl    along with this library; see the file COPYING.  If not, write to
19 dnl    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 dnl    Boston, MA 02110-1301, USA.
21
22
23
24 dnl This keeps being the first instruction.
25 dnl Change the 2nd argument if the version increases
26 dnl 1st + 2nd argument is used for distribution package name
27 AC_INIT(lcr, 1.7, andreas@eversberg.eu)
28 AC_PREREQ(2.59)
29 AC_CONFIG_SRCDIR([main.c])
30 AM_CONFIG_HEADER(config.h)
31
32 # fix warnings from autoconf + automake
33 AC_GNU_SOURCE
34 # AC_USE_SYSTEM_EXTENSIONS
35 AM_INIT_AUTOMAKE(lcr,1.7)
36
37
38
39 # Checks for programs.
40 AC_PROG_CPP
41 AC_PROG_CXX
42 AC_PROG_CC
43 AC_PROG_INSTALL
44 AC_PROG_MAKE_SET
45 dnl required, if per binary CFLAGS are used
46 dnl AM_PROG_CC_C_O
47
48
49 # site specific configs
50 dnl enable this to have all special options on one place
51 dnl AC_PRESERVE_HELP_ORDER
52
53 # check for asterisk
54 AC_ARG_WITH([asterisk],
55         [AS_HELP_STRING([--with-asterisk],
56                         [compile with built-in Asterisk channel driver @<:@default=check@:>@])
57         ],
58         [],
59         [with_asterisk="check"])
60
61 AS_IF([test "x$with_asterisk" != xno],
62       [AC_CHECK_HEADERS([asterisk/compiler.h],
63                         [with_asterisk="yes"],
64                         [if test "x$with_asterisk" != xcheck ; then
65                       AC_MSG_FAILURE(
66                         [--with-asterisk was given, but test for header-file asterisk/compiler.h failed])
67                      fi
68                      ])
69       ])
70
71 if test "x$with_asterisk" = "xyes"; then
72         ast_tone_zone_sound=
73
74         AC_MSG_CHECKING([for struct tone_zone_sound in asterisk/indications.h])
75         tzs_test_result=no
76         AC_COMPILE_IFELSE([
77                 AC_LANG_PROGRAM(
78                         [[#include <asterisk.h>],
79                         [#include <asterisk/linkedlists.h>],
80                         [#include <asterisk/indications.h>]],
81                         [[struct tone_zone_sound * ts = NULL; (void) ts->data;]])],
82                 [tzs_test_result=yes])
83         AC_MSG_RESULT([$tzs_test_result])
84
85         if test "x$tzs_test_result" = "xyes"; then
86                 ast_tone_zone_sound=tone_zone_sound
87         fi
88
89         if test "x$ast_tone_zone_sound" = "x"; then
90                 AC_MSG_CHECKING([for struct ast_tone_zone_sound in asterisk/indications.h])
91                 tzs_test_result=no
92                 AC_COMPILE_IFELSE([
93                         AC_LANG_PROGRAM(
94                                 [[#include <asterisk.h>],
95                                 [#include <asterisk/linkedlists.h>],
96                                 [#include <asterisk/indications.h>]],
97                                 [[struct ast_tone_zone_sound * ts = NULL; (void) ts->name;]])],
98                         [tzs_test_result=yes])
99                 AC_MSG_RESULT([$tzs_test_result])
100
101                 if test "x$tzs_test_result" = "xyes"; then
102                         ast_tone_zone_sound=ast_tone_zone_sound
103                 fi
104         fi
105
106         if test "x$ast_tone_zone_sound" = "x"; then
107                 AC_MSG_FAILURE([No ast_tone_zone_sound, confused...])
108         fi
109
110         AST_CFLAGS="-Dtone_zone_sound=$ast_tone_zone_sound"
111         AC_SUBST([AST_CFLAGS])
112 fi
113
114 AM_CONDITIONAL(ENABLE_ASTERISK_CHANNEL_DRIVER, test "x$with_asterisk" == "xyes" )
115
116 # check for crypto
117 AC_ARG_WITH([ssl],
118         [AS_HELP_STRING([--with-ssl],
119                         [compile with ssl support (libcrypto) @<:@default=check@:>@])
120         ],
121         [],
122         [with_ssl=check])
123 LIBCRYPTO=
124 AS_IF([test "x$with_ssl" != xno],
125       [AC_CHECK_HEADERS([openssl/rsa.h])
126        AC_CHECK_LIB([crypto], [main],
127                     [AC_SUBST([LIBCRYPTO], ["-lcrypto"])
128                      AC_DEFINE([HAVE_LIBCRYPTO], [1],
129                                [Define if you have libcrypto])
130                     ],
131                     [if test "x$with_ssl" != xcheck ; then
132                       AC_MSG_FAILURE(
133                         [--with-ssl was given, but test for libcrypto failed])
134                      fi
135                     ],
136                     -lcrypto
137                    )
138       ]
139      )
140
141 # check for gsm-bs
142 AC_ARG_WITH([gsm-bs],
143         [AS_HELP_STRING([--with-gsm-bs],
144                         [compile with OpenBSC support @<:@default=check@:>@])
145         ],
146         [],
147         [with_gsm_bs="check"])
148
149 AS_IF([test "x$with_gsm_bs" != xno],
150       [AC_MSG_CHECKING(openbsc/include/openbsc/gsm_data.h)
151        if test -d openbsc/include/openbsc/gsm_data.h; then
152                 with_gsm_bs="yes"
153                 AC_MSG_RESULT(yes)
154        elif test "x$with_gsm_bs" != xcheck ; then
155                 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])
156        fi
157       ])
158
159 AM_CONDITIONAL(ENABLE_GSM_BS, test "x$with_gsm_bs" == "xyes" )
160
161 # check for gsm-ms
162 AC_ARG_WITH([gsm-ms],
163         [AS_HELP_STRING([--with-gsm-ms],
164                         [compile with Osmocom-bb support @<:@default=check@:>@])
165         ],
166         [],
167         [with_gsm_ms="check"])
168
169 AS_IF([test "x$with_gsm_ms" != xno],
170       [AC_MSG_CHECKING(layer23/include/osmocom/osmocom_data.h)
171        if test -d layer23/include/osmocom/osmocom_data.h; then
172                 with_gsm_ms="yes"
173                 AC_MSG_RESULT(yes)
174        elif test "x$with_gsm_bs" != xcheck ; then
175                 AC_MSG_FAILURE([--with-gsm-ms was given, but layer23/include/osmocom/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])
176        fi
177       ])
178
179 AM_CONDITIONAL(ENABLE_GSM_MS, test "x$with_gsm_ms" == "xyes" )
180
181 AM_CONDITIONAL(ENABLE_GSM, test "x$with_gsm_bs" == "xyes" -o "x$with_gsm_ms" == "xyes")
182
183 # check for ss5
184 AC_ARG_WITH([ss5],
185         [AS_HELP_STRING([--with-ss5],
186                         [compile with CCITT No. 5 support @<:@default=no@:>@])
187         ],
188         [],
189         [with_ss5="check"])
190
191 AM_CONDITIONAL(ENABLE_SS5, test "x$with_ss5" == "xyes" )
192
193 # Checks for libraries.
194 AC_CHECK_LIB([m], [main])
195 AC_CHECK_LIB([ncurses], [main])
196 AC_CHECK_LIB([pthread], [main])
197
198 # Checks for header files.
199 AC_HEADER_DIRENT
200 AC_HEADER_STDC
201 AC_HEADER_SYS_WAIT
202 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])
203
204 # Checks for typedefs, structures, and compiler characteristics.
205 AC_HEADER_STDBOOL
206 AC_C_CONST
207 AC_C_INLINE
208 AC_TYPE_PID_T
209 AC_HEADER_TIME
210 AC_STRUCT_TM
211
212 # Checks for library functions.
213 AC_FUNC_FORK
214 AC_PROG_GCC_TRADITIONAL
215 AC_FUNC_LSTAT
216 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
217 AC_FUNC_MALLOC
218 AC_FUNC_MEMCMP
219 AC_TYPE_SIGNAL
220 AC_FUNC_STRNLEN
221 AC_FUNC_STRTOD
222 AC_FUNC_VPRINTF
223 AC_CHECK_FUNCS([gettimeofday memmove memset mkdir socket strcasecmp strchr strerror strncasecmp strstr strtol strtoul])
224
225
226 AC_CONFIG_FILES([Makefile])
227 AC_OUTPUT