]>
Commit | Line | Data |
---|---|---|
4da77ea5 AM |
1 | # -*- Autoconf -*- |
2 | # Process this file with autoconf to produce a configure script. | |
3 | ||
8ef2aa54 MJ |
4 | # Must change all of the below together |
5 | # For a release, set revision for that tagged release as well and uncomment | |
01379cd6 | 6 | AC_INIT([freeswitch], [1.0.pre4], BUG-REPORT-ADDRESS) |
8ef2aa54 MJ |
7 | AC_SUBST(SWITCH_VERSION_MAJOR, [1]) |
8 | AC_SUBST(SWITCH_VERSION_MINOR, [0]) | |
01379cd6 | 9 | AC_SUBST(SWITCH_VERSION_MICRO, [pre4]) |
8ef2aa54 MJ |
10 | #AC_SUBST(SWITCH_VERSION_REVISION, [svn-revision-here]) |
11 | ||
12 | AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template]) | |
7a5bc3b7 | 13 | |
e8b9a4f7 | 14 | AC_CONFIG_AUX_DIR(build/config) |
4da77ea5 AM |
15 | AM_INIT_AUTOMAKE(libfreeswitch,0.1) |
16 | AC_CONFIG_SRCDIR([src/switch.c]) | |
42e78242 MJ |
17 | AC_CONFIG_HEADER([src/include/switch_private.h]) |
18 | ||
a642381f | 19 | AC_PREFIX_DEFAULT(/usr/local/freeswitch) |
94206d80 MJ |
20 | # AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script |
21 | if test "x$prefix" = "xNONE" ; then | |
22 | prefix='/usr/local/freeswitch' | |
23 | fi | |
55b3e6cb | 24 | |
31d1e20f BW |
25 | AC_CANONICAL_HOST |
26 | ||
55b3e6cb MJ |
27 | # Absolute source/build directory |
28 | switch_srcdir=`(cd $srcdir && pwd)` | |
29 | switch_builddir=`pwd` | |
30 | AC_SUBST(switch_srcdir) | |
31 | AC_SUBST(switch_builddir) | |
32 | ||
b552cb3a | 33 | # Where to install the modules |
2bcd991b SK |
34 | AC_ARG_WITH([modinstdir], |
35 | [AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modinstdir="$withval"], [modinstdir="${prefix}/mod"]) | |
b552cb3a MB |
36 | |
37 | AC_SUBST(modinstdir) | |
38 | AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modinstdir}",[where to install the modules to]) | |
1481d37f | 39 | |
6bc48b70 MJ |
40 | #Set default language |
41 | AC_LANG_C | |
4da77ea5 AM |
42 | # Checks for programs. |
43 | AC_PROG_CC | |
bac1e3fd | 44 | AC_PROG_AWK |
4da77ea5 | 45 | AC_PROG_MAKE_SET |
4da77ea5 | 46 | AC_PROG_INSTALL |
3de6a7e9 MJ |
47 | |
48 | #override some default libtool behavior and invoke AC_PROG_LIBTOOL (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html) | |
49 | m4_defun([_LT_AC_LANG_F77_CONFIG], [:]) | |
50 | m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:]) | |
51 | m4_defun([_LT_AC_LANG_RC_CONFIG], [:]) | |
5b3f19fb | 52 | AM_PROG_CC_C_O |
bac1e3fd | 53 | AC_PROG_LIBTOOL |
4da77ea5 | 54 | |
6bc48b70 MJ |
55 | #Check for compiler vendor |
56 | AX_COMPILER_VENDOR | |
57 | ||
58 | # Optimize | |
59 | AC_ARG_ENABLE(optimization, | |
60 | [AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"]) | |
61 | ||
62 | if test "${enable_optimizer}" = "yes" ; then | |
63 | AC_DEFINE([OPTIMZER],[],[Enable Optimization.]) | |
64 | AX_CC_MAXOPT | |
65 | fi | |
66 | ||
6bc48b70 | 67 | |
4341b8e6 MJ |
68 | # Optional Features |
69 | ||
70 | AC_ARG_ENABLE(resample, | |
89dc2f83 | 71 | [AC_HELP_STRING([--disable-resample],[build without embedded resampler])],[enable_resample="$enableval"],[enable_resample="yes"]) |
4341b8e6 MJ |
72 | |
73 | # We should add checking for out of tree libresample here | |
74 | RESAMPLE_LIB= | |
75 | RESAMPLE_CFLAGS= | |
76 | if test "${enable_resample}" = "yes"; then | |
77 | RESAMPLE_LIB="libs/libresample/libresample.la" | |
78 | RESAMPLE_CFLAGS="-I${switch_srcdir}/libs/libresample/include" | |
79 | else | |
80 | AC_DEFINE([DISABLE_RESAMPLE],[],[Disable the embedded resampler]) | |
81 | fi | |
82 | ||
83 | AC_SUBST(RESAMPLE_LIB) | |
84 | AC_SUBST(RESAMPLE_CFLAGS) | |
85 | ||
86 | AM_CONDITIONAL([USE_INTREE_RESAMPLE],[test "${enable_resample}" = "yes"]) | |
87 | ||
55b3e6cb | 88 | # set defaults for use on all platforms |
3a541262 AM |
89 | SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_srcdir}/libs/libteletone/src" |
90 | SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_srcdir}/libs/libteletone/src" | |
31d1e20f | 91 | SWITCH_AM_LDFLAGS="-lm -L/usr/local/lib" |
55b3e6cb MJ |
92 | |
93 | #set SOLINK variable based on compiler and host | |
94 | if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then | |
95 | SOLINK="-Bdynamic -dy -G" | |
96 | elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then | |
97 | case "$host" in | |
6ae16d15 | 98 | *darwin*) |
55b3e6cb MJ |
99 | SOLINK="-dynamic -bundle -force-flat-namespace" |
100 | ;; | |
101 | *) | |
102 | SOLINK="-shared -Xlinker -x" | |
103 | ;; | |
104 | esac | |
105 | else | |
106 | AC_ERROR([Please update configure.in with SOLINK values for your compiler]) | |
107 | fi | |
6bc48b70 | 108 | |
55b3e6cb MJ |
109 | # set DYNAMIC_LIB_EXTEN |
110 | # we should really be using libtool so we don't need to do this | |
6bc48b70 | 111 | case "$host" in |
55b3e6cb MJ |
112 | *cygwin* | *mingw*) |
113 | DYNAMIC_LIB_EXTEN="dll" | |
114 | ;; | |
115 | *) | |
116 | DYNAMIC_LIB_EXTEN="so" | |
117 | ;; | |
6bc48b70 | 118 | esac |
55b3e6cb | 119 | |
0f6a6c31 | 120 | # Enable 64 bit build |
6d45f5f5 | 121 | AC_ARG_ENABLE(64, |
0f6a6c31 | 122 | [AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"]) |
6d45f5f5 | 123 | |
55b3e6cb MJ |
124 | # tweak compiler specific flags |
125 | if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then | |
126 | APR_ADDTO(SWITCH_AM_CFLAGS, -KPIC) | |
127 | APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC) | |
514bde18 MJ |
128 | APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC) |
129 | APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC) | |
f32f6f24 MJ |
130 | APR_ADDTO(SWITCH_AM_CXXFLAGS, "-features=extensions") |
131 | ||
55b3e6cb | 132 | APR_ADDTO(SWITCH_AM_LDFLAGS, -R${prefix}/lib) |
6d45f5f5 MJ |
133 | if test "${enable_64}" = "yes"; then |
134 | APR_ADDTO(SWITCH_AM_CFLAGS, -m64) | |
5b2d20bf MJ |
135 | APR_ADDTO(SWITCH_AM_CXXFLAGS, -m64) |
136 | APR_ADDTO(SWITCH_AM_LDFLAGS, -m64) | |
6d45f5f5 | 137 | fi |
55b3e6cb MJ |
138 | elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then |
139 | APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC) | |
514bde18 | 140 | APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC) |
44ef8650 | 141 | APR_ADDTO(SWITCH_AM_CFLAGS, -Werror) |
55b3e6cb MJ |
142 | fi |
143 | ||
fcd2a7b0 SK |
144 | # Enable debugging (default: on) |
145 | # (rename option if the default is changed) | |
2faabff7 | 146 | AC_ARG_ENABLE(debug, |
fcd2a7b0 | 147 | [AC_HELP_STRING([--disable-debug],[build without debug information])],[enable_debug="$enableval"],[enable_debug="yes"]) |
2faabff7 AM |
148 | |
149 | if test "${enable_debug}" = "yes"; then | |
150 | AC_DEFINE([DEBUG],[],[Enable extra debugging.]) | |
151 | AX_CFLAGS_WARN_ALL_ANSI | |
152 | ||
153 | if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then | |
154 | APR_ADDTO(SWITCH_AM_CFLAGS, -g -ggdb) | |
37845b42 | 155 | export DEBUG_CFLAGS="-g -ggdb" |
2faabff7 AM |
156 | fi |
157 | ||
158 | fi | |
159 | ||
a4a52620 SK |
160 | AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"]) |
161 | ||
2faabff7 | 162 | |
55b3e6cb MJ |
163 | # tweak platform specific flags |
164 | case "$host" in | |
6ae16d15 | 165 | *darwin*) |
55b3e6cb MJ |
166 | APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX) |
167 | APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC) | |
168 | ;; | |
169 | *-solaris2*) | |
170 | APR_ADDTO(SWITCH_AM_CFLAGS, -DPATH_MAX=2048) | |
171 | ;; | |
f0b58efb MJ |
172 | *bsd*) |
173 | APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include) | |
174 | ;; | |
55b3e6cb MJ |
175 | esac |
176 | ||
514bde18 MJ |
177 | APR_REMOVEFROM(SWITCH_AM_CXXFLAGS, -std=c99) |
178 | ||
55b3e6cb | 179 | AC_SUBST(SWITCH_AM_CFLAGS) |
514bde18 | 180 | AC_SUBST(SWITCH_AM_CXXFLAGS) |
55b3e6cb | 181 | AC_SUBST(SWITCH_AM_LDFLAGS) |
6bc48b70 MJ |
182 | AC_SUBST(SOLINK) |
183 | AC_SUBST(DYNAMIC_LIB_EXTEN) | |
6bc48b70 | 184 | |
4da77ea5 AM |
185 | # Checks for header files. |
186 | AC_HEADER_DIRENT | |
187 | AC_HEADER_STDC | |
b382c0a4 | 188 | AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h]) |
4da77ea5 AM |
189 | |
190 | # Checks for typedefs, structures, and compiler characteristics. | |
191 | AC_C_CONST | |
192 | AC_C_INLINE | |
193 | AC_TYPE_SIZE_T | |
194 | AC_HEADER_TIME | |
195 | AC_STRUCT_TM | |
196 | ||
197 | # Checks for library functions. | |
198 | AC_PROG_GCC_TRADITIONAL | |
199 | AC_FUNC_MALLOC | |
200 | AC_TYPE_SIGNAL | |
201 | AC_FUNC_STRFTIME | |
1386d846 | 202 | AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep]) |
b382c0a4 MJ |
203 | AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups]) |
204 | ||
eb9f9fb2 AM |
205 | AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])]) |
206 | AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])]) | |
207 | ||
b382c0a4 MJ |
208 | AC_CHECK_DECL([RLIMIT_MEMLOCK], |
209 | [AC_DEFINE([HAVE_RLIMIT_MEMLOCK],[1],[RLIMIT_MEMLOCK constant for setrlimit])],, | |
210 | [#ifdef HAVE_SYS_RESOURCE_H | |
211 | #include <sys/resource.h> | |
212 | #endif]) | |
213 | ||
214 | AC_CHECK_DECL([SCHED_RR], | |
215 | [AC_DEFINE([HAVE_SCHED_RR],[1],[SCHED_RR constant for sched_setscheduler])],, | |
216 | [#ifdef HAVE_SCHED_H | |
217 | #include <sched.h> | |
218 | #endif]) | |
219 | ||
220 | # | |
221 | # use mlockall only on linux (for now; if available) | |
222 | # | |
223 | if test "x${ac_cv_func_mlockall}" = "xyes"; then | |
224 | AC_MSG_CHECKING([whether to use mlockall]) | |
225 | case "$host" in | |
226 | *-linux-*) | |
227 | AC_DEFINE([USE_MLOCKALL],[1],[Enable mlockall support]) | |
228 | AC_MSG_RESULT([yes]) | |
229 | USE_MLOCKALL=yes | |
230 | ;; | |
231 | *-freebsd*) | |
232 | AC_MSG_RESULT([no, broken for non-root users]) | |
233 | ;; | |
234 | *) | |
235 | AC_MSG_RESULT([no]) | |
236 | ;; | |
237 | esac | |
238 | ||
239 | # | |
240 | # setrlimit prerequisites | |
241 | # | |
242 | if test "x${USE_MLOCKALL}" = "xyes" -a \ | |
243 | "x${ac_cv_func_setrlimit}" = "xyes" -a \ | |
244 | "x${ac_cv_have_decl_RLIMIT_MEMLOCK}" = "xyes" | |
245 | then | |
246 | AC_DEFINE([USE_SETRLIMIT],[1],[Use setrlimit to disable mlock limit for non-root users]) | |
247 | fi | |
248 | fi | |
249 | ||
250 | # | |
251 | # sched_setcheduler + round-robin scheduler prerequisites | |
252 | # | |
253 | if test "x${ac_cv_func_sched_setscheduler}" = "xyes" -a \ | |
254 | "x${ac_cv_have_decl_SCHED_RR}" = "xyes" | |
255 | then | |
256 | AC_DEFINE([USE_SCHED_SETSCHEDULER],[1],[Enable round-robin scheduler using sched_setscheduler]) | |
257 | fi | |
258 | ||
4da77ea5 | 259 | |
44cc7d5c | 260 | AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian])) |
49a0eb29 | 261 | |
42e78242 MJ |
262 | # Checks for integer size |
263 | AC_CHECK_SIZEOF(char, 1) | |
264 | AC_CHECK_SIZEOF(int, 4) | |
265 | AC_CHECK_SIZEOF(long, 4) | |
266 | AC_CHECK_SIZEOF(short, 2) | |
267 | AC_CHECK_SIZEOF(long long, 8) | |
268 | AC_TYPE_SIZE_T | |
269 | AC_CHECK_TYPE(ssize_t, int) | |
270 | ||
271 | # Checks for pointer size | |
272 | AC_CHECK_SIZEOF(void*, 4) | |
273 | ||
274 | if test "x$ac_cv_sizeof_voidp" != "x"; then | |
275 | voidp_size=$ac_cv_sizeof_voidp | |
276 | else | |
277 | AC_ERROR([Cannot determine size of void*]) | |
278 | fi | |
279 | ||
280 | if test "$ac_cv_sizeof_short" = "2"; then | |
281 | short_value=short | |
282 | fi | |
283 | if test "$ac_cv_sizeof_int" = "4"; then | |
284 | int_value=int | |
285 | fi | |
286 | ||
287 | if test "$ac_cv_sizeof_int" = "8"; then | |
288 | int64_t_fmt='#define SWITCH_INT64_T_FMT "d"' | |
289 | uint64_t_fmt='#define SWITCH_UINT64_T_FMT "u"' | |
290 | int64_value="int" | |
291 | long_value=int | |
292 | elif test "$ac_cv_sizeof_long" = "8"; then | |
293 | int64_t_fmt='#define SWITCH_INT64_T_FMT "ld"' | |
294 | uint64_t_fmt='#define SWITCH_UINT64_T_FMT "lu"' | |
295 | int64_value="long" | |
296 | long_value=long | |
297 | elif test "$ac_cv_sizeof_long_long" = "8"; then | |
298 | int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"' | |
299 | uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"' | |
300 | int64_value="long long" | |
301 | long_value="long long" | |
302 | elif test "$ac_cv_sizeof_longlong" = "8"; then | |
303 | int64_t_fmt='#define SWITCH_INT64_T_FMT "qd"' | |
304 | uint64_t_fmt='#define SWITCH_UINT64_T_FMT "qu"' | |
305 | int64_value="__int64" | |
306 | long_value="__int64" | |
307 | else | |
308 | AC_ERROR([could not detect a 64-bit integer type]) | |
309 | fi | |
310 | ||
311 | if test "$ac_cv_type_size_t" = "yes"; then | |
312 | size_t_value="size_t" | |
313 | else | |
314 | size_t_value="switch_int32_t" | |
315 | fi | |
316 | ||
317 | if test "$ac_cv_type_ssize_t" = "yes"; then | |
318 | ssize_t_value="ssize_t" | |
319 | else | |
320 | ssize_t_value="switch_int32_t" | |
321 | fi | |
322 | ||
323 | APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8) | |
324 | ||
325 | if test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then | |
326 | ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"' | |
327 | elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then | |
328 | ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"' | |
329 | else | |
330 | ssize_t_fmt='#error Can not determine the proper size for ssize_t' | |
331 | fi | |
332 | ||
333 | APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8) | |
334 | ||
335 | if test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then | |
336 | size_t_fmt='#define SWITCH_SIZE_T_FMT "d"' | |
337 | elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then | |
338 | size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"' | |
339 | else | |
340 | size_t_fmt='#error Can not determine the proper size for size_t' | |
341 | fi | |
342 | ||
343 | # Basically, we have tried to figure out the correct format strings | |
344 | # for SWITCH types which vary between platforms, but we don't always get | |
345 | # it right. If you find that we don't get it right for your platform, | |
346 | # you can override our decision below. | |
347 | # NOTE: borrowed much of this logic from apr. | |
348 | case $host in | |
349 | s390*linux*) | |
350 | # uniquely, the 31-bit Linux/s390 uses "unsigned long int" | |
351 | # for size_t rather than "unsigned int": | |
352 | size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"' | |
353 | ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"' | |
354 | ;; | |
355 | *-os2*) | |
356 | size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"' | |
357 | ;; | |
6d66ecfd MJ |
358 | *-openbsd*) |
359 | size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"' | |
360 | ;; | |
42e78242 MJ |
361 | *aix4*|*aix5*) |
362 | ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"' | |
363 | size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"' | |
364 | ;; | |
365 | *beos*) | |
366 | ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"' | |
367 | size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"' | |
368 | ;; | |
369 | *apple-darwin*) | |
370 | osver=`uname -r` | |
371 | case $osver in | |
372 | [0-7].*) | |
373 | ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"' | |
374 | ;; | |
375 | *) | |
376 | ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"' | |
377 | ;; | |
378 | esac | |
379 | size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"' | |
380 | ;; | |
381 | esac | |
382 | ||
383 | AC_SUBST(voidp_size) | |
384 | AC_SUBST(short_value) | |
385 | AC_SUBST(int_value) | |
386 | AC_SUBST(long_value) | |
387 | AC_SUBST(int64_value) | |
388 | AC_SUBST(size_t_value) | |
389 | AC_SUBST(ssize_t_value) | |
390 | AC_SUBST(int64_t_fmt) | |
391 | AC_SUBST(uint64_t_fmt) | |
392 | AC_SUBST(ssize_t_fmt) | |
393 | AC_SUBST(size_t_fmt) | |
b552cb3a MB |
394 | AC_SUBST(libdir) |
395 | AC_SUBST(bindir) | |
396 | AC_SUBST(includedir) | |
42e78242 | 397 | |
bc34fb76 MJ |
398 | AC_PATH_PROGS(ZCAT, gunzip gzcat gzip zcat) |
399 | AC_PATH_PROGS(TAR, gtar tar) | |
400 | AC_PATH_PROGS(WGET, wget) | |
401 | AC_PATH_PROGS(CURL, curl) | |
c99d8c9b MJ |
402 | GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_srcdir/build/getlib.sh" |
403 | AC_SUBST(GETLIB) | |
3d5fcabe MJ |
404 | GETSOUNDS="${SHELL} $switch_srcdir/build/getsounds.sh" |
405 | AC_SUBST(GETSOUNDS) | |
c99d8c9b | 406 | |
bc34fb76 | 407 | |
f85be6ff MJ |
408 | LIBCURL_CHECK_CONFIG([yes], [7.13.0], [LIBCURL_DEPS=''], [LIBCURL_DEPS='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include']) |
409 | AC_SUBST(LIBCURL_DEPS) | |
410 | ||
4d62a1ad | 411 | AC_ARG_ENABLE(core-odbc-support, |
2bcd991b | 412 | [AS_HELP_STRING([--enable-core-odbc-support], [Compile with ODBC Support])],,[enable_core_odbc_support="no"]) |
4d62a1ad | 413 | |
c5c13c26 | 414 | AC_ARG_ENABLE(core-libedit-support, |
2bcd991b | 415 | [AS_HELP_STRING([--disable-core-libedit-support], [Compile without libedit Support])], [enable_core_libedit_support="$enableval"], [enable_core_libedit_support="yes"]) |
c5c13c26 | 416 | |
28213aad AM |
417 | if test "$enable_core_libedit_support" = "yes" ; then |
418 | AC_CHECK_LIB(ncurses, tgetent,, | |
419 | [AC_CHECK_LIB(curses, tgetent,, | |
420 | [AC_MSG_ERROR([libtermcap, libcurses or libncurses are required!])] )] ) | |
421 | fi | |
422 | ||
e69fe7e3 | 423 | AX_CHECK_JAVA |
7df787b7 | 424 | |
4d62a1ad | 425 | AM_CONDITIONAL([ADD_ODBC],[test "x$enable_core_odbc_support" != "xno"]) |
c5c13c26 | 426 | AM_CONDITIONAL([ADD_LIBEDIT],[test "x$enable_core_libedit_support" != "xno"]) |
778a82cc | 427 | AM_CONDITIONAL([HAVE_MYSQL],[test "$found_mysql" = "yes"]) |
49a0eb29 | 428 | |
e8c88aa1 SK |
429 | # |
430 | # Python checks for mod_python | |
431 | # | |
432 | AC_ARG_WITH( | |
433 | [python], | |
434 | [AS_HELP_STRING([--with-python], [Use system provided version of python (default: try)])], | |
435 | [with_python="$withval"], | |
436 | [with_python="try"] | |
437 | ) | |
438 | ||
439 | AC_ARG_WITH( | |
440 | [python-config], | |
441 | [AS_HELP_STRING([--with-python-config=PATH], [Location of python-config])], | |
442 | [with_python_config="$withval"], | |
443 | [with_python_config="no"] | |
444 | ) | |
445 | ||
446 | ||
447 | if test "$with_python" != "no" | |
448 | then | |
2d14539e SK |
449 | save_CFLAGS="$CFLAGS" |
450 | save_LIBS="$LIBS" | |
451 | ||
e8c88aa1 SK |
452 | if test "$with_python" != "yes" -a "$with_python" != "try" ; then |
453 | AC_MSG_CHECKING([for python]) | |
454 | if test ! -x "$with_python" ; then | |
455 | AC_MSG_ERROR([Specified python does not exist or is not executable: $with_python]) | |
456 | fi | |
457 | AC_MSG_RESULT([$with_python]) | |
458 | AC_SUBST([PYTHON], ["$with_python"]) | |
459 | else | |
460 | AC_PATH_PROG([PYTHON], ["python"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"]) | |
461 | fi | |
462 | ||
463 | if test "$PYTHON" != "no" ; then | |
464 | AC_MSG_CHECKING([python version]) | |
465 | PYTHON_VER="`$PYTHON -V 2>&1 | cut -d' ' -f2`" | |
466 | ||
467 | if test -z "$PYTHON_VER" ; then | |
468 | AC_MSG_ERROR([Unable to detect python version]) | |
469 | fi | |
470 | AC_MSG_RESULT([$PYTHON_VER]) | |
471 | ||
e8c88aa1 | 472 | |
2d14539e SK |
473 | AC_MSG_CHECKING([for python distutils]) |
474 | python_has_distutils="no" | |
475 | if test "$PYTHON -c 'import distutils;' 2>/dev/null" ; then | |
476 | python_has_distutils="yes" | |
477 | fi | |
478 | AC_MSG_RESULT([$python_has_distutils]) | |
479 | ||
480 | ||
481 | if test "$python_has_distutils" = "no" ; then | |
482 | AC_MSG_RESULT([Falling back to python-config]) | |
483 | ||
f08ac862 SK |
484 | # NOTE: this assumes our desired location is always the last one in the list |
485 | # (= system package location is searched last) | |
486 | # | |
487 | # needs double brackets because m4 removes one pair | |
488 | AC_MSG_CHECKING([location of site-packages]) | |
489 | ||
490 | PYTHON_SITE_DIR="`$PYTHON -c 'import sys; print sys.path[[-1]];'`" | |
491 | ||
492 | if test -z "$PYTHON_SITE_DIR" ; then | |
493 | AC_MSG_ERROR([Unable to detect python site-packages path]) | |
494 | elif test ! -d "$PYTHON_SITE_DIR" ; then | |
495 | AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!]) | |
496 | fi | |
497 | AC_MSG_RESULT([$PYTHON_SITE_DIR]) | |
498 | AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR]) | |
499 | ||
2d14539e SK |
500 | # |
501 | # no python distutils, try to use python-config | |
502 | # (do we really need to keep this?) | |
503 | ||
504 | if test "$with_python_config" != "no" ; then | |
505 | AC_MSG_CHECKING([for python-config]) | |
506 | if test ! -x "$with_python_config" ; then | |
507 | AC_MSG_ERROR([Specified python-config does not exist or is not executable: $with_python_config]) | |
508 | fi | |
509 | AC_MSG_RESULT([$with_python_config]) | |
510 | AC_SUBST([PYTHON_CONFIG], ["$with_python_config"]) | |
511 | else | |
512 | AC_PATH_PROG([PYTHON_CONFIG], ["python-config"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"]) | |
513 | fi | |
514 | ||
515 | if test "$PYTHON_CONFIG" != "no" ; then | |
516 | PYTHON_CFLAGS="`$PYTHON_CONFIG --cflags`" | |
517 | PYTHON_LDFLAGS="`$PYTHON_CONFIG --ldflags`" | |
518 | else | |
519 | AS_IF([test "$with_python" = "try"], | |
520 | [AC_MSG_WARN([python-config could not be found, mod_python will not build, use --with-python-config to specify the location])], | |
521 | [AC_MSG_ERROR([python-config could not be found, use --with-python-config to specify the location])] | |
522 | ) | |
e8c88aa1 | 523 | fi |
e8c88aa1 | 524 | else |
f08ac862 SK |
525 | AC_MSG_CHECKING([location of site-packages]) |
526 | ||
527 | PYTHON_SITE_DIR="`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_python_lib(1);'`" | |
528 | ||
529 | if test -z "$PYTHON_SITE_DIR" ; then | |
530 | AC_MSG_ERROR([Unable to detect python site-packages path]) | |
531 | elif test ! -d "$PYTHON_SITE_DIR" ; then | |
532 | AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!]) | |
533 | fi | |
534 | AC_MSG_RESULT([$PYTHON_SITE_DIR]) | |
535 | AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR]) | |
536 | ||
2d14539e SK |
537 | # |
538 | # python distutils found, get settings from python directly | |
539 | # | |
f08ac862 SK |
540 | PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print \" \".join(flags);'`" |
541 | PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\"+sysconfig.get_config_var(\"VERSION\")); print \" \".join(libs);'`" | |
542 | PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print \"python\" + sysconfig.get_config_var(\"VERSION\");'`" | |
e8c88aa1 SK |
543 | fi |
544 | ||
2d14539e SK |
545 | if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LDFLAGS" |
546 | then | |
547 | # check libpython | |
548 | AC_CHECK_LIB([$PYTHON_LIB], [main], [has_libpython="yes"], [has_libpython="no"]) | |
549 | ||
550 | if test "$has_libpython" = "no" ; then | |
551 | AS_IF([test "$with_python" = "try"], | |
552 | [AC_MSG_WARN([$PYTHON_LIB is unusable])], | |
553 | [AC_MSG_ERROR([$PYTHON_LIB is unusable])] | |
554 | ) | |
555 | fi | |
e8c88aa1 SK |
556 | |
557 | # check whether system libpython is usable and has threads support | |
2d14539e | 558 | CFLAGS="$PYTHON_CFLAGS" |
e8c88aa1 SK |
559 | LIBS="$PYTHON_LDFLAGS" |
560 | AC_CHECK_FUNC([PyThread_init_thread], [python_has_threads="yes"], [python_has_threads="no"]) | |
e8c88aa1 | 561 | |
2d14539e SK |
562 | if test "$python_has_threads" = "no"; then |
563 | AS_IF([test "$with_python" = "try"], | |
564 | [AC_MSG_WARN([Your python lacks threads support, can not build mod_python])], | |
565 | [AC_MSG_ERROR([Your python lacks threads support, can not build mod_python])] | |
566 | ) | |
e8c88aa1 SK |
567 | else |
568 | AC_MSG_NOTICE([Your python seems OK, do not forget to enable mod_python in modules.conf]) | |
2d14539e | 569 | AC_SUBST([PYTHON_CFLAGS], [$PYTHON_CFLAGS]) |
e8c88aa1 SK |
570 | AC_SUBST([PYTHON_LDFLAGS], [$PYTHON_LDFLAGS]) |
571 | fi | |
572 | else | |
2d14539e SK |
573 | AS_IF([test "$with_python" = "try"], |
574 | [AC_MSG_WARN([Unable to use python, maybe you need to install "python-devel"])], | |
575 | [AC_MSG_ERROR([Unable to use python, maybe you need to install "python-devel"])] | |
576 | ) | |
e8c88aa1 SK |
577 | fi |
578 | ||
2d14539e SK |
579 | LIBS="$save_LIBS" |
580 | CFLAGS="$save_CFLAGS" | |
581 | ||
582 | unset python_has_threads | |
583 | unset python_has_distutils | |
584 | else | |
585 | AS_IF([test "$with_python" = "try"], | |
586 | [AC_MSG_WARN([Could not find python, mod_python will not build, use --with-python to specify the location])], | |
587 | [AC_MSG_ERROR([Could not find python, use --with-python to specify the location])] | |
588 | ) | |
e8c88aa1 SK |
589 | fi |
590 | else | |
591 | AC_MSG_WARN([python support disabled, building mod_python will fail!]) | |
592 | fi | |
593 | ||
42e78242 | 594 | AC_CONFIG_FILES([Makefile |
4ffd0bc0 | 595 | src/Makefile |
1481d37f | 596 | src/mod/Makefile |
33d3c1c2 | 597 | src/mod/endpoints/mod_sofia/Makefile |
c33dc3eb | 598 | src/mod/event_handlers/mod_radius_cdr/Makefile |
e69fe7e3 | 599 | src/mod/languages/mod_java/Makefile |
e8c88aa1 | 600 | src/mod/languages/mod_python/Makefile |
514bde18 | 601 | src/include/switch_am_config.h |
3d5fcabe | 602 | build/getsounds.sh |
bc34fb76 | 603 | build/getlib.sh |
24248ae1 SK |
604 | build/modmake.rules |
605 | scripts/gentls_cert]) | |
4da77ea5 | 606 | |
a6e9f279 | 607 | AM_CONDITIONAL(ISLINUX, [test `uname -s` = Linux]) |
db399276 | 608 | AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin]) |
a092a55a | 609 | AM_CONDITIONAL(IS64BITLINUX, [test `uname -m` = x86_64]) |
a6e9f279 | 610 | |
c7753b06 MJ |
611 | #some vars to sub into the Makefile.am's |
612 | #LIBS+=> core.log || error="yes";if test -n "$(VERBOSE)" -o "$$error" = "yes";then cat core.log;fi;if test "$$error" = "yes";then exit 1;fi | |
613 | LIBTOOL='`if test -z "$(VERBOSE)" ; then echo $(SHELL) $(switch_builddir)/quiet_libtool ;else echo $(switch_builddir)/libtool; fi;`' | |
614 | TOUCH_TARGET='if test -f "$@";then touch "$@";fi;' | |
564cd368 | 615 | CONF_MODULES='\`grep -v "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" | sort | uniq \`' |
ed960392 | 616 | CONF_DISABLED_MODULES='\`grep "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" | sort | uniq \`' |
5f053e18 MJ |
617 | OUR_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-all ; done \`; echo $$mods `' |
618 | OUR_CLEAN_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-clean ; done \`; echo $$mods `' | |
619 | OUR_INSTALL_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-install ; done\`; echo $$mods `' | |
620 | OUR_UNINSTALL_MODS='`if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods=\`for i in $$tmp_mods ; do echo $$i-uninstall ; done\`; echo $$mods `' | |
ed960392 AM |
621 | OUR_DISABLED_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)"; mods=\`for i in $$tmp_mods ; do echo $$i-all ; done \`; echo $$mods `' |
622 | OUR_DISABLED_CLEAN_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)"; mods=\`for i in $$tmp_mods ; do echo $$i-clean ; done \`; echo $$mods `' | |
623 | OUR_DISABLED_INSTALL_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)"; mods=\`for i in $$tmp_mods ; do echo $$i-install ; done\`; echo $$mods `' | |
624 | OUR_DISABLED_UNINSTALL_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)"; mods=\`for i in $$tmp_mods ; do echo $$i-uninstall ; done\`; echo $$mods `' | |
625 | ||
626 | AM_MAKEFLAGS='"OUR_MODULES=$(OUR_MODS)" "OUR_CLEAN_MODULES=$(OUR_CLEAN_MODS)" "OUR_INSTALL_MODULES=$(OUR_INSTALL_MODS)" "OUR_UNINSTALL_MODULES=$(OUR_UNINSTALL_MODS)" "OUR_DISABLED_MODULES=$(OUR_DISABLED_MODS)" "OUR_DISABLED_CLEAN_MODULES=$(OUR_DISABLED_CLEAN_MODS)" "OUR_DISABLED_INSTALL_MODULES=$(OUR_DISABLED_INSTALL_MODS)" "OUR_DISABLED_UNINSTALL_MODULES=$(OUR_DISABLED_UNINSTALL_MODS)" `test -n "$(VERBOSE)" || echo -s`' | |
5f053e18 | 627 | #AM_MAKEFLAGS='`test -n "$(VERBOSE)" || echo -s`' |
c7753b06 MJ |
628 | AC_SUBST(LIBTOOL) |
629 | AC_SUBST(TOUCH_TARGET) | |
ed960392 | 630 | AC_SUBST(CONF_DISABLED_MODULES) |
5f053e18 | 631 | AC_SUBST(CONF_MODULES) |
ed960392 | 632 | |
5f053e18 MJ |
633 | AC_SUBST(OUR_MODS) |
634 | AC_SUBST(OUR_CLEAN_MODS) | |
635 | AC_SUBST(OUR_INSTALL_MODS) | |
636 | AC_SUBST(OUR_UNINSTALL_MODS) | |
ed960392 AM |
637 | AC_SUBST(OUR_DISABLED_MODS) |
638 | AC_SUBST(OUR_DISABLED_CLEAN_MODS) | |
639 | AC_SUBST(OUR_DISABLED_INSTALL_MODS) | |
640 | AC_SUBST(OUR_DISABLED_UNINSTALL_MODS) | |
c7753b06 MJ |
641 | AC_SUBST(AM_MAKEFLAGS) |
642 | ||
46f6981d MJ |
643 | # Run configure in all the subdirs |
644 | AC_CONFIG_SUBDIRS(libs/srtp) | |
645 | AC_CONFIG_SUBDIRS(libs/sqlite) | |
646 | AC_CONFIG_SUBDIRS(libs/libresample) | |
99b12efe MB |
647 | if test "$enable_core_libedit_support" = "yes" ; then |
648 | AC_CONFIG_SUBDIRS(libs/libedit) | |
649 | fi | |
46f6981d MJ |
650 | AC_CONFIG_SUBDIRS(libs/pcre) |
651 | AC_CONFIG_SUBDIRS(libs/apr) | |
652 | AC_CONFIG_SUBDIRS(libs/apr-util) | |
ad555456 | 653 | AC_CONFIG_SUBDIRS(libs/voipcodecs) |
ee3fc89f | 654 | AC_CONFIG_SUBDIRS(libs/codec/ilbc) |
ee3fc89f | 655 | AC_CONFIG_SUBDIRS(libs/curl) |
ee3fc89f MJ |
656 | AC_CONFIG_SUBDIRS(libs/iksemel) |
657 | AC_CONFIG_SUBDIRS(libs/js/nsprpub) | |
658 | AC_CONFIG_SUBDIRS(libs/js) | |
659 | AC_CONFIG_SUBDIRS(libs/libdingaling) | |
ee3fc89f MJ |
660 | AC_CONFIG_SUBDIRS(libs/libsndfile) |
661 | AC_CONFIG_SUBDIRS(libs/sofia-sip) | |
662 | AC_CONFIG_SUBDIRS(libs/speex) | |
663 | AC_CONFIG_SUBDIRS(libs/xmlrpc-c) | |
664 | AC_CONFIG_SUBDIRS(libs/portaudio) | |
b552cb3a | 665 | AC_CONFIG_SUBDIRS(libs/openmrcp) |
6cc890bf | 666 | AC_CONFIG_SUBDIRS(libs/openzap) |
ee3fc89f | 667 | |
6e81dda1 | 668 | AC_OUTPUT |