]> git.ipfire.org Git - thirdparty/freeswitch.git/blame - configure.ac
force sofia rebuild
[thirdparty/freeswitch.git] / configure.ac
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
4b6c08b3 6AC_INIT([freeswitch], [1.5.11b], bugs@freeswitch.org)
8ef2aa54 7AC_SUBST(SWITCH_VERSION_MAJOR, [1])
308a8396 8AC_SUBST(SWITCH_VERSION_MINOR, [5])
4b6c08b3 9AC_SUBST(SWITCH_VERSION_MICRO, [11b])
a330febb
KR
10AC_SUBST(SWITCH_VERSION_REVISION, [])
11AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
8ef2aa54
MJ
12
13AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
7a5bc3b7 14
e8b9a4f7 15AC_CONFIG_AUX_DIR(build/config)
2513388d 16AM_INIT_AUTOMAKE
b324e263 17m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
4da77ea5 18AC_CONFIG_SRCDIR([src/switch.c])
42e78242 19AC_CONFIG_HEADER([src/include/switch_private.h])
4062b636 20AC_CONFIG_HEADER([libs/xmlrpc-c/xmlrpc_amconfig.h])
42e78242 21
a642381f 22AC_PREFIX_DEFAULT(/usr/local/freeswitch)
94206d80
MJ
23# AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script
24if test "x$prefix" = "xNONE" ; then
25 prefix='/usr/local/freeswitch'
26fi
55b3e6cb 27
31d1e20f
BW
28AC_CANONICAL_HOST
29
55b3e6cb
MJ
30# Absolute source/build directory
31switch_srcdir=`(cd $srcdir && pwd)`
32switch_builddir=`pwd`
33AC_SUBST(switch_srcdir)
34AC_SUBST(switch_builddir)
35
f5ecbc84
TC
36# Whether to follow FHS
37AC_ARG_ENABLE([fhs],
38 [AS_HELP_STRING([--enable-fhs],
39 [Follow the FHS when placing files and directories])],,
40 [enable_fhs="no"])
41AM_CONDITIONAL([ENABLE_FHS],[test "${enable_fhs}" = "yes"])
1481d37f 42
88aa159b
MJ
43if test "$localstatedir" = "\${prefix}/var" ; then
44 rundir="$prefix/run"
7ae3f5b7 45 logdir="${prefix}/log"
88aa159b
MJ
46else
47 rundir="$localstatedir/run/freeswitch"
7ae3f5b7 48 logdir="$localstatedir/log/freeswitch"
88aa159b 49fi
f5ecbc84
TC
50
51default_certsdir="$prefix/certs"
52default_dbdir="$prefix/db"
53default_grammardir="$prefix/grammar"
54default_htdocsdir="$prefix/htdocs"
55default_logfiledir="$logdir"
56default_modulesdir="$prefix/mod"
57default_pkgconfigdir="$libdir/pkgconfig"
58default_recordingsdir="$prefix/recordings"
59default_runtimedir="$rundir"
60default_scriptdir="$prefix/scripts"
61default_soundsdir="$prefix/sounds"
62default_storagedir="$prefix/storage"
63
64if test "$enable_fhs" = yes; then
b04bbc6c
TC
65 prefix="/usr" exec_prefix="$prefix"
66 libdir="$(eval echo "$libdir")"
ab350968 67 sysconfdir="/etc/freeswitch"
f5ecbc84
TC
68 localstatedir="/var"
69 default_certsdir="/etc/freeswitch/tls"
70 default_dbdir="/var/lib/freeswitch/db"
71 default_grammardir="/usr/share/freeswitch/grammar"
72 default_htdocsdir="/usr/share/freeswitch/htdocs"
73 default_logfiledir="/var/log/freeswitch"
74 default_modulesdir="$libdir/freeswitch/mod"
75 default_pkgconfigdir="$libdir/pkgconfig"
76 default_recordingsdir="/var/lib/freeswitch/recordings"
77 default_runtimedir="/var/run/freeswitch"
78 default_scriptdir="/usr/share/freeswitch/scripts"
79 default_soundsdir="/usr/share/freeswitch/sounds"
80 default_storagedir="/var/lib/freeswitch/storage"
81fi
82
83# Where to install the modules
84AC_ARG_WITH([modinstdir],
85 [AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modulesdir="$withval"], [modulesdir="${default_modulesdir}"])
86AC_SUBST(modulesdir)
87AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modulesdir}",[where to install the modules to])
88
107f9135
MJ
89# Where to put pidfile
90AC_ARG_WITH([rundir],
f5ecbc84 91 [AS_HELP_STRING([--with-rundir=DIR], [Put pidfile into this location (default: $prefix/run)])], [runtimedir="$withval"], [runtimedir="${default_runtimedir}"])
5ccac21d
MJ
92AC_SUBST(runtimedir)
93AC_DEFINE_UNQUOTED([SWITCH_RUN_DIR],"${runtimedir}",[where to put pidfile to])
94
7ae3f5b7 95AC_ARG_WITH([logfiledir],
f5ecbc84 96 [AS_HELP_STRING([--with-logfiledir=DIR], [Put logfiles into this location (default: $localstatedir/log)])], [logfiledir="$withval"], [logfiledir="${default_logfiledir}"])
5ccac21d
MJ
97AC_SUBST(logfiledir)
98AC_DEFINE_UNQUOTED([SWITCH_LOG_DIR],"${logfiledir}",[where to put log files])
107f9135 99
7ae3f5b7 100AC_ARG_WITH([dbdir],
f5ecbc84 101 [AS_HELP_STRING([--with-dbdir=DIR], [Put database files into this location (default: $prefix/db)])], [dbdir="$withval"], [dbdir="${default_dbdir}"])
5ccac21d
MJ
102AC_SUBST(dbdir)
103AC_DEFINE_UNQUOTED([SWITCH_DB_DIR],"${dbdir}",[where to put db files])
104
7ae3f5b7 105AC_ARG_WITH([htdocsdir],
f5ecbc84 106 [AS_HELP_STRING([--with-htdocsdir=DIR], [Put html files into this location (default: $prefix/htdocs)])], [htdocsdir="$withval"], [htdocsdir="${default_htdocsdir}"])
89ae5f47
MJ
107AC_SUBST(htdocsdir)
108AC_DEFINE_UNQUOTED([SWITCH_HTDOCS_DIR],"${htdocsdir}",[where to put htdocs files])
109
7ae3f5b7 110AC_ARG_WITH([soundsdir],
f5ecbc84 111 [AS_HELP_STRING([--with-soundsdir=DIR], [Put sound files into this location (default: $prefix/sounds)])], [soundsdir="$withval"], [soundsdir="${default_soundsdir}"])
d1c60899
MJ
112AC_SUBST(soundsdir)
113AC_DEFINE_UNQUOTED([SWITCH_SOUNDS_DIR],"${soundsdir}",[where to put sounds files])
114
7ae3f5b7 115AC_ARG_WITH([grammardir],
f5ecbc84 116 [AS_HELP_STRING([--with-grammardir=DIR], [Put grammar files into this location (default: $prefix/grammar)])], [grammardir="$withval"], [grammardir="${default_grammardir}"])
89ae5f47
MJ
117AC_SUBST(grammardir)
118AC_DEFINE_UNQUOTED([SWITCH_GRAMMAR_DIR],"${grammardir}",[where to put grammar files])
119
dabb85c3 120AC_ARG_WITH([certsdir],
f5ecbc84 121 [AS_HELP_STRING([--with-certsdir=DIR], [Put certs files into this location (default: $prefix/certs)])], [certsdir="$withval"], [certsdir="${default_certsdir}"])
dabb85c3
AM
122AC_SUBST(certsdir)
123AC_DEFINE_UNQUOTED([SWITCH_CERTS_DIR],"${certsdir}",[where to put certs files])
124
7ae3f5b7 125AC_ARG_WITH([scriptdir],
f5ecbc84 126 [AS_HELP_STRING([--with-scriptdir=DIR], [Put script files into this location (default: $prefix/scripts)])], [scriptdir="$withval"], [scriptdir="${default_scriptdir}"])
5ccac21d
MJ
127AC_SUBST(scriptdir)
128AC_DEFINE_UNQUOTED([SWITCH_SCRIPT_DIR],"${scriptdir}",[where to put script files])
107f9135 129
7ae3f5b7 130AC_ARG_WITH([recordingsdir],
f5ecbc84 131 [AS_HELP_STRING([--with-recordingsdir=DIR], [Put recordings files into this location (default: $prefix/recordings)])], [recordingsdir="$withval"], [recordingsdir="${default_recordingsdir}"])
c064a2a5
MJ
132AC_SUBST(recordingsdir)
133AC_DEFINE_UNQUOTED([SWITCH_RECORDINGS_DIR],"${recordingsdir}",[where to put recording files])
134
f3d851d1 135AC_ARG_WITH([storagedir],
f5ecbc84 136 [AS_HELP_STRING([--with-storagedir=DIR], [Put storage files into this location (default: $prefix/storage)])], [storagedir="$withval"], [storagedir="${default_storagedir}"])
f3d851d1
TC
137AC_SUBST(storagedir)
138AC_DEFINE_UNQUOTED([SWITCH_STORAGE_DIR],"${storagedir}",[where to put storage files])
139
911e4a09
MJ
140if test "$sysconfdir" = "\${prefix}/etc" ; then
141 confdir="$prefix/conf"
142else
143 confdir="$sysconfdir"
144fi
145
5ccac21d
MJ
146sysconfdir="$confdir"
147
911e4a09 148AC_SUBST(confdir)
7da7790b 149AC_DEFINE_UNQUOTED([SWITCH_CONF_DIR],"${confdir}",[directory for configuration files])
911e4a09 150
8b3f71cc
MJ
151AC_SUBST(libdir)
152AC_SUBST(bindir)
153AC_SUBST(includedir)
154
f20ba4d1 155AC_ARG_WITH([pkgconfigdir],
78472897 156 [AS_HELP_STRING([--with-pkgconfigdir=DIR], [Installation directory for pkgconfig file (default: ${libdir}/pkgconfig)])],
f20ba4d1
SK
157 [case "${withval}" in
158 yes|no) AC_MSG_ERROR([Invalid value ${withval} for option --with-pkgconfigdir]) ;;
159 *) pkgconfigdir="${withval}" ;;
160 esac
161 ],
f5ecbc84 162 [pkgconfigdir="${default_pkgconfigdir}"]
f20ba4d1
SK
163)
164AC_SUBST([pkgconfigdir])
165
6bc48b70
MJ
166#Set default language
167AC_LANG_C
4da77ea5
AM
168# Checks for programs.
169AC_PROG_CC
80eec6e5 170AC_PROG_CXX
40f18d30
MJ
171
172#check if the g++ compiler works
173AC_CACHE_CHECK([whether the C++ compiler works], [ac_cv_sys_cxx_works], [
174 AC_LANG_PUSH([C++])
3dd36873 175 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() { }])], [ac_cv_sys_cxx_works=yes],
40f18d30
MJ
176 [ac_cv_sys_cxx_works=no])
177 AC_LANG_POP([C++])
178 ])
179[ if [ "x$ac_cv_sys_cxx_works" = "xno" ]; then ]
180 AC_MSG_FAILURE([The C++ compiler does not work. Please (re)install the C++ compiler])
181[ fi ]
182
bac1e3fd 183AC_PROG_AWK
4da77ea5 184AC_PROG_MAKE_SET
4da77ea5 185AC_PROG_INSTALL
3de6a7e9
MJ
186
187#override some default libtool behavior and invoke AC_PROG_LIBTOOL (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html)
188m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
189m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
190m4_defun([_LT_AC_LANG_RC_CONFIG], [:])
5b3f19fb 191AM_PROG_CC_C_O
bac1e3fd 192AC_PROG_LIBTOOL
4da77ea5 193
6bc48b70
MJ
194#Check for compiler vendor
195AX_COMPILER_VENDOR
196
197# Optimize
198AC_ARG_ENABLE(optimization,
199[AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
200
201if test "${enable_optimizer}" = "yes" ; then
202 AC_DEFINE([OPTIMZER],[],[Enable Optimization.])
203 AX_CC_MAXOPT
204fi
205
55b3e6cb 206# set defaults for use on all platforms
1c5e6144
MJ
207SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
208SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
1953ac5c 209SWITCH_AM_LDFLAGS="-lm"
55b3e6cb
MJ
210
211#set SOLINK variable based on compiler and host
212if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
213 SOLINK="-Bdynamic -dy -G"
44d5d43b 214elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
55b3e6cb 215 case "$host" in
44d5d43b 216 *darwin*)
5e7986bf
MJ
217 SOLINK="-dynamic -force-flat-namespace"
218 ;;
44d5d43b 219 *)
7549be4b 220 SOLINK="-shared -Xlinker -x"
44d5d43b
MJ
221 ;;
222
223 esac
224elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
225 case "$host" in
226# older Xcode test for darwin, Xcode 4/5 use clang above
6ae16d15 227 *darwin*)
55b3e6cb
MJ
228 SOLINK="-dynamic -bundle -force-flat-namespace"
229 ;;
872c349f
MB
230 *-solaris2*)
231 SOLINK="-shared -Xlinker"
232 ;;
55b3e6cb
MJ
233 *)
234 SOLINK="-shared -Xlinker -x"
235 ;;
236 esac
237else
238 AC_ERROR([Please update configure.in with SOLINK values for your compiler])
239fi
55b3e6cb 240
4a77854b
SK
241##
242# detect libtool major version,
243# set libtool library extension based on this
244# to work around some brokeness when using 'la' with libtool-1.5
245#
246AC_MSG_CHECKING([libtool major version])
247libtool="${switch_builddir}/libtool"
df33a43a 248LIBTOOL_MAJOR_VERSION="`$libtool --version 2>/dev/null| sed -e 's/([[^)]]*)//g;s/^[[^0-9]]*//;s/[[- ]].*//g;q'| awk 'BEGIN { FS = "." } { print $1 }' `"
0c0a4a53 249if test -z "$LIBTOOL_MAJOR_VERSION" ; then
751c2894 250 LIBTOOL_MAJOR_VERSION="`sed -n -e '/^VERSION/{s/^.*=\"\{0,1\}\([[0-9]]\{1,\}\)\..*/\1/;p;}' ${switch_srcdir}/build/config/ltmain.sh`"
0c0a4a53
SK
251fi
252if test -z "$LIBTOOL_MAJOR_VERSION" ; then
253 AC_MSG_ERROR([Failed to detect your libtool version, please open a bug report on http://jira.freeswitch.org/])
254fi
4a77854b 255AC_MSG_RESULT([${LIBTOOL_MAJOR_VERSION}])
02141e30 256
4216e3e0 257LIBTOOL_LIB_EXTEN=so
02141e30 258
4a77854b 259if test "${LIBTOOL_MAJOR_VERSION}" = "2" ; then
02141e30
MJ
260 LIBTOOL_LIB_EXTEN="la"
261fi
4a77854b
SK
262AC_MSG_RESULT([using libtool library extension... ${LIBTOOL_LIB_EXTEN}])
263
02141e30 264
0f6a6c31 265# Enable 64 bit build
6d45f5f5 266AC_ARG_ENABLE(64,
0f6a6c31 267[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
6d45f5f5 268
55b3e6cb
MJ
269# tweak compiler specific flags
270if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
271 APR_ADDTO(SWITCH_AM_CFLAGS, -KPIC)
272 APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC)
99913ce3
MJ
273 APR_ADDTO(SWITCH_AM_CFLAGS, -erroff=E_END_OF_LOOP_CODE_NOT_REACHED)
274 APR_ADDTO(SWITCH_AM_CFLAGS, -errtags=yes)
2343708a 275 APR_ADDTO(SWITCH_AM_CFLAGS, -D__FUNCTION__=__func__ )
276 APR_ADDTO(SWITCH_AM_CFLAGS, -mt)
99913ce3 277 APR_ADDTO(SWITCH_AM_CXXFLAGS, -errtags=yes)
514bde18
MJ
278 APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC)
279 APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC)
f32f6f24 280 APR_ADDTO(SWITCH_AM_CXXFLAGS, "-features=extensions")
2343708a 281 APR_ADDTO(SWITCH_AM_CXXFLAGS, -D__FUNCTION__=__func__)
282 APR_ADDTO(SWITCH_AM_CXXFLAGS, -mt)
f32f6f24 283
55b3e6cb 284 APR_ADDTO(SWITCH_AM_LDFLAGS, -R${prefix}/lib)
6d45f5f5
MJ
285 if test "${enable_64}" = "yes"; then
286 APR_ADDTO(SWITCH_AM_CFLAGS, -m64)
5b2d20bf
MJ
287 APR_ADDTO(SWITCH_AM_CXXFLAGS, -m64)
288 APR_ADDTO(SWITCH_AM_LDFLAGS, -m64)
1953ac5c 289 LIBS="$LIBS -m64"
6d45f5f5 290 fi
d755b340
BW
291elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
292 APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
293 APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
55b3e6cb
MJ
294elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
295 APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
514bde18 296 APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
44ef8650 297 APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
1953ac5c 298 if test "${enable_64}" = "yes"; then
5e7986bf 299 case "$host" in
851db97a 300 *darwin12.*|*darwin11.*|*darwin10.*|*darwin9.*|*darwin8.*)
5e7986bf
MJ
301 APR_ADDTO(CFLAGS, -arch x86_64)
302 APR_ADDTO(LDFLAGS, -arch x86_64)
303 APR_ADDTO(CXXFLAGS, -arch x86_64)
304 ;;
7803a752
MJ
305 *)
306 LIBS="$LIBS -m64"
307 ;;
5e7986bf 308 esac
1953ac5c 309 fi
55b3e6cb
MJ
310fi
311
ffe2ad4b
MJ
312#
313# gcc visibility cflag checks
314#
315AC_ARG_ENABLE([visibility],
316 [AS_HELP_STRING([--disable-visibility], [Disable or enable API visibility support (default: use if available)])],
317 [enable_visibility="${enableval}"],
318 [enable_visibility="detect"]
319)
320HAVE_VISIBILITY="no"
321
322if test "x${enable_visibility}" != "xno" ; then
323
324 case "${ax_cv_c_compiler_vendor}" in
325 gnu)
326 save_CFLAGS="${CFLAGS}"
327 CFLAGS="${CFLAGS} -fvisibility=hidden"
328 AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
329 AC_COMPILE_IFELSE(
330 [AC_LANG_PROGRAM(
331 [int foo __attribute__ ((visibility("default")));],
332 [;]
333 )],
334
335 [AC_MSG_RESULT([yes])
336 APR_ADDTO([SWITCH_AM_CFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
337 APR_ADDTO([SWITCH_AM_CXXFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
338 HAVE_VISIBILITY="yes"],
339
340 [AC_MSG_RESULT([no])]
341 )
342 CFLAGS="${save_CFLAGS}"
343 ;;
344
900907a2 345 sun)
96114867
SK
346 # save_CFLAGS="${CFLAGS}"
347 # CFLAGS="${CFLAGS} -xldscope=hidden"
348 # AC_MSG_CHECKING([whether the compiler supports -xldscope=hidden])
349 # AC_COMPILE_IFELSE(
350 # [AC_LANG_PROGRAM(
351 # [int foo __attribute__ ((visibility("default")));],
352 # [;]
353 # )],
354 #
355 # [AC_MSG_RESULT([yes])
356 # APR_ADDTO([SWITCH_AM_CFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
357 # APR_ADDTO([SWITCH_AM_CXXFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
358 # HAVE_VISIBILITY="yes"],
359 #
360 # [AC_MSG_RESULT([no])]
361 # )
362 # CFLAGS="${save_CFLAGS}"
900907a2
MJ
363 ;;
364
ffe2ad4b
MJ
365 *)
366 if test "x${enable_visibility}" = "xyes" ; then
900907a2 367 AC_MSG_ERROR([Non-GNU / SUN compilers are currently unsupported])
ffe2ad4b 368 else
900907a2 369 AC_MSG_WARN([Non-GNU / SUN compilers are currently unsupported])
ffe2ad4b
MJ
370 fi
371 ;;
372 esac
373
374 #
375 # visibility explicitly requested but not supported by this compiler => error
376 #
377 if test "x${enable_visibility}" = "xyes" -a "x${HAVE_VISIBILITY}" = "xno" ; then
378 AC_MSG_ERROR([API visibility not supported by this compiler])
379 fi
380fi
381
fcd2a7b0
SK
382# Enable debugging (default: on)
383# (rename option if the default is changed)
2faabff7 384AC_ARG_ENABLE(debug,
fcd2a7b0 385[AC_HELP_STRING([--disable-debug],[build without debug information])],[enable_debug="$enableval"],[enable_debug="yes"])
2faabff7
AM
386
387if test "${enable_debug}" = "yes"; then
388 AC_DEFINE([DEBUG],[],[Enable extra debugging.])
554f476c 389 saved_CFLAGS="$CFLAGS"
44ea66c2 390 CFLAGS=
2faabff7 391 AX_CFLAGS_WARN_ALL_ANSI
02c7a3ac 392 SWITCH_ANSI_CFLAGS=$CFLAGS
554f476c 393 CFLAGS="$saved_CFLAGS"
2faabff7
AM
394
395 if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
396 APR_ADDTO(SWITCH_AM_CFLAGS, -g -ggdb)
37845b42 397 export DEBUG_CFLAGS="-g -ggdb"
2faabff7
AM
398 fi
399
400fi
401
59ba5a15
MJ
402AC_ARG_ENABLE(cpp,
403[AC_HELP_STRING([--disable-cpp],[build without cpp code])],[enable_cpp="$enableval"],[enable_cpp="yes"])
404
405AM_CONDITIONAL([ENABLE_CPP],[test "${enable_cpp}" = "yes"])
406
714e3133
MJ
407AC_ARG_ENABLE([system-xmlrpc-c],
408 [AS_HELP_STRING([--enable-system-xmlrpc-c],
409 [use system lib for xmlrpc-c])],,
410 [enable_xmlrpcc="no"])
411
412if test "${enable_xmlrpcc}" = "yes" ; then
413SYS_XMLRPC_CFLAGS=`xmlrpc-c-config --cflags`
414SYS_XMLRPC_LDFLAGS=`xmlrpc-c-config --libs`
415fi
416AC_SUBST(SYS_XMLRPC_CFLAGS)
417AC_SUBST(SYS_XMLRPC_LDFLAGS)
418AM_CONDITIONAL([SYSTEM_XMLRPCC],[test "${enable_xmlrpcc}" = "yes"])
419
a8b87ffe
AM
420AC_ARG_ENABLE(srtp,
421[AC_HELP_STRING([--disable-srtp],[build without srtp support])],[enable_srtp="$enableval"],[enable_srtp="yes"])
422
423AM_CONDITIONAL([ENABLE_SRTP],[test "${enable_srtp}" = "yes"])
424
861bd209
BW
425AC_ARG_ENABLE(zrtp,
426 [AS_HELP_STRING([--enable-zrtp], [Compile with zrtp Support])],,[enable_zrtp="no"])
427if test "x$enable_zrtp" = "xyes" ; then
393b63b7 428 LIBS="-lpthread $LIBS"
861bd209
BW
429 APR_ADDTO(SWITCH_AM_CFLAGS, -DENABLE_ZRTP)
430fi
ae67ecce 431
c4d13331
MJ
432PA_LIBS=
433
434PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
435if test "x$have_jack" = "xyes" ; then
436PA_LIBS+=$JACK_LIBS
437fi
438
ae67ecce 439AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
1911a262 440if test "x$have_alsa" = "xyes" ; then
c4d13331 441PA_LIBS+=-lasound
ae67ecce 442fi
c4d13331
MJ
443
444AC_SUBST(PA_LIBS)
ae67ecce 445
861bd209
BW
446AM_CONDITIONAL([ENABLE_ZRTP],[test "x$enable_zrtp" != "xno"])
447
a4a52620
SK
448AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
449
ab2bc7c6
TC
450AC_ARG_ENABLE(core-odbc-support,
451 [AS_HELP_STRING([--enable-core-odbc-support], [Compile with ODBC Support (default is optional)])],,[enable_core_odbc_support="optional"])
452if ! test "$enable_core_odbc_support" = "no"; then
453 AX_LIB_ODBC
454 if test "$ac_cv_found_odbc" = "yes" ; then
455 enable_core_odbc_support="yes"
456 elif test "$enable_core_odbc_support" = "yes"; then
457 AC_MSG_ERROR([no usable libodbc; please install unixodbc devel package or equivalent])
458 else
459 enable_core_odbc_support="no"
460 fi
ffc8e81b
TC
461fi
462
6e9fa3ba
AM
463CHECK_LIBUUID
464SWITCH_AM_LDFLAGS="$LIBUUID_LIBS $SWITCH_AM_LDFLAGS"
465SWITCH_AM_CFLAGS="$LIBUUID_CFLAGS $SWITCH_AM_CFLAGS"
466
5cb354dd
EG
467AC_ARG_ENABLE(core-pgsql-support,
468 [AS_HELP_STRING([--enable-core-pgsql-support], [Compile with PGSQL Support])],,[enable_core_pgsql_support="no"])
ba052c22 469AC_ARG_ENABLE(core-pgsql-pkgconfig,
299081ed 470 [AS_HELP_STRING([--disable-core-pgsql-pkgconfig], [Use pg_config to get PGQSL build options])],[enable_core_pgsql_pkgconfig="$enableval"],[enable_core_pgsql_pkgconfig="yes"])
5cb354dd
EG
471
472if test x"$enable_core_pgsql_support" = x"yes" ; then
ba052c22
TC
473 AC_PATH_PROG([PG_CONFIG], [pg_config], [no])
474 AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
ba052c22
TC
475 if test "$PKG_CONFIG" = "no" \
476 || test x"$enable_core_pgsql_pkgconfig" = x"no" \
477 || ! pkg-config libpq; then
81185aa9
KR
478 if test "$PG_CONFIG" != "no"; then
479 AC_MSG_CHECKING([for PostgreSQL libraries via pg_config])
480 POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`"
481 POSTGRESQL_LIBDIR="-L`$PG_CONFIG --libdir`"
482 POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq"
483 POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'`
484 POSTGRESQL_MAJOR_VERSION=`$PG_CONFIG --version | sed -e 's/devel//' | sed -re 's#PostgreSQL ([0-9]+).[0-9]+.?[0-9]+?#\1#'`
485 POSTGRESQL_MINOR_VERSION=`$PG_CONFIG --version | sed -e 's/devel//' | sed -re 's#PostgreSQL [0-9]+.([0-9]+).?[0-9]+?#\1#'`
486 POSTGRESQL_PATCH_VERSION=`$PG_CONFIG --version | sed -e 's/devel//' | sed -re 's#PostgreSQL [0-9]+.[0-9]+.?([0-9]+)?#\1#'`
487 else
488 AC_MSG_ERROR([no usable pkg-config or pg_config; please install libpq devel package or equivalent])
489 fi
ba052c22 490 else
81185aa9
KR
491 AC_MSG_CHECKING([for PostgreSQL libraries via pkg_config])
492 POSTGRESQL_CFLAGS="`$PKG_CONFIG --cflags libpq`"
493 POSTGRESQL_LIBDIR="`$PKG_CONFIG libpq --libs-only-L`"
ba052c22
TC
494 POSTGRESQL_LDFLAGS="`$PKG_CONFIG --libs libpq`"
495 POSTGRESQL_VERSION="`$PKG_CONFIG --modversion libpq`"
496 POSTGRESQL_MAJOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f1`"
497 POSTGRESQL_MINOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f2`"
498 POSTGRESQL_PATCH_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f3`"
499 fi
81185aa9
KR
500 save_LIBS="$LIBS"
501 LIBS="$POSTGRESQL_LIBDIR $LIBS"
502 AC_MSG_RESULT([$POSTGRESQL_LIBDIR])
503
ba052c22
TC
504 AC_DEFINE([SWITCH_HAVE_PGSQL], [1], [Define to 1 if PostgreSQL libraries are available])
505 AC_DEFINE_UNQUOTED([POSTGRESQL_VERSION], "${POSTGRESQL_VERSION}", [Specifies the version of PostgreSQL we are linking against])
506 AC_DEFINE_UNQUOTED([POSTGRESQL_MAJOR_VERSION], ${POSTGRESQL_MAJOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
507 AC_DEFINE_UNQUOTED([POSTGRESQL_MINOR_VERSION], ${POSTGRESQL_MINOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
508 AC_DEFINE_UNQUOTED([POSTGRESQL_PATCH_VERSION], ${POSTGRESQL_PATCH_VERSION}, [Specifies the version of PostgreSQL we are linking against])
81185aa9 509
ba052c22
TC
510 AC_CHECK_LIB([pq], [PQgetvalue],, AC_MSG_ERROR([no usable libpq; please install PostgreSQL devel package or equivalent]))
511 AC_MSG_RESULT([yes])
81185aa9 512 SWITCH_AM_CXXFLAGS="$POSTGRESQL_CFLAGS $SWITCH_AM_CXXFLAGS"
ba052c22 513 SWITCH_AM_LDFLAGS="$POSTGRESQL_LDFLAGS $SWITCH_AM_LDFLAGS"
81185aa9
KR
514
515 LIBS="$save_LIBS"
5cb354dd 516fi
25c725c2 517
603f3eff
MJ
518AC_ARG_ENABLE(deprecated-core-db-events,
519 [AS_HELP_STRING([--enable-deprecated-core-db-events], [Keep deprecated core db events])],,[enable_deprecated_core_db_events="no"])
520
521if test x"$enable_deprecated_core_db_events" = x"yes" ; then
522 AC_DEFINE([SWITCH_DEPRECATED_CORE_DB], [1], [Define to 1 to enable deprecated core db events])
523fi
524
25c725c2
AM
525AC_ARG_ENABLE(timerfd-wrapper,
526[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
527AM_CONDITIONAL([ENABLE_TIMERFD_WRAPPER],[test "x$enable_timer_fd_wrapper" != "xno"])
528
f2067001
BW
529ESL_LDFLAGS=
530PLATFORM_CORE_LDFLAGS=
531PLATFORM_CORE_LIBS=
d28b2391 532
55b3e6cb
MJ
533# tweak platform specific flags
534case "$host" in
851db97a 535 *darwin12.*|*darwin11.*)
0952a99a 536 APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
85d6b9af
MJ
537 APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp -Wno-deprecated-declarations -I/usr/local/opt/openssl/include)
538 APR_ADDTO(LDFLAGS, -pipe -bind_at_load -L/usr/local/opt/openssl/lib)
0952a99a
MJ
539 APR_ADDTO(CXXFLAGS, -pipe)
540 APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
541 if test "x$enable_core_odbc_support" != "xno"; then
542 APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
543 fi
544 APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl])
545 ;;
5e7986bf
MJ
546 *darwin10.*)
547 APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
85d6b9af
MJ
548 APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp -I/usr/local/opt/openssl/include)
549 APR_ADDTO(LDFLAGS, -pipe -bind_at_load -L/usr/local/opt/openssl/lib)
5e7986bf
MJ
550 APR_ADDTO(CXXFLAGS, -pipe)
551 APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
552 if test "x$enable_core_odbc_support" != "xno"; then
a48da3b4 553 APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
5e7986bf 554 fi
cdabd564 555 APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl])
5e7986bf 556 ;;
6ae16d15 557 *darwin*)
85d6b9af
MJ
558 APR_ADDTO(CFLAGS, -I/usr/local/opt/openssl/include)
559 APR_ADDTO(LDFLAGS, -L/usr/local/opt/openssl/lib)
55b3e6cb
MJ
560 APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
561 APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
9a9ba4c3 562 if test "x$enable_core_odbc_support" != "xno"; then
a48da3b4 563 APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
9a9ba4c3 564 fi
cdabd564 565 APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl])
55b3e6cb
MJ
566 ;;
567 *-solaris2*)
cb1cb69e 568 APR_ADDTO(SWITCH_AM_CFLAGS, -DPATH_MAX=2048 -D__EXTENSIONS__)
54a9eba4 569 APR_ADDTO(SWITCH_AM_LDFLAGS, -lsendfile -lresolv -lsocket -lnsl -luuid)
bb33c4e7 570 APR_ADDTO(ESL_LDFLAGS, -lnsl -lsocket)
a48da3b4 571 APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt -lsendfile -lresolv -lsocket -lnsl -luuid])
55b3e6cb 572 ;;
4f2e0f19
MJ
573 *dragonfly*)
574 APR_ADDTO(CFLAGS, -I/usr/local/include)
575 APR_ADDTO(LDFLAGS, -L/usr/local/lib)
576 APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
577 ;;
eab96981
MJ
578 *openbsd*)
579 APR_ADDTO(CFLAGS, -I/usr/local/include)
580 APR_ADDTO(LDFLAGS, -L/usr/local/lib)
581 APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
582 ;;
a91ba93d
BW
583 *netbsd*)
584 APR_ADDTO(CFLAGS, -I/usr/pkg/include)
783a4083 585 APR_ADDTO(LDFLAGS, [-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib])
a91ba93d
BW
586 APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/pkg/include)
587 ;;
f0b58efb 588 *bsd*)
ec718814
MJ
589 APR_ADDTO(CFLAGS, -I/usr/local/include)
590 APR_ADDTO(LDFLAGS, -L/usr/local/lib)
f0b58efb 591 APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
041e3bf0 592 APR_ADDTO([PLATFORM_CORE_LIBS], [-lcrypt -lrt])
a48da3b4
SK
593 ;;
594 *linux*)
595 APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
f0b58efb 596 ;;
55b3e6cb
MJ
597esac
598
514bde18
MJ
599APR_REMOVEFROM(SWITCH_AM_CXXFLAGS, -std=c99)
600
9b85b9c9
MJ
601AC_CHECK_LIB(z, inflateReset, have_libz=yes, AC_MSG_ERROR([no usable zlib; please install zlib devel package or equivalent]))
602if test "x$have_libz" = "xyes" ; then
603APR_ADDTO([PLATFORM_CORE_LIBS], [-lz])
604fi
605
606AC_CHECK_LIB(jpeg, jpeg_std_error,, AC_MSG_ERROR([no usable libjpeg; please install libjpeg devel package or equivalent]))
607
608AC_CHECK_LIB(jbig, jbg_enc_out, have_libjbig=yes, have_libjbig=no)
609if test "x$have_libjbig" = "xyes" ; then
610SPANDSP_LA_JBIG="-ljbig"
611AC_SUBST(SPANDSP_LA_JBIG)
612fi
613
614AC_CHECK_LIB(lzma, lzma_code, have_liblzma=yes, have_liblzma=no)
615if test "x$have_liblzma" = "xyes" ; then
616SPANDSP_LA_LZMA="-llzma"
617AC_SUBST(SPANDSP_LA_LZMA)
618fi
619
620AC_CHECK_LIB(resolv, res_init, have_libresolv=yes, have_libresolv=no)
621if test "x$have_libresolv" = "xyes" ; then
622APR_ADDTO(SWITCH_AM_LDFLAGS, -lresolv)
623fi
624
55b3e6cb 625AC_SUBST(SWITCH_AM_CFLAGS)
02c7a3ac 626AC_SUBST(SWITCH_ANSI_CFLAGS)
514bde18 627AC_SUBST(SWITCH_AM_CXXFLAGS)
55b3e6cb 628AC_SUBST(SWITCH_AM_LDFLAGS)
3ec59cdb 629AC_SUBST(ESL_LDFLAGS)
a48da3b4
SK
630AC_SUBST(PLATFORM_CORE_LDFLAGS)
631AC_SUBST(PLATFORM_CORE_LIBS)
6bc48b70 632AC_SUBST(SOLINK)
02141e30 633AC_SUBST(LIBTOOL_LIB_EXTEN)
6bc48b70 634
4da77ea5
AM
635# Checks for header files.
636AC_HEADER_DIRENT
637AC_HEADER_STDC
6b6c83a7 638AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h sys/select.h netdb.h execinfo.h])
56008e2b 639
56008e2b
AM
640if test x"$ac_cv_header_wchar_h" = xyes; then
641 HAVE_WCHAR_H_DEFINE=1
642else
643 HAVE_WCHAR_H_DEFINE=0
644fi
645AC_SUBST(HAVE_WCHAR_H_DEFINE)
4da77ea5 646
6b6c83a7
JL
647# Needed by Abyss on Solaris:
648
649if test x"$ac_cv_header_sys_filio_h" = xyes; then
650 HAVE_SYS_FILIO_H_DEFINE=1
651else
652 HAVE_SYS_FILIO_H_DEFINE=0
653fi
654AC_SUBST(HAVE_SYS_FILIO_H_DEFINE)
655
656# Needed by Abyss on Solaris:
657
658if test x"$ac_cv_header_sys_ioctl_h" = xyes; then
659 HAVE_SYS_IOCTL_H_DEFINE=1
660else
661 HAVE_SYS_IOCTL_H_DEFINE=0
662fi
663AC_SUBST(HAVE_SYS_IOCTL_H_DEFINE)
664
665if test x"$ac_cv_header_sys_select_h" = xyes; then
666 HAVE_SYS_SELECT_H_DEFINE=1
667else
668 HAVE_SYS_SELECT_H_DEFINE=0
669fi
670AC_SUBST(HAVE_SYS_SELECT_H_DEFINE)
671
4da77ea5
AM
672# Checks for typedefs, structures, and compiler characteristics.
673AC_C_CONST
674AC_C_INLINE
675AC_TYPE_SIZE_T
676AC_HEADER_TIME
677AC_STRUCT_TM
678
679# Checks for library functions.
680AC_PROG_GCC_TRADITIONAL
a7bf6f8d 681AC_FUNC_MALLOC
4da77ea5
AM
682AC_TYPE_SIGNAL
683AC_FUNC_STRFTIME
d91f67d0 684AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep getifaddrs timerfd_create getdtablesize posix_openpt])
ea5c0c21 685AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups])
4062b636 686AC_CHECK_FUNCS([wcsncmp setgroups asprintf setenv pselect gettimeofday localtime_r gmtime_r strcasecmp stricmp _stricmp])
b382c0a4 687
8bcf3b4f
SK
688# Check availability and return type of strerror_r
689# (NOTE: apr-1-config sets -D_GNU_SOURCE at build-time, need to run the check with it too)
690save_CPPFLAGS="$CPPFLAGS"
691CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
692AC_FUNC_STRERROR_R
693CPPFLAGS="$save_CPPFLAGS"
694
ea5c0c21
MJ
695AX_HAVE_CPU_SET
696
eb9f9fb2 697AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])])
d314f254 698AC_CHECK_LIB(rt, clock_getres, [AC_DEFINE(HAVE_CLOCK_GETRES, 1, [Define if you have clock_getres()])])
eb9f9fb2 699AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
6627dc86 700AC_CHECK_LIB(pthread, pthread_setschedparam, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM, 1, [Define if you have pthread_setschedparam()])])
5f469ad2 701
4062b636 702AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
eb9f9fb2 703
d91f67d0
AM
704AC_CHECK_FILE(/dev/ptmx, [AC_DEFINE(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx])])
705AC_CHECK_LIB(util, openpty, [AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have openpty()])])
706
bf988471 707AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
21159328
MJ
708#include <sys/types.h>
709#include <time.h>])
710
bf988471 711AC_CHECK_MEMBERS([struct tm.tm_zone],,,[
21159328
MJ
712#include <sys/types.h>
713#include <time.h>])
714
b382c0a4
MJ
715AC_CHECK_DECL([RLIMIT_MEMLOCK],
716 [AC_DEFINE([HAVE_RLIMIT_MEMLOCK],[1],[RLIMIT_MEMLOCK constant for setrlimit])],,
717 [#ifdef HAVE_SYS_RESOURCE_H
718 #include <sys/resource.h>
719 #endif])
720
721AC_CHECK_DECL([SCHED_RR],
722 [AC_DEFINE([HAVE_SCHED_RR],[1],[SCHED_RR constant for sched_setscheduler])],,
723 [#ifdef HAVE_SCHED_H
724 #include <sched.h>
725 #endif])
726
817439d7
AM
727AC_CHECK_DECL([SCHED_FIFO],
728 [AC_DEFINE([HAVE_SCHED_FIFO],[1],[SCHED_FIFO constant for sched_setscheduler])],,
729 [#ifdef HAVE_SCHED_H
730 #include <sched.h>
731 #endif])
732
b382c0a4
MJ
733#
734# use mlockall only on linux (for now; if available)
735#
736if test "x${ac_cv_func_mlockall}" = "xyes"; then
737 AC_MSG_CHECKING([whether to use mlockall])
738 case "$host" in
739 *-linux-*)
740 AC_DEFINE([USE_MLOCKALL],[1],[Enable mlockall support])
741 AC_MSG_RESULT([yes])
742 USE_MLOCKALL=yes
743 ;;
744 *-freebsd*)
883de14f
JL
745 APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
746 APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
b382c0a4
MJ
747 AC_MSG_RESULT([no, broken for non-root users])
748 ;;
749 *)
750 AC_MSG_RESULT([no])
751 ;;
752 esac
753
754 #
755 # setrlimit prerequisites
756 #
757 if test "x${USE_MLOCKALL}" = "xyes" -a \
758 "x${ac_cv_func_setrlimit}" = "xyes" -a \
759 "x${ac_cv_have_decl_RLIMIT_MEMLOCK}" = "xyes"
760 then
761 AC_DEFINE([USE_SETRLIMIT],[1],[Use setrlimit to disable mlock limit for non-root users])
762 fi
763fi
764
765#
766# sched_setcheduler + round-robin scheduler prerequisites
767#
768if test "x${ac_cv_func_sched_setscheduler}" = "xyes" -a \
769 "x${ac_cv_have_decl_SCHED_RR}" = "xyes"
770then
771 AC_DEFINE([USE_SCHED_SETSCHEDULER],[1],[Enable round-robin scheduler using sched_setscheduler])
772fi
4062b636
AM
773#
774# xmlrpc-c checks
775#
776
6b6c83a7 777AC_CHECK_FUNCS(setenv strtoll strtoull strtoq strtouq __strtoll __strtoull)
4062b636
AM
778
779HAVE_LIBWWW_SSL_DEFINE=0
780AC_SUBST(HAVE_LIBWWW_SSL_DEFINE)
781
782DIRECTORY_SEPARATOR="/"
783AC_SUBST(DIRECTORY_SEPARATOR)
784
785va_list_is_array=no
786AC_MSG_CHECKING(whether va_list is an array)
787AC_TRY_COMPILE([
788#include <stdarg.h>
789], [va_list list1, list2; list1 = list2;], ,
790va_list_is_array=yes)
791AC_MSG_RESULT($va_list_is_array)
792if test x"$va_list_is_array" = xyes; then
793 VA_LIST_IS_ARRAY_DEFINE=1
794else
795 VA_LIST_IS_ARRAY_DEFINE=0
796fi
797AC_SUBST(VA_LIST_IS_ARRAY_DEFINE)
798
554f476c 799
4062b636
AM
800AC_MSG_CHECKING(whether compiler has __attribute__)
801AC_TRY_COMPILE(, [int x __attribute__((__unused__));],
802compiler_has_attribute=yes,
803compiler_has_attribute=no)
804AC_MSG_RESULT($compiler_has_attribute)
805if test x"$compiler_has_attribute" = xyes; then
806 ATTR_UNUSED="__attribute__((__unused__))"
807else
808 ATTR_UNUSED=
809fi
810AC_SUBST(ATTR_UNUSED)
811
812
554f476c
MJ
813saved_CFLAGS="$CFLAGS"
814AC_CACHE_CHECK([whether compiler supports -Wdeclaration-after-statement], [ac_cv_gcc_declaration_after_statement], [
815CFLAGS="$CFLAGS -Wdeclaration-after-statement"
816AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_declaration_after_statement=yes],[ac_cv_gcc_declaration_after_statement=no])
817])
818AC_MSG_RESULT($ac_cv_gcc_declaration_after_statement)
819if test x"$ac_cv_gcc_declaration_after_statement" = xyes; then
820 APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wdeclaration-after-statement)
821fi
822CFLAGS="$saved_CFLAGS"
4da77ea5 823
c7ccf84a
MJ
824if test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
825 # Next check added for Xcode 5 and systems with clang 5 llvm 3.3 or above, extended offset must be off
826 AC_CACHE_CHECK([whether compiler supports -Wextended-offsetof], [ac_cv_clang_extended_offsetof], [
827 AC_TRY_COMPILE([],[return 0;],[ac_cv_clang_extended_offsetof=yes],[ac_cv_clang_extended_offsetof=no])
828 ])
829 AC_MSG_RESULT($ac_cv_clang_extended_offsetof)
830 if test x"$ac_cv_clang_extended_offsetof" = xyes; then
831 APR_ADDTO(CFLAGS, -Wno-extended-offsetof)
832 fi
44d5d43b
MJ
833fi
834
eb8ff5a0
MOC
835# Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready
836# Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_dingaling mod_opal mod_skypopen mod_h323 mod_khomp
837# mod_unimrcp mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed
838#
839#saved_CFLAGS="$CFLAGS"
840#AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [
841#CFLAGS="$CFLAGS -Wunused-but-set-variable"
842#AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_unused_but_set_variable=yes],[ac_cv_gcc_unused_but_set_variable=no])
843#])
844#AC_MSG_RESULT($ac_cv_gcc_unused_but_set_variable)
845#if test x"$ac_cv_gcc_unused_but_set_variable" = xyes; then
846# APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wunused-but-set-variable)
847#fi
848#CFLAGS="$saved_CFLAGS"
f952719e 849
44cc7d5c 850AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
49a0eb29 851
42e78242
MJ
852# Checks for integer size
853AC_CHECK_SIZEOF(char, 1)
854AC_CHECK_SIZEOF(int, 4)
855AC_CHECK_SIZEOF(long, 4)
856AC_CHECK_SIZEOF(short, 2)
857AC_CHECK_SIZEOF(long long, 8)
858AC_TYPE_SIZE_T
859AC_CHECK_TYPE(ssize_t, int)
860
861# Checks for pointer size
862AC_CHECK_SIZEOF(void*, 4)
863
864if test "x$ac_cv_sizeof_voidp" != "x"; then
865 voidp_size=$ac_cv_sizeof_voidp
866else
867 AC_ERROR([Cannot determine size of void*])
868fi
869
870if test "$ac_cv_sizeof_short" = "2"; then
871 short_value=short
872fi
873if test "$ac_cv_sizeof_int" = "4"; then
874 int_value=int
875fi
876
877if test "$ac_cv_sizeof_int" = "8"; then
878 int64_t_fmt='#define SWITCH_INT64_T_FMT "d"'
879 uint64_t_fmt='#define SWITCH_UINT64_T_FMT "u"'
880 int64_value="int"
881 long_value=int
882elif test "$ac_cv_sizeof_long" = "8"; then
883 int64_t_fmt='#define SWITCH_INT64_T_FMT "ld"'
884 uint64_t_fmt='#define SWITCH_UINT64_T_FMT "lu"'
885 int64_value="long"
886 long_value=long
764b7958 887 case "$host" in
44410b71
BW
888 *pc-solaris2*)
889 ;;
f6fe2667 890 *-solaris2*|*apple-darwin*|*-openbsd*)
764b7958
MJ
891 if test "$ac_cv_sizeof_long_long" = "8"; then
892 int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"'
893 uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"'
894 int64_value="long long"
895 long_value="long long"
896 fi
897 ;;
898 esac
42e78242
MJ
899elif test "$ac_cv_sizeof_long_long" = "8"; then
900 int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"'
901 uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"'
902 int64_value="long long"
903 long_value="long long"
904elif test "$ac_cv_sizeof_longlong" = "8"; then
905 int64_t_fmt='#define SWITCH_INT64_T_FMT "qd"'
906 uint64_t_fmt='#define SWITCH_UINT64_T_FMT "qu"'
907 int64_value="__int64"
908 long_value="__int64"
909else
910 AC_ERROR([could not detect a 64-bit integer type])
911fi
912
913if test "$ac_cv_type_size_t" = "yes"; then
914 size_t_value="size_t"
915else
916 size_t_value="switch_int32_t"
917fi
918
919if test "$ac_cv_type_ssize_t" = "yes"; then
920 ssize_t_value="ssize_t"
921else
922 ssize_t_value="switch_int32_t"
923fi
924
925APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
926
927if test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then
928 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"'
929elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then
930 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
931else
932 ssize_t_fmt='#error Can not determine the proper size for ssize_t'
933fi
934
935APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
936
937if test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then
938 size_t_fmt='#define SWITCH_SIZE_T_FMT "d"'
939elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then
940 size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
941else
d90bac38 942 size_t_fmt='#define SWITCH_SIZE_T_FMT "zu"'
42e78242
MJ
943fi
944
945# Basically, we have tried to figure out the correct format strings
946# for SWITCH types which vary between platforms, but we don't always get
947# it right. If you find that we don't get it right for your platform,
948# you can override our decision below.
949# NOTE: borrowed much of this logic from apr.
950case $host in
951 s390*linux*)
952 # uniquely, the 31-bit Linux/s390 uses "unsigned long int"
953 # for size_t rather than "unsigned int":
954 size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
955 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
956 ;;
957 *-os2*)
958 size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
959 ;;
6d66ecfd
MJ
960 *-openbsd*)
961 size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
962 ;;
42e78242
MJ
963 *aix4*|*aix5*)
964 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
965 size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
966 ;;
967 *beos*)
968 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
969 size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
970 ;;
971 *apple-darwin*)
972 osver=`uname -r`
973 case $osver in
974 [0-7].*)
975 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"'
976 ;;
977 *)
978 ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
979 ;;
980 esac
981 size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
982 ;;
983esac
984
985AC_SUBST(voidp_size)
986AC_SUBST(short_value)
987AC_SUBST(int_value)
988AC_SUBST(long_value)
989AC_SUBST(int64_value)
990AC_SUBST(size_t_value)
991AC_SUBST(ssize_t_value)
992AC_SUBST(int64_t_fmt)
993AC_SUBST(uint64_t_fmt)
994AC_SUBST(ssize_t_fmt)
995AC_SUBST(size_t_fmt)
42e78242 996
f6fe2667
MJ
997case $host in
998 *-openbsd*)
999 # OpenBSD's gunzip and friends don't like -d because its redundant, only gzip does
1000 AC_PATH_PROGS(ZCAT, gzip)
1001 ;;
1002 *)
1003 AC_PATH_PROGS(ZCAT, gunzip gzcat gzip zcat)
1004 ;;
1005esac
1006
50328a66
TC
1007AC_PATH_PROGS(BZIP, bzip2)
1008AC_PATH_PROGS(XZ, xz)
bc34fb76
MJ
1009AC_PATH_PROGS(TAR, gtar tar)
1010AC_PATH_PROGS(WGET, wget)
1011AC_PATH_PROGS(CURL, curl)
d2cf7f86 1012GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_builddir/build/getlib.sh"
c99d8c9b 1013AC_SUBST(GETLIB)
17d52112
MJ
1014GETG729="cd $switch_srcdir/libs && ${SHELL} $switch_builddir/build/getg729.sh"
1015AC_SUBST(GETG729)
d2cf7f86 1016GETSOUNDS="${SHELL} $switch_builddir/build/getsounds.sh"
3d5fcabe 1017AC_SUBST(GETSOUNDS)
c99d8c9b 1018
bc34fb76 1019
493fc648
MJ
1020LIBCURL_DEPS=
1021
1022AC_ARG_WITH(libcurl,
1023 AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]),
1024 [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])])
1025
e704f021
MP
1026AC_CACHE_CHECK([whether to use system libcurl library], [ac_cv_use_system_curl], [
1027 LIBCURL_CHECK_CONFIG([yes], [7.13.0], [ac_cv_use_system_curl='yes'], [ac_cv_use_system_curl='no'])
1028])
1029
493fc648
MJ
1030if test "$_libcurl_with" = "no" ; then
1031 ac_cv_use_system_curl=no;
1032fi
1033if test "$_libcurl_with" = "yes" ; then
1034 ac_cv_use_system_curl=yes;
1035fi
1036
36f0a5b8
MJ
1037if test "$ac_cv_use_system_curl" = "yes" ; then
1038AC_CACHE_CHECK([whether to use system libcurl library], [ac_cv_curl_usable], [
666231f9 1039 AC_CHECK_LIB(curl, curl_easy_setopt, [ac_cv_curl_usable="yes"], [ac_cv_curl_usable="no"])
36f0a5b8
MJ
1040])
1041fi
1042
1043if test "$ac_cv_curl_usable" != "yes" ; then
1044 ac_cv_use_system_curl=no;
1045fi
1046
493fc648
MJ
1047if test "$ac_cv_use_system_curl" != "yes" ; then
1048 LIBCURL_DEPS='${switch_builddir}/libs/curl/lib/libcurl.la'
1049 LIBCURL='${switch_builddir}/libs/curl/lib/libcurl.la'
1050 LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include'
a7238d0b
AM
1051else
1052 SWITCH_AM_LDFLAGS="$LIBCURL $SWITCH_AM_LDFLAGS"
493fc648
MJ
1053fi
1054
a7238d0b
AM
1055SWITCH_AM_CFLAGS="$LIBCURL_CPPFLAGS $SWITCH_AM_CFLAGS"
1056SWITCH_AM_CXXFLAGS="$LIBCURL_CPPFLAGS $SWITCH_AM_CXXFLAGS"
1057
74ed2cef
MJ
1058AM_CONDITIONAL([CURL_BUILTIN],[test "${ac_cv_use_system_curl}" != "yes"])
1059
f85be6ff
MJ
1060AC_SUBST(LIBCURL_DEPS)
1061
4d62a1ad 1062
c5c13c26 1063AC_ARG_ENABLE(core-libedit-support,
2bcd991b 1064 [AS_HELP_STRING([--disable-core-libedit-support], [Compile without libedit Support])], [enable_core_libedit_support="$enableval"], [enable_core_libedit_support="yes"])
c5c13c26 1065
28213aad 1066if test "$enable_core_libedit_support" = "yes" ; then
58e7db0c
MJ
1067 AC_CHECK_LIB(tinfo, tgetent, [have_libtinfo="yes"], [have_libtinfo="no"])
1068 if test "$have_libtinfo" == "yes" ; then
1069 TINFO_LIBS="-ltinfo"
1070 else
1071 TINFO_LIBS=""
1072 AC_CHECK_LIB(ncurses, tgetent,,
1073 [AC_CHECK_LIB(curses, tgetent,,
1074 [AC_MSG_ERROR([libtermcap, libcurses or libncurses are required!])] )] )
1075 fi
1076 AC_SUBST(TINFO_LIBS)
28213aad
AM
1077fi
1078
219a2ecc
AT
1079SAC_OPENSSL
1080
9d6d8a1c
AT
1081if test x$HAVE_OPENSSL = x1; then
1082 openssl_CFLAGS="$openssl_CFLAGS -DHAVE_OPENSSL";
1d18b58b 1083 APR_ADDTO(SWITCH_AM_CFLAGS, -DHAVE_OPENSSL)
2fe3ef03 1084 AC_CHECK_LIB(ssl, SSL_CTX_set_tlsext_use_srtp, AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DTLS_SRTP, 1, HAVE_OPENSSL_DTLS_SRTP), AC_MSG_ERROR([OpenSSL >= 1.0.1e and associated developement headers required]))
85d6b9af 1085 AC_CHECK_LIB(ssl, DTLSv1_method, AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DTLS, 1, HAVE_OPENSSL_DTLS), AC_MSG_ERROR([OpenSSL >= 1.0.1e and associaed developement headers required]))
15f219ea 1086else
f2331de6 1087 AC_MSG_ERROR([OpenSSL >= 1.0.1e and associated developement headers required])
9d6d8a1c
AT
1088fi
1089
e69fe7e3 1090AX_CHECK_JAVA
7df787b7 1091
2e32d105
PO
1092# Option to enable static linking of Google's V8 inside mod_v8
1093AC_ARG_ENABLE(static-v8,
1094[AS_HELP_STRING([--enable-static-v8], [Statically link V8 into mod_v8])], [enable_static_v8="$enableval"], [enable_static_v8="no"])
1095AM_CONDITIONAL([ENABLE_STATIC_V8],[test "x$enable_static_v8" != "xno"])
753fa8fb 1096
31b743d6
MJ
1097AM_CONDITIONAL([HAVE_ODBC],[test "x$enable_core_odbc_support" != "xno"])
1098AM_CONDITIONAL([HAVE_LIBEDIT],[test "x$enable_core_libedit_support" != "xno"])
778a82cc 1099AM_CONDITIONAL([HAVE_MYSQL],[test "$found_mysql" = "yes"])
49a0eb29 1100
e8c88aa1
SK
1101#
1102# Python checks for mod_python
1103#
1104AC_ARG_WITH(
1105 [python],
1106 [AS_HELP_STRING([--with-python], [Use system provided version of python (default: try)])],
1107 [with_python="$withval"],
1108 [with_python="try"]
1109)
1110
e8c88aa1
SK
1111if test "$with_python" != "no"
1112then
2d14539e
SK
1113 save_CFLAGS="$CFLAGS"
1114 save_LIBS="$LIBS"
1115
e8c88aa1
SK
1116 if test "$with_python" != "yes" -a "$with_python" != "try" ; then
1117 AC_MSG_CHECKING([for python])
1118 if test ! -x "$with_python" ; then
1119 AC_MSG_ERROR([Specified python does not exist or is not executable: $with_python])
1120 fi
1121 AC_MSG_RESULT([$with_python])
1122 AC_SUBST([PYTHON], ["$with_python"])
1123 else
1124 AC_PATH_PROG([PYTHON], ["python"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"])
1125 fi
1126
1127 if test "$PYTHON" != "no" ; then
1128 AC_MSG_CHECKING([python version])
1129 PYTHON_VER="`$PYTHON -V 2>&1 | cut -d' ' -f2`"
1130
1131 if test -z "$PYTHON_VER" ; then
1132 AC_MSG_ERROR([Unable to detect python version])
1133 fi
1134 AC_MSG_RESULT([$PYTHON_VER])
1135
2d14539e 1136 AC_MSG_CHECKING([for python distutils])
baf944eb
SK
1137 python_result="`$PYTHON -c 'import distutils;' 2>&1`"
1138 if test -z "$python_result" ; then
2d14539e 1139 python_has_distutils="yes"
baf944eb
SK
1140 else
1141 python_has_distutils="no"
2d14539e
SK
1142 fi
1143 AC_MSG_RESULT([$python_has_distutils])
1144
baf944eb 1145 if test "$python_has_distutils" != "no" ; then
f08ac862
SK
1146 AC_MSG_CHECKING([location of site-packages])
1147
83680470 1148 PYTHON_SITE_DIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0));'`"
f08ac862
SK
1149
1150 if test -z "$PYTHON_SITE_DIR" ; then
1151 AC_MSG_ERROR([Unable to detect python site-packages path])
1152 elif test ! -d "$PYTHON_SITE_DIR" ; then
1153 AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!])
1154 fi
1155 AC_MSG_RESULT([$PYTHON_SITE_DIR])
1156 AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR])
1157
2d14539e
SK
1158 #
1159 # python distutils found, get settings from python directly
1160 #
93129e32 1161 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));' | sed -e 's/-arch i386//g;s/-arch x86_64//g'`"
83680470
SK
1162 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));'`"
1163 PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print(\"python\" + sysconfig.get_config_var(\"VERSION\"));'`"
1164 PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`"
ba892c27
SK
1165
1166 # handle python being installed into /usr/local
1167 AC_MSG_CHECKING([python libdir])
1168 if test -z "`echo $PYTHON_LIBDIR | grep "/usr/lib"`" ; then
1169 PYTHON_LDFLAGS="-L$PYTHON_LIBDIR $PYTHON_LDFLAGS"
1170 LIBS="-L$PYTHON_LIBDIR $LIBS"
1171 fi
1172 AC_MSG_RESULT([$PYTHON_LIBDIR])
e8c88aa1 1173
2d14539e
SK
1174 # check libpython
1175 AC_CHECK_LIB([$PYTHON_LIB], [main], [has_libpython="yes"], [has_libpython="no"])
1176
1177 if test "$has_libpython" = "no" ; then
1178 AS_IF([test "$with_python" = "try"],
1179 [AC_MSG_WARN([$PYTHON_LIB is unusable])],
1180 [AC_MSG_ERROR([$PYTHON_LIB is unusable])]
1181 )
1182 fi
e8c88aa1
SK
1183
1184 # check whether system libpython is usable and has threads support
2d14539e 1185 CFLAGS="$PYTHON_CFLAGS"
e8c88aa1
SK
1186 LIBS="$PYTHON_LDFLAGS"
1187 AC_CHECK_FUNC([PyThread_init_thread], [python_has_threads="yes"], [python_has_threads="no"])
e8c88aa1 1188
2d14539e
SK
1189 if test "$python_has_threads" = "no"; then
1190 AS_IF([test "$with_python" = "try"],
1191 [AC_MSG_WARN([Your python lacks threads support, can not build mod_python])],
1192 [AC_MSG_ERROR([Your python lacks threads support, can not build mod_python])]
1193 )
e8c88aa1
SK
1194 else
1195 AC_MSG_NOTICE([Your python seems OK, do not forget to enable mod_python in modules.conf])
2d14539e 1196 AC_SUBST([PYTHON_CFLAGS], [$PYTHON_CFLAGS])
e8c88aa1
SK
1197 AC_SUBST([PYTHON_LDFLAGS], [$PYTHON_LDFLAGS])
1198 fi
1199 else
2d14539e 1200 AS_IF([test "$with_python" = "try"],
baf944eb
SK
1201 [AC_MSG_WARN([Could not find or use python distutils module: $python_result])],
1202 [AC_MSG_ERROR([Could not find or use python distutils module: $python_result])]
2d14539e 1203 )
e8c88aa1
SK
1204 fi
1205
2d14539e
SK
1206 LIBS="$save_LIBS"
1207 CFLAGS="$save_CFLAGS"
1208
1209 unset python_has_threads
1210 unset python_has_distutils
baf944eb 1211 unset python_result
2d14539e
SK
1212 else
1213 AS_IF([test "$with_python" = "try"],
1214 [AC_MSG_WARN([Could not find python, mod_python will not build, use --with-python to specify the location])],
1215 [AC_MSG_ERROR([Could not find python, use --with-python to specify the location])]
1216 )
e8c88aa1
SK
1217 fi
1218else
1219 AC_MSG_WARN([python support disabled, building mod_python will fail!])
1220fi
1221
ea0316b8
AT
1222CHECK_ERLANG
1223
42e78242 1224AC_CONFIG_FILES([Makefile
7b3d3f7e
AM
1225 build/Makefile
1226 src/Makefile
1227 src/mod/Makefile
bcd9f49f
MJ
1228 src/mod/applications/mod_abstraction/Makefile
1229 src/mod/applications/mod_avmd/Makefile
1230 src/mod/applications/mod_blacklist/Makefile
1231 src/mod/applications/mod_callcenter/Makefile
1232 src/mod/applications/mod_cidlookup/Makefile
1233 src/mod/applications/mod_cluechoo/Makefile
1234 src/mod/applications/mod_commands/Makefile
1235 src/mod/applications/mod_conference/Makefile
1236 src/mod/applications/mod_curl/Makefile
1237 src/mod/applications/mod_db/Makefile
1238 src/mod/applications/mod_directory/Makefile
1239 src/mod/applications/mod_distributor/Makefile
1240 src/mod/applications/mod_dptools/Makefile
1241 src/mod/applications/mod_easyroute/Makefile
1242 src/mod/applications/mod_enum/Makefile
1243 src/mod/applications/mod_esf/Makefile
1244 src/mod/applications/mod_esl/Makefile
aad61cad 1245 src/mod/applications/mod_expr/Makefile
bcd9f49f
MJ
1246 src/mod/applications/mod_fifo/Makefile
1247 src/mod/applications/mod_fsk/Makefile
1248 src/mod/applications/mod_fsv/Makefile
1249 src/mod/applications/mod_hash/Makefile
1250 src/mod/applications/mod_httapi/Makefile
1251 src/mod/applications/mod_http_cache/Makefile
1252 src/mod/applications/mod_ladspa/Makefile
1253 src/mod/applications/mod_lcr/Makefile
1254 src/mod/applications/mod_limit/Makefile
1255 src/mod/applications/mod_memcache/Makefile
1256 src/mod/applications/mod_mongo/Makefile
1257 src/mod/applications/mod_mp4/Makefile
1258 src/mod/applications/mod_nibblebill/Makefile
1259 src/mod/applications/mod_oreka/Makefile
dc06a039 1260 src/mod/applications/mod_osp/Makefile
bcd9f49f
MJ
1261 src/mod/applications/mod_rad_auth/Makefile
1262 src/mod/applications/mod_random/Makefile
1263 src/mod/applications/mod_redis/Makefile
1264 src/mod/applications/mod_rss/Makefile
1265 src/mod/applications/mod_skel/Makefile
1266 src/mod/applications/mod_sms/Makefile
1267 src/mod/applications/mod_snapshot/Makefile
1268 src/mod/applications/mod_snipe_hunt/Makefile
1269 src/mod/applications/mod_snom/Makefile
1270 src/mod/applications/mod_sonar/Makefile
1271 src/mod/applications/mod_soundtouch/Makefile
1272 src/mod/applications/mod_spandsp/Makefile
1273 src/mod/applications/mod_spy/Makefile
ea181ca4 1274 src/mod/applications/mod_stress/Makefile
bcd9f49f
MJ
1275 src/mod/applications/mod_translate/Makefile
1276 src/mod/applications/mod_valet_parking/Makefile
1277 src/mod/applications/mod_vmd/Makefile
1278 src/mod/applications/mod_voicemail/Makefile
1279 src/mod/applications/mod_voicemail_ivr/Makefile
1280 src/mod/asr_tts/mod_cepstral/Makefile
1281 src/mod/asr_tts/mod_flite/Makefile
1282 src/mod/asr_tts/mod_pocketsphinx/Makefile
1283 src/mod/asr_tts/mod_tts_commandline/Makefile
1284 src/mod/asr_tts/mod_unimrcp/Makefile
1285 src/mod/codecs/mod_amr/Makefile
1286 src/mod/codecs/mod_amrwb/Makefile
1287 src/mod/codecs/mod_b64/Makefile
1288 src/mod/codecs/mod_bv/Makefile
1289 src/mod/codecs/mod_celt/Makefile
1290 src/mod/codecs/mod_codec2/Makefile
17d52112 1291 src/mod/codecs/mod_com_g729/Makefile
bcd9f49f
MJ
1292 src/mod/codecs/mod_dahdi_codec/Makefile
1293 src/mod/codecs/mod_g723_1/Makefile
1294 src/mod/codecs/mod_g729/Makefile
1295 src/mod/codecs/mod_h26x/Makefile
1296 src/mod/codecs/mod_ilbc/Makefile
1297 src/mod/codecs/mod_isac/Makefile
1298 src/mod/codecs/mod_mp4v/Makefile
1299 src/mod/codecs/mod_opus/Makefile
1300 src/mod/codecs/mod_sangoma_codec/Makefile
1301 src/mod/codecs/mod_silk/Makefile
1302 src/mod/codecs/mod_siren/Makefile
1303 src/mod/codecs/mod_skel_codec/Makefile
1304 src/mod/codecs/mod_theora/Makefile
1305 src/mod/codecs/mod_vp8/Makefile
1306 src/mod/dialplans/mod_dialplan_asterisk/Makefile
1307 src/mod/dialplans/mod_dialplan_directory/Makefile
1308 src/mod/dialplans/mod_dialplan_xml/Makefile
1309 src/mod/directories/mod_ldap/Makefile
1310 src/mod/endpoints/mod_alsa/Makefile
1311 src/mod/endpoints/mod_dingaling/Makefile
1312 src/mod/endpoints/mod_h323/Makefile
1313 src/mod/endpoints/mod_khomp/Makefile
1314 src/mod/endpoints/mod_loopback/Makefile
1315 src/mod/endpoints/mod_opal/Makefile
59472c23 1316 src/mod/endpoints/mod_portaudio/Makefile
bcd9f49f
MJ
1317 src/mod/endpoints/mod_reference/Makefile
1318 src/mod/endpoints/mod_rtmp/Makefile
ad4eb5e0 1319 src/mod/endpoints/mod_skinny/Makefile
99e55ae0 1320 src/mod/endpoints/mod_skypopen/Makefile
7b3d3f7e 1321 src/mod/endpoints/mod_sofia/Makefile
bcd9f49f
MJ
1322 src/mod/endpoints/mod_unicall/Makefile
1323 src/mod/event_handlers/mod_cdr_csv/Makefile
1324 src/mod/event_handlers/mod_cdr_mongodb/Makefile
1325 src/mod/event_handlers/mod_cdr_pg_csv/Makefile
1326 src/mod/event_handlers/mod_cdr_sqlite/Makefile
1327 src/mod/event_handlers/mod_erlang_event/Makefile
1328 src/mod/event_handlers/mod_event_multicast/Makefile
1329 src/mod/event_handlers/mod_event_socket/Makefile
1330 src/mod/event_handlers/mod_event_test/Makefile
1331 src/mod/event_handlers/mod_format_cdr/Makefile
1332 src/mod/event_handlers/mod_json_cdr/Makefile
1333 src/mod/event_handlers/mod_radius_cdr/Makefile
1334 src/mod/event_handlers/mod_rayo/Makefile
1335 src/mod/event_handlers/mod_snmp/Makefile
c19bb4d1 1336 src/mod/event_handlers/mod_event_zmq/Makefile
bcd9f49f
MJ
1337 src/mod/formats/mod_local_stream/Makefile
1338 src/mod/formats/mod_native_file/Makefile
1339 src/mod/formats/mod_shell_stream/Makefile
1340 src/mod/formats/mod_shout/Makefile
1341 src/mod/formats/mod_sndfile/Makefile
1342 src/mod/formats/mod_ssml/Makefile
1343 src/mod/formats/mod_tone_stream/Makefile
1344 src/mod/formats/mod_vlc/Makefile
59472c23 1345 src/mod/formats/mod_portaudio_stream/Makefile
7b3d3f7e 1346 src/mod/languages/mod_java/Makefile
9b8392bc 1347 src/mod/languages/mod_lua/Makefile
bcd9f49f
MJ
1348 src/mod/languages/mod_managed/Makefile
1349 src/mod/languages/mod_perl/Makefile
7b3d3f7e 1350 src/mod/languages/mod_python/Makefile
0c1ae13d 1351 src/mod/languages/mod_spidermonkey/Makefile
b7623326 1352 src/mod/languages/mod_v8/Makefile
bcd9f49f
MJ
1353 src/mod/languages/mod_yaml/Makefile
1354 src/mod/legacy/languages/mod_lua/Makefile
1355 src/mod/loggers/mod_console/Makefile
1356 src/mod/loggers/mod_logfile/Makefile
1357 src/mod/loggers/mod_syslog/Makefile
1358 src/mod/say/mod_say_de/Makefile
1359 src/mod/say/mod_say_en/Makefile
1360 src/mod/say/mod_say_es/Makefile
1361 src/mod/say/mod_say_fa/Makefile
1362 src/mod/say/mod_say_fr/Makefile
1363 src/mod/say/mod_say_he/Makefile
1364 src/mod/say/mod_say_hr/Makefile
1365 src/mod/say/mod_say_hu/Makefile
1366 src/mod/say/mod_say_it/Makefile
1367 src/mod/say/mod_say_ja/Makefile
1368 src/mod/say/mod_say_nl/Makefile
1369 src/mod/say/mod_say_pl/Makefile
1370 src/mod/say/mod_say_pt/Makefile
1371 src/mod/say/mod_say_ru/Makefile
1372 src/mod/say/mod_say_sv/Makefile
1373 src/mod/say/mod_say_th/Makefile
1374 src/mod/say/mod_say_zh/Makefile
1375 src/mod/timers/mod_posix_timer/Makefile
1376 src/mod/timers/mod_timerfd/Makefile
1377 src/mod/xml_int/mod_xml_cdr/Makefile
1378 src/mod/xml_int/mod_xml_curl/Makefile
1379 src/mod/xml_int/mod_xml_ldap/Makefile
1380 src/mod/xml_int/mod_xml_radius/Makefile
1381 src/mod/xml_int/mod_xml_rpc/Makefile
1382 src/mod/xml_int/mod_xml_scgi/Makefile
7b3d3f7e
AM
1383 src/include/switch_am_config.h
1384 build/getsounds.sh
1385 build/getlib.sh
17d52112 1386 build/getg729.sh
68b58406 1387 build/freeswitch.pc
7b3d3f7e 1388 build/modmake.rules
58e7db0c 1389 libs/esl/eslmake.rules
7b3d3f7e 1390 libs/xmlrpc-c/xmlrpc_config.h
6b6c83a7
JL
1391 libs/xmlrpc-c/config.mk
1392 libs/xmlrpc-c/srcdir.mk
1393 libs/xmlrpc-c/stamp-h
7b3d3f7e 1394 scripts/gentls_cert])
4da77ea5 1395
a6e9f279 1396AM_CONDITIONAL(ISLINUX, [test `uname -s` = Linux])
db399276 1397AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin])
fba1c2bf 1398AM_CONDITIONAL(ISFREEBSD, [test `uname -s` = FreeBSD])
a092a55a 1399AM_CONDITIONAL(IS64BITLINUX, [test `uname -m` = x86_64])
a6e9f279 1400
bcd9f49f
MJ
1401AM_CONDITIONAL(HAVE_AMR, [ test -d ${switch_srcdir}/libs/amr ])
1402AM_CONDITIONAL(HAVE_AMRWB, [ test -d ${switch_srcdir}/libs/amrwb ])
1403AM_CONDITIONAL(HAVE_G723_1, [ test -d ${switch_srcdir}/libs/libg723_1 ])
1404AM_CONDITIONAL(HAVE_G729, [ test -d ${switch_srcdir}/libs/libg729 ])
1405
c7753b06
MJ
1406#some vars to sub into the Makefile.am's
1407#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
c7753b06 1408TOUCH_TARGET='if test -f "$@";then touch "$@";fi;'
afe7d97f 1409CONF_MODULES='$$(grep -v "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" | sort | uniq )'
b9f2bdfb 1410CONF_DISABLED_MODULES='$$(grep "\#" $(switch_builddir)/modules.conf | grep -v "\#\#" | sed -e "s|^.*/||" | sort | uniq )'
afe7d97f
MJ
1411OUR_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 )'
1412OUR_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 )'
1413OUR_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 )'
1414OUR_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 )'
1415OUR_DISABLED_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-all ; done )"; echo $$mods )'
1416OUR_DISABLED_CLEAN_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-clean ; done )"; echo $$mods )'
1417OUR_DISABLED_INSTALL_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-install ; done)"; echo $$mods )'
1418OUR_DISABLED_UNINSTALL_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-uninstall ; done)"; echo $$mods )'
ed960392
AM
1419
1420AM_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 1421#AM_MAKEFLAGS='`test -n "$(VERBOSE)" || echo -s`'
c7753b06
MJ
1422AC_SUBST(LIBTOOL)
1423AC_SUBST(TOUCH_TARGET)
ed960392 1424AC_SUBST(CONF_DISABLED_MODULES)
5f053e18 1425AC_SUBST(CONF_MODULES)
ed960392 1426
5f053e18
MJ
1427AC_SUBST(OUR_MODS)
1428AC_SUBST(OUR_CLEAN_MODS)
1429AC_SUBST(OUR_INSTALL_MODS)
1430AC_SUBST(OUR_UNINSTALL_MODS)
ed960392
AM
1431AC_SUBST(OUR_DISABLED_MODS)
1432AC_SUBST(OUR_DISABLED_CLEAN_MODS)
1433AC_SUBST(OUR_DISABLED_INSTALL_MODS)
1434AC_SUBST(OUR_DISABLED_UNINSTALL_MODS)
c7753b06
MJ
1435AC_SUBST(AM_MAKEFLAGS)
1436
74fd6fb6 1437ac_configure_args="$ac_configure_args CONFIGURE_CFLAGS='$CFLAGS' CONFIGURE_CXXFLAGS='$CXXFLAGS' CONFIGURE_LDFLAGS='$LDFLAGS' "
452b0bde 1438
40ff9a41
MJ
1439# --prefix='$prefix' --exec_prefix='$exec_prefix' --libdir='$libdir' --libexecdir='$libexecdir' --bindir='$bindir' --sbindir='$sbindir' \
1440# --localstatedir='$localstatedir' --datadir='$datadir'"
8f9ab613 1441
46f6981d 1442# Run configure in all the subdirs
236bfeea
MJ
1443AC_CONFIG_SUBDIRS([libs/srtp])
1444AC_CONFIG_SUBDIRS([libs/sqlite])
1445if test "$enable_core_libedit_support" = "yes" ; then
1446 AC_CONFIG_SUBDIRS([libs/libedit])
1447fi
1448
1449AC_CONFIG_SUBDIRS([libs/pcre])
1450AC_CONFIG_SUBDIRS([libs/apr])
1451AC_CONFIG_SUBDIRS([libs/apr-util])
1452AC_CONFIG_SUBDIRS([libs/ilbc])
64a2f549
JLC
1453if test "$ac_cv_use_system_curl" != "yes"; then
1454 AC_CONFIG_SUBDIRS([libs/curl])
1455fi
236bfeea
MJ
1456AC_CONFIG_SUBDIRS([libs/iksemel])
1457AC_CONFIG_SUBDIRS([libs/js/nsprpub])
1458AC_CONFIG_SUBDIRS([libs/js])
1459AC_CONFIG_SUBDIRS([libs/libdingaling])
1460AC_CONFIG_SUBDIRS([libs/libsndfile])
1461AC_CONFIG_SUBDIRS([libs/sofia-sip])
1462AC_CONFIG_SUBDIRS([libs/speex])
1463AC_CONFIG_SUBDIRS([libs/portaudio])
1464AC_CONFIG_SUBDIRS([libs/openzap])
1465AC_CONFIG_SUBDIRS([libs/freetdm])
1466AC_CONFIG_SUBDIRS([libs/unimrcp])
1467AC_CONFIG_SUBDIRS([libs/tiff-4.0.2])
1468AC_CONFIG_SUBDIRS([libs/spandsp])
1469AC_CONFIG_SUBDIRS([libs/broadvoice])
1470AC_CONFIG_SUBDIRS([libs/libg722_1])
1471AC_CONFIG_SUBDIRS([libs/silk])
1472AC_CONFIG_SUBDIRS([libs/libcodec2])
1473if test "x${enable_zrtp}" = "xyes"; then
e5a1b54e 1474 AC_CONFIG_SUBDIRS([libs/libzrtp])
393b63b7 1475fi
ee3fc89f 1476
f6fe2667
MJ
1477case $host in
1478 *-openbsd*)
1479 # libtool won't link static libs against shared ones on OpenBSD unless we tell it not to be stupid
1480 AC_CONFIG_COMMANDS([hacklibtool], [cp libtool libtool.orig && sed -e "s/deplibs_check_method=.*/deplibs_check_method=pass_all/g" libtool.orig > libtool])
1481 ;;
1482esac
1483
1484
6e81dda1 1485AC_OUTPUT
5ccac21d 1486
1ed00b4d
BW
1487##
1488## Registering for ClueCon
1489##
4ff9b2f1 1490if ! test -f noreg ; then
1ed00b4d
BW
1491echo ""
1492echo ""
1493echo $ECHO_N "Registering you for ClueCon http://www.cluecon.com $ECHO_C" 1>&6
82f77413 1494sleep 1
1ed00b4d 1495echo $ECHO_N ".$ECHO_C" 1>&6
82f77413 1496sleep 1
1ed00b4d 1497echo $ECHO_N ".$ECHO_C" 1>&6
82f77413 1498sleep 1
1ed00b4d 1499AC_MSG_RESULT([ See you in August. ;-)])
1ed00b4d 1500echo ""
17d52112 1501fi
1ed00b4d 1502
5ccac21d
MJ
1503##
1504## Configuration summary
1505##
1506
1507echo
8912b80e 1508echo "-------------------------- FreeSWITCH configuration --------------------------"
5ccac21d
MJ
1509echo ""
1510echo " Locations:"
fd1b0279 1511echo " FHS enabled: ${enable_fhs}"
5ccac21d
MJ
1512echo ""
1513echo " prefix: ${prefix}"
1514echo " exec_prefix: ${exec_prefix}"
1515echo " bindir: ${bindir}"
fd1b0279 1516echo " sysconfdir: ${sysconfdir}"
5ccac21d 1517echo " libdir: ${libdir}"
fd1b0279
TC
1518echo ""
1519echo " certsdir: ${certsdir}"
1520echo " dbdir: ${dbdir}"
1521echo " grammardir: ${grammardir}"
1522echo " htdocsdir: ${htdocsdir}"
1523echo " logfiledir: ${logfiledir}"
5ccac21d 1524echo " modulesdir: ${modulesdir}"
fd1b0279
TC
1525echo " pkgconfigdir: ${pkgconfigdir}"
1526echo " recordingsdir: ${recordingsdir}"
5ccac21d 1527echo " runtimedir: ${runtimedir}"
fd1b0279
TC
1528echo " scriptdir: ${scriptdir}"
1529echo " soundsdir: ${soundsdir}"
1530echo " storagedir: ${storagedir}"
5ccac21d 1531echo ""
8912b80e 1532echo "------------------------------------------------------------------------------"