]> git.ipfire.org Git - thirdparty/freeswitch.git/blame - configure.in
Non-bash and m4 quoting fixes, improve site-packages detection with distutils
[thirdparty/freeswitch.git] / configure.in
CommitLineData
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 6AC_INIT([freeswitch], [1.0.pre4], BUG-REPORT-ADDRESS)
8ef2aa54
MJ
7AC_SUBST(SWITCH_VERSION_MAJOR, [1])
8AC_SUBST(SWITCH_VERSION_MINOR, [0])
01379cd6 9AC_SUBST(SWITCH_VERSION_MICRO, [pre4])
8ef2aa54
MJ
10#AC_SUBST(SWITCH_VERSION_REVISION, [svn-revision-here])
11
12AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
7a5bc3b7 13
e8b9a4f7 14AC_CONFIG_AUX_DIR(build/config)
4da77ea5
AM
15AM_INIT_AUTOMAKE(libfreeswitch,0.1)
16AC_CONFIG_SRCDIR([src/switch.c])
42e78242
MJ
17AC_CONFIG_HEADER([src/include/switch_private.h])
18
a642381f 19AC_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
21if test "x$prefix" = "xNONE" ; then
22 prefix='/usr/local/freeswitch'
23fi
55b3e6cb 24
31d1e20f
BW
25AC_CANONICAL_HOST
26
55b3e6cb
MJ
27# Absolute source/build directory
28switch_srcdir=`(cd $srcdir && pwd)`
29switch_builddir=`pwd`
30AC_SUBST(switch_srcdir)
31AC_SUBST(switch_builddir)
32
b552cb3a 33# Where to install the modules
2bcd991b
SK
34AC_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
37AC_SUBST(modinstdir)
38AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modinstdir}",[where to install the modules to])
1481d37f 39
6bc48b70
MJ
40#Set default language
41AC_LANG_C
4da77ea5
AM
42# Checks for programs.
43AC_PROG_CC
bac1e3fd 44AC_PROG_AWK
4da77ea5 45AC_PROG_MAKE_SET
4da77ea5 46AC_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)
49m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
50m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
51m4_defun([_LT_AC_LANG_RC_CONFIG], [:])
5b3f19fb 52AM_PROG_CC_C_O
bac1e3fd 53AC_PROG_LIBTOOL
4da77ea5 54
6bc48b70
MJ
55#Check for compiler vendor
56AX_COMPILER_VENDOR
57
58# Optimize
59AC_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
62if test "${enable_optimizer}" = "yes" ; then
63 AC_DEFINE([OPTIMZER],[],[Enable Optimization.])
64 AX_CC_MAXOPT
65fi
66
6bc48b70 67
4341b8e6
MJ
68# Optional Features
69
70AC_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
74RESAMPLE_LIB=
75RESAMPLE_CFLAGS=
76if test "${enable_resample}" = "yes"; then
77 RESAMPLE_LIB="libs/libresample/libresample.la"
78 RESAMPLE_CFLAGS="-I${switch_srcdir}/libs/libresample/include"
79else
80 AC_DEFINE([DISABLE_RESAMPLE],[],[Disable the embedded resampler])
81fi
82
83AC_SUBST(RESAMPLE_LIB)
84AC_SUBST(RESAMPLE_CFLAGS)
85
86AM_CONDITIONAL([USE_INTREE_RESAMPLE],[test "${enable_resample}" = "yes"])
87
55b3e6cb 88# set defaults for use on all platforms
3a541262
AM
89SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_srcdir}/libs/libteletone/src"
90SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_srcdir}/libs/libteletone/src"
31d1e20f 91SWITCH_AM_LDFLAGS="-lm -L/usr/local/lib"
55b3e6cb
MJ
92
93#set SOLINK variable based on compiler and host
94if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
95 SOLINK="-Bdynamic -dy -G"
96elif 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
105else
106 AC_ERROR([Please update configure.in with SOLINK values for your compiler])
107fi
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 111case "$host" in
55b3e6cb
MJ
112 *cygwin* | *mingw*)
113 DYNAMIC_LIB_EXTEN="dll"
114 ;;
115 *)
116 DYNAMIC_LIB_EXTEN="so"
117 ;;
6bc48b70 118esac
55b3e6cb 119
0f6a6c31 120# Enable 64 bit build
6d45f5f5 121AC_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
125if 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
138elif 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
142fi
143
fcd2a7b0
SK
144# Enable debugging (default: on)
145# (rename option if the default is changed)
2faabff7 146AC_ARG_ENABLE(debug,
fcd2a7b0 147[AC_HELP_STRING([--disable-debug],[build without debug information])],[enable_debug="$enableval"],[enable_debug="yes"])
2faabff7
AM
148
149if 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
158fi
159
a4a52620
SK
160AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
161
2faabff7 162
55b3e6cb
MJ
163# tweak platform specific flags
164case "$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
175esac
176
514bde18
MJ
177APR_REMOVEFROM(SWITCH_AM_CXXFLAGS, -std=c99)
178
55b3e6cb 179AC_SUBST(SWITCH_AM_CFLAGS)
514bde18 180AC_SUBST(SWITCH_AM_CXXFLAGS)
55b3e6cb 181AC_SUBST(SWITCH_AM_LDFLAGS)
6bc48b70
MJ
182AC_SUBST(SOLINK)
183AC_SUBST(DYNAMIC_LIB_EXTEN)
6bc48b70 184
4da77ea5
AM
185# Checks for header files.
186AC_HEADER_DIRENT
187AC_HEADER_STDC
b382c0a4 188AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h])
4da77ea5
AM
189
190# Checks for typedefs, structures, and compiler characteristics.
191AC_C_CONST
192AC_C_INLINE
193AC_TYPE_SIZE_T
194AC_HEADER_TIME
195AC_STRUCT_TM
196
197# Checks for library functions.
198AC_PROG_GCC_TRADITIONAL
199AC_FUNC_MALLOC
200AC_TYPE_SIGNAL
201AC_FUNC_STRFTIME
1386d846 202AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep])
b382c0a4
MJ
203AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups])
204
eb9f9fb2
AM
205AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])])
206AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
207
b382c0a4
MJ
208AC_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
214AC_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#
223if 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
248fi
249
250#
251# sched_setcheduler + round-robin scheduler prerequisites
252#
253if test "x${ac_cv_func_sched_setscheduler}" = "xyes" -a \
254 "x${ac_cv_have_decl_SCHED_RR}" = "xyes"
255then
256 AC_DEFINE([USE_SCHED_SETSCHEDULER],[1],[Enable round-robin scheduler using sched_setscheduler])
257fi
258
4da77ea5 259
44cc7d5c 260AC_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
263AC_CHECK_SIZEOF(char, 1)
264AC_CHECK_SIZEOF(int, 4)
265AC_CHECK_SIZEOF(long, 4)
266AC_CHECK_SIZEOF(short, 2)
267AC_CHECK_SIZEOF(long long, 8)
268AC_TYPE_SIZE_T
269AC_CHECK_TYPE(ssize_t, int)
270
271# Checks for pointer size
272AC_CHECK_SIZEOF(void*, 4)
273
274if test "x$ac_cv_sizeof_voidp" != "x"; then
275 voidp_size=$ac_cv_sizeof_voidp
276else
277 AC_ERROR([Cannot determine size of void*])
278fi
279
280if test "$ac_cv_sizeof_short" = "2"; then
281 short_value=short
282fi
283if test "$ac_cv_sizeof_int" = "4"; then
284 int_value=int
285fi
286
287if 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
292elif 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
297elif 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"
302elif 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"
307else
308 AC_ERROR([could not detect a 64-bit integer type])
309fi
310
311if test "$ac_cv_type_size_t" = "yes"; then
312 size_t_value="size_t"
313else
314 size_t_value="switch_int32_t"
315fi
316
317if test "$ac_cv_type_ssize_t" = "yes"; then
318 ssize_t_value="ssize_t"
319else
320 ssize_t_value="switch_int32_t"
321fi
322
323APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
324
325if test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then
326 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"'
327elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then
328 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
329else
330 ssize_t_fmt='#error Can not determine the proper size for ssize_t'
331fi
332
333APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
334
335if test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then
336 size_t_fmt='#define SWITCH_SIZE_T_FMT "d"'
337elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then
338 size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
339else
340 size_t_fmt='#error Can not determine the proper size for size_t'
341fi
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.
348case $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 ;;
381esac
382
383AC_SUBST(voidp_size)
384AC_SUBST(short_value)
385AC_SUBST(int_value)
386AC_SUBST(long_value)
387AC_SUBST(int64_value)
388AC_SUBST(size_t_value)
389AC_SUBST(ssize_t_value)
390AC_SUBST(int64_t_fmt)
391AC_SUBST(uint64_t_fmt)
392AC_SUBST(ssize_t_fmt)
393AC_SUBST(size_t_fmt)
b552cb3a
MB
394AC_SUBST(libdir)
395AC_SUBST(bindir)
396AC_SUBST(includedir)
42e78242 397
bc34fb76
MJ
398AC_PATH_PROGS(ZCAT, gunzip gzcat gzip zcat)
399AC_PATH_PROGS(TAR, gtar tar)
400AC_PATH_PROGS(WGET, wget)
401AC_PATH_PROGS(CURL, curl)
c99d8c9b
MJ
402GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_srcdir/build/getlib.sh"
403AC_SUBST(GETLIB)
3d5fcabe
MJ
404GETSOUNDS="${SHELL} $switch_srcdir/build/getsounds.sh"
405AC_SUBST(GETSOUNDS)
c99d8c9b 406
bc34fb76 407
f85be6ff
MJ
408LIBCURL_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'])
409AC_SUBST(LIBCURL_DEPS)
410
4d62a1ad 411AC_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 414AC_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
417if 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!])] )] )
421fi
422
e69fe7e3 423AX_CHECK_JAVA
7df787b7 424
4d62a1ad 425AM_CONDITIONAL([ADD_ODBC],[test "x$enable_core_odbc_support" != "xno"])
c5c13c26 426AM_CONDITIONAL([ADD_LIBEDIT],[test "x$enable_core_libedit_support" != "xno"])
778a82cc 427AM_CONDITIONAL([HAVE_MYSQL],[test "$found_mysql" = "yes"])
49a0eb29 428
e8c88aa1
SK
429#
430# Python checks for mod_python
431#
432AC_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
439AC_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
447if test "$with_python" != "no"
448then
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
590else
591 AC_MSG_WARN([python support disabled, building mod_python will fail!])
592fi
593
42e78242 594AC_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 607AM_CONDITIONAL(ISLINUX, [test `uname -s` = Linux])
db399276 608AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin])
a092a55a 609AM_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
613LIBTOOL='`if test -z "$(VERBOSE)" ; then echo $(SHELL) $(switch_builddir)/quiet_libtool ;else echo $(switch_builddir)/libtool; fi;`'
614TOUCH_TARGET='if test -f "$@";then touch "$@";fi;'
564cd368 615CONF_MODULES='\`grep -v "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" | sort | uniq \`'
ed960392 616CONF_DISABLED_MODULES='\`grep "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" | sort | uniq \`'
5f053e18
MJ
617OUR_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 `'
618OUR_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 `'
619OUR_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 `'
620OUR_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
621OUR_DISABLED_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)"; mods=\`for i in $$tmp_mods ; do echo $$i-all ; done \`; echo $$mods `'
622OUR_DISABLED_CLEAN_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)"; mods=\`for i in $$tmp_mods ; do echo $$i-clean ; done \`; echo $$mods `'
623OUR_DISABLED_INSTALL_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)"; mods=\`for i in $$tmp_mods ; do echo $$i-install ; done\`; echo $$mods `'
624OUR_DISABLED_UNINSTALL_MODS='`tmp_mods="$(CONF_DISABLED_MODULES)"; mods=\`for i in $$tmp_mods ; do echo $$i-uninstall ; done\`; echo $$mods `'
625
626AM_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
628AC_SUBST(LIBTOOL)
629AC_SUBST(TOUCH_TARGET)
ed960392 630AC_SUBST(CONF_DISABLED_MODULES)
5f053e18 631AC_SUBST(CONF_MODULES)
ed960392 632
5f053e18
MJ
633AC_SUBST(OUR_MODS)
634AC_SUBST(OUR_CLEAN_MODS)
635AC_SUBST(OUR_INSTALL_MODS)
636AC_SUBST(OUR_UNINSTALL_MODS)
ed960392
AM
637AC_SUBST(OUR_DISABLED_MODS)
638AC_SUBST(OUR_DISABLED_CLEAN_MODS)
639AC_SUBST(OUR_DISABLED_INSTALL_MODS)
640AC_SUBST(OUR_DISABLED_UNINSTALL_MODS)
c7753b06
MJ
641AC_SUBST(AM_MAKEFLAGS)
642
46f6981d
MJ
643# Run configure in all the subdirs
644AC_CONFIG_SUBDIRS(libs/srtp)
645AC_CONFIG_SUBDIRS(libs/sqlite)
646AC_CONFIG_SUBDIRS(libs/libresample)
99b12efe
MB
647if test "$enable_core_libedit_support" = "yes" ; then
648 AC_CONFIG_SUBDIRS(libs/libedit)
649fi
46f6981d
MJ
650AC_CONFIG_SUBDIRS(libs/pcre)
651AC_CONFIG_SUBDIRS(libs/apr)
652AC_CONFIG_SUBDIRS(libs/apr-util)
ad555456 653AC_CONFIG_SUBDIRS(libs/voipcodecs)
ee3fc89f 654AC_CONFIG_SUBDIRS(libs/codec/ilbc)
ee3fc89f 655AC_CONFIG_SUBDIRS(libs/curl)
ee3fc89f
MJ
656AC_CONFIG_SUBDIRS(libs/iksemel)
657AC_CONFIG_SUBDIRS(libs/js/nsprpub)
658AC_CONFIG_SUBDIRS(libs/js)
659AC_CONFIG_SUBDIRS(libs/libdingaling)
ee3fc89f
MJ
660AC_CONFIG_SUBDIRS(libs/libsndfile)
661AC_CONFIG_SUBDIRS(libs/sofia-sip)
662AC_CONFIG_SUBDIRS(libs/speex)
663AC_CONFIG_SUBDIRS(libs/xmlrpc-c)
664AC_CONFIG_SUBDIRS(libs/portaudio)
b552cb3a 665AC_CONFIG_SUBDIRS(libs/openmrcp)
6cc890bf 666AC_CONFIG_SUBDIRS(libs/openzap)
ee3fc89f 667
6e81dda1 668AC_OUTPUT