]> git.ipfire.org Git - thirdparty/freeswitch.git/blame - configure.in
FS-3672 --resolve
[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
8e76877a 6AC_INIT([freeswitch], [1.0.head], BUG-REPORT-ADDRESS)
8ef2aa54
MJ
7AC_SUBST(SWITCH_VERSION_MAJOR, [1])
8AC_SUBST(SWITCH_VERSION_MINOR, [0])
8e76877a
MJ
9AC_SUBST(SWITCH_VERSION_MICRO, [head])
10#AC_SUBST(SWITCH_VERSION_REVISION, [])
8ef2aa54
MJ
11
12AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
4df02914 13AC_CONFIG_FILES([.version:.version.in])
7a5bc3b7 14
e8b9a4f7 15AC_CONFIG_AUX_DIR(build/config)
4da77ea5
AM
16AM_INIT_AUTOMAKE(libfreeswitch,0.1)
17AC_CONFIG_SRCDIR([src/switch.c])
42e78242 18AC_CONFIG_HEADER([src/include/switch_private.h])
4062b636 19AC_CONFIG_HEADER([libs/xmlrpc-c/xmlrpc_amconfig.h])
42e78242 20
a642381f 21AC_PREFIX_DEFAULT(/usr/local/freeswitch)
94206d80
MJ
22# AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script
23if test "x$prefix" = "xNONE" ; then
24 prefix='/usr/local/freeswitch'
25fi
55b3e6cb 26
31d1e20f
BW
27AC_CANONICAL_HOST
28
55b3e6cb
MJ
29# Absolute source/build directory
30switch_srcdir=`(cd $srcdir && pwd)`
31switch_builddir=`pwd`
32AC_SUBST(switch_srcdir)
33AC_SUBST(switch_builddir)
34
b552cb3a 35# Where to install the modules
2bcd991b 36AC_ARG_WITH([modinstdir],
5ccac21d
MJ
37 [AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modulesdir="$withval"], [modulesdir="${prefix}/mod"])
38AC_SUBST(modulesdir)
39AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modulesdir}",[where to install the modules to])
1481d37f 40
88aa159b
MJ
41if test "$localstatedir" = "\${prefix}/var" ; then
42 rundir="$prefix/run"
43 logfiledir="${prefix}/log"
44else
45 rundir="$localstatedir/run/freeswitch"
46 logfiledir="$localstatedir/log/freeswitch"
47fi
107f9135
MJ
48# Where to put pidfile
49AC_ARG_WITH([rundir],
88aa159b 50 [AS_HELP_STRING([--with-rundir=DIR], [Put pidfile into this location (default: $prefix/run)])], [runtimedir="$withval"], [runtimedir="$rundir"])
5ccac21d
MJ
51AC_SUBST(runtimedir)
52AC_DEFINE_UNQUOTED([SWITCH_RUN_DIR],"${runtimedir}",[where to put pidfile to])
53
5ccac21d
MJ
54AC_SUBST(logfiledir)
55AC_DEFINE_UNQUOTED([SWITCH_LOG_DIR],"${logfiledir}",[where to put log files])
107f9135 56
5ccac21d
MJ
57dbdir="${prefix}/db"
58AC_SUBST(dbdir)
59AC_DEFINE_UNQUOTED([SWITCH_DB_DIR],"${dbdir}",[where to put db files])
60
89ae5f47
MJ
61htdocsdir="${prefix}/htdocs"
62AC_SUBST(htdocsdir)
63AC_DEFINE_UNQUOTED([SWITCH_HTDOCS_DIR],"${htdocsdir}",[where to put htdocs files])
64
d1c60899
MJ
65soundsdir="${prefix}/sounds"
66AC_SUBST(soundsdir)
67AC_DEFINE_UNQUOTED([SWITCH_SOUNDS_DIR],"${soundsdir}",[where to put sounds files])
68
89ae5f47
MJ
69grammardir="${prefix}/grammar"
70AC_SUBST(grammardir)
71AC_DEFINE_UNQUOTED([SWITCH_GRAMMAR_DIR],"${grammardir}",[where to put grammar files])
72
5ccac21d
MJ
73scriptdir="${prefix}/scripts"
74AC_SUBST(scriptdir)
75AC_DEFINE_UNQUOTED([SWITCH_SCRIPT_DIR],"${scriptdir}",[where to put script files])
107f9135 76
c064a2a5
MJ
77recordingsdir="${prefix}/recordings"
78AC_SUBST(recordingsdir)
79AC_DEFINE_UNQUOTED([SWITCH_RECORDINGS_DIR],"${recordingsdir}",[where to put recording files])
80
911e4a09
MJ
81if test "$sysconfdir" = "\${prefix}/etc" ; then
82 confdir="$prefix/conf"
83else
84 confdir="$sysconfdir"
85fi
86
5ccac21d
MJ
87sysconfdir="$confdir"
88
911e4a09 89AC_SUBST(confdir)
7da7790b 90AC_DEFINE_UNQUOTED([SWITCH_CONF_DIR],"${confdir}",[directory for configuration files])
911e4a09 91
8b3f71cc
MJ
92AC_SUBST(libdir)
93AC_SUBST(bindir)
94AC_SUBST(includedir)
95
f20ba4d1 96AC_ARG_WITH([pkgconfigdir],
78472897 97 [AS_HELP_STRING([--with-pkgconfigdir=DIR], [Installation directory for pkgconfig file (default: ${libdir}/pkgconfig)])],
f20ba4d1
SK
98 [case "${withval}" in
99 yes|no) AC_MSG_ERROR([Invalid value ${withval} for option --with-pkgconfigdir]) ;;
100 *) pkgconfigdir="${withval}" ;;
101 esac
102 ],
103 [pkgconfigdir="${libdir}/pkgconfig"]
104)
105AC_SUBST([pkgconfigdir])
106
6bc48b70
MJ
107#Set default language
108AC_LANG_C
4da77ea5
AM
109# Checks for programs.
110AC_PROG_CC
80eec6e5 111AC_PROG_CXX
40f18d30
MJ
112
113#check if the g++ compiler works
114AC_CACHE_CHECK([whether the C++ compiler works], [ac_cv_sys_cxx_works], [
115 AC_LANG_PUSH([C++])
116 AC_COMPILE_IFELSE([int main() { }], [ac_cv_sys_cxx_works=yes],
117 [ac_cv_sys_cxx_works=no])
118 AC_LANG_POP([C++])
119 ])
120[ if [ "x$ac_cv_sys_cxx_works" = "xno" ]; then ]
121 AC_MSG_FAILURE([The C++ compiler does not work. Please (re)install the C++ compiler])
122[ fi ]
123
bac1e3fd 124AC_PROG_AWK
4da77ea5 125AC_PROG_MAKE_SET
4da77ea5 126AC_PROG_INSTALL
3de6a7e9
MJ
127
128#override some default libtool behavior and invoke AC_PROG_LIBTOOL (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html)
129m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
130m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
131m4_defun([_LT_AC_LANG_RC_CONFIG], [:])
5b3f19fb 132AM_PROG_CC_C_O
bac1e3fd 133AC_PROG_LIBTOOL
4da77ea5 134
6bc48b70
MJ
135#Check for compiler vendor
136AX_COMPILER_VENDOR
137
138# Optimize
139AC_ARG_ENABLE(optimization,
140[AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
141
142if test "${enable_optimizer}" = "yes" ; then
143 AC_DEFINE([OPTIMZER],[],[Enable Optimization.])
144 AX_CC_MAXOPT
145fi
146
294b0779
MJ
147AX_PATH_LIBGNUTLS()
148
55b3e6cb 149# set defaults for use on all platforms
3f5c2bed
MJ
150SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
151SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
1953ac5c 152SWITCH_AM_LDFLAGS="-lm"
55b3e6cb
MJ
153
154#set SOLINK variable based on compiler and host
155if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
156 SOLINK="-Bdynamic -dy -G"
157elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
158 case "$host" in
5e7986bf
MJ
159 *darwin10.*)
160 SOLINK="-dynamic -force-flat-namespace"
161 ;;
6ae16d15 162 *darwin*)
55b3e6cb
MJ
163 SOLINK="-dynamic -bundle -force-flat-namespace"
164 ;;
872c349f
MB
165 *-solaris2*)
166 SOLINK="-shared -Xlinker"
167 ;;
55b3e6cb
MJ
168 *)
169 SOLINK="-shared -Xlinker -x"
170 ;;
171 esac
172else
173 AC_ERROR([Please update configure.in with SOLINK values for your compiler])
174fi
6bc48b70 175
55b3e6cb
MJ
176# set DYNAMIC_LIB_EXTEN
177# we should really be using libtool so we don't need to do this
6bc48b70 178case "$host" in
55b3e6cb
MJ
179 *cygwin* | *mingw*)
180 DYNAMIC_LIB_EXTEN="dll"
181 ;;
182 *)
183 DYNAMIC_LIB_EXTEN="so"
184 ;;
6bc48b70 185esac
55b3e6cb 186
4a77854b
SK
187##
188# detect libtool major version,
189# set libtool library extension based on this
190# to work around some brokeness when using 'la' with libtool-1.5
191#
192AC_MSG_CHECKING([libtool major version])
193libtool="${switch_builddir}/libtool"
df33a43a 194LIBTOOL_MAJOR_VERSION="`$libtool --version 2>/dev/null| sed -e 's/([[^)]]*)//g;s/^[[^0-9]]*//;s/[[- ]].*//g;q'| awk 'BEGIN { FS = "." } { print $1 }' `"
0c0a4a53 195if test -z "$LIBTOOL_MAJOR_VERSION" ; then
751c2894 196 LIBTOOL_MAJOR_VERSION="`sed -n -e '/^VERSION/{s/^.*=\"\{0,1\}\([[0-9]]\{1,\}\)\..*/\1/;p;}' ${switch_srcdir}/build/config/ltmain.sh`"
0c0a4a53
SK
197fi
198if test -z "$LIBTOOL_MAJOR_VERSION" ; then
199 AC_MSG_ERROR([Failed to detect your libtool version, please open a bug report on http://jira.freeswitch.org/])
200fi
4a77854b 201AC_MSG_RESULT([${LIBTOOL_MAJOR_VERSION}])
02141e30
MJ
202
203LIBTOOL_LIB_EXTEN="$DYNAMIC_LIB_EXTEN"
204
4a77854b 205if test "${LIBTOOL_MAJOR_VERSION}" = "2" ; then
02141e30
MJ
206 LIBTOOL_LIB_EXTEN="la"
207fi
4a77854b
SK
208AC_MSG_RESULT([using libtool library extension... ${LIBTOOL_LIB_EXTEN}])
209
02141e30 210
0f6a6c31 211# Enable 64 bit build
6d45f5f5 212AC_ARG_ENABLE(64,
0f6a6c31 213[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
6d45f5f5 214
55b3e6cb
MJ
215# tweak compiler specific flags
216if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
217 APR_ADDTO(SWITCH_AM_CFLAGS, -KPIC)
218 APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC)
99913ce3
MJ
219 APR_ADDTO(SWITCH_AM_CFLAGS, -erroff=E_END_OF_LOOP_CODE_NOT_REACHED)
220 APR_ADDTO(SWITCH_AM_CFLAGS, -errtags=yes)
2343708a 221 APR_ADDTO(SWITCH_AM_CFLAGS, -D__FUNCTION__=__func__ )
222 APR_ADDTO(SWITCH_AM_CFLAGS, -mt)
99913ce3 223 APR_ADDTO(SWITCH_AM_CXXFLAGS, -errtags=yes)
514bde18
MJ
224 APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC)
225 APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC)
f32f6f24 226 APR_ADDTO(SWITCH_AM_CXXFLAGS, "-features=extensions")
2343708a 227 APR_ADDTO(SWITCH_AM_CXXFLAGS, -D__FUNCTION__=__func__)
228 APR_ADDTO(SWITCH_AM_CXXFLAGS, -mt)
f32f6f24 229
55b3e6cb 230 APR_ADDTO(SWITCH_AM_LDFLAGS, -R${prefix}/lib)
6d45f5f5
MJ
231 if test "${enable_64}" = "yes"; then
232 APR_ADDTO(SWITCH_AM_CFLAGS, -m64)
5b2d20bf
MJ
233 APR_ADDTO(SWITCH_AM_CXXFLAGS, -m64)
234 APR_ADDTO(SWITCH_AM_LDFLAGS, -m64)
1953ac5c 235 LIBS="$LIBS -m64"
6d45f5f5 236 fi
55b3e6cb
MJ
237elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
238 APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
514bde18 239 APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
44ef8650 240 APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
1953ac5c 241 if test "${enable_64}" = "yes"; then
5e7986bf 242 case "$host" in
7803a752 243 *darwin10.*|*darwin9.*|*darwin8.*)
5e7986bf
MJ
244 APR_ADDTO(CFLAGS, -arch x86_64)
245 APR_ADDTO(LDFLAGS, -arch x86_64)
246 APR_ADDTO(CXXFLAGS, -arch x86_64)
247 ;;
7803a752
MJ
248 *)
249 LIBS="$LIBS -m64"
250 ;;
5e7986bf 251 esac
1953ac5c 252 fi
55b3e6cb
MJ
253fi
254
ffe2ad4b
MJ
255#
256# gcc visibility cflag checks
257#
258AC_ARG_ENABLE([visibility],
259 [AS_HELP_STRING([--disable-visibility], [Disable or enable API visibility support (default: use if available)])],
260 [enable_visibility="${enableval}"],
261 [enable_visibility="detect"]
262)
263HAVE_VISIBILITY="no"
264
265if test "x${enable_visibility}" != "xno" ; then
266
267 case "${ax_cv_c_compiler_vendor}" in
268 gnu)
269 save_CFLAGS="${CFLAGS}"
270 CFLAGS="${CFLAGS} -fvisibility=hidden"
271 AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
272 AC_COMPILE_IFELSE(
273 [AC_LANG_PROGRAM(
274 [int foo __attribute__ ((visibility("default")));],
275 [;]
276 )],
277
278 [AC_MSG_RESULT([yes])
279 APR_ADDTO([SWITCH_AM_CFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
280 APR_ADDTO([SWITCH_AM_CXXFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
281 HAVE_VISIBILITY="yes"],
282
283 [AC_MSG_RESULT([no])]
284 )
285 CFLAGS="${save_CFLAGS}"
286 ;;
287
900907a2 288 sun)
96114867
SK
289 # save_CFLAGS="${CFLAGS}"
290 # CFLAGS="${CFLAGS} -xldscope=hidden"
291 # AC_MSG_CHECKING([whether the compiler supports -xldscope=hidden])
292 # AC_COMPILE_IFELSE(
293 # [AC_LANG_PROGRAM(
294 # [int foo __attribute__ ((visibility("default")));],
295 # [;]
296 # )],
297 #
298 # [AC_MSG_RESULT([yes])
299 # APR_ADDTO([SWITCH_AM_CFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
300 # APR_ADDTO([SWITCH_AM_CXXFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
301 # HAVE_VISIBILITY="yes"],
302 #
303 # [AC_MSG_RESULT([no])]
304 # )
305 # CFLAGS="${save_CFLAGS}"
900907a2
MJ
306 ;;
307
ffe2ad4b
MJ
308 *)
309 if test "x${enable_visibility}" = "xyes" ; then
900907a2 310 AC_MSG_ERROR([Non-GNU / SUN compilers are currently unsupported])
ffe2ad4b 311 else
900907a2 312 AC_MSG_WARN([Non-GNU / SUN compilers are currently unsupported])
ffe2ad4b
MJ
313 fi
314 ;;
315 esac
316
317 #
318 # visibility explicitly requested but not supported by this compiler => error
319 #
320 if test "x${enable_visibility}" = "xyes" -a "x${HAVE_VISIBILITY}" = "xno" ; then
321 AC_MSG_ERROR([API visibility not supported by this compiler])
322 fi
323fi
324
fcd2a7b0
SK
325# Enable debugging (default: on)
326# (rename option if the default is changed)
2faabff7 327AC_ARG_ENABLE(debug,
fcd2a7b0 328[AC_HELP_STRING([--disable-debug],[build without debug information])],[enable_debug="$enableval"],[enable_debug="yes"])
2faabff7
AM
329
330if test "${enable_debug}" = "yes"; then
331 AC_DEFINE([DEBUG],[],[Enable extra debugging.])
554f476c 332 saved_CFLAGS="$CFLAGS"
44ea66c2 333 CFLAGS=
2faabff7 334 AX_CFLAGS_WARN_ALL_ANSI
02c7a3ac 335 SWITCH_ANSI_CFLAGS=$CFLAGS
554f476c 336 CFLAGS="$saved_CFLAGS"
2faabff7
AM
337
338 if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
339 APR_ADDTO(SWITCH_AM_CFLAGS, -g -ggdb)
37845b42 340 export DEBUG_CFLAGS="-g -ggdb"
2faabff7
AM
341 fi
342
343fi
344
59ba5a15
MJ
345AC_ARG_ENABLE(cpp,
346[AC_HELP_STRING([--disable-cpp],[build without cpp code])],[enable_cpp="$enableval"],[enable_cpp="yes"])
347
348AM_CONDITIONAL([ENABLE_CPP],[test "${enable_cpp}" = "yes"])
349
a8b87ffe
AM
350AC_ARG_ENABLE(srtp,
351[AC_HELP_STRING([--disable-srtp],[build without srtp support])],[enable_srtp="$enableval"],[enable_srtp="yes"])
352
353AM_CONDITIONAL([ENABLE_SRTP],[test "${enable_srtp}" = "yes"])
354
861bd209
BW
355AC_ARG_ENABLE(zrtp,
356 [AS_HELP_STRING([--enable-zrtp], [Compile with zrtp Support])],,[enable_zrtp="no"])
357if test "x$enable_zrtp" = "xyes" ; then
554f476c 358 saved_LIBS="$LIBS"
861bd209
BW
359 LIBS="$saved_LIBS -L/usr/local/lib -lbn -lpthread"
360 AC_CHECK_LIB(zrtp, zrtp_init, [has_zrtp="yes"], [has_zrtp="no"])
554f476c 361 LIBS="$saved_LIBS"
861bd209
BW
362 if test "x$has_zrtp" = "xno"; then
363 AC_ERROR([Cannot locate zrtp libraries])
364 fi
365 APR_ADDTO(SWITCH_AM_CFLAGS, -DENABLE_ZRTP)
366fi
ae67ecce 367
c4d13331
MJ
368PA_LIBS=
369
370PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
371if test "x$have_jack" = "xyes" ; then
372PA_LIBS+=$JACK_LIBS
373fi
374
ae67ecce 375AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
1911a262 376if test "x$have_alsa" = "xyes" ; then
c4d13331 377PA_LIBS+=-lasound
ae67ecce 378fi
c4d13331
MJ
379
380AC_SUBST(PA_LIBS)
ae67ecce 381
861bd209
BW
382AM_CONDITIONAL([ENABLE_ZRTP],[test "x$enable_zrtp" != "xno"])
383
a4a52620
SK
384AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
385
cd788c1a
MJ
386AC_ARG_ENABLE(core-odbc-support,
387 [AS_HELP_STRING([--enable-core-odbc-support], [Compile with ODBC Support])],,[enable_core_odbc_support="no"])
388AX_LIB_ODBC
389if test "$ac_cv_found_odbc" = "yes" ; then
390 enable_core_odbc_support="yes"
391fi
392
25c725c2
AM
393
394AC_ARG_ENABLE(timerfd-wrapper,
395[AC_HELP_STRING([--enable-timerfd-wrapper],[timerfd is in the kernel but not in your libc])],[enable_timer_fd_wrapper="$enableval"],[enable_timer_fd_wrapper="no"])
d28b2391
AM
396AM_CONDITIONAL([ENABLE_TIMERFD_WRAPPER],[test "x$enable_timer_fd_wrapper" != "xno"])
397
398
da195caa
MJ
399AC_CHECK_LIB(z, inflateReset, have_libz=yes, have_libz=no)
400if test "x$have_libz" = "xyes" ; then
401APR_ADDTO(SWITCH_AM_LDFLAGS, -lz)
402fi
403
b017931c
MJ
404AC_CHECK_LIB(resolv, res_init, have_libresolv=yes, have_libresolv=no)
405if test "x$have_libresolv" = "xyes" ; then
406APR_ADDTO(SWITCH_AM_LDFLAGS, -lresolv)
407fi
408
3ec59cdb 409ESL_LDFLAGS=
a48da3b4
SK
410PLATFORM_CORE_LDFLAGS=
411PLATFORM_CORE_LIBS=
55b3e6cb
MJ
412# tweak platform specific flags
413case "$host" in
5e7986bf
MJ
414 *darwin10.*)
415 APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
416 APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp)
417 APR_ADDTO(LDFLAGS, -pipe -bind_at_load)
418 APR_ADDTO(CXXFLAGS, -pipe)
419 APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
420 if test "x$enable_core_odbc_support" != "xno"; then
a48da3b4 421 APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
5e7986bf 422 fi
a48da3b4 423 APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
5e7986bf 424 ;;
6ae16d15 425 *darwin*)
55b3e6cb
MJ
426 APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
427 APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
9a9ba4c3 428 if test "x$enable_core_odbc_support" != "xno"; then
a48da3b4 429 APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
9a9ba4c3 430 fi
a48da3b4 431 APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
55b3e6cb
MJ
432 ;;
433 *-solaris2*)
cb1cb69e 434 APR_ADDTO(SWITCH_AM_CFLAGS, -DPATH_MAX=2048 -D__EXTENSIONS__)
54a9eba4 435 APR_ADDTO(SWITCH_AM_LDFLAGS, -lsendfile -lresolv -lsocket -lnsl -luuid)
bb33c4e7 436 APR_ADDTO(ESL_LDFLAGS, -lnsl -lsocket)
a48da3b4 437 APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt -lsendfile -lresolv -lsocket -lnsl -luuid])
55b3e6cb 438 ;;
f0b58efb
MJ
439 *bsd*)
440 APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
a48da3b4
SK
441 APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
442 ;;
443 *linux*)
444 APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
f0b58efb 445 ;;
55b3e6cb
MJ
446esac
447
514bde18
MJ
448APR_REMOVEFROM(SWITCH_AM_CXXFLAGS, -std=c99)
449
55b3e6cb 450AC_SUBST(SWITCH_AM_CFLAGS)
02c7a3ac 451AC_SUBST(SWITCH_ANSI_CFLAGS)
514bde18 452AC_SUBST(SWITCH_AM_CXXFLAGS)
55b3e6cb 453AC_SUBST(SWITCH_AM_LDFLAGS)
3ec59cdb 454AC_SUBST(ESL_LDFLAGS)
a48da3b4
SK
455AC_SUBST(PLATFORM_CORE_LDFLAGS)
456AC_SUBST(PLATFORM_CORE_LIBS)
6bc48b70
MJ
457AC_SUBST(SOLINK)
458AC_SUBST(DYNAMIC_LIB_EXTEN)
02141e30 459AC_SUBST(LIBTOOL_LIB_EXTEN)
6bc48b70 460
4da77ea5
AM
461# Checks for header files.
462AC_HEADER_DIRENT
463AC_HEADER_STDC
286362ca 464AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h netdb.h execinfo.h])
56008e2b
AM
465
466# for xmlrpc-c config.h
467if test x"$ac_cv_header_wchar_h" = xyes; then
468 HAVE_WCHAR_H_DEFINE=1
469else
470 HAVE_WCHAR_H_DEFINE=0
471fi
472AC_SUBST(HAVE_WCHAR_H_DEFINE)
4da77ea5
AM
473
474# Checks for typedefs, structures, and compiler characteristics.
475AC_C_CONST
476AC_C_INLINE
477AC_TYPE_SIZE_T
478AC_HEADER_TIME
479AC_STRUCT_TM
480
481# Checks for library functions.
482AC_PROG_GCC_TRADITIONAL
483AC_FUNC_MALLOC
484AC_TYPE_SIGNAL
485AC_FUNC_STRFTIME
910f5364 486AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep getifaddrs timerfd_create getdtablesize])
ea5c0c21 487AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups])
4062b636 488AC_CHECK_FUNCS([wcsncmp setgroups asprintf setenv pselect gettimeofday localtime_r gmtime_r strcasecmp stricmp _stricmp])
b382c0a4 489
ea5c0c21
MJ
490AX_HAVE_CPU_SET
491
eb9f9fb2 492AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])])
d314f254 493AC_CHECK_LIB(rt, clock_getres, [AC_DEFINE(HAVE_CLOCK_GETRES, 1, [Define if you have clock_getres()])])
eb9f9fb2 494AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
4062b636 495AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
eb9f9fb2 496
bf988471 497AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
21159328
MJ
498#include <sys/types.h>
499#include <time.h>])
500
bf988471 501AC_CHECK_MEMBERS([struct tm.tm_zone],,,[
21159328
MJ
502#include <sys/types.h>
503#include <time.h>])
504
b382c0a4
MJ
505AC_CHECK_DECL([RLIMIT_MEMLOCK],
506 [AC_DEFINE([HAVE_RLIMIT_MEMLOCK],[1],[RLIMIT_MEMLOCK constant for setrlimit])],,
507 [#ifdef HAVE_SYS_RESOURCE_H
508 #include <sys/resource.h>
509 #endif])
510
511AC_CHECK_DECL([SCHED_RR],
512 [AC_DEFINE([HAVE_SCHED_RR],[1],[SCHED_RR constant for sched_setscheduler])],,
513 [#ifdef HAVE_SCHED_H
514 #include <sched.h>
515 #endif])
516
517#
518# use mlockall only on linux (for now; if available)
519#
520if test "x${ac_cv_func_mlockall}" = "xyes"; then
521 AC_MSG_CHECKING([whether to use mlockall])
522 case "$host" in
523 *-linux-*)
524 AC_DEFINE([USE_MLOCKALL],[1],[Enable mlockall support])
525 AC_MSG_RESULT([yes])
526 USE_MLOCKALL=yes
527 ;;
528 *-freebsd*)
529 AC_MSG_RESULT([no, broken for non-root users])
530 ;;
531 *)
532 AC_MSG_RESULT([no])
533 ;;
534 esac
535
536 #
537 # setrlimit prerequisites
538 #
539 if test "x${USE_MLOCKALL}" = "xyes" -a \
540 "x${ac_cv_func_setrlimit}" = "xyes" -a \
541 "x${ac_cv_have_decl_RLIMIT_MEMLOCK}" = "xyes"
542 then
543 AC_DEFINE([USE_SETRLIMIT],[1],[Use setrlimit to disable mlock limit for non-root users])
544 fi
545fi
546
547#
548# sched_setcheduler + round-robin scheduler prerequisites
549#
550if test "x${ac_cv_func_sched_setscheduler}" = "xyes" -a \
551 "x${ac_cv_have_decl_SCHED_RR}" = "xyes"
552then
553 AC_DEFINE([USE_SCHED_SETSCHEDULER],[1],[Enable round-robin scheduler using sched_setscheduler])
554fi
555
4062b636
AM
556#
557# xmlrpc-c checks
558#
559
560
561HAVE_LIBWWW_SSL_DEFINE=0
562AC_SUBST(HAVE_LIBWWW_SSL_DEFINE)
563
564DIRECTORY_SEPARATOR="/"
565AC_SUBST(DIRECTORY_SEPARATOR)
566
567va_list_is_array=no
568AC_MSG_CHECKING(whether va_list is an array)
569AC_TRY_COMPILE([
570#include <stdarg.h>
571], [va_list list1, list2; list1 = list2;], ,
572va_list_is_array=yes)
573AC_MSG_RESULT($va_list_is_array)
574if test x"$va_list_is_array" = xyes; then
575 VA_LIST_IS_ARRAY_DEFINE=1
576else
577 VA_LIST_IS_ARRAY_DEFINE=0
578fi
579AC_SUBST(VA_LIST_IS_ARRAY_DEFINE)
580
554f476c 581
4062b636
AM
582AC_MSG_CHECKING(whether compiler has __attribute__)
583AC_TRY_COMPILE(, [int x __attribute__((__unused__));],
584compiler_has_attribute=yes,
585compiler_has_attribute=no)
586AC_MSG_RESULT($compiler_has_attribute)
587if test x"$compiler_has_attribute" = xyes; then
588 ATTR_UNUSED="__attribute__((__unused__))"
589else
590 ATTR_UNUSED=
591fi
592AC_SUBST(ATTR_UNUSED)
593
594
554f476c
MJ
595saved_CFLAGS="$CFLAGS"
596AC_CACHE_CHECK([whether compiler supports -Wdeclaration-after-statement], [ac_cv_gcc_declaration_after_statement], [
597CFLAGS="$CFLAGS -Wdeclaration-after-statement"
598AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_declaration_after_statement=yes],[ac_cv_gcc_declaration_after_statement=no])
599])
600AC_MSG_RESULT($ac_cv_gcc_declaration_after_statement)
601if test x"$ac_cv_gcc_declaration_after_statement" = xyes; then
602 APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wdeclaration-after-statement)
603fi
604CFLAGS="$saved_CFLAGS"
4da77ea5 605
eb8ff5a0
MOC
606# Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready
607# Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_dingaling mod_opal mod_skypopen mod_h323 mod_khomp
608# mod_unimrcp mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed
609#
610#saved_CFLAGS="$CFLAGS"
611#AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [
612#CFLAGS="$CFLAGS -Wunused-but-set-variable"
613#AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_unused_but_set_variable=yes],[ac_cv_gcc_unused_but_set_variable=no])
614#])
615#AC_MSG_RESULT($ac_cv_gcc_unused_but_set_variable)
616#if test x"$ac_cv_gcc_unused_but_set_variable" = xyes; then
617# APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wunused-but-set-variable)
618#fi
619#CFLAGS="$saved_CFLAGS"
f952719e 620
44cc7d5c 621AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
49a0eb29 622
42e78242
MJ
623# Checks for integer size
624AC_CHECK_SIZEOF(char, 1)
625AC_CHECK_SIZEOF(int, 4)
626AC_CHECK_SIZEOF(long, 4)
627AC_CHECK_SIZEOF(short, 2)
628AC_CHECK_SIZEOF(long long, 8)
629AC_TYPE_SIZE_T
630AC_CHECK_TYPE(ssize_t, int)
631
632# Checks for pointer size
633AC_CHECK_SIZEOF(void*, 4)
634
635if test "x$ac_cv_sizeof_voidp" != "x"; then
636 voidp_size=$ac_cv_sizeof_voidp
637else
638 AC_ERROR([Cannot determine size of void*])
639fi
640
641if test "$ac_cv_sizeof_short" = "2"; then
642 short_value=short
643fi
644if test "$ac_cv_sizeof_int" = "4"; then
645 int_value=int
646fi
647
648if test "$ac_cv_sizeof_int" = "8"; then
649 int64_t_fmt='#define SWITCH_INT64_T_FMT "d"'
650 uint64_t_fmt='#define SWITCH_UINT64_T_FMT "u"'
651 int64_value="int"
652 long_value=int
653elif test "$ac_cv_sizeof_long" = "8"; then
654 int64_t_fmt='#define SWITCH_INT64_T_FMT "ld"'
655 uint64_t_fmt='#define SWITCH_UINT64_T_FMT "lu"'
656 int64_value="long"
657 long_value=long
764b7958 658 case "$host" in
f6fe2667 659 *-solaris2*|*apple-darwin*|*-openbsd*)
764b7958
MJ
660 if test "$ac_cv_sizeof_long_long" = "8"; then
661 int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"'
662 uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"'
663 int64_value="long long"
664 long_value="long long"
665 fi
666 ;;
667 esac
42e78242
MJ
668elif test "$ac_cv_sizeof_long_long" = "8"; then
669 int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"'
670 uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"'
671 int64_value="long long"
672 long_value="long long"
673elif test "$ac_cv_sizeof_longlong" = "8"; then
674 int64_t_fmt='#define SWITCH_INT64_T_FMT "qd"'
675 uint64_t_fmt='#define SWITCH_UINT64_T_FMT "qu"'
676 int64_value="__int64"
677 long_value="__int64"
678else
679 AC_ERROR([could not detect a 64-bit integer type])
680fi
681
682if test "$ac_cv_type_size_t" = "yes"; then
683 size_t_value="size_t"
684else
685 size_t_value="switch_int32_t"
686fi
687
688if test "$ac_cv_type_ssize_t" = "yes"; then
689 ssize_t_value="ssize_t"
690else
691 ssize_t_value="switch_int32_t"
692fi
693
694APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
695
696if test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then
697 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"'
698elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then
699 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
700else
701 ssize_t_fmt='#error Can not determine the proper size for ssize_t'
702fi
703
704APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
705
706if test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then
707 size_t_fmt='#define SWITCH_SIZE_T_FMT "d"'
708elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then
709 size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
710else
d90bac38 711 size_t_fmt='#define SWITCH_SIZE_T_FMT "zu"'
42e78242
MJ
712fi
713
714# Basically, we have tried to figure out the correct format strings
715# for SWITCH types which vary between platforms, but we don't always get
716# it right. If you find that we don't get it right for your platform,
717# you can override our decision below.
718# NOTE: borrowed much of this logic from apr.
719case $host in
720 s390*linux*)
721 # uniquely, the 31-bit Linux/s390 uses "unsigned long int"
722 # for size_t rather than "unsigned int":
723 size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
724 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
725 ;;
726 *-os2*)
727 size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
728 ;;
6d66ecfd
MJ
729 *-openbsd*)
730 size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
731 ;;
42e78242
MJ
732 *aix4*|*aix5*)
733 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
734 size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
735 ;;
736 *beos*)
737 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
738 size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
739 ;;
740 *apple-darwin*)
741 osver=`uname -r`
742 case $osver in
743 [0-7].*)
744 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"'
745 ;;
746 *)
747 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
748 ;;
749 esac
750 size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
751 ;;
752esac
753
754AC_SUBST(voidp_size)
755AC_SUBST(short_value)
756AC_SUBST(int_value)
757AC_SUBST(long_value)
758AC_SUBST(int64_value)
759AC_SUBST(size_t_value)
760AC_SUBST(ssize_t_value)
761AC_SUBST(int64_t_fmt)
762AC_SUBST(uint64_t_fmt)
763AC_SUBST(ssize_t_fmt)
764AC_SUBST(size_t_fmt)
42e78242 765
f6fe2667
MJ
766case $host in
767 *-openbsd*)
768 # OpenBSD's gunzip and friends don't like -d because its redundant, only gzip does
769 AC_PATH_PROGS(ZCAT, gzip)
770 ;;
771 *)
772 AC_PATH_PROGS(ZCAT, gunzip gzcat gzip zcat)
773 ;;
774esac
775
50328a66
TC
776AC_PATH_PROGS(BZIP, bzip2)
777AC_PATH_PROGS(XZ, xz)
bc34fb76
MJ
778AC_PATH_PROGS(TAR, gtar tar)
779AC_PATH_PROGS(WGET, wget)
780AC_PATH_PROGS(CURL, curl)
d2cf7f86 781GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_builddir/build/getlib.sh"
c99d8c9b 782AC_SUBST(GETLIB)
17d52112
MJ
783GETG729="cd $switch_srcdir/libs && ${SHELL} $switch_builddir/build/getg729.sh"
784AC_SUBST(GETG729)
d2cf7f86 785GETSOUNDS="${SHELL} $switch_builddir/build/getsounds.sh"
3d5fcabe 786AC_SUBST(GETSOUNDS)
c99d8c9b 787
bc34fb76 788
493fc648
MJ
789LIBCURL_DEPS=
790
791AC_ARG_WITH(libcurl,
792 AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]),
793 [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])])
794
e704f021
MP
795AC_CACHE_CHECK([whether to use system libcurl library], [ac_cv_use_system_curl], [
796 LIBCURL_CHECK_CONFIG([yes], [7.13.0], [ac_cv_use_system_curl='yes'], [ac_cv_use_system_curl='no'])
797])
798
493fc648
MJ
799if test "$_libcurl_with" = "no" ; then
800 ac_cv_use_system_curl=no;
801fi
802if test "$_libcurl_with" = "yes" ; then
803 ac_cv_use_system_curl=yes;
804fi
805
493fc648
MJ
806if test "$ac_cv_use_system_curl" != "yes" ; then
807 LIBCURL_DEPS='${switch_builddir}/libs/curl/lib/libcurl.la'
808 LIBCURL='${switch_builddir}/libs/curl/lib/libcurl.la'
809 LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include'
810fi
811
f85be6ff
MJ
812AC_SUBST(LIBCURL_DEPS)
813
4d62a1ad 814
c5c13c26 815AC_ARG_ENABLE(core-libedit-support,
2bcd991b 816 [AS_HELP_STRING([--disable-core-libedit-support], [Compile without libedit Support])], [enable_core_libedit_support="$enableval"], [enable_core_libedit_support="yes"])
c5c13c26 817
28213aad
AM
818if test "$enable_core_libedit_support" = "yes" ; then
819 AC_CHECK_LIB(ncurses, tgetent,,
820 [AC_CHECK_LIB(curses, tgetent,,
821 [AC_MSG_ERROR([libtermcap, libcurses or libncurses are required!])] )] )
822fi
823
219a2ecc
AT
824SAC_OPENSSL
825
9d6d8a1c
AT
826if test x$HAVE_OPENSSL = x1; then
827 openssl_CFLAGS="$openssl_CFLAGS -DHAVE_OPENSSL";
1d18b58b 828 APR_ADDTO(SWITCH_AM_CFLAGS, -DHAVE_OPENSSL)
9d6d8a1c
AT
829fi
830
e69fe7e3 831AX_CHECK_JAVA
7df787b7 832
753fa8fb 833
31b743d6
MJ
834AM_CONDITIONAL([HAVE_ODBC],[test "x$enable_core_odbc_support" != "xno"])
835AM_CONDITIONAL([HAVE_LIBEDIT],[test "x$enable_core_libedit_support" != "xno"])
778a82cc 836AM_CONDITIONAL([HAVE_MYSQL],[test "$found_mysql" = "yes"])
49a0eb29 837
e8c88aa1
SK
838#
839# Python checks for mod_python
840#
841AC_ARG_WITH(
842 [python],
843 [AS_HELP_STRING([--with-python], [Use system provided version of python (default: try)])],
844 [with_python="$withval"],
845 [with_python="try"]
846)
847
e8c88aa1
SK
848if test "$with_python" != "no"
849then
2d14539e
SK
850 save_CFLAGS="$CFLAGS"
851 save_LIBS="$LIBS"
852
e8c88aa1
SK
853 if test "$with_python" != "yes" -a "$with_python" != "try" ; then
854 AC_MSG_CHECKING([for python])
855 if test ! -x "$with_python" ; then
856 AC_MSG_ERROR([Specified python does not exist or is not executable: $with_python])
857 fi
858 AC_MSG_RESULT([$with_python])
859 AC_SUBST([PYTHON], ["$with_python"])
860 else
861 AC_PATH_PROG([PYTHON], ["python"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"])
862 fi
863
864 if test "$PYTHON" != "no" ; then
865 AC_MSG_CHECKING([python version])
866 PYTHON_VER="`$PYTHON -V 2>&1 | cut -d' ' -f2`"
867
868 if test -z "$PYTHON_VER" ; then
869 AC_MSG_ERROR([Unable to detect python version])
870 fi
871 AC_MSG_RESULT([$PYTHON_VER])
872
2d14539e 873 AC_MSG_CHECKING([for python distutils])
baf944eb
SK
874 python_result="`$PYTHON -c 'import distutils;' 2>&1`"
875 if test -z "$python_result" ; then
2d14539e 876 python_has_distutils="yes"
baf944eb
SK
877 else
878 python_has_distutils="no"
2d14539e
SK
879 fi
880 AC_MSG_RESULT([$python_has_distutils])
881
baf944eb 882 if test "$python_has_distutils" != "no" ; then
f08ac862
SK
883 AC_MSG_CHECKING([location of site-packages])
884
83680470 885 PYTHON_SITE_DIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0));'`"
f08ac862
SK
886
887 if test -z "$PYTHON_SITE_DIR" ; then
888 AC_MSG_ERROR([Unable to detect python site-packages path])
889 elif test ! -d "$PYTHON_SITE_DIR" ; then
890 AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!])
891 fi
892 AC_MSG_RESULT([$PYTHON_SITE_DIR])
893 AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR])
894
2d14539e
SK
895 #
896 # python distutils found, get settings from python directly
897 #
83680470
SK
898 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));'`"
899 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));'`"
900 PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print(\"python\" + sysconfig.get_config_var(\"VERSION\"));'`"
901 PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`"
ba892c27
SK
902
903 # handle python being installed into /usr/local
904 AC_MSG_CHECKING([python libdir])
905 if test -z "`echo $PYTHON_LIBDIR | grep "/usr/lib"`" ; then
906 PYTHON_LDFLAGS="-L$PYTHON_LIBDIR $PYTHON_LDFLAGS"
907 LIBS="-L$PYTHON_LIBDIR $LIBS"
908 fi
909 AC_MSG_RESULT([$PYTHON_LIBDIR])
e8c88aa1 910
2d14539e
SK
911 # check libpython
912 AC_CHECK_LIB([$PYTHON_LIB], [main], [has_libpython="yes"], [has_libpython="no"])
913
914 if test "$has_libpython" = "no" ; then
915 AS_IF([test "$with_python" = "try"],
916 [AC_MSG_WARN([$PYTHON_LIB is unusable])],
917 [AC_MSG_ERROR([$PYTHON_LIB is unusable])]
918 )
919 fi
e8c88aa1
SK
920
921 # check whether system libpython is usable and has threads support
2d14539e 922 CFLAGS="$PYTHON_CFLAGS"
e8c88aa1
SK
923 LIBS="$PYTHON_LDFLAGS"
924 AC_CHECK_FUNC([PyThread_init_thread], [python_has_threads="yes"], [python_has_threads="no"])
e8c88aa1 925
2d14539e
SK
926 if test "$python_has_threads" = "no"; then
927 AS_IF([test "$with_python" = "try"],
928 [AC_MSG_WARN([Your python lacks threads support, can not build mod_python])],
929 [AC_MSG_ERROR([Your python lacks threads support, can not build mod_python])]
930 )
e8c88aa1
SK
931 else
932 AC_MSG_NOTICE([Your python seems OK, do not forget to enable mod_python in modules.conf])
2d14539e 933 AC_SUBST([PYTHON_CFLAGS], [$PYTHON_CFLAGS])
e8c88aa1
SK
934 AC_SUBST([PYTHON_LDFLAGS], [$PYTHON_LDFLAGS])
935 fi
936 else
2d14539e 937 AS_IF([test "$with_python" = "try"],
baf944eb
SK
938 [AC_MSG_WARN([Could not find or use python distutils module: $python_result])],
939 [AC_MSG_ERROR([Could not find or use python distutils module: $python_result])]
2d14539e 940 )
e8c88aa1
SK
941 fi
942
2d14539e
SK
943 LIBS="$save_LIBS"
944 CFLAGS="$save_CFLAGS"
945
946 unset python_has_threads
947 unset python_has_distutils
baf944eb 948 unset python_result
2d14539e
SK
949 else
950 AS_IF([test "$with_python" = "try"],
951 [AC_MSG_WARN([Could not find python, mod_python will not build, use --with-python to specify the location])],
952 [AC_MSG_ERROR([Could not find python, use --with-python to specify the location])]
953 )
e8c88aa1
SK
954 fi
955else
956 AC_MSG_WARN([python support disabled, building mod_python will fail!])
957fi
958
ea0316b8
AT
959CHECK_ERLANG
960
42e78242 961AC_CONFIG_FILES([Makefile
7b3d3f7e
AM
962 build/Makefile
963 src/Makefile
964 src/mod/Makefile
aad61cad 965 src/mod/applications/mod_expr/Makefile
7b3d3f7e 966 src/mod/applications/mod_fax/Makefile
fa9a59a8 967 src/mod/applications/mod_spandsp/Makefile
dc06a039 968 src/mod/applications/mod_osp/Makefile
ea181ca4 969 src/mod/applications/mod_stress/Makefile
a31222ac 970 src/mod/applications/mod_hash/Makefile
17d52112 971 src/mod/codecs/mod_com_g729/Makefile
59472c23 972 src/mod/endpoints/mod_portaudio/Makefile
ad4eb5e0 973 src/mod/endpoints/mod_skinny/Makefile
99e55ae0 974 src/mod/endpoints/mod_skypopen/Makefile
7b3d3f7e 975 src/mod/endpoints/mod_sofia/Makefile
59472c23 976 src/mod/formats/mod_portaudio_stream/Makefile
7b3d3f7e
AM
977 src/mod/asr_tts/mod_unimrcp/Makefile
978 src/mod/languages/mod_java/Makefile
9b8392bc 979 src/mod/languages/mod_lua/Makefile
7b3d3f7e 980 src/mod/languages/mod_python/Makefile
0c1ae13d 981 src/mod/languages/mod_spidermonkey/Makefile
7b3d3f7e
AM
982 src/mod/event_handlers/mod_erlang_event/Makefile
983 src/include/switch_am_config.h
984 build/getsounds.sh
985 build/getlib.sh
17d52112 986 build/getg729.sh
68b58406 987 build/freeswitch.pc
7b3d3f7e
AM
988 build/modmake.rules
989 libs/xmlrpc-c/include/xmlrpc-c/config.h
990 libs/xmlrpc-c/xmlrpc_config.h
991 scripts/gentls_cert])
4da77ea5 992
a6e9f279 993AM_CONDITIONAL(ISLINUX, [test `uname -s` = Linux])
db399276 994AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin])
a092a55a 995AM_CONDITIONAL(IS64BITLINUX, [test `uname -m` = x86_64])
a6e9f279 996
c7753b06
MJ
997#some vars to sub into the Makefile.am's
998#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
999LIBTOOL='`if test -z "$(VERBOSE)" ; then echo $(SHELL) $(switch_builddir)/quiet_libtool ;else echo $(switch_builddir)/libtool; fi;`'
1000TOUCH_TARGET='if test -f "$@";then touch "$@";fi;'
afe7d97f 1001CONF_MODULES='$$(grep -v "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" | sort | uniq )'
b9f2bdfb 1002CONF_DISABLED_MODULES='$$(grep "\#" $(switch_builddir)/modules.conf | grep -v "\#\#" | sed -e "s|^.*/||" | sort | uniq )'
afe7d97f
MJ
1003OUR_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 )'
1004OUR_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 )'
1005OUR_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 )'
1006OUR_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 )'
1007OUR_DISABLED_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-all ; done )"; echo $$mods )'
1008OUR_DISABLED_CLEAN_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-clean ; done )"; echo $$mods )'
1009OUR_DISABLED_INSTALL_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-install ; done)"; echo $$mods )'
1010OUR_DISABLED_UNINSTALL_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-uninstall ; done)"; echo $$mods )'
ed960392
AM
1011
1012AM_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 1013#AM_MAKEFLAGS='`test -n "$(VERBOSE)" || echo -s`'
c7753b06
MJ
1014AC_SUBST(LIBTOOL)
1015AC_SUBST(TOUCH_TARGET)
ed960392 1016AC_SUBST(CONF_DISABLED_MODULES)
5f053e18 1017AC_SUBST(CONF_MODULES)
ed960392 1018
5f053e18
MJ
1019AC_SUBST(OUR_MODS)
1020AC_SUBST(OUR_CLEAN_MODS)
1021AC_SUBST(OUR_INSTALL_MODS)
1022AC_SUBST(OUR_UNINSTALL_MODS)
ed960392
AM
1023AC_SUBST(OUR_DISABLED_MODS)
1024AC_SUBST(OUR_DISABLED_CLEAN_MODS)
1025AC_SUBST(OUR_DISABLED_INSTALL_MODS)
1026AC_SUBST(OUR_DISABLED_UNINSTALL_MODS)
c7753b06
MJ
1027AC_SUBST(AM_MAKEFLAGS)
1028
74fd6fb6 1029ac_configure_args="$ac_configure_args CONFIGURE_CFLAGS='$CFLAGS' CONFIGURE_CXXFLAGS='$CXXFLAGS' CONFIGURE_LDFLAGS='$LDFLAGS' "
452b0bde 1030
40ff9a41
MJ
1031# --prefix='$prefix' --exec_prefix='$exec_prefix' --libdir='$libdir' --libexecdir='$libexecdir' --bindir='$bindir' --sbindir='$sbindir' \
1032# --localstatedir='$localstatedir' --datadir='$datadir'"
8f9ab613 1033
46f6981d 1034# Run configure in all the subdirs
5ccac21d
MJ
1035AC_CONFIG_SUBDIRS([libs/srtp])
1036AC_CONFIG_SUBDIRS([libs/sqlite])
99b12efe 1037if test "$enable_core_libedit_support" = "yes" ; then
5ccac21d
MJ
1038 AC_CONFIG_SUBDIRS([libs/libedit])
1039fi
1040
1041AC_CONFIG_SUBDIRS([libs/pcre])
1042AC_CONFIG_SUBDIRS([libs/apr])
1043AC_CONFIG_SUBDIRS([libs/apr-util])
1044AC_CONFIG_SUBDIRS([libs/ilbc])
493fc648
MJ
1045
1046if test "$ac_cv_use_system_curl" != "yes" ; then
1047 AC_CONFIG_SUBDIRS([libs/curl])
1048fi
5ccac21d
MJ
1049AC_CONFIG_SUBDIRS([libs/iksemel])
1050AC_CONFIG_SUBDIRS([libs/js/nsprpub])
1051AC_CONFIG_SUBDIRS([libs/js])
1052AC_CONFIG_SUBDIRS([libs/libdingaling])
1053AC_CONFIG_SUBDIRS([libs/libsndfile])
1054AC_CONFIG_SUBDIRS([libs/sofia-sip])
1055AC_CONFIG_SUBDIRS([libs/speex])
1056AC_CONFIG_SUBDIRS([libs/portaudio])
1057AC_CONFIG_SUBDIRS([libs/openzap])
8aebc016 1058AC_CONFIG_SUBDIRS([libs/freetdm])
5ccac21d
MJ
1059AC_CONFIG_SUBDIRS([libs/unimrcp])
1060AC_CONFIG_SUBDIRS([libs/tiff-3.8.2])
1061AC_CONFIG_SUBDIRS([libs/spandsp])
1062AC_CONFIG_SUBDIRS([libs/broadvoice])
1063AC_CONFIG_SUBDIRS([libs/libg722_1])
d1095058 1064AC_CONFIG_SUBDIRS([libs/silk])
62b55523 1065AC_CONFIG_SUBDIRS([libs/libcodec2])
ee3fc89f 1066
f6fe2667
MJ
1067case $host in
1068 *-openbsd*)
1069 # libtool won't link static libs against shared ones on OpenBSD unless we tell it not to be stupid
1070 AC_CONFIG_COMMANDS([hacklibtool], [cp libtool libtool.orig && sed -e "s/deplibs_check_method=.*/deplibs_check_method=pass_all/g" libtool.orig > libtool])
1071 ;;
1072esac
1073
1074
6e81dda1 1075AC_OUTPUT
5ccac21d 1076
1ed00b4d
BW
1077##
1078## Registering for ClueCon
1079##
17d52112 1080if ! test -f noreg ; then
1ed00b4d
BW
1081echo ""
1082echo ""
1083echo $ECHO_N "Registering you for ClueCon http://www.cluecon.com $ECHO_C" 1>&6
82f77413 1084sleep 1
1ed00b4d 1085echo $ECHO_N ".$ECHO_C" 1>&6
82f77413 1086sleep 1
1ed00b4d 1087echo $ECHO_N ".$ECHO_C" 1>&6
82f77413 1088sleep 1
1ed00b4d 1089echo $ECHO_N ".$ECHO_C" 1>&6
82f77413 1090sleep 1
1ed00b4d 1091echo $ECHO_N ".$ECHO_C" 1>&6
82f77413 1092sleep 1
61172345 1093echo $ECHO_N ".$ECHO_C" 1>&6
82f77413 1094sleep 1
1ed00b4d 1095AC_MSG_RESULT([ See you in August. ;-)])
82f77413 1096sleep 2
1ed00b4d 1097echo ""
17d52112 1098fi
1ed00b4d 1099
5ccac21d
MJ
1100##
1101## Configuration summary
1102##
1103
1104echo
8912b80e 1105echo "-------------------------- FreeSWITCH configuration --------------------------"
5ccac21d
MJ
1106echo ""
1107echo " Locations:"
1108echo " Selected layout: ${layout_name}"
1109echo ""
1110echo " prefix: ${prefix}"
1111echo " exec_prefix: ${exec_prefix}"
1112echo " bindir: ${bindir}"
1113echo " libdir: ${libdir}"
1114echo " modulesdir: ${modulesdir}"
1115echo " sysconfdir: ${sysconfdir}"
1116echo " runtimedir: ${runtimedir}"
1117echo " logfiledir: ${logfiledir}"
1118echo ""
8912b80e 1119echo "------------------------------------------------------------------------------"