Debian Codegraph @

configure.ac

raw ◀ ▶
Source reconstructed at patch state 2 of 4 — not the installed (fully patched) source.
4 Debian patches touch this file
1 AC_PREREQ(2.60a)
2
3 AC_INIT([asterisk], [22], [https://github.com/asterisk/asterisk/issues])
4
5 # cross-compile macros
6 AC_CANONICAL_BUILD
7 AC_CANONICAL_HOST
8
9 # check existence of the package
10 AC_CONFIG_SRCDIR([main/asterisk.c])
11
12 AC_COPYRIGHT("Asterisk")
13
14 # preserve any CFLAGS or LDFLAGS that may be set
15 # NOTE: This must be done before calling any macros that end up
16 # calling AC_PROG_CC or the like, since they will set a default
17 # set of CFLAGS ("-g -O2") if the user did not supply any, and
18 # we don't want those default flags to be carried over into the
19 # rest of the build system since we have other means of controlling
20 # debugging symbol generation and optimization.
21 CONFIG_CFLAGS="${CFLAGS}"
22 CONFIG_LDFLAGS="${LDFLAGS}"
23 AC_SUBST(CONFIG_CFLAGS)
24 AC_SUBST(CONFIG_LDFLAGS)
25
26 # specify output header file
27 AC_CONFIG_HEADERS([include/asterisk/autoconfig.h])
28
29 # Note: AC_PROG_CC *must* be specified before AC_USE_SYSTEM_EXTENSIONS or any
30 # other macro that uses the C compiler, or the default order will be used.
31 AC_PROG_CC([gcc cc])
32
33 AC_USE_SYSTEM_EXTENSIONS dnl note- does not work on FreeBSD
34
35 # System default paths
36 AC_SUBST([astsbindir], ['${sbindir}'])dnl
37 AC_SUBST([astcachedir], ['${localstatedir}/cache/asterisk'])dnl
38 AC_SUBST([astetcdir], ['${sysconfdir}/asterisk'])dnl
39 AC_SUBST([astheaderdir], ['${includedir}/asterisk'])dnl
40 AC_SUBST([astlibdir], ['${libdir}'])dnl
41 AC_SUBST([astmoddir], ['${libdir}/asterisk/modules'])dnl
42 AC_SUBST([astmandir], ['${mandir}'])dnl
43 AC_SUBST([astvarlibdir], ['${localstatedir}/lib/asterisk'])dnl
44 AC_SUBST([astdatadir], ['${datadir}/asterisk'])dnl
45 AC_SUBST([astdbdir], ['${astvarlibdir}'])dnl
46 AC_SUBST([astkeydir], ['${astvarlibdir}'])dnl
47 AC_SUBST([astspooldir], ['${localstatedir}/spool/asterisk'])dnl
48 AC_SUBST([astlogdir], ['${localstatedir}/log/asterisk'])dnl
49 AC_SUBST([astvarrundir], ['${localstatedir}/run/asterisk'])dnl
50
51 case "${host_os}" in
52 *bsd*)
53 if test ${prefix} != 'NONE'; then
54 astvarlibdir='${prefix}/share/asterisk'
55 astdbdir='${localstatedir}/db/asterisk'
56 fi
57 ;;
58 darwin*)
59 if test ${prefix} = 'NONE'; then
60 astvarrundir='/Library/Application Support/Asterisk/Run'
61 fi
62 ;;
63 esac
64
65 case "${host_os}" in
66 netbsd*)
67 ac_default_prefix=/usr/pkg
68 CPPFLAGS=-I/usr/pkg/include
69 LDFLAGS=-L/usr/pkg/lib
70 ;;
71 dragonfly*|freebsd*)
72 ac_default_prefix=/usr/local
73 CPPFLAGS=-I/usr/local/include
74 LDFLAGS=-L/usr/local/lib
75 ;;
76 openbsd*)
77 ac_default_prefix=/usr/local
78 if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
79 if test ${sysconfdir} = '${prefix}/etc'; then
80 astetcdir=/etc/asterisk
81 fi
82 if test ${mandir} = '${prefix}/man'; then
83 astmandir=/usr/share/man
84 fi
85 fi
86 CPPFLAGS=-I/usr/local/include
87 LDFLAGS=-L/usr/local/lib
88 ;;
89 darwin*)
90 ac_default_prefix=/usr/local
91 if test ${prefix} = 'NONE'; then
92 astmoddir='/Library/Application Support/Asterisk/Modules'
93 astvarlibdir='/Library/Application Support/Asterisk'
94 astlogdir=/Library/Logs/Asterisk
95 astvarrundir='/Library/Application Support/Asterisk/Run'
96 fi
97 AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.])
98 AC_DEFINE([_DARWIN_UNLIMITED_SELECT], 1, [Define to 1 if running on Darwin.])
99 ;;
100 solaris*)
101 if test ${prefix} = 'NONE'; then
102 astcachedir=/var/cache/asterisk
103 astetcdir=/var/etc/asterisk
104 astsbindir=/opt/asterisk/sbin
105 astlibdir=/opt/asterisk/lib
106 astmoddir=/opt/asterisk/lib/modules
107 astheaderdir=/opt/asterisk/include
108 astmandir=/opt/asterisk/man
109 astvarlibdir=/var/opt/asterisk
110 astspooldir=/var/spool/asterisk
111 astlogdir=/var/log/asterisk
112 astvarrundir=/var/run/asterisk
113 fi
114 ;;
115 *)
116 ac_default_prefix=/usr
117 if test ${prefix} = '/usr' || test ${prefix} = 'NONE'; then
118 if test ${sysconfdir} = '${prefix}/etc'; then
119 sysconfdir=/etc
120 fi
121 if test ${mandir} = '${prefix}/man'; then
122 mandir=/usr/share/man
123 fi
124 fi
125 ;;
126 esac
127
128 if test ${prefix} = ${ac_default_prefix} || test ${prefix} = 'NONE'; then
129 if test ${localstatedir} = '${prefix}/var'; then
130 localstatedir=/var
131 fi
132 fi
133
134 BUILD_PLATFORM=${build}
135 BUILD_CPU=${build_cpu}
136 BUILD_VENDOR=${build_vendor}
137 BUILD_OS=${build_os}
138
139 AC_SUBST(BUILD_PLATFORM)
140 AC_SUBST(BUILD_CPU)
141 AC_SUBST(BUILD_VENDOR)
142 AC_SUBST(BUILD_OS)
143
144 HOST_PLATFORM=${host}
145 HOST_CPU=${host_cpu}
146 HOST_VENDOR=${host_vendor}
147 HOST_OS=${host_os}
148
149 AC_SUBST(HOST_PLATFORM)
150 AC_SUBST(HOST_CPU)
151 AC_SUBST(HOST_VENDOR)
152 AC_SUBST(HOST_OS)
153
154 PBX_WINARCH=0
155
156 case "${host_os}" in
157 dragonfly*|freebsd*)
158 OSARCH=FreeBSD
159 ;;
160 netbsd*)
161 OSARCH=NetBSD
162 ;;
163 openbsd*)
164 OSARCH=OpenBSD
165 ;;
166 solaris*)
167 OSARCH=SunOS
168 ;;
169 mingw32)
170 OSARCH=mingw32
171 PBX_WINARCH=1
172 ;;
173 cygwin)
174 OSARCH=cygwin
175 PBX_WINARCH=1
176 ;;
177 linux-gnu*)
178 OSARCH=linux-gnu
179 ;;
180 linux-musl*)
181 OSARCH=linux-musl
182 ;;
183 kfreebsd*-gnu)
184 OSARCH=kfreebsd-gnu
185 ;;
186 *)
187 OSARCH=${host_os}
188 ;;
189 esac
190
191 AC_SUBST(OSARCH)
192 AC_SUBST(PBX_WINARCH)
193
194 AC_MSG_CHECKING(whether char is unsigned)
195 AC_COMPILE_IFELSE(
196 [
197 AC_LANG_SOURCE(
198 #include <limits.h>
199 #if CHAR_MIN == 0
200 #error
201 #endif
202 )
203 ],[
204 AC_MSG_RESULT(no)
205 CONFIG_SIGNED_CHAR=""
206 ],[
207 AC_MSG_RESULT(yes)
208 CONFIG_SIGNED_CHAR="-fsigned-char"
209 ]
210 )
211 AC_SUBST(CONFIG_SIGNED_CHAR)
212
213 # check for uname
214 AC_PATH_TOOL([UNAME], [uname], :)
215 if test "x${UNAME}" != "x:"; then
216 PBX_OSREV=$(${UNAME} -r)
217 fi
218 AC_SUBST(PBX_OSREV)
219
220 AH_TOP([#ifndef ASTERISK_AUTOCONFIG_H
221 #define ASTERISK_AUTOCONFIG_H
222 /* IWYU pragma: private, include "asterisk.h" */
223
224 #include "asterisk/buildopts.h" /* IWYU pragma: export */])
225
226 AH_BOTTOM([#endif /* ASTERISK_AUTOCONFIG_H */])
227
228 # cross-compile checks
229 if test "${cross_compiling}" = "yes";
230 then
231 AC_CHECK_TOOL(CC, gcc, :)
232 AC_CHECK_TOOL(CXX, g++, :)
233 AC_CHECK_TOOL(LD, ld, :)
234 AC_CHECK_TOOL(RANLIB, ranlib, :)
235 CROSS_COMPILING=1
236 AC_SUBST(CROSS_COMPILING)
237 fi
238
239 # Checks for programs.
240 AC_PROG_CXX
241 AC_PROG_CPP
242 AC_PROG_CXXCPP
243
244 # Do we want to force the C++ compiler to use the latest standard it supports?
245 AC_ARG_ENABLE([latest-cxx-std],
246 [AS_HELP_STRING([--enable-latest-cxx-std],
247 [Force C++ compiler to use the latest standard it supports])],
248 [case "${enableval}" in
249 y|ye|yes) ENABLE_LATEST_CXX_STD=yes ;;
250 n|no) ENABLE_LATEST_CXX_STD=no ;;
251 *) AC_MSG_ERROR(bad value ${enableval} for --enable-latest-cxx-std) ;;
252 esac], [ENABLE_LATEST_CXX_STD=no])
253
254 # Check to see if the C++ compiler supports STDC++11,14,17,20,23
255 # These MUST be in ascending order.
256 AST_CXX_CHECK_STD([11], [${ENABLE_LATEST_CXX_STD}])
257 AST_CXX_CHECK_STD([14], [${ENABLE_LATEST_CXX_STD}])
258 AST_CXX_CHECK_STD([17], [${ENABLE_LATEST_CXX_STD}])
259 AST_CXX_CHECK_STD([20], [${ENABLE_LATEST_CXX_STD}])
260 AST_CXX_CHECK_STD([23], [${ENABLE_LATEST_CXX_STD}])
261
262 # This macro is just copied into our local acinclude.m4 from libtool.m4 so that
263 # the developers regenerating the configure script don't have to install libtool.
264 AST_PROG_LD # note, does not work on FreeBSD
265 AC_PROG_AWK
266 AC_PROG_INSTALL
267 AC_PROG_LN_S
268 AC_PROG_RANLIB
269 AST_CHECK_GNU_MAKE
270 AC_PROG_EGREP
271
272 AC_CHECK_TOOLS([STRIP], [strip gstrip], :)
273 AC_CHECK_TOOLS([AR], [ar gar], :)
274
275 GNU_LD=0
276 if test "x$with_gnu_ld" = "xyes" ; then
277 GNU_LD=1
278 fi
279 AC_SUBST(GNU_LD)
280
281 AC_PATH_PROG([BISON], [bison], :)
282 AC_PATH_PROG([CMP], [cmp], :)
283 AC_PATH_PROG([CAT], [cat], :)
284 AC_PATH_PROG([CUT], [cut], :)
285 AC_PATH_PROG([FLEX], [flex], :)
286 AC_PATH_PROG([GREP], [grep], :)
287 AC_PATH_PROGS([PYTHON], [python2.7 python2 python python3], :)
288 AC_PATH_PROG([FIND], [find], :)
289 AC_PATH_PROG([BASENAME], [basename], :)
290 AC_PATH_PROG([DIRNAME], [dirname], :)
291 AC_PATH_PROG([SHELL], [sh], :)
292 AC_PATH_PROG([LN], [ln], :)
293 AC_PATH_PROG([DOXYGEN], [doxygen], :)
294 AC_PATH_PROG([DOT], [dot], :)
295 AC_PATH_PROG([WGET], [wget], :)
296 AC_PATH_PROG([CURL], [curl], :)
297 AC_PATH_PROG([XMLLINT], [xmllint], :)
298 AC_PATH_PROGS([XMLSTARLET], [xmlstarlet xml], :)
299 AC_PATH_PROG([BASH], [bash], :)
300 AC_PATH_PROG([GIT], [git], :)
301 AC_PATH_PROG([ALEMBIC], [alembic], :)
302 AC_PATH_PROG([BZIP2], [bzip2], :)
303 AC_PATH_PROG([TAR], [tar], :)
304 AC_PATH_PROG([PATCH], [patch], :)
305 AC_PATH_PROG([SED], [sed], :)
306 AC_PATH_TOOL([NM], [nm], :)
307 AC_PATH_PROG([REALPATH], [realpath], :)
308
309
310 DOWNLOAD=":"
311 DOWNLOAD_TO_STDOUT=
312 DOWNLOAD_TIMEOUT=
313 if test "x${WGET}" != "x:"; then
314 DOWNLOAD=${WGET}
315 DOWNLOAD_TO_STDOUT="${WGET} -q -O-"
316 DOWNLOAD_TIMEOUT='--timeout=$1'
317 elif test "x${CURL}" != "x:"; then
318 DOWNLOAD="${CURL} -L -O --progress-bar -w \"%{url_effective}\n\""
319 DOWNLOAD_TO_STDOUT="${CURL} -Ls"
320 DOWNLOAD_TIMEOUT='--max-time $(or $2,$1)'
321 else
322 AC_PATH_PROG([FETCH], [fetch], :)
323 if test "x${FETCH}" != "x:"; then
324 DOWNLOAD=${FETCH}
325 DOWNLOAD_TO_STDOUT="${FETCH} -o-"
326 DOWNLOAD_TIMEOUT='--timeout=$(or $2,$1)'
327 fi
328 fi
329 AC_SUBST(DOWNLOAD)
330 AC_SUBST(DOWNLOAD_TO_STDOUT)
331 AC_SUBST(DOWNLOAD_TIMEOUT)
332
333 AC_PATH_PROG([LDCONFIG], [ldconfig], :)
334 AC_PATH_PROG([SHA1SUM], [sha1sum], $ac_aux_dir/build_tools/sha1sum-sh)
335 AC_PATH_PROG([OPENSSL], [openssl], :)
336
337 PKG_PROG_PKG_CONFIG()
338
339 AC_CACHE_CHECK([for bison that supports parse-param], [ac_cv_path_BISON2], [
340 if test "x$BISON" != "x:" ; then
341 # Create a temporary directory $tmp in $TMPDIR (default /tmp).
342 # Use mktemp if possible; otherwise fall back on mkdir,
343 # with $RANDOM to make collisions less likely.
344 : ${TMPDIR=/tmp}
345 {
346 tmp=`
347 (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
348 ` &&
349 test -n "$tmp" && test -d "$tmp"
350 } || {
351 tmp=$TMPDIR/foo$$-$RANDOM
352 (umask 077 && mkdir "$tmp")
353 } || exit $?
354 cat >$tmp/test.y <<__EOL__
355 %parse-param {struct parse_io *parseio}
356 %%
357 file : { \$\$ = parseio->pval = 1; }
358 ;
359 %%
360 __EOL__
361 ${BISON} -o ${tmp}/test.tab.c ${tmp}/test.y >/dev/null 2>&1
362 if test -e "${tmp}/test.tab.c"; then
363 ac_cv_path_BISON2=${BISON}
364 fi
365 rm -rf ${tmp}
366 fi
367 ])
368 if test "x${ac_cv_path_BISON2}" = "x" ; then
369 BISON=:
370 PBX_BISON=0
371 else
372 PBX_BISON=1
373 fi
374 AC_SUBST(PBX_BISON)
375
376 if test "${FLEX}" = ":"; then
377 PBX_FLEX=0
378 else
379 PBX_FLEX=1
380 fi
381 AC_SUBST(PBX_FLEX)
382
383 if test "${XMLSTARLET}" = ":"; then
384 PBX_XMLSTARLET=0
385 else
386 PBX_XMLSTARLET=1
387 fi
388 AC_SUBST(PBX_XMLSTARLET)
389
390 if test "${BASH}" = ":"; then
391 PBX_BASH=0
392 else
393 PBX_BASH=1
394 fi
395 AC_SUBST(PBX_BASH)
396
397 AC_CHECK_TOOL([SOXMIX], [soxmix], :)
398 if test "x${SOXMIX}" != "x:"; then
399 AC_DEFINE([HAVE_SOXMIX], 1, [Define to 1 if your system has soxmix application.])
400 fi
401
402 AC_CHECK_PROGS([MD5], [md5 md5sum gmd5sum digest])
403
404 if test "${MD5}" = "digest" ; then
405 MD5="${MD5} -a md5"
406 fi
407
408 AX_PTHREAD
409
410 AC_LANG(C)
411
412 PBX_NO_BINARY_MODULES=0
413 AC_ARG_ENABLE([binary-modules],
414 [AS_HELP_STRING([--disable-binary-modules],
415 [Block installation of binary modules.])],
416 [case "${enableval}" in
417 y|ye|yes) PBX_NO_BINARY_MODULES=0 ;;
418 n|no) PBX_NO_BINARY_MODULES=1 ;;
419 *) AC_MSG_ERROR(bad value ${enableval} for --disable-binary-modules) ;;
420 esac])
421 AC_SUBST(PBX_NO_BINARY_MODULES)
422
423 AC_ARG_ENABLE([dev-mode],
424 [AS_HELP_STRING([--enable-dev-mode],
425 [Turn on developer mode])],
426 [case "${enableval}" in
427 y|ye|yes) AST_DEVMODE=yes ;;
428 n|no) AST_DEVMODE=no ;;
429 noisy)
430 AST_DEVMODE=yes
431 NOISY_BUILD=yes
432 ;;
433 strict)
434 AST_DEVMODE=yes
435 AST_DEVMODE_STRICT=yes
436 ;;
437 *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode) ;;
438 esac])
439 AC_SUBST(NOISY_BUILD)
440 AC_SUBST(AST_DEVMODE)
441 AC_SUBST(AST_DEVMODE_STRICT)
442
443 AST_OPTION_ONLY([download-cache], [AST_DOWNLOAD_CACHE], [cached sound AND external module tarfiles], [])
444 AST_OPTION_ONLY([sounds-cache], [SOUNDS_CACHE_DIR], [cached sound tarfiles], [])
445 AST_OPTION_ONLY([externals-cache], [EXTERNALS_CACHE_DIR], [cached external module tarfiles], [])
446
447 AST_CODE_COVERAGE=no
448 AC_ARG_ENABLE([coverage],
449 [AS_HELP_STRING([--enable-coverage],
450 [Turn on code coverage tracking (for gcov)])],
451 [case "${enableval}" in
452 y|ye|yes) AST_CODE_COVERAGE=yes ;;
453 n|no) AST_CODE_COVERAGE=no ;;
454 *) AC_MSG_ERROR(bad value ${enableval} for --enable-coverage) ;;
455 esac])
456 AC_SUBST(AST_CODE_COVERAGE)
457
458 AST_CHECK_RAII()
459 AST_CHECK_STRSEP_ARRAY_BOUNDS()
460
461 JANSSON_BUNDLED=no
462 AC_ARG_WITH([jansson-bundled],
463 [AS_HELP_STRING([--with-jansson-bundled],
464 [Use bundled jansson library])],
465 [case "${withval}" in
466 y|ye|yes) JANSSON_BUNDLED=yes ;;
467 *) JANSSON_BUNDLED=no ;;
468 esac])
469
470 PJPROJECT_BUNDLED=yes
471 AH_TEMPLATE(m4_bpatsubst([[HAVE_PJPROJECT_BUNDLED]], [(.*)]), [Define to 1 when using the bundled pjproject.])
472
473 AC_ARG_WITH([pjproject-bundled],
474 [AS_HELP_STRING([--with-pjproject-bundled],
475 [Use bundled pjproject libraries (default)])],
476 [case "${withval}" in
477 n|no) PJPROJECT_BUNDLED=no ;;
478 *) PJPROJECT_BUNDLED=yes ;;
479 esac])
480
481 if test "${with_pjproject}" = "no" || test "${with_pjproject}" = "n" ; then
482 PJPROJECT_BUNDLED=no
483 fi
484
485 LIBJWT_BUNDLED=no
486 AC_ARG_WITH([libjwt-bundled],
487 [AS_HELP_STRING([--with-libjwt-bundled],
488 [Use bundled libjwt library])],
489 [case "${withval}" in
490 y|ye|yes) LIBJWT_BUNDLED=yes ;;
491 *) LIBJWT_BUNDLED=no ;;
492 esac])
493
494 #
495 # OpenSSL stuff has to be done here because we want to pass
496 # any resulting CFLAGS and LDFLAGS to the bundled pjproject
497 # configure done in THIRD_PARTY_CONFIGURE()
498 #
499 AST_EXT_LIB_SETUP([CRYPTO], [OpenSSL Cryptography], [crypto])
500 AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer], [ssl])
501 AST_EXT_LIB_SETUP_OPTIONAL([OPENSSL_BIO_METHOD], [OpenSSL BIO Method Support], [CRYPTO], [crypto])
502
503 # If neither --without-ssl (PBX_OPENSSL=-1) nor --without-crypto (PBX_CRYPTO=-1)
504 # and there were no directories atdded to --with-ssl and --with-crypto, and
505 # pkg-config is installed (which is should be by install_prereq).
506 if test "x$PKG_CONFIG" != "x" -a $PBX_OPENSSL -ge 0 -a $PBX_CRYPTO -ge 0 -a "x$OPENSSL_DIR" = "x" ; then
507 AC_MSG_NOTICE(checking OPENSSL with pkg-config)
508 AC_MSG_NOTICE(checking whether system openssl > 1.1.0)
509 AST_PKG_CONFIG_CHECK([OPENSSL], [openssl >= 1.1.0])
510 if test $PBX_OPENSSL -eq 0 ; then
511 AC_MSG_NOTICE(checking whether alternate openssl11 is installed)
512 AST_PKG_CONFIG_CHECK([OPENSSL], [openssl11])
513 fi
514 if test $PBX_OPENSSL -eq 1 ; then
515 AC_DEFINE([HAVE_OPENSSL_BIO_METHOD], 1)
516 PBX_OPENSSL_BIO_METHOD=1
517 else
518 AC_MSG_NOTICE(checking fallback system openssl)
519 AST_PKG_CONFIG_CHECK([OPENSSL], [openssl])
520 fi
521
522 if test $PBX_OPENSSL -eq 1; then
523 AC_DEFINE([HAVE_CRYPTO], 1)
524 PBX_CRYPTO=1
525 fi
526 else
527 AC_MSG_NOTICE(Checking OPENSSL without pkg-config)
528 AST_EXT_LIB_CHECK([CRYPTO], [crypto], [AES_encrypt], [openssl/aes.h])
529 if test "$PBX_CRYPTO" = "1";
530 then
531 AST_EXT_LIB_CHECK([OPENSSL], [ssl], [SSL_connect], [openssl/ssl.h], [-lcrypto])
532 AST_EXT_LIB_CHECK([OPENSSL_BIO_METHOD], [ssl], [BIO_meth_new], [openssl/ssl.h], [-lcrypto])
533 fi
534 fi
535 if test $PBX_OPENSSL -eq 0 ; then
536 AC_MSG_WARN(OpenSSL does not seem to be installed)
537 fi
538
539
540 THIRD_PARTY_CONFIGURE()
541
542 # AST_EXT_LIB_SETUP is used to tell configure to handle variables for
543 # various packages.
544 # $1 is the prefix for the variables in makeopts and autoconfig.h
545 # $2 is the short comment, $4 is the long comment
546 # $3 is the name used in --with- or --without- flags for configure.
547 #
548 # Package option names should be in alphabetical order
549 # by the --with option name (the third field),
550 # to make things easier for the users.
551
552 AST_EXT_LIB_SETUP([BFD], [Debug symbol decoding], [bfd])
553
554 # BKTR is used for backtrace support on platforms that do not
555 # have it natively.
556 AST_EXT_LIB_SETUP([BKTR], [Stack Backtrace], [execinfo])
557 AST_EXT_LIB_SETUP([BLUETOOTH], [Bluetooth], [bluetooth])
558 AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capabilities], [cap])
559 AST_EXT_LIB_SETUP([CODEC2], [Codec 2 Audio Decoder/Encoder], [codec2])
560 AST_EXT_LIB_SETUP([COROSYNC], [Corosync], [cpg])
561 AST_EXT_LIB_SETUP_OPTIONAL([COROSYNC_CFG_STATE_TRACK], [A callback only in corosync 1.x], [COROSYNC], [cfg])
562 AST_EXT_LIB_SETUP([CRYPT], [password and data encryption], [crypt])
563 AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
564 AST_EXT_LIB_SETUP([FFMPEG], [FFmpeg (avcodec and swscale)], [ffmpeg])
565 AST_EXT_LIB_SETUP([GSM], [External GSM], [gsm], [, use 'internal' GSM otherwise])
566 AST_EXT_LIB_SETUP([ILBC], [System iLBC], [ilbc], [, use 'internal' iLBC otherwise])
567 AST_EXT_LIB_SETUP([GTK2], [gtk2], [gtk2])
568 AST_EXT_LIB_SETUP([GMIME], [GMime], [gmime])
569 AST_EXT_LIB_SETUP([HOARD], [Hoard Memory Allocator], [hoard])
570 AST_EXT_LIB_SETUP([ICAL], [iCal], [ical])
571 AST_EXT_LIB_SETUP([ICONV], [Iconv], [iconv])
572 AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber], [iksemel])
573 AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
574 AST_EXT_LIB_SETUP([INOTIFY], [inotify support], [inotify])
575 AST_EXT_LIB_SETUP([IODBC], [iODBC], [iodbc])
576 AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
577 AST_EXT_LIB_SETUP([JANSSON], [Jansson JSON library], [jansson])
578 AST_EXT_LIB_SETUP([URIPARSER], [uriparser library], [uriparser])
579 AST_EXT_LIB_SETUP([KQUEUE], [kqueue support], [kqueue])
580 AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
581 AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
582 AST_EXT_LIB_SETUP([LIBEDIT], [NetBSD Editline library], [libedit])
583 AST_EXT_LIB_SETUP_OPTIONAL([LIBEDIT_IS_UNICODE], [Libedit compiled for unicode], [LIBEDIT], [libedit])
584 AST_EXT_LIB_SETUP([LIBJWT], [LIBJWT], [libjwt])
585 AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
586 AST_EXT_LIB_SETUP([LIBXSLT], [LibXSLT], [libxslt])
587 AST_EXT_LIB_SETUP_OPTIONAL([LIBXSLT_CLEANUP], [LibXSLT Library Cleanup Function], [LIBXSLT], [libxslt])
588 AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
589 AC_ARG_VAR([LUA_VERSIONS],[A space separated list of target lua versions to test.])
590 AST_EXT_LIB_SETUP([MYSQLCLIENT], [MySQL client], [mysqlclient])
591 AST_EXT_LIB_SETUP([NEON], [neon], [neon])
592 AST_EXT_LIB_SETUP([NEON29], [neon29], [neon29])
593 AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
594 AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
595 AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
596 AST_EXT_LIB_SETUP([OPENR2], [MFR2], [openr2])
597 AST_EXT_LIB_SETUP([OPUS], [Opus], [opus])
598 AST_EXT_LIB_SETUP([OPUSFILE], [Opusfile], [opusfile])
599 AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
600 AST_EXT_LIB_SETUP([BEANSTALK], [Beanstalk Job Queue], [beanstalk])
601
602 if test "x${PBX_PJPROJECT}" != "x1" ; then
603 AST_EXT_LIB_SETUP([PJPROJECT], [PJPROJECT], [pjproject])
604 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], [PJSIP Dialog Create UAS with Incremented Lock], [PJPROJECT], [pjsip])
605 AST_EXT_LIB_SETUP_OPTIONAL([PJ_TRANSACTION_GRP_LOCK], [PJSIP Transaction Group Lock Support], [PJPROJECT], [pjsip])
606 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_REPLACE_MEDIA_STREAM], [PJSIP Media Stream Replacement Support], [PJPROJECT], [pjsip])
607 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_GET_DEST_INFO], [pjsip_get_dest_info support], [PJPROJECT], [pjsip])
608 AST_EXT_LIB_SETUP_OPTIONAL([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj_ssl_cert_load_from_files2 support], [PJPROJECT], [pjsip])
609 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_EXTERNAL_RESOLVER], [PJSIP External Resolver Support], [PJPROJECT], [pjsip])
610 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TLS_TRANSPORT_PROTO], [PJSIP TLS Transport proto field support], [PJPROJECT], [pjsip])
611 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TLS_1_1], [PJSIP TLS 1.1 Support], [PJPROJECT], [pjsip])
612 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TLS_1_2], [PJSIP TLS 1.2 Support], [PJPROJECT], [pjsip])
613 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TLS_1_3], [PJSIP TLS 1.3 Support], [PJPROJECT], [pjsip])
614 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_EVSUB_GRP_LOCK], [PJSIP EVSUB Group Lock support], [PJPROJECT], [pjsip])
615 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_INV_SESSION_REF], [PJSIP INVITE Session Reference Count support], [PJPROJECT], [pjsip])
616 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_AUTH_CLT_DEINIT], [pjsip_auth_clt_deinit support], [PJPROJECT], [pjsip])
617 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TSX_LAYER_FIND_TSX2], [pjsip_tsx_layer_find_tsx2 support], [PJPROJECT], [pjsip])
618 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS], [PJSIP INVITE Accept Multiple SDP Answers], [PJPROJECT], [pjsip])
619 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_ENDPOINT_COMPACT_FORM], [PJSIP Compact Form Support on Endpoint], [PJPROJECT], [pjsip])
620 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TRANSPORT_DISABLE_CONNECTION_REUSE], [PJSIP Transport Connection Reuse Disabling], [PJPROJECT], [pjsip])
621 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_OAUTH_AUTHENTICATION], [PJSIP OAuth Authentication Support], [PJPROJECT], [pjsip])
622 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TLS_TRANSPORT_RESTART], [PJSIP TLS Transport Restart Support], [PJPROJECT], [pjsip])
623 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_AUTH_NEW_DIGESTS], [PJSIP Auth new digests like SHA-256 and SHA-512-256], [PJPROJECT], [pjsip])
624 fi
625
626 AST_EXT_LIB_SETUP([POPT], [popt], [popt])
627 AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
628 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
629 AST_EXT_LIB_SETUP_OPTIONAL([PRI_SETUP_ACK_INBAND], [ISDN PRI progress inband ie in SETUP ACK], [PRI], [pri])
630 AST_EXT_LIB_SETUP_OPTIONAL([PRI_L2_PERSISTENCE], [ISDN Layer 2 persistence option], [PRI], [pri])
631 AST_EXT_LIB_SETUP_OPTIONAL([PRI_DATETIME_SEND], [ISDN PRI Date/time ie send policy], [PRI], [pri])
632 AST_EXT_LIB_SETUP_OPTIONAL([PRI_MWI_V2], [ISDN PRI Message Waiting Indication (Fixed)], [PRI], [pri])
633 AST_EXT_LIB_SETUP_OPTIONAL([PRI_DISPLAY_TEXT], [ISDN PRI user display text IE contents during call], [PRI], [pri])
634 AST_EXT_LIB_SETUP_OPTIONAL([PRI_MWI], [ISDN PRI Message Waiting Indication], [PRI], [pri])
635 AST_EXT_LIB_SETUP_OPTIONAL([PRI_MCID], [ISDN PRI Malicious Call ID], [PRI], [pri])
636 AST_EXT_LIB_SETUP_OPTIONAL([PRI_CALL_WAITING], [ISDN PRI call waiting supplementary service], [PRI], [pri])
637 AST_EXT_LIB_SETUP_OPTIONAL([PRI_AOC_EVENTS], [ISDN PRI advice of charge supplementary service events], [PRI], [pri])
638 AST_EXT_LIB_SETUP_OPTIONAL([PRI_TRANSFER], [ISDN PRI call transfer supplementary service], [PRI], [pri])
639 AST_EXT_LIB_SETUP_OPTIONAL([PRI_CCSS], [ISDN PRI call completion supplementary service], [PRI], [pri])
640 AST_EXT_LIB_SETUP_OPTIONAL([PRI_HANGUP_FIX], [ISDN PRI hangup fix], [PRI], [pri])
641 AST_EXT_LIB_SETUP_OPTIONAL([PRI_SUBADDR], [ISDN PRI subaddressing], [PRI], [pri])
642 AST_EXT_LIB_SETUP_OPTIONAL([PRI_CALL_HOLD], [ISDN PRI call hold], [PRI], [pri])
643 AST_EXT_LIB_SETUP_OPTIONAL([PRI_CALL_REROUTING], [ISDN PRI call rerouting and call deflection], [PRI], [pri])
644 AST_EXT_LIB_SETUP_OPTIONAL([PRI_SETUP_KEYPAD], [ISDN PRI keypad facility in SETUP], [PRI], [pri])
645 # ------------------------------------v
646 # TODO: The code can be changed to always include these features now.
647 # These features will always be present if pri_connected_line_update is available.
648 AST_EXT_LIB_SETUP_OPTIONAL([PRI_INBANDDISCONNECT], [ISDN PRI set_inbanddisconnect], [PRI], [pri])
649 AST_EXT_LIB_SETUP_OPTIONAL([PRI_PROG_W_CAUSE], [ISDN progress with cause], [PRI], [pri])
650 AST_EXT_LIB_SETUP_OPTIONAL([PRI_SERVICE_MESSAGES], [ISDN service messages], [PRI], [pri])
651 AST_EXT_LIB_SETUP_OPTIONAL([PRI_REVERSE_CHARGE], [ISDN reverse charge], [PRI], [pri])
652 # ------------------------------------^
653 AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
654 AST_EXT_LIB_SETUP([FFTW3], [LIBFFTW3], [fftw3])
655 AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
656 AST_EXT_LIB_SETUP([SNDFILE], [libsndfile], [sndfile])
657 AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
658 AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image], [SDL_image])
659 AST_EXT_LIB_SETUP([SPANDSP], [SPANDSP], [spandsp])
660 AST_EXT_LIB_SETUP([SS7], [ISDN SS7], [ss7])
661 AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
662 AST_EXT_LIB_SETUP([SPEEX_PREPROCESS], [Speex preprocess routines], [speex])
663 AST_EXT_LIB_SETUP([SPEEXDSP], [SpeexDSP], [speexdsp])
664 AST_EXT_LIB_SETUP_DEPENDENT([SPEEX_PREPROCESS], [speex_preprocess_ctl], [], [speex])
665 AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
666 AST_EXT_LIB_SETUP([SRTP], [Secure RTP], [srtp])
667 AST_EXT_LIB_SETUP_OPTIONAL([SRTP_256], [SRTP Library AES-256 (ICM)], [SRTP], [srtp])
668 AST_EXT_LIB_SETUP_OPTIONAL([SRTP_192], [SRTP Library AES-192 (ICM)], [SRTP], [srtp])
669 AST_EXT_LIB_SETUP_OPTIONAL([SRTP_GCM], [SRTP Library AES-128 (GCM) and AES-256 (GCM)], [SRTP], [srtp])
670 AST_EXT_LIB_SETUP_OPTIONAL([SRTP_SHUTDOWN], [SRTP Library Shutdown Function], [SRTP], [srtp])
671 AST_EXT_LIB_SETUP_OPTIONAL([SRTP_GET_VERSION], [SRTP Library Version Function], [SRTP], [srtp])
672 AST_EXT_LIB_SETUP_OPTIONAL([RT], [Realtime functions], [rt])
673 AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
674 AST_EXT_LIB_SETUP([TIMERFD], [timerfd], [timerfd])
675 AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
676 AST_EXT_LIB_SETUP([UNBOUND], [unbound], [unbound])
677 AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [unixodbc])
678 AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
679 AST_EXT_LIB_SETUP([X11], [X11], [x11])
680 AST_EXT_LIB_SETUP([ZLIB], [zlib compression], [z])
681
682 # check for basic system features and functionality before
683 # checking for package libraries
684
685 AC_FUNC_ALLOCA
686 AC_HEADER_DIRENT
687 if test -z $ac_header_dirent -o "$ac_header_dirent" = "no"; then
688 AC_MSG_ERROR([*** Could not find dirent header that defines 'DIR'.])
689 fi
690
691 AC_HEADER_SYS_WAIT
692 if test "$ac_cv_header_sys_wait_h" != "yes"; then
693 AC_MSG_ERROR([*** POSIX.1 compatible sys/wait.h is required.])
694 fi
695
696 AC_HEADER_RESOLV
697 if test "$ac_cv_header_resolv_h" != "yes"; then
698 AC_MSG_ERROR([*** resolv.h is required.])
699 fi
700
701 # Check for headers that are unconditionally required on all platforms. Do not use
702 # this to check for headers that are only needed by modules.
703 AC_CHECK_HEADERS([ \
704 arpa/nameser.h assert.h ctype.h dlfcn.h errno.h fcntl.h float.h grp.h \
705 inttypes.h limits.h locale.h math.h pwd.h netinet/in.h regex.h \
706 sched.h stdarg.h stdint.h stdio.h stdlib.h string.h syslog.h \
707 sys/file.h sys/ioctl.h sys/param.h sys/resource.h sys/socket.h sys/stat.h \
708 sys/time.h sys/types.h sys/un.h \
709 termios.h time.h unistd.h \
710 ], [], [
711 AC_MSG_ERROR([*** A required header was not found.])
712 ])
713
714 AC_CHECK_HEADERS([arpa/inet.h libintl.h malloc.h netdb.h stddef.h strings.h sys/event.h utime.h])
715
716 # Find required NetBSD Editline library (libedit).
717 AST_PKG_CONFIG_CHECK(LIBEDIT, libedit)
718 # some platforms do not list libedit via pkg-config, for example OpenBSD 6.2
719 AST_EXT_LIB_CHECK([LIBEDIT], [edit], [history_init], [histedit.h], [-ltermcap])
720 if test "${PBX_LIBEDIT}" != 1; then
721 AC_MSG_ERROR(*** Please install the 'libedit' development package.)
722 exit 1
723 fi
724 AST_C_COMPILE_CHECK([LIBEDIT_IS_UNICODE], [el_rfunc_t *callback;], [histedit.h], [], [Testing for libedit unicode support])
725
726 # Find required UUID support.
727 # * -luuid on Linux
728 # * -le2fs-uuid on OpenBSD
729 # * in libsystem on OS X
730 AST_EXT_LIB_CHECK([LIBUUID], [uuid], [uuid_generate_random], [uuid/uuid.h])
731 if test "x$LIBUUID_LIB" != "x" ; then
732 UUID_INCLUDE="$LIBUUID_INCLUDE"
733 UUID_LIB="$LIBUUID_LIB"
734 else
735 AST_EXT_LIB_CHECK([E2FSUUID], [e2fs-uuid], [uuid_generate_random], [uuid/uuid.h])
736 if test "x$E2FSUUID_LIB" != "x" ; then
737 UUID_INCLUDE="$E2FSUUID_INCLUDE"
738 UUID_LIB="$E2FSUUID_LIB"
739 else
740 AC_CHECK_FUNCS([uuid_generate_random], [SYSUUID=true], [SYSUUID=""])
741 if test "x$SYSUUID" != "x" ; then
742 UUID_INCLUDE=""
743 UUID_LIB=""
744 else
745 AC_MSG_ERROR([*** uuid support not found (this typically means the uuid development package is missing)])
746 fi
747 fi
748 fi
749 AC_SUBST(UUID_INCLUDE)
750 AC_SUBST(UUID_LIB)
751
752 # Find required JSON support if bundled is not enabled.
753 if test "$JANSSON_BUNDLED" = "no" ; then
754 AST_PKG_CONFIG_CHECK([JANSSON], [jansson >= 2.11])
755 # json_sprintf is available in 2.11+
756 AST_EXT_LIB_CHECK([JANSSON], [jansson], [json_sprintf], [jansson.h])
757
758 if test "${PBX_JANSSON}" != 1; then
759 AC_MSG_NOTICE(*** Asterisk requires libjansson >= 2.11 and no system copy was found.)
760 AC_MSG_NOTICE(*** Please install the 'libjansson' development package or)
761 AC_MSG_NOTICE(*** use './configure --with-jansson-bundled')
762 exit 1
763 fi
764 JANSSON_DEFINE_JSON_INT()
765 else
766 PBX_JANSSON=1
767 fi
768
769 . ./third-party/versions.mak
770 # Find required JWT support if bundled is not enabled.
771 if test "$LIBJWT_BUNDLED" = "no" ; then
772 AST_PKG_CONFIG_CHECK([LIBJWT], [libjwt >= $LIBJWT_VERSION])
773 else
774 PBX_LIBJWT=1
775 fi
776
777 # See if clock_gettime is in librt
778 AST_EXT_LIB_CHECK([RT], [rt], [clock_gettime], [])
779
780 AST_PKG_CONFIG_CHECK([LIBXML2], [libxml-2.0])
781 AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
782 [#include <libxml/tree.h>
783 #include <libxml/parser.h>],
784 [LIBXML_TEST_VERSION])
785
786 if test "${PBX_LIBXML2}" != 1; then
787 AC_MSG_NOTICE(*** The Asterisk menuselect tool requires the 'libxml2' development package.)
788 AC_MSG_NOTICE(*** Please install the 'libxml2' development package.)
789 exit 1
790 fi
791
792 AST_EXT_LIB_CHECK([URIPARSER], [uriparser], [uriParseUriA], [uriparser/Uri.h])
793
794 # Another mandatory item (unless it's explicitly disabled)
795 AC_ARG_ENABLE([xmldoc],
796 [AS_HELP_STRING([--disable-xmldoc],
797 [Explicitly disable XML documentation])],
798 [case "${enableval}" in
799 y|ye|yes) DISABLE_XMLDOC=no ;;
800 n|no) DISABLE_XMLDOC=yes ;;
801 *) AC_MSG_ERROR(bad value ${enableval} for --disable-xmldoc) ;;
802 esac], [DISABLE_XMLDOC=no])
803
804 AC_SUBST([DISABLE_XMLDOC])
805 if test "${DISABLE_XMLDOC}" != "yes"; then
806 AC_DEFINE([AST_XML_DOCS], 1, [Define to enable XML documentation.])
807 fi
808
809 AST_EXT_LIB_CHECK([LIBXSLT], [xslt], [xsltLoadStylesheetPI], [libxslt/xsltInternals.h], [${LIBXML2_LIB}], [${LIBXML2_INCLUDE}])
810 AST_EXT_LIB_CHECK([LIBXSLT_CLEANUP], [xslt], [xsltCleanupGlobals], [libxslt/xsltInternals.h], [${LIBXML2_LIB}], [${LIBXML2_INCLUDE}])
811
812 AC_ARG_ENABLE([permanent-dlopen],
813 [AS_HELP_STRING([--enable-permanent-dlopen],
814 [Enable when your libc has a permanent dlopen like musl])],
815 [case "${enableval}" in
816 y|ye|yes) PERMANENT_DLOPEN=yes ;;
817 n|no) PERMANENT_DLOPEN=no ;;
818 *) AC_MSG_ERROR(bad value ${enableval} for --enable-permanent-dlopen) ;;
819 esac], [PERMANENT_DLOPEN=no])
820
821 AC_SUBST([PERMANENT_DLOPEN])
822 if test "${PERMANENT_DLOPEN}" = "yes"; then
823 AC_DEFINE([HAVE_PERMANENT_DLOPEN], 1, [Define to support libc with permanent dlopen.])
824 fi
825
826 # some embedded systems omit internationalization (locale) support
827 AC_CHECK_HEADERS([xlocale.h])
828
829 AC_CHECK_HEADERS([winsock.h winsock2.h])
830
831 AC_CHECK_HEADER([sys/poll.h],
832 [],
833 AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.]))
834
835 AC_SYS_LARGEFILE
836
837 # Checks for typedefs, structures, and compiler characteristics.
838 AC_HEADER_STDBOOL
839 AC_C_CONST
840 AC_TYPE_UID_T
841 AC_C_INLINE
842 AC_TYPE_LONG_DOUBLE_WIDER
843 AC_TYPE_MODE_T
844 AC_TYPE_OFF_T
845 AC_TYPE_PID_T
846 AC_TYPE_SIZE_T
847 AC_CHECK_MEMBERS([struct stat.st_blksize])
848 AC_CHECK_MEMBERS([struct ucred.uid, struct ucred.cr_uid, struct sockpeercred.uid], [], [], [#include <sys/types.h>
849 #include <sys/socket.h> ])
850 AC_CHECK_MEMBERS([struct ifreq.ifr_ifru.ifru_hwaddr], [], [], [#include <net/if.h>])
851 AC_STRUCT_TM
852 AC_C_VOLATILE
853 AC_CHECK_TYPES([ptrdiff_t])
854 stat_nsec_found=no
855 AC_CHECK_MEMBERS([struct stat.st_mtim, struct stat.st_mtimensec, struct stat.st_mtimespec], [stat_nsec_found=yes], [], [[#include <sys/stat.h>]])
856 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_len, struct sockaddr_in.sin_len], [], [], [[#include <netinet/in.h>]])
857
858 if test "${stat_nsec_found}" != yes; then
859 AC_MSG_WARN(Cannot determine nanosecond field of struct stat)
860 fi
861
862 # Checks for library functions.
863 AC_FUNC_CHOWN
864 AC_FUNC_CLOSEDIR_VOID
865 AC_FUNC_ERROR_AT_LINE
866 AST_FUNC_FORK
867 AC_FUNC_FSEEKO
868 # AC_PROG_GCC_TRADITIONAL Obsolete
869 # XXX: these are commented out until we determine whether it matters if our malloc()
870 # acts exactly like glibc's or not
871 # AC_FUNC_MALLOC
872 # AC_FUNC_REALLOC
873 AC_FUNC_MEMCMP
874 AC_FUNC_MMAP
875 AC_FUNC_SELECT_ARGTYPES
876 AC_FUNC_STAT
877 AC_FUNC_STRCOLL
878 AC_FUNC_STRFTIME
879 AC_FUNC_STRNLEN
880 AC_FUNC_STRTOD
881 AC_FUNC_UTIME_NULL
882 AC_FUNC_VPRINTF
883 AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap newlocale pipe2 ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv uselocale utime vasprintf getpeereid sysctl swapctl malloc_trim])
884
885 AC_MSG_CHECKING(for htonll)
886 AC_LINK_IFELSE(
887 [AC_LANG_PROGRAM([#include <arpa/inet.h>],
888 [return htonll(0);])],
889 AC_MSG_RESULT(yes)
890 AC_DEFINE(HAVE_HTONLL, 1, [Define to 1 if arpa/inet.h includes a htonll definition.]),
891 AC_MSG_RESULT(no)
892 )
893
894 AC_MSG_CHECKING(for ntohll)
895 AC_LINK_IFELSE(
896 [AC_LANG_PROGRAM([#include <arpa/inet.h>],
897 [return ntohll(0);])],
898 AC_MSG_RESULT(yes)
899 AC_DEFINE(HAVE_NTOHLL, 1, [Define to 1 if arpa/inet.h includes a ntohll definition.]),
900 AC_MSG_RESULT(no)
901 )
902
903 # NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
904 # so that AC_CHECK_FUNCS can detect functions in that library.
905 AC_CHECK_LIB([m], [sqrt])
906 # BSD might not have exp2, and/or log2
907 AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round roundf trunc floor ceil])
908
909 # Certain architectures don't really have long double, even though
910 # AC_CHECK_FUNCS would otherwise find the following functions.
911 if test "x${ac_cv_type_long_double_wider}" = "xyes" ; then
912 AC_CHECK_FUNCS([exp2l log2l exp10l log10l sinl cosl tanl asinl acosl atanl atan2l powl sqrtl rintl expl logl remainderl fmodl roundl truncl floorl ceill])
913 fi
914
915 AC_MSG_CHECKING(for LLONG_MAX in limits.h)
916 AC_LINK_IFELSE(
917 [AC_LANG_PROGRAM([#include <limits.h>],
918 [long long foo = LLONG_MAX])],
919 AC_MSG_RESULT(yes)
920 AC_DEFINE([HAVE_LLONG_MAX], 1, [Define to 1 if limits.h includes a LLONG_MAX definition.]),
921 AC_MSG_RESULT(no)
922 )
923
924 AC_MSG_CHECKING(for timersub in time.h)
925 AC_LINK_IFELSE(
926 [AC_LANG_PROGRAM([#include <sys/time.h>],
927 [struct timeval *a; timersub(a, a, a);])],
928 AC_MSG_RESULT(yes)
929 AC_DEFINE([HAVE_TIMERSUB], 1, [Define to 1 if your system defines timersub.]),
930 AC_MSG_RESULT(no)
931 )
932
933 AC_MSG_CHECKING(for a version of GNU ld that supports the --dynamic-list flag)
934 old_LDFLAGS=${LDFLAGS}
935 cat >conftest.dynamics <<_ACEOF
936 {
937 *ast_*;
938 };
939 _ACEOF
940 LDFLAGS="${LDFLAGS} -Wl,--dynamic-list,conftest.dynamics"
941 PBX_DYNAMIC_LIST=0
942 AC_LINK_IFELSE(
943 [AC_LANG_PROGRAM([], [])],
944 PBX_DYNAMIC_LIST=1
945 AC_MSG_RESULT(yes),
946 AC_MSG_RESULT(no)
947 )
948 AC_SUBST(PBX_DYNAMIC_LIST)
949 LDFLAGS=${old_LDFLAGS}
950 rm -f conftest.dynamics
951
952 AC_CHECK_HEADER([sys/poll.h],
953 [HAS_POLL=1]
954 AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]),
955 )
956
957 AC_ARG_ENABLE([internal-poll],
958 [AS_HELP_STRING([--enable-internal-poll],
959 [Use Asterisk's poll implementation])],
960 [case "${enableval}" in
961 y|ye|yes) HAS_POLL="";;
962 n|no) HAS_POLL="${HAS_POLL}" ;;
963 *) AC_MSG_ERROR(bad value ${enableval} for --enable-internal-poll) ;;
964 esac])
965 AC_SUBST(HAS_POLL)
966
967 AC_ARG_ENABLE([asteriskssl],
968 [AS_HELP_STRING([--disable-asteriskssl],
969 [Disable Asterisk's SSL wrapper library])],
970 [case "${enableval}" in
971 y|ye|yes) AST_ASTERISKSSL=yes ;;
972 n|no) AST_ASTERISKSSL=no ;;
973 *) AC_MSG_ERROR(bad value ${enableval} for --disable-asteriskssl) ;;
974 esac], [AST_ASTERISKSSL=yes])
975 AC_SUBST(AST_ASTERISKSSL)
976
977 AC_CHECK_FUNCS([inet_aton])
978
979 # check if we have IP_PKTINFO constant defined
980 AC_MSG_CHECKING(for IP_PKTINFO)
981 AC_LINK_IFELSE(
982 [AC_LANG_PROGRAM([#include <netinet/in.h>],
983 [int pi = IP_PKTINFO;])],
984 AC_MSG_RESULT(yes)
985 AC_DEFINE([HAVE_PKTINFO], 1, [Define to 1 if your system defines IP_PKTINFO.]),
986 AC_MSG_RESULT(no)
987 )
988
989 # NetBSD libc ships with an internal-only incompatible symbol gethostbyname_r
990 AC_CHECK_DECLS([gethostbyname_r],
991 [have_gethostbyname_r_public_declaration=yes],
992 [have_gethostbyname_r_public_declaration=no],
993 [#include <stdlib.h>
994 #include <netdb.h>]
995 )
996
997 if test "x$have_gethostbyname_r_public_declaration" = "xyes"; then
998 # some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
999 AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])
1000
1001 AC_MSG_CHECKING(for gethostbyname_r with 6 arguments)
1002 AC_LINK_IFELSE(
1003 [AC_LANG_PROGRAM([#include <stdlib.h>
1004 #include <netdb.h>],
1005 [int r = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);])],
1006 AC_MSG_RESULT(yes)
1007 AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]),
1008 AC_MSG_RESULT(no)
1009 )
1010
1011 AC_MSG_CHECKING(for gethostbyname_r with 5 arguments)
1012 AC_LINK_IFELSE(
1013 [AC_LANG_PROGRAM([#include <stdlib.h>
1014 #include <netdb.h>],
1015 [int r = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);])],
1016 AC_MSG_RESULT(yes)
1017 AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]),
1018 AC_MSG_RESULT(no)
1019 )
1020 fi
1021
1022 AC_CHECK_HEADER([byteswap.h], [AC_DEFINE_UNQUOTED([HAVE_BYTESWAP_H], 1, [Define to 1 if byteswap.h macros are available.])])
1023
1024 AC_MSG_CHECKING(for __swap16 variant of <sys/endian.h> byteswapping macros)
1025 AC_LINK_IFELSE(
1026 [AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = __swap16(a);])],
1027 AC_MSG_RESULT(yes)
1028 AC_DEFINE([HAVE_SYS_ENDIAN_SWAP16], 1, [Define to 1 if your sys/endian.h header file provides the __swap16 macro.]),
1029 AC_MSG_RESULT(no)
1030 )
1031
1032 AC_MSG_CHECKING(for bswap16 variant of <sys/endian.h> byteswapping macros)
1033 AC_LINK_IFELSE(
1034 [AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = bswap16(a);])],
1035 AC_MSG_RESULT(yes)
1036 AC_DEFINE([HAVE_SYS_ENDIAN_BSWAP16], 1, [Define to 1 if your sys/endian.h header file provides the bswap16 macro.]),
1037 AC_MSG_RESULT(no)
1038 )
1039
1040 AC_MSG_CHECKING(for locale_t in locale.h)
1041 AC_LINK_IFELSE(
1042 [AC_LANG_PROGRAM([#include <locale.h>], [locale_t lt = NULL])],
1043 AC_MSG_RESULT(yes)
1044 AC_DEFINE([HAVE_LOCALE_T_IN_LOCALE_H], 1, [Define to 1 if your system defines the locale_t type in locale.h]),
1045 AC_MSG_RESULT(no)
1046 AC_MSG_CHECKING(for locale_t in xlocale.h)
1047 AC_LINK_IFELSE(
1048 [AC_LANG_PROGRAM([#include <xlocale.h>], [locale_t lt = NULL])],
1049 AC_MSG_RESULT(yes)
1050 AC_DEFINE([HAVE_LOCALE_T_IN_XLOCALE_H], 1, [Define to 1 if your system defines the locale_t type in xlocale.h]),
1051 AC_MSG_RESULT(no)
1052 )
1053 )
1054
1055 AC_MSG_CHECKING(for O_EVTONLY in fcntl.h)
1056 AC_LINK_IFELSE(
1057 [AC_LANG_PROGRAM([#include <fcntl.h>], [int a = O_EVTONLY;])],
1058 AC_MSG_RESULT(yes)
1059 AC_DEFINE([HAVE_O_EVTONLY], 1, [Define to 1 if your system defines the file flag O_EVTONLY in fcntl.h]),
1060 AC_MSG_RESULT(no)
1061 )
1062
1063 AC_MSG_CHECKING(for O_SYMLINK in fcntl.h)
1064 AC_LINK_IFELSE(
1065 [AC_LANG_PROGRAM([#include <fcntl.h>], [int a = O_SYMLINK;])],
1066 AC_MSG_RESULT(yes)
1067 AC_DEFINE([HAVE_O_SYMLINK], 1, [Define to 1 if your system defines the file flag O_SYMLINK in fcntl.h]),
1068 AC_MSG_RESULT(no)
1069 )
1070
1071 AST_C_DEFINE_CHECK([PTHREAD_RWLOCK_INITIALIZER], [PTHREAD_RWLOCK_INITIALIZER], [pthread.h])
1072
1073 AC_MSG_CHECKING(for PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h)
1074 AC_LINK_IFELSE(
1075 [AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_RWLOCK_PREFER_WRITER_NP;])],
1076 AC_MSG_RESULT(yes)
1077 AC_DEFINE([HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP], 1, [Define to 1 if your system defines PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h]),
1078 AC_MSG_RESULT(no)
1079 )
1080
1081 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h)
1082 AC_LINK_IFELSE(
1083 [AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_MUTEX_RECURSIVE_NP;])],
1084 AC_MSG_RESULT(yes)
1085 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1, [Define to 1 if your system defines PTHREAD_MUTEX_RECURSIVE_NP in pthread.h]),
1086 AC_MSG_RESULT(no)
1087 )
1088
1089 AC_MSG_CHECKING(for PTHREAD_MUTEX_ADAPTIVE_NP in pthread.h)
1090 AC_LINK_IFELSE(
1091 [AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_MUTEX_ADAPTIVE_NP;])],
1092 AC_MSG_RESULT(yes)
1093 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1, [Define to 1 if your system defines PTHREAD_MUTEX_ADAPTIVE_NP in pthread.h]),
1094 AC_MSG_RESULT(no)
1095 )
1096
1097 AC_MSG_CHECKING(for pthread_spinlock_t in pthread.h)
1098 AC_LINK_IFELSE(
1099 [AC_LANG_PROGRAM([#include <pthread.h>], [pthread_spinlock_t spin;])],
1100 AC_MSG_RESULT(yes)
1101 AC_DEFINE([HAVE_PTHREAD_SPINLOCK], 1, [Define to 1 if your system has pthread_spinlock_t in pthread.h]),
1102 AC_MSG_RESULT(no)
1103 )
1104
1105 save_LIBS="$LIBS"
1106 save_CFLAGS="$CFLAGS"
1107 LIBS="$PTHREAD_LIBS $LIBS"
1108 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1109
1110 AC_MSG_CHECKING(for pthread_rwlock_timedwrlock() in pthread.h)
1111 AC_LINK_IFELSE(
1112 [AC_LANG_PROGRAM(
1113 [#include <pthread.h>
1114 #include <time.h>],
1115 [pthread_rwlock_t foo; struct timespec bar; pthread_rwlock_timedwrlock(&foo, &bar)])
1116 ],[
1117 AC_MSG_RESULT(yes)
1118 ac_cv_pthread_rwlock_timedwrlock="yes"
1119 ],[
1120 AC_MSG_RESULT(no)
1121 ac_cv_pthread_rwlock_timedwrlock="no"
1122 ]
1123 )
1124
1125 # Some platforms define sem_init(), but only support sem_open(). joyous.
1126 AC_MSG_CHECKING(for working unnamed semaphores)
1127 AC_RUN_IFELSE(
1128 [AC_LANG_PROGRAM([#include <semaphore.h>],
1129 [sem_t sem; return sem_init(&sem, 0, 0);])],
1130 AC_MSG_RESULT(yes)
1131 AC_DEFINE([HAS_WORKING_SEMAPHORE], 1, [Define to 1 if anonymous semaphores work.]),
1132 AC_MSG_RESULT(no),
1133 AC_MSG_RESULT(cross-compile)
1134 AC_MSG_NOTICE([WARNING: result yes guessed because of cross compilation])
1135 AC_DEFINE([HAS_WORKING_SEMAPHORE], 1, [Define to 1 if anonymous semaphores work.])
1136 )
1137
1138 LIBS="$save_LIBS"
1139 CFLAGS="$save_CFLAGS"
1140 if test "${ac_cv_pthread_rwlock_timedwrlock}" = "yes"; then
1141 AC_DEFINE([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK], 1, [Define if your system has pthread_rwlock_timedwrlock()])
1142 fi
1143
1144 AC_MSG_CHECKING(if PTHREAD_ONCE_INIT needs braces)
1145 saved_CFLAGS="${CFLAGS}"
1146 CFLAGS="${CFLAGS} -Werror -Wmissing-braces"
1147 AC_COMPILE_IFELSE(
1148 [AC_LANG_PROGRAM(
1149 [#include <pthread.h>
1150 void empty(){}],
1151 [pthread_once_t once = PTHREAD_ONCE_INIT; pthread_once(&once, empty);])
1152 ],[
1153 AC_MSG_RESULT(no)
1154 ac_cv_pthread_once_needsbraces="no"
1155 ],[
1156 AC_MSG_RESULT(yes)
1157 ac_cv_pthread_once_needsbraces="yes"
1158 ]
1159 )
1160 CFLAGS="${saved_CFLAGS}"
1161 if test "${ac_cv_pthread_once_needsbraces}" = "yes"; then
1162 AC_DEFINE([PTHREAD_ONCE_INIT_NEEDS_BRACES], 1, [Define if your system needs braces around PTHREAD_ONCE_INIT])
1163 fi
1164
1165 AST_C_DEFINE_CHECK([PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [pthread.h])
1166
1167 # Can we compare a mutex to its initial value?
1168 # Generally yes on OpenBSD/FreeBSD and no on Mac OS X.
1169 AC_MSG_CHECKING(whether we can compare a mutex to its initial value)
1170 AC_LINK_IFELSE(
1171 [AC_LANG_PROGRAM([#include <pthread.h>], [pthread_mutex_t lock;
1172 if ((lock) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
1173 return 0;
1174 }
1175 return 0])],
1176 AC_MSG_RESULT(yes)
1177 AC_DEFINE([CAN_COMPARE_MUTEX_TO_INIT_VALUE], 1, [Define to 1 if your system's implementation of mutexes supports comparison of a mutex to its initializer.]),
1178 AC_MSG_RESULT(no)
1179 )
1180
1181 #if test "${cross_compiling}" = "no";
1182 #then
1183 #AC_MSG_CHECKING(for working epoll support)
1184 #AC_LINK_IFELSE(
1185 #AC_LANG_PROGRAM([#include <sys/epoll.h>], [int res = epoll_create(10);
1186 # if (res < 0)
1187 # return 1;
1188 # close (res);
1189 # return 0;]),
1190 #AC_MSG_RESULT(yes)
1191 #AC_DEFINE([HAVE_EPOLL], 1, [Define to 1 if your system has working epoll support.]),
1192 #AC_MSG_RESULT(no)
1193 #)
1194 #fi
1195
1196 AC_MSG_CHECKING(for compiler sync operations)
1197 AC_LINK_IFELSE(
1198 [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
1199 AC_MSG_RESULT(yes)
1200 ax_cv_have_gcc_atomics=1
1201 AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides __sync atomic operations.]),
1202 AC_MSG_RESULT(no)
1203 )
1204
1205 AC_MSG_CHECKING(for compiler atomic operations)
1206 AC_LINK_IFELSE(
1207 [AC_LANG_PROGRAM([], [int foo1; int foo2 = __atomic_fetch_add(&foo1, 1, __ATOMIC_RELAXED);])],
1208 AC_MSG_RESULT(yes)
1209 ax_cv_have_c_atomics=1
1210 AC_DEFINE([HAVE_C_ATOMICS], 1, [Define to 1 if your C compiler provides __atomic operations.]),
1211 AC_MSG_RESULT(no)
1212 )
1213
1214 if test -z $ax_cv_have_c_atomics$ax_cv_have_gcc_atomics; then
1215 AC_MSG_ERROR([*** Atomic operations are not supported by your compiler.])
1216 fi
1217
1218 # glibc, AFAIK, is the only C library that makes printing a NULL to a string safe.
1219 AC_MSG_CHECKING([if your system printf is NULL-safe.])
1220 AC_RUN_IFELSE(
1221 [AC_LANG_PROGRAM([#include <stdio.h>],
1222 [printf("%s", NULL)])],
1223 AC_DEFINE([HAVE_NULLSAFE_PRINTF], 1, [Define to 1 if your C library can safely print NULL to string formats.])
1224 AC_MSG_RESULT(yes),
1225 AC_MSG_RESULT(no),
1226 # It's unlikely an embedded system will have this.
1227 AC_MSG_RESULT(unknown)
1228 )
1229
1230 AC_MSG_CHECKING([if socket() accepts SOCK_NONBLOCK])
1231 AC_RUN_IFELSE(
1232 [AC_LANG_PROGRAM([
1233 #ifdef HAVE_SYS_TYPES_H
1234 # include <sys/types.h>
1235 #endif
1236 #ifdef HAVE_SYS_SOCKET_H
1237 # include <sys/socket.h>
1238 #endif
1239 ], [
1240 if (socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0) < 0) {
1241 return 1;
1242 }
1243 return 0;
1244 ])],
1245 AC_MSG_RESULT(yes)
1246 AC_DEFINE([HAVE_SOCK_NONBLOCK], 1, [Define to 1 if your socket() implementation can accept SOCK_NONBLOCK.]),
1247 AC_MSG_RESULT(no),
1248 AC_MSG_RESULT(cross-compile)
1249 )
1250
1251 AC_MSG_CHECKING([if setsockopt() accepts the IPV6_V6ONLY socket option])
1252 AC_COMPILE_IFELSE(
1253 [AC_LANG_PROGRAM([
1254 #include <sys/socket.h>
1255 #include <netinet/in.h>
1256 ], [
1257 int opt = IPV6_V6ONLY;
1258 ])],
1259 AC_MSG_RESULT(yes)
1260 AC_DEFINE(HAVE_SOCK_IPV6_V6ONLY, 1, [Define to 1 if your socket() implementation has the IPV6_V6ONLY socket option.]),
1261 AC_MSG_RESULT(no)
1262 )
1263
1264 AC_MSG_CHECKING(if we can increase the maximum select-able file descriptor)
1265 AC_RUN_IFELSE(
1266 [AC_LANG_PROGRAM([
1267 #include <stdio.h>
1268 #include <sys/select.h>
1269 #include <sys/time.h>
1270 #include <sys/resource.h>
1271 #include <string.h>
1272 #include <errno.h>
1273 #include <stdlib.h>
1274 #include <sys/types.h>
1275 #include <sys/stat.h>
1276 #include <fcntl.h>
1277 #include <unistd.h>
1278 ], [[
1279 struct rlimit rlim = { FD_SETSIZE * 2, FD_SETSIZE * 2 };
1280 int fd0, fd1;
1281 struct timeval tv = { 0, };
1282 struct ast_fdset { long fds_bits[[1024]]; } fds = { { 0, } };
1283 if (setrlimit(RLIMIT_NOFILE, &rlim)) { exit(1); }
1284 if ((fd0 = open("/dev/null", O_RDONLY)) < 0) { exit(1); }
1285 if (dup2(fd0, (fd1 = FD_SETSIZE + 1)) < 0) { exit(1); }
1286 FD_SET(fd0, (fd_set *) &fds);
1287 FD_SET(fd1, (fd_set *) &fds);
1288 if (select(FD_SETSIZE + 2, (fd_set *) &fds, NULL, NULL, &tv) < 0) { exit(1); }
1289 exit(0)]])],
1290 AC_MSG_RESULT(yes)
1291 AC_DEFINE([HAVE_VARIABLE_FDSET], 1, [Define to 1 if your system can support larger than default select bitmasks.]),
1292 AC_MSG_RESULT(no),
1293 AC_MSG_RESULT(cross-compile)
1294 )
1295
1296 if test "${ac_cv_have_variable_fdset}x" = "0x"; then
1297 AC_RUN_IFELSE(
1298 [AC_LANG_PROGRAM([
1299 #include <unistd.h>
1300 #include <sys/types.h>
1301 #include <stdlib.h>
1302 ], [if (getuid() != 0) { exit(1); }])],
1303 AC_DEFINE([CONFIGURE_RAN_AS_ROOT], 1, [Some configure tests will unexpectedly fail if configure is run by a non-root user. These may be able to be tested at runtime.]))
1304 fi
1305
1306 AC_MSG_CHECKING([if we have usable eventfd support])
1307 AC_RUN_IFELSE(
1308 [AC_LANG_PROGRAM([#include <sys/eventfd.h>],
1309 [return eventfd(0, EFD_NONBLOCK | EFD_SEMAPHORE) == -1;])],
1310 AC_MSG_RESULT(yes)
1311 AC_DEFINE([HAVE_EVENTFD], 1, [Define to 1 if your system supports eventfd and the EFD_NONBLOCK and EFD_SEMAPHORE flags.]),
1312 AC_MSG_RESULT(no),
1313 AC_MSG_RESULT(cross-compile)
1314 )
1315
1316 AST_GCC_ATTRIBUTE(pure)
1317 AST_GCC_ATTRIBUTE(malloc)
1318 AST_GCC_ATTRIBUTE(const)
1319 AST_GCC_ATTRIBUTE(unused)
1320 AST_GCC_ATTRIBUTE(always_inline)
1321 AST_GCC_ATTRIBUTE(deprecated)
1322 AST_GCC_ATTRIBUTE(sentinel)
1323 AST_GCC_ATTRIBUTE(warn_unused_result)
1324 AST_GCC_ATTRIBUTE(may_alias)
1325 AST_GCC_ATTRIBUTE(constructor)
1326 if test "$ax_cv_have_func_attribute_constructor" != "1"; then
1327 AC_MSG_ERROR([*** Function constructor attribute is not supported by your compiler.])
1328 fi
1329
1330 AST_GCC_ATTRIBUTE(destructor)
1331 if test "$ax_cv_have_func_attribute_destructor" != "1"; then
1332 AC_MSG_ERROR([*** Function destructor attribute is not supported by your compiler.])
1333 fi
1334 AST_GCC_ATTRIBUTE(noreturn,noreturn)
1335
1336 AC_MSG_CHECKING(for -fsanitize=address support)
1337 saved_sanitize_CFLAGS="${CFLAGS}"
1338 saved_sanitize_LDFLAGS="${LDFLAGS}"
1339 CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
1340 LDFLAGS="-fsanitize=address"
1341 AC_COMPILE_IFELSE(
1342 [AC_LANG_PROGRAM([], [int x = 1;])],
1343 AC_MSG_RESULT(yes)
1344 [AST_ADDRESS_SANITIZER=1],
1345 [AST_ADDRESS_SANITIZER=0]
1346 AC_MSG_RESULT(no)
1347 )
1348 CFLAGS="${saved_sanitize_CFLAGS}"
1349 LDFLAGS="${saved_sanitize_LDFLAGS}"
1350 AC_SUBST(AST_ADDRESS_SANITIZER)
1351
1352 AC_MSG_CHECKING(for -fsanitize=thread support)
1353 saved_sanitize_CFLAGS="${CFLAGS}"
1354 saved_sanitize_LDFLAGS="${LDFLAGS}"
1355 CFLAGS="-fno-omit-frame-pointer -pie -fPIE -fsanitize=thread"
1356 LDFLAGS="-fsanitize=thread -pie -fPIE"
1357 AC_COMPILE_IFELSE(
1358 [AC_LANG_PROGRAM([], [int x = 1;])],
1359 AC_MSG_RESULT(yes)
1360 [AST_THREAD_SANITIZER=1],
1361 [AST_THREAD_SANITIZER=0]
1362 AC_MSG_RESULT(no)
1363 )
1364 CFLAGS="${saved_sanitize_CFLAGS}"
1365 LDFLAGS="${saved_sanitize_LDFLAGS}"
1366 AC_SUBST(AST_THREAD_SANITIZER)
1367
1368 AC_MSG_CHECKING(for -fsanitize=leak support)
1369 saved_sanitize_CFLAGS="${CFLAGS}"
1370 saved_sanitize_LDFLAGS="${LDFLAGS}"
1371 CFLAGS="-fno-omit-frame-pointer -fsanitize=leak"
1372 LDFLAGS="-fsanitize=leak"
1373 AC_COMPILE_IFELSE(
1374 [AC_LANG_PROGRAM([], [int x = 1;])],
1375 AC_MSG_RESULT(yes)
1376 [AST_LEAK_SANITIZER=1],
1377 [AST_LEAK_SANITIZER=0]
1378 AC_MSG_RESULT(no)
1379 )
1380 CFLAGS="${saved_sanitize_CFLAGS}"
1381 LDFLAGS="${saved_sanitize_LDFLAGS}"
1382 AC_SUBST(AST_LEAK_SANITIZER)
1383
1384 AC_MSG_CHECKING(for -fsanitize=undefined support)
1385 saved_sanitize_CFLAGS="${CFLAGS}"
1386 saved_sanitize_LDFLAGS="${LDFLAGS}"
1387 CFLAGS="-fno-omit-frame-pointer -fsanitize=undefined"
1388 LDFLAGS="-fsanitize=undefined"
1389 AC_COMPILE_IFELSE(
1390 [AC_LANG_PROGRAM([], [int x = 1;])],
1391 AC_MSG_RESULT(yes)
1392 [AST_UNDEFINED_SANITIZER=1],
1393 [AST_UNDEFINED_SANITIZER=0]
1394 AC_MSG_RESULT(no)
1395 )
1396 CFLAGS="${saved_sanitize_CFLAGS}"
1397 LDFLAGS="${saved_sanitize_LDFLAGS}"
1398 AC_SUBST(AST_UNDEFINED_SANITIZER)
1399
1400 AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
1401 if $(${CC} -Wdeclaration-after-statement -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
1402 AC_MSG_RESULT(yes)
1403 AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
1404 else
1405 AC_MSG_RESULT(no)
1406 AST_DECLARATION_AFTER_STATEMENT=
1407 fi
1408 AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
1409
1410 AC_MSG_CHECKING(for -Wtrampolines support)
1411 if $(${CC} -Wtrampolines -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
1412 AC_MSG_RESULT(yes)
1413 AST_TRAMPOLINES=-Wtrampolines
1414 else
1415 AC_MSG_RESULT(no)
1416 AST_TRAMPOLINES=
1417 fi
1418 AC_SUBST(AST_TRAMPOLINES)
1419
1420 AC_MSG_CHECKING(for _FORTIFY_SOURCE support)
1421 if $(${CC} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
1422 AC_MSG_RESULT(yes)
1423 AST_FORTIFY_SOURCE="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
1424 else
1425 AC_MSG_RESULT(no)
1426 AST_FORTIFY_SOURCE=
1427 fi
1428 AC_SUBST(AST_FORTIFY_SOURCE)
1429
1430 AC_MSG_CHECKING(for -fno-strict-overflow)
1431 if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
1432 AC_MSG_RESULT(yes)
1433 AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
1434 else
1435 AC_MSG_RESULT(no)
1436 AST_NO_STRICT_OVERFLOW=
1437 fi
1438 AC_SUBST(AST_NO_STRICT_OVERFLOW)
1439
1440 AC_MSG_CHECKING(for -Wno-format-truncation)
1441 if $(${CC} -Wno-format-truncation -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
1442 AC_MSG_RESULT(yes)
1443 AST_NO_FORMAT_TRUNCATION=-Wno-format-truncation
1444 else
1445 AC_MSG_RESULT(no)
1446 AST_NO_FORMAT_TRUNCATION=
1447 fi
1448 AC_SUBST(AST_NO_FORMAT_TRUNCATION)
1449
1450 AC_MSG_CHECKING(for -Wno-format-y2k)
1451 if $(${CC} -Wno-format-y2k -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
1452 AC_MSG_RESULT(yes)
1453 AST_NO_FORMAT_Y2K=-Wno-format-y2k
1454 else
1455 AC_MSG_RESULT(no)
1456 AST_NO_FORMAT_Y2K=
1457 fi
1458 AC_SUBST(AST_NO_FORMAT_Y2K)
1459
1460 AC_MSG_CHECKING(for -Wno-stringop-truncation)
1461 if $(${CC} -Wno-stringop-truncation -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
1462 AC_MSG_RESULT(yes)
1463 AST_NO_STRINGOP_TRUNCATION=-Wno-stringop-truncation
1464 else
1465 AC_MSG_RESULT(no)
1466 AST_NO_STRINGOP_TRUNCATION=
1467 fi
1468 AC_SUBST(AST_NO_STRINGOP_TRUNCATION)
1469
1470 AC_MSG_CHECKING(for -Wshadow)
1471 if $(${CC} -Wshadow -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
1472 AC_MSG_RESULT(yes)
1473 AST_SHADOW_WARNINGS=-Wshadow
1474 else
1475 AC_MSG_RESULT(no)
1476 AST_SHADOW_WARNINGS=
1477 fi
1478 AC_SUBST(AST_SHADOW_WARNINGS)
1479
1480 AC_MSG_CHECKING(for -march=native support)
1481 if $(${CC} -march=native -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
1482 AC_MSG_RESULT(yes)
1483 AST_NATIVE_ARCH=1
1484 else
1485 AC_MSG_RESULT(no)
1486 AST_NATIVE_ARCH=0
1487 fi
1488 AC_SUBST(AST_NATIVE_ARCH)
1489
1490
1491 dnl Check to see if rpath should be set in LDFLAGS
1492 AC_ARG_ENABLE(rpath,
1493 [AS_HELP_STRING([--disable-rpath],
1494 [Disables rpath linker option checking])],
1495 [case "${enableval}" in
1496 y|ye|yes) check_rpath=yes ;;
1497 n|no) check_rpath=no ;;
1498 *) AC_MSG_ERROR(bad value ${enableval} for --disable-rpath) ;;
1499 esac], [check_rpath=yes])
1500
1501 AC_MSG_CHECKING(whether to use rpath)
1502 AST_RPATH=
1503 if test "${OSARCH}" = "NetBSD"; then
1504 AST_RPATH="-Wl,-rpath,/usr/pkg/lib"
1505 fi
1506 if test "${check_rpath}" != yes; then
1507 AC_MSG_RESULT(skipped)
1508 elif test "${prefix}" = /usr || test "${prefix}" = NONE; then
1509 AC_MSG_RESULT(not needed)
1510 else
1511 AST_RPATH="-Wl,-rpath,${libdir}"
1512 fi
1513 AC_SUBST(AST_RPATH)
1514
1515 AC_MSG_CHECKING(for sysinfo)
1516 AC_LINK_IFELSE(
1517 [AC_LANG_PROGRAM([#include <sys/sysinfo.h>],
1518 [struct sysinfo sys_info; int uptime = sys_info.uptime])],
1519 AC_MSG_RESULT(yes)
1520 AC_DEFINE([HAVE_SYSINFO], 1, [Define to 1 if your system has sysinfo support]),
1521 AC_MSG_RESULT(no)
1522 )
1523
1524 AC_SEARCH_LIBS(res_9_ninit, resolv)
1525 AC_MSG_CHECKING(for res_ninit)
1526 AC_LINK_IFELSE(
1527 [AC_LANG_PROGRAM([
1528 #ifdef HAVE_SYS_SOCKET_H
1529 #include <sys/socket.h>
1530 #endif
1531 #ifdef HAVE_NETINET_IN_H
1532 #include <netinet/in.h>
1533 #endif
1534 #ifdef HAVE_ARPA_NAMESER_H
1535 #include <arpa/nameser.h>
1536 #endif
1537 #include <resolv.h>],
1538 [
1539 int foo;
1540 foo = res_ninit(NULL);
1541 foo = res_nsearch(NULL, NULL, 0, 0, NULL, 0);
1542 ])],
1543 AC_MSG_RESULT(yes)
1544 AC_DEFINE([HAVE_RES_NINIT], 1, [Define to 1 if your system has the re-entrant resolver functions.])
1545 AC_SEARCH_LIBS(res_9_ndestroy, resolv)
1546 AC_MSG_CHECKING(for res_ndestroy)
1547 AC_LINK_IFELSE(
1548 [AC_LANG_PROGRAM([
1549 #ifdef HAVE_SYS_SOCKET_H
1550 #include <sys/socket.h>
1551 #endif
1552 #ifdef HAVE_NETINET_IN_H
1553 #include <netinet/in.h>
1554 #endif
1555 #ifdef HAVE_ARPA_NAMESER_H
1556 #include <arpa/nameser.h>
1557 #endif
1558 #include <resolv.h>],
1559 [res_ndestroy(NULL);])],
1560 AC_MSG_RESULT(yes)
1561 AC_DEFINE([HAVE_RES_NDESTROY], 1, [Define to 1 if your system has the ndestroy resolver function.]),
1562 AC_MSG_RESULT(no)
1563 )
1564 AC_SEARCH_LIBS(res_9_close, resolv)
1565 AC_MSG_CHECKING(for res_close)
1566 AC_LINK_IFELSE(
1567 [AC_LANG_PROGRAM([
1568 #ifdef HAVE_SYS_SOCKET_H
1569 #include <sys/socket.h>
1570 #endif
1571 #ifdef HAVE_NETINET_IN_H
1572 #include <netinet/in.h>
1573 #endif
1574 #ifdef HAVE_ARPA_NAMESER_H
1575 #include <arpa/nameser.h>
1576 #endif
1577 #include <resolv.h>],
1578 [res_close();])],
1579 AC_MSG_RESULT(yes)
1580 AC_DEFINE([HAVE_RES_CLOSE], 1, [Define to 1 if your system has the close resolver function.]),
1581 AC_MSG_RESULT(no)
1582 )
1583 AC_CHECK_MEMBERS([struct __res_state._u._ext.nsaddrs], [], [], [[#include <resolv.h>]]),
1584 AC_MSG_RESULT(no)
1585 )
1586
1587 AC_MSG_CHECKING(for BIND_8_COMPAT required)
1588 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1589 [[
1590 #undef BIND_8_COMPAT
1591 #include <arpa/nameser.h>
1592 ]],
1593 [[int x = NXDOMAIN]])],
1594 AC_MSG_RESULT(no),
1595 AC_MSG_RESULT(yes)
1596 [BIND8_CFLAGS=-DBIND_8_COMPAT])
1597 AC_SUBST(BIND8_CFLAGS)
1598
1599 AST_C_DEFINE_CHECK([GLOB_NOMAGIC], [GLOB_NOMAGIC], [glob.h])
1600
1601 AST_C_DEFINE_CHECK([GLOB_BRACE], [GLOB_BRACE], [glob.h])
1602
1603 AST_C_DEFINE_CHECK([FNM_CASEFOLD], [FNM_CASEFOLD], [fnmatch.h])
1604
1605 AST_C_DEFINE_CHECK([RTLD_NOLOAD], [RTLD_NOLOAD], [dlfcn.h])
1606
1607 AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [IP_MTU_DISCOVER], [netinet/in.h])
1608
1609 AC_CHECK_SIZEOF([int])
1610 AC_CHECK_SIZEOF([long])
1611 AC_CHECK_SIZEOF([long long])
1612 AC_CHECK_SIZEOF([char *])
1613 AC_CHECK_SIZEOF(long)
1614 AC_CHECK_SIZEOF(long long)
1615 AC_COMPUTE_INT([ac_cv_sizeof_fd_set_fds_bits], [sizeof(foo.fds_bits[[0]])], [$ac_includes_default
1616 fd_set foo;])
1617 # This doesn't actually work; what it does is to use the variable set in the
1618 # previous test as a cached value to set the right output variables.
1619 AC_CHECK_SIZEOF(fd_set.fds_bits)
1620
1621 # Set a type compatible with the previous. We cannot just use a generic type
1622 # for these bits, because on big-endian systems, the bits won't match up
1623 # correctly if the size is wrong.
1624 if test $ac_cv_sizeof_int = $ac_cv_sizeof_fd_set_fds_bits; then
1625 AC_DEFINE([TYPEOF_FD_SET_FDS_BITS], [int], [Define to a type of the same size as fd_set.fds_bits[[0]]])
1626 elif test $ac_cv_sizeof_long = $ac_cv_sizeof_fd_set_fds_bits; then
1627 AC_DEFINE([TYPEOF_FD_SET_FDS_BITS], [long], [Define to a type of the same size as fd_set.fds_bits[[0]]])
1628 elif test $ac_cv_sizeof_long_long = $ac_cv_sizeof_fd_set_fds_bits; then
1629 AC_DEFINE([TYPEOF_FD_SET_FDS_BITS], [long long], [Define to a type of the same size as fd_set.fds_bits[[0]]])
1630 fi
1631
1632 AC_MSG_CHECKING(for dladdr in dlfcn.h)
1633 PBX_DLADDR=0
1634 old_LIBS=${LIBS}
1635 LIBS="${LIBS} -ldl"
1636 AC_LINK_IFELSE(
1637 [AC_LANG_PROGRAM([#define _GNU_SOURCE 1
1638 #include <dlfcn.h>],
1639 [dladdr((void *)0, (void *)0)]
1640 )],
1641 AC_MSG_RESULT(yes)
1642 PBX_DLADDR=1
1643 AC_SUBST([PBX_DLADDR])
1644 AC_DEFINE([HAVE_DLADDR], 1, [Define to 1 if your system has the dladdr() GNU extension]),
1645 AC_MSG_RESULT(no)
1646 )
1647 LIBS=${old_LIBS}
1648
1649 # re-check without -ldl
1650 # Non-Linux platforms like FreeBSD and NetBSD do not need a library libdl.so.
1651 if test "${PBX_DLADDR}" = "0"; then
1652 AC_MSG_CHECKING(for dladdr in dlfcn.h without -ldl)
1653 AC_LINK_IFELSE(
1654 [AC_LANG_PROGRAM([#define _GNU_SOURCE 1
1655 #include <dlfcn.h>],
1656 [dladdr((void *)0, (void *)0)]
1657 )],
1658 AC_MSG_RESULT(yes)
1659 PBX_DLADDR=1
1660 AC_SUBST([PBX_DLADDR])
1661 AC_DEFINE([HAVE_DLADDR], 1, [Define to 1 if your system has the dladdr() GNU extension]),
1662 AC_MSG_RESULT(no)
1663 )
1664 fi
1665
1666
1667 # do the package library checks now
1668
1669 AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h])
1670 # Fedora/RedHat/CentOS require extra libraries
1671 AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h], [-ldl -liberty])
1672 # openSUSE requires -lz
1673 AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h], [-ldl -liberty -lz])
1674
1675 case "${OSARCH}" in
1676 linux*)
1677 AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
1678 ;;
1679 esac
1680
1681 AST_C_DEFINE_CHECK([DAHDI], [DAHDI_RESET_COUNTERS], [dahdi/user.h], [230])
1682 AST_C_DEFINE_CHECK([DAHDI], [DAHDI_DEFAULT_MTU_MRU], [dahdi/user.h], [220])
1683 AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h], [200])
1684
1685 AST_C_DEFINE_CHECK([DAHDI_HALF_FULL], [DAHDI_POLICY_HALF_FULL], [dahdi/user.h])
1686
1687 AST_C_COMPILE_CHECK([DAHDI_LINEREVERSE_VMWI], [struct dahdi_vmwi_info booger], [dahdi/user.h], , [enhanced dahdi vmwi support])
1688
1689 AST_C_COMPILE_CHECK([DAHDI_ECHOCANCEL_FAX_MODE], [int foo = DAHDI_ECHOCANCEL_FAX_MODE], [dahdi/user.h])
1690
1691 AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h], , [getifaddrs() support])
1692 AST_C_COMPILE_CHECK([TIMERFD], [timerfd_create(0,0); timerfd_settime(0,0,NULL,NULL);], [sys/timerfd.h], , [timerfd support])
1693
1694 GSM_INTERNAL="yes"
1695 AC_SUBST(GSM_INTERNAL)
1696 GSM_SYSTEM="yes"
1697 if test "${USE_GSM}" != "no"; then
1698 if test "${GSM_DIR}" = "internal"; then
1699 GSM_SYSTEM="no"
1700 elif test "${GSM_DIR}" != ""; then
1701 GSM_INTERNAL="no"
1702 fi
1703 if test "${GSM_SYSTEM}" = "yes"; then
1704 gsmlibdir=""
1705 if test "x${GSM_DIR}" != "x"; then
1706 if test -d ${GSM_DIR}/lib; then
1707 gsmlibdir="-L${GSM_DIR}/lib"
1708 else
1709 gsmlibdir="-L${GSM_DIR}"
1710 fi
1711 fi
1712 AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
1713 [Define to indicate the GSM library]), [], ${gsmlibdir})
1714 if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
1715 if test "x${GSM_DIR}" != "x" ; then
1716 AC_CHECK_HEADER([${GSM_DIR}/include/gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
1717 AC_CHECK_HEADER([${GSM_DIR}/include/gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
1718 else
1719 AC_CHECK_HEADER([gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
1720 AC_CHECK_HEADER([gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
1721 fi
1722 if test "${GSM_HEADER_FOUND}" = "0" ; then
1723 if test "{GSM_GSM_HEADER_FOUND}" = "0" ; then
1724 if test "x${GSM_MANDATORY}" = "xyes" ; then
1725 AC_MSG_NOTICE([***])
1726 AC_MSG_NOTICE([*** It appears that you do not have the gsm development package installed.])
1727 AC_MSG_NOTICE([*** Please install it to include ${GSM_DESCRIP} support, or re-run configure])
1728 AC_MSG_NOTICE([*** without explicitly specifying --with-${GSM_OPTION}])
1729 exit 1
1730 fi
1731 fi
1732 fi
1733 GSM_OK=0
1734 if test "${GSM_HEADER_FOUND}" = "1" ; then
1735 AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
1736 GSM_OK=1
1737 elif test "${GSM_GSM_HEADER_FOUND}" = "1" ; then
1738 AC_DEFINE_UNQUOTED([HAVE_GSM_GSM_HEADER], 1, [Define to indicate that gsm.h is in gsm/gsm.h])
1739 GSM_OK=1
1740 fi
1741 if test "${GSM_OK}" = "1" ; then
1742 GSM_LIB="-lgsm"
1743 if test "x${GSM_DIR}" != "x"; then
1744 GSM_LIB="${gsmlibdir} ${GSM_LIB}"
1745 GSM_INCLUDE="-I${GSM_DIR}/include"
1746 fi
1747 PBX_GSM=1
1748 GSM_INTERNAL="no"
1749 fi
1750 fi
1751 fi
1752 if test "${GSM_INTERNAL}" = "yes"; then
1753 PBX_GSM=1
1754 AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
1755 fi
1756 fi
1757
1758 ILBC_INTERNAL="yes"
1759 AC_SUBST(ILBC_INTERNAL)
1760 ILBC_SYSTEM="yes"
1761 if test "${USE_ILBC}" != "no"; then
1762 if test "${ILBC_DIR}" = "internal"; then
1763 ILBC_SYSTEM="no"
1764 elif test "${ILBC_DIR}" != ""; then
1765 ILBC_INTERNAL="no"
1766 fi
1767 if test "${ILBC_SYSTEM}" = "yes"; then
1768 AST_PKG_CONFIG_CHECK(ILBC, libilbc < 3)
1769 if test "$PBX_ILBC" = "1"; then
1770 ILBC_INTERNAL="no"
1771 fi
1772 fi
1773 if test "${ILBC_INTERNAL}" = "yes"; then
1774 PBX_ILBC=1
1775 fi
1776 fi
1777
1778 AST_EXT_LIB_CHECK([ICONV], [iconv], [iconv_open], [iconv.h])
1779 # GNU libiconv #define's iconv_open to libiconv_open, so we need to search for that symbol
1780 AST_EXT_LIB_CHECK([ICONV], [iconv], [libiconv_open], [iconv.h])
1781 # Some versions of Linux package iconv in glibc
1782 AST_EXT_LIB_CHECK([ICONV], [c], [iconv_close], [iconv.h])
1783
1784 # If ical.h is NOT in the libical directory, then it is of a version insufficient for us.
1785 AST_EXT_LIB_CHECK([ICAL], [ical], [icaltimezone_get_utc_timezone], [libical/ical.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
1786
1787 AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h])
1788
1789 if test "${USE_IMAP_TK}" != "no"; then
1790 saved_cppflags="${CPPFLAGS}"
1791 saved_libs="${LIBS}"
1792 switch_to_system_on_failure="no"
1793 if test "${IMAP_TK_DIR}" = ""; then
1794 IMAP_TK_DIR="`pwd`/../imap-2004g"
1795 switch_to_system_on_failure="yes"
1796 fi
1797 if test "${IMAP_TK_DIR}" != "system"; then
1798 AC_MSG_CHECKING(for UW IMAP Toolkit c-client library)
1799 if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then
1800 imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
1801 fi
1802 imap_libs="${IMAP_TK_DIR}/c-client/c-client.a"
1803 imap_include="-I${IMAP_TK_DIR}/c-client"
1804 CPPFLAGS="${CPPFLAGS} ${imap_include}"
1805 LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
1806 AC_LINK_IFELSE(
1807 [AC_LANG_PROGRAM(
1808 [#include "c-client.h"
1809 void mm_searched (MAILSTREAM *stream,unsigned long number)
1810 {
1811 }
1812 void mm_exists (MAILSTREAM *stream,unsigned long number)
1813 {
1814 }
1815 void mm_expunged (MAILSTREAM *stream,unsigned long number)
1816 {
1817 }
1818 void mm_flags (MAILSTREAM *stream,unsigned long number)
1819 {
1820 }
1821 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1822 {
1823 }
1824 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1825 {
1826 }
1827 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1828 {
1829 }
1830 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1831 {
1832 }
1833 void mm_log (char *string,long errflg)
1834 {
1835 }
1836 void mm_dlog (char *string)
1837 {
1838 }
1839 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1840 {
1841 }
1842 void mm_critical (MAILSTREAM *stream)
1843 {
1844 }
1845 void mm_nocritical (MAILSTREAM *stream)
1846 {
1847 }
1848 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1849 {
1850 }
1851 void mm_fatal (char *string)
1852 {
1853 }],
1854 [
1855 MAILSTREAM *foo = mail_open(NULL, "", 0);
1856 ]
1857 )],
1858 [ac_cv_imap_tk="yes"],
1859 [ac_cv_imap_tk="no"]
1860 )
1861 if test "${ac_cv_imap_tk}" = "yes"; then
1862 AC_LINK_IFELSE(
1863 [AC_LANG_PROGRAM(
1864 [#include "c-client.h"
1865 void mm_searched (MAILSTREAM *stream,unsigned long number)
1866 {
1867 }
1868 void mm_exists (MAILSTREAM *stream,unsigned long number)
1869 {
1870 }
1871 void mm_expunged (MAILSTREAM *stream,unsigned long number)
1872 {
1873 }
1874 void mm_flags (MAILSTREAM *stream,unsigned long number)
1875 {
1876 }
1877 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1878 {
1879 }
1880 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1881 {
1882 }
1883 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1884 {
1885 }
1886 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1887 {
1888 }
1889 void mm_log (char *string,long errflg)
1890 {
1891 }
1892 void mm_dlog (char *string)
1893 {
1894 }
1895 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1896 {
1897 }
1898 void mm_critical (MAILSTREAM *stream)
1899 {
1900 }
1901 void mm_nocritical (MAILSTREAM *stream)
1902 {
1903 }
1904 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1905 {
1906 }
1907 void mm_fatal (char *string)
1908 {
1909 }],
1910 [
1911 long check = mail_expunge_full(NULL, "", 0);
1912 ]
1913 )],
1914 [ac_cv_imap_tk2006="yes"],
1915 [ac_cv_imap_tk2006="no"]
1916 )
1917 fi
1918 CPPFLAGS="${saved_cppflags}"
1919 LIBS="${saved_libs}"
1920 if test "${ac_cv_imap_tk}" = "no"; then
1921 AC_MSG_RESULT(no)
1922 if test "${switch_to_system_on_failure}" = "yes"; then
1923 IMAP_TK_DIR="system"
1924 else #This means they specified a directory. Search for a package installation there too
1925 AC_MSG_CHECKING([for system c-client library...])
1926 CPPFLAGS="${saved_cppflags}"
1927 LIBS="${saved_libs}"
1928 imap_include="-I${IMAP_TK_DIR}/include"
1929 imap_ldflags="-L${IMAP_TK_DIR}/lib"
1930 imap_libs="-lc-client"
1931 CPPFLAGS="${CPPFLAGS} ${imap_include}"
1932 LIBS="${LIBS} ${imap_libs} ${imap_ldflags}"
1933 AC_LINK_IFELSE(
1934 [AC_LANG_PROGRAM(
1935 [#include "c-client.h"
1936 void mm_searched (MAILSTREAM *stream,unsigned long number)
1937 {
1938 }
1939 void mm_exists (MAILSTREAM *stream,unsigned long number)
1940 {
1941 }
1942 void mm_expunged (MAILSTREAM *stream,unsigned long number)
1943 {
1944 }
1945 void mm_flags (MAILSTREAM *stream,unsigned long number)
1946 {
1947 }
1948 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1949 {
1950 }
1951 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1952 {
1953 }
1954 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1955 {
1956 }
1957 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1958 {
1959 }
1960 void mm_log (char *string,long errflg)
1961 {
1962 }
1963 void mm_dlog (char *string)
1964 {
1965 }
1966 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1967 {
1968 }
1969 void mm_critical (MAILSTREAM *stream)
1970 {
1971 }
1972 void mm_nocritical (MAILSTREAM *stream)
1973 {
1974 }
1975 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1976 {
1977 }
1978 void mm_fatal (char *string)
1979 {
1980 }],
1981 [
1982 MAILSTREAM *foo = mail_open(NULL, "", 0);
1983 ]
1984 )],
1985 [ac_cv_imap_tk="yes"],
1986 [ac_cv_imap_tk="no"]
1987 )
1988 if test "${ac_cv_imap_tk}" = "yes"; then
1989 AC_LINK_IFELSE(
1990 [AC_LANG_PROGRAM(
1991 [#include "c-client.h"
1992 void mm_searched (MAILSTREAM *stream,unsigned long number)
1993 {
1994 }
1995 void mm_exists (MAILSTREAM *stream,unsigned long number)
1996 {
1997 }
1998 void mm_expunged (MAILSTREAM *stream,unsigned long number)
1999 {
2000 }
2001 void mm_flags (MAILSTREAM *stream,unsigned long number)
2002 {
2003 }
2004 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
2005 {
2006 }
2007 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2008 {
2009 }
2010 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2011 {
2012 }
2013 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
2014 {
2015 }
2016 void mm_log (char *string,long errflg)
2017 {
2018 }
2019 void mm_dlog (char *string)
2020 {
2021 }
2022 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
2023 {
2024 }
2025 void mm_critical (MAILSTREAM *stream)
2026 {
2027 }
2028 void mm_nocritical (MAILSTREAM *stream)
2029 {
2030 }
2031 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
2032 {
2033 }
2034 void mm_fatal (char *string)
2035 {
2036 }],
2037 [
2038 long check = mail_expunge_full(NULL, "", 0);
2039 ]
2040 )],
2041 [ac_cv_imap_tk2006="yes"],
2042 [ac_cv_imap_tk2006="no"]
2043 )
2044 fi
2045 fi
2046 fi
2047 fi
2048 if test "${IMAP_TK_DIR}" = "system"; then
2049 #We will enter here if user specified "system" or if any of above checks failed
2050 AC_MSG_CHECKING([for system c-client library...])
2051 CPPFLAGS="${saved_cppflags}"
2052 LIBS="${saved_libs}"
2053 imap_ldflags=""
2054 imap_libs="-lcrypto -lssl -lc-client"
2055 imap_include="-DUSE_SYSTEM_IMAP" #Try the imap directory first
2056 CPPFLAGS="${CPPFLAGS} ${imap_include}"
2057 LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
2058 AC_LINK_IFELSE(
2059 [AC_LANG_PROGRAM(
2060 [#include <stdio.h>
2061 #include <imap/c-client.h>
2062 void mm_searched (MAILSTREAM *stream,unsigned long number)
2063 {
2064 }
2065 void mm_exists (MAILSTREAM *stream,unsigned long number)
2066 {
2067 }
2068 void mm_expunged (MAILSTREAM *stream,unsigned long number)
2069 {
2070 }
2071 void mm_flags (MAILSTREAM *stream,unsigned long number)
2072 {
2073 }
2074 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
2075 {
2076 }
2077 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2078 {
2079 }
2080 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2081 {
2082 }
2083 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
2084 {
2085 }
2086 void mm_log (char *string,long errflg)
2087 {
2088 }
2089 void mm_dlog (char *string)
2090 {
2091 }
2092 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
2093 {
2094 }
2095 void mm_critical (MAILSTREAM *stream)
2096 {
2097 }
2098 void mm_nocritical (MAILSTREAM *stream)
2099 {
2100 }
2101 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
2102 {
2103 }
2104 void mm_fatal (char *string)
2105 {
2106 }],
2107 [
2108 MAILSTREAM *foo = mail_open(NULL, "", 0);
2109 ]
2110 )],
2111 [ac_cv_imap_tk="yes"],
2112 [ac_cv_imap_tk="no"]
2113 )
2114 if test "${ac_cv_imap_tk}" = "yes"; then
2115 AC_LINK_IFELSE(
2116 [AC_LANG_PROGRAM(
2117 [#include <stdio.h>
2118 #include <imap/c-client.h>
2119 void mm_searched (MAILSTREAM *stream,unsigned long number)
2120 {
2121 }
2122 void mm_exists (MAILSTREAM *stream,unsigned long number)
2123 {
2124 }
2125 void mm_expunged (MAILSTREAM *stream,unsigned long number)
2126 {
2127 }
2128 void mm_flags (MAILSTREAM *stream,unsigned long number)
2129 {
2130 }
2131 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
2132 {
2133 }
2134 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2135 {
2136 }
2137 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2138 {
2139 }
2140 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
2141 {
2142 }
2143 void mm_log (char *string,long errflg)
2144 {
2145 }
2146 void mm_dlog (char *string)
2147 {
2148 }
2149 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
2150 {
2151 }
2152 void mm_critical (MAILSTREAM *stream)
2153 {
2154 }
2155 void mm_nocritical (MAILSTREAM *stream)
2156 {
2157 }
2158 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
2159 {
2160 }
2161 void mm_fatal (char *string)
2162 {
2163 }],
2164 [
2165 long check = mail_expunge_full(NULL, "", 0);
2166 ]
2167 )],
2168 [ac_cv_imap_tk2006="yes"],
2169 [ac_cv_imap_tk2006="no"]
2170 )
2171 else #looking in imap directory didn't work, try c-client
2172 imap_ldflags=""
2173 imap_libs="-lcrypto -lssl -lc-client"
2174 imap_include="-DUSE_SYSTEM_CCLIENT"
2175 CPPFLAGS="${saved_cppflags}"
2176 LIBS="${saved_libs}"
2177 CPPFLAGS="${CPPFLAGS} ${imap_include}"
2178 LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
2179 AC_LINK_IFELSE(
2180 [AC_LANG_PROGRAM(
2181 [#include <stdio.h>
2182 #include <c-client/c-client.h>
2183 void mm_searched (MAILSTREAM *stream,unsigned long number)
2184 {
2185 }
2186 void mm_exists (MAILSTREAM *stream,unsigned long number)
2187 {
2188 }
2189 void mm_expunged (MAILSTREAM *stream,unsigned long number)
2190 {
2191 }
2192 void mm_flags (MAILSTREAM *stream,unsigned long number)
2193 {
2194 }
2195 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
2196 {
2197 }
2198 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2199 {
2200 }
2201 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2202 {
2203 }
2204 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
2205 {
2206 }
2207 void mm_log (char *string,long errflg)
2208 {
2209 }
2210 void mm_dlog (char *string)
2211 {
2212 }
2213 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
2214 {
2215 }
2216 void mm_critical (MAILSTREAM *stream)
2217 {
2218 }
2219 void mm_nocritical (MAILSTREAM *stream)
2220 {
2221 }
2222 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
2223 {
2224 }
2225 void mm_fatal (char *string)
2226 {
2227 }],
2228 [
2229 MAILSTREAM *foo = mail_open(NULL, "", 0);
2230 ]
2231 )],
2232 [ac_cv_imap_tk="yes"],
2233 [ac_cv_imap_tk="no"]
2234 )
2235 if test "${ac_cv_imap_tk}" = "no"; then
2236 imap_libs="-lcrypto -lssl -lc-client4"
2237 LIBS="${saved_libs} ${imap_libs} "`echo ${imap_ldflags}`
2238 AC_LINK_IFELSE(
2239 [AC_LANG_PROGRAM(
2240 [#include <stdio.h>
2241 #include <c-client/c-client.h>
2242 void mm_searched (MAILSTREAM *stream,unsigned long number)
2243 {
2244 }
2245 void mm_exists (MAILSTREAM *stream,unsigned long number)
2246 {
2247 }
2248 void mm_expunged (MAILSTREAM *stream,unsigned long number)
2249 {
2250 }
2251 void mm_flags (MAILSTREAM *stream,unsigned long number)
2252 {
2253 }
2254 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
2255 {
2256 }
2257 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2258 {
2259 }
2260 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2261 {
2262 }
2263 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
2264 {
2265 }
2266 void mm_log (char *string,long errflg)
2267 {
2268 }
2269 void mm_dlog (char *string)
2270 {
2271 }
2272 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
2273 {
2274 }
2275 void mm_critical (MAILSTREAM *stream)
2276 {
2277 }
2278 void mm_nocritical (MAILSTREAM *stream)
2279 {
2280 }
2281 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
2282 {
2283 }
2284 void mm_fatal (char *string)
2285 {
2286 }],
2287 [
2288 MAILSTREAM *foo = mail_open(NULL, "", 0);
2289 ]
2290 )],
2291 [ac_cv_imap_tk="yes"],
2292 [ac_cv_imap_tk="no"]
2293 )
2294 fi
2295 if test "${ac_cv_imap_tk}" = "yes"; then
2296 AC_LINK_IFELSE(
2297 [AC_LANG_PROGRAM(
2298 [#include <stdio.h>
2299 #include <c-client/c-client.h>
2300 void mm_searched (MAILSTREAM *stream,unsigned long number)
2301 {
2302 }
2303 void mm_exists (MAILSTREAM *stream,unsigned long number)
2304 {
2305 }
2306 void mm_expunged (MAILSTREAM *stream,unsigned long number)
2307 {
2308 }
2309 void mm_flags (MAILSTREAM *stream,unsigned long number)
2310 {
2311 }
2312 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
2313 {
2314 }
2315 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2316 {
2317 }
2318 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
2319 {
2320 }
2321 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
2322 {
2323 }
2324 void mm_log (char *string,long errflg)
2325 {
2326 }
2327 void mm_dlog (char *string)
2328 {
2329 }
2330 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
2331 {
2332 }
2333 void mm_critical (MAILSTREAM *stream)
2334 {
2335 }
2336 void mm_nocritical (MAILSTREAM *stream)
2337 {
2338 }
2339 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
2340 {
2341 }
2342 void mm_fatal (char *string)
2343 {
2344 }],
2345 [
2346 long check = mail_expunge_full(NULL, "", 0);
2347 ]
2348 )],
2349 [ac_cv_imap_tk2006="yes"],
2350 [ac_cv_imap_tk2006="no"]
2351 )
2352 fi
2353 fi
2354 fi
2355 if test "${ac_cv_imap_tk}" = "yes"; then
2356 AC_MSG_RESULT(yes)
2357 IMAP_TK_LIB="${imap_libs} "`echo ${imap_ldflags}`
2358 IMAP_TK_INCLUDE="${imap_include}"
2359 PBX_IMAP_TK=1
2360 AC_DEFINE([HAVE_IMAP_TK], 1, [Define if your system has the UW IMAP Toolkit c-client library.])
2361 if test "${ac_cv_imap_tk2006}" = "yes"; then
2362 AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
2363 fi
2364 else
2365 AC_MSG_RESULT(no)
2366 fi
2367 CPPFLAGS="${saved_cppflags}"
2368 LIBS="${saved_libs}"
2369 fi
2370
2371 AST_EXT_LIB_CHECK([IODBC], [iodbc], [SQLConnect], [sql.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
2372
2373 AST_EXT_LIB_CHECK([INOTIFY], [c], [inotify_init], [sys/inotify.h])
2374
2375 AST_EXT_LIB_CHECK([JACK], [jack], [jack_activate], [jack/jack.h])
2376
2377 # BSD (and OS X) equivalent of inotify
2378 AST_EXT_LIB_CHECK([KQUEUE], [c], [kqueue], [sys/event.h])
2379
2380 # 64-bit version of kevent (from kqueue) on OS X
2381 AC_CHECK_FUNCS([kevent64])
2382
2383 AST_EXT_LIB_CHECK([LDAP], [ldap], [ldap_initialize], [ldap.h])
2384
2385 AST_EXT_TOOL_CHECK([MYSQLCLIENT], [mysql_config])
2386
2387 if test "${PBX_MYSQLCLIENT}" = 1; then
2388 AC_MSG_CHECKING(for MySQL client bool support)
2389 AC_LINK_IFELSE(
2390 [AC_LANG_PROGRAM([#include <mysql/mysql.h>],
2391 [bool test = 1;])],
2392 AC_MSG_RESULT(yes)
2393 AC_DEFINE(HAVE_MYSQLCLIENT_BOOL, 1, [Define to 1 if mysql/mysql.h has bool defined.]),
2394 AC_MSG_RESULT(no)
2395 )
2396 AC_MSG_CHECKING(for MySQL client my_bool support)
2397 AC_LINK_IFELSE(
2398 [AC_LANG_PROGRAM([#include <mysql/mysql.h>],
2399 [my_bool test = 1;])],
2400 AC_MSG_RESULT(yes)
2401 AC_DEFINE(HAVE_MYSQLCLIENT_MY_BOOL, 1, [Define to 1 if mysql/mysql.h has my_bool defined.]),
2402 AC_MSG_RESULT(no)
2403 )
2404 fi
2405
2406 AST_EXT_TOOL_CHECK([NEON], [neon-config])
2407
2408 AST_EXT_TOOL_CHECK([NEON29], [neon-config], , [--libs],
2409 [#include <ne_auth.h>],
2410 [#ifndef NE_AUTH_NTLM
2411 #error Need libneon >= 0.29.0
2412 #endif])
2413
2414 AST_PKG_CONFIG_CHECK(NETSNMP, netsnmp-agent)
2415 AST_EXT_TOOL_CHECK([NETSNMP], [net-snmp-config], , [--agent-libs],
2416 [#include <net-snmp/net-snmp-config.h>
2417 #include <net-snmp/net-snmp-includes.h>
2418 #include <net-snmp/agent/net-snmp-agent-includes.h>],
2419 [int callback = snmp_register_callback(0, 0, NULL, NULL)])
2420
2421 AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
2422
2423 # Check that unbound is installed and the version code fragment compiles
2424 AST_EXT_LIB_EXTRA_CHECK([UNBOUND], [unbound], [ub_ctx_delete], [unbound.h],
2425 [], [], [
2426 AC_LANG_PROGRAM( [#include <unbound.h>],
2427 [
2428 #if (UNBOUND_VERSION_MAJOR < 1 || (UNBOUND_VERSION_MAJOR == 1 && UNBOUND_VERSION_MINOR < 5 ))
2429 #error "Unbound version must be >= 1.5"
2430 #endif
2431 ]
2432 )
2433 ], [unbound version >= 1.5])
2434
2435 AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h])
2436
2437 AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_stream_init], [ogg/ogg.h])
2438
2439 # Non-glibc platforms require libexecinfo for backtrace support
2440 AST_EXT_LIB_CHECK([BKTR], [execinfo], [backtrace], [execinfo.h])
2441 # Linux, however, has backtrace directly in glibc
2442 AST_EXT_LIB_CHECK([BKTR], [c], [backtrace], [execinfo.h])
2443
2444 AST_EXT_LIB_CHECK([BLUETOOTH], [bluetooth], [ba2str], [bluetooth/bluetooth.h])
2445
2446 AST_EXT_LIB_CHECK([BEANSTALK], [beanstalk], [bs_version], [beanstalk.h])
2447
2448 PG_CONFIG=":"
2449 if test "${USE_PGSQL}" != "no"; then
2450 if test "x${PGSQL_DIR}" != "x"; then
2451 AC_PATH_TOOL([PG_CONFIG], [pg_config], :, [${PGSQL_DIR}/bin])
2452 if test "${PG_CONFIG}" = ":"; then
2453 AC_MSG_NOTICE([***])
2454 AC_MSG_NOTICE([*** pg_config was not found in the path you specified:])
2455 AC_MSG_NOTICE([*** ${PGSQL_DIR}/bin])
2456 AC_MSG_NOTICE([*** Either correct the installation, or run configure])
2457 AC_MSG_NOTICE([*** including --without-postgres])
2458 exit 1
2459 fi
2460 else
2461 AC_PATH_TOOL([PG_CONFIG], [pg_config], :)
2462 fi
2463 fi
2464 if test "x${PG_CONFIG}" != "x:"; then
2465 PGSQL_libdir=`${PG_CONFIG} --libdir`
2466 PGSQL_includedir=`${PG_CONFIG} --includedir`
2467 if test "x$?" != "x0" ; then
2468 if test -n "${PGSQL_MANDATORY}" ; then
2469 AC_MSG_NOTICE([***])
2470 AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
2471 AC_MSG_NOTICE([*** Either correct the installation, or run configure])
2472 AC_MSG_NOTICE([*** including --without-postgres])
2473 exit 1
2474 fi
2475 else
2476 AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
2477 [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
2478
2479 AC_MSG_CHECKING(for pg_encoding_to_char within Postgres headers)
2480 old_CFLAGS=${CFLAGS}
2481 CFLAGS="${CFLAGS} -I${PGSQL_includedir} -Werror"
2482 old_LDFLAGS=${LDFLAGS}
2483 LDFLAGS="${LDFLAGS} -L${PGSQL_libdir} -lpq -lz"
2484 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <libpq-fe.h>],
2485 [const char *foo = pg_encoding_to_char(1)])],
2486 [AC_MSG_RESULT(yes)
2487 AC_DEFINE_UNQUOTED([HAVE_PGSQL_pg_encoding_to_char], 1, [Define to indicate presence of the pg_encoding_to_char API.])],
2488 [AC_MSG_RESULT(no)])
2489 CFLAGS=${old_CFLAGS}
2490 LDFLAGS=${old_LDFLAGS}
2491
2492 if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
2493 PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
2494 PGSQL_INCLUDE="-I${PGSQL_includedir}"
2495 PBX_PGSQL=1
2496 elif test -n "${PGSQL_MANDATORY}";
2497 then
2498 AC_MSG_NOTICE([***])
2499 AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
2500 AC_MSG_NOTICE([*** Either correct the installation, or run configure])
2501 AC_MSG_NOTICE([*** including --without-postgres])
2502 exit 1
2503 fi
2504 fi
2505 fi
2506
2507 if test "$USE_PJPROJECT" != "no" ; then
2508 if test "$PJPROJECT_BUNDLED" = "no" ; then
2509 AST_PKG_CONFIG_CHECK([PJPROJECT], [libpjproject])
2510 if test "x$PBX_PJPROJECT" = "x1" ; then
2511 AST_EXT_LIB_CHECK([PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], [pjsip], [pjsip_dlg_create_uas_and_inc_lock], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
2512 AST_EXT_LIB_CHECK([PJ_TRANSACTION_GRP_LOCK], [pjsip], [pjsip_tsx_create_uac2], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
2513
2514 saved_cppflags="${CPPFLAGS}"
2515 saved_libs="${LIBS}"
2516 CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}"
2517 LIBS="${LIBS} ${PJPROJECT_LIB}"
2518 AST_C_COMPILE_CHECK([PJSIP_REPLACE_MEDIA_STREAM], [pjmedia_mod_offer_flag flag = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE], [pjmedia.h])
2519 LIBS="${saved_libs}"
2520 CPPFLAGS="${saved_cppflags}"
2521
2522 AST_EXT_LIB_CHECK([PJSIP_GET_DEST_INFO], [pjsip], [pjsip_get_dest_info], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
2523 AST_EXT_LIB_CHECK([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj], [pj_ssl_cert_load_from_files2], [pjlib.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
2524 AST_EXT_LIB_CHECK([PJSIP_EXTERNAL_RESOLVER], [pjsip], [pjsip_endpt_set_ext_resolver], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
2525
2526 saved_cppflags="${CPPFLAGS}"
2527 saved_libs="${LIBS}"
2528 CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}"
2529 LIBS="${LIBS} ${PJPROJECT_LIB}"
2530 AST_C_COMPILE_CHECK([PJSIP_TLS_TRANSPORT_PROTO], [struct pjsip_tls_setting setting; int proto; proto = setting.proto;], [pjsip.h])
2531 AST_C_COMPILE_CHECK([PJSIP_TLS_1_1], [enum pjsip_ssl_method method = PJSIP_TLSV1_1_METHOD;], [pjsip.h])
2532 AST_C_COMPILE_CHECK([PJSIP_TLS_1_2], [enum pjsip_ssl_method method = PJSIP_TLSV1_2_METHOD;], [pjsip.h])
2533 AST_C_COMPILE_CHECK([PJSIP_TLS_1_3], [enum pjsip_ssl_method method = PJSIP_TLSV1_3_METHOD;], [pjsip.h])
2534 AST_C_COMPILE_CHECK([PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS], [pjsip_cfg()->endpt.accept_multiple_sdp_answers = 0;], [pjsip.h])
2535 AST_C_COMPILE_CHECK([PJSIP_ENDPOINT_COMPACT_FORM], [pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;], [pjsip.h])
2536 AST_C_COMPILE_CHECK([PJSIP_TRANSPORT_DISABLE_CONNECTION_REUSE], [struct pjsip_tpselector sel; sel.disable_connection_reuse = PJ_TRUE;], [pjsip.h])
2537 AST_C_COMPILE_CHECK([PJSIP_OAUTH_AUTHENTICATION], [struct pjsip_oauth_credential credential;], [pjsip.h])
2538 AC_MSG_CHECKING(for pjproject on_valid_pair callback)
2539 AC_LINK_IFELSE(
2540 [AC_LANG_PROGRAM(
2541 [#include <pjsip.h>
2542 #include <pjsip_ua.h>
2543 #include <pjnath.h>
2544 void on_valid_pair(pj_ice_sess *ice) {}
2545 void on_ice_complete(pj_ice_sess *ice, pj_status_t status) {}
2546 void on_rx_data(pj_ice_sess *ice, unsigned comp_id, unsigned transport_id, void *pkt, pj_size_t size, const pj_sockaddr_t *src_addr, unsigned src_addr_len) {}
2547 pj_status_t on_tx_pkt(pj_ice_sess *ice, unsigned comp_id, unsigned transport_id, const void *pkt, pj_size_t size, const pj_sockaddr_t *dst_addr, unsigned dst_addr_len) {}],
2548 [pj_ice_sess_cb ice_sess_cb = {
2549 .on_valid_pair = on_valid_pair,
2550 .on_ice_complete = on_ice_complete,
2551 .on_rx_data = on_rx_data,
2552 .on_tx_pkt = on_tx_pkt,
2553 };])],
2554 AC_MSG_RESULT(yes)
2555 AC_DEFINE(HAVE_PJPROJECT_ON_VALID_ICE_PAIR_CALLBACK, 1, [Define to 1 if on_valid_pair callback is present.]),
2556 AC_MSG_RESULT(no)
2557 )
2558 LIBS="${saved_libs}"
2559 CPPFLAGS="${saved_cppflags}"
2560
2561 AST_EXT_LIB_CHECK([PJSIP_EVSUB_GRP_LOCK], [pjsip], [pjsip_evsub_add_ref], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
2562 AST_EXT_LIB_CHECK([PJSIP_INV_SESSION_REF], [pjsip], [pjsip_inv_add_ref], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
2563 AST_EXT_LIB_CHECK([PJSIP_AUTH_CLT_DEINIT], [pjsip], [pjsip_auth_clt_deinit], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
2564 AST_EXT_LIB_CHECK([PJSIP_TSX_LAYER_FIND_TSX2], [pjsip], [pjsip_tsx_layer_find_tsx2], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
2565 AST_EXT_LIB_CHECK([PJSIP_TLS_TRANSPORT_RESTART], [pjsip], [pjsip_tls_transport_restart], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
2566 AST_EXT_LIB_CHECK([PJSIP_AUTH_NEW_DIGESTS], [pjsip], [pjsip_auth_get_algorithm_by_type], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
2567 fi
2568 fi
2569 fi
2570
2571 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
2572
2573 AST_PKG_CONFIG_CHECK([PORTAUDIO], [portaudio-2.0])
2574 AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
2575
2576 AST_EXT_LIB_CHECK([PRI], [pri], [pri_connected_line_update], [libpri.h])
2577 if test "x$PBX_PRI" = "x1" ; then
2578 AST_EXT_LIB_CHECK([PRI_SETUP_ACK_INBAND], [pri], [pri_setup_ack], [libpri.h])
2579 AST_EXT_LIB_CHECK([PRI_L2_PERSISTENCE], [pri], [pri_persistent_layer2_option], [libpri.h])
2580 AST_EXT_LIB_CHECK([PRI_DATETIME_SEND], [pri], [pri_date_time_send_option], [libpri.h])
2581 AST_EXT_LIB_CHECK([PRI_MWI_V2], [pri], [pri_mwi_indicate_v2], [libpri.h])
2582 AST_EXT_LIB_CHECK([PRI_DISPLAY_TEXT], [pri], [pri_display_text], [libpri.h])
2583 AST_EXT_LIB_CHECK([PRI_MWI], [pri], [pri_mwi_indicate], [libpri.h])
2584 AST_EXT_LIB_CHECK([PRI_MCID], [pri], [pri_mcid_enable], [libpri.h])
2585 AST_EXT_LIB_CHECK([PRI_CALL_WAITING], [pri], [pri_connect_ack_enable], [libpri.h])
2586 AST_EXT_LIB_CHECK([PRI_AOC_EVENTS], [pri], [pri_aoc_events_enable], [libpri.h])
2587 AST_EXT_LIB_CHECK([PRI_TRANSFER], [pri], [pri_transfer_enable], [libpri.h])
2588 AST_EXT_LIB_CHECK([PRI_CCSS], [pri], [pri_cc_enable], [libpri.h])
2589 AST_EXT_LIB_CHECK([PRI_HANGUP_FIX], [pri], [pri_hangup_fix_enable], [libpri.h])
2590 AST_EXT_LIB_CHECK([PRI_SUBADDR], [pri], [pri_sr_set_called_subaddress], [libpri.h])
2591 AST_EXT_LIB_CHECK([PRI_CALL_HOLD], [pri], [pri_hold_enable], [libpri.h])
2592 AST_EXT_LIB_CHECK([PRI_CALL_REROUTING], [pri], [pri_reroute_enable], [libpri.h])
2593 AST_EXT_LIB_CHECK([PRI_SETUP_KEYPAD], [pri], [pri_sr_set_keypad_digits], [libpri.h])
2594
2595 # ------------------------------------v
2596 # TODO: The code can be changed to always include these features now.
2597 # These features will always be present if pri_connected_line_update is available.
2598 AST_EXT_LIB_CHECK([PRI_PROG_W_CAUSE], [pri], [pri_progress_with_cause], [libpri.h])
2599 AST_EXT_LIB_CHECK([PRI_INBANDDISCONNECT], [pri], [pri_set_inbanddisconnect], [libpri.h])
2600 AST_EXT_LIB_CHECK([PRI_SERVICE_MESSAGES], [pri], [pri_maintenance_service], [libpri.h])
2601 AST_EXT_LIB_CHECK([PRI_REVERSE_CHARGE], [pri], [pri_sr_set_reversecharge], [libpri.h])
2602 # ------------------------------------^
2603 fi
2604
2605 AST_EXT_LIB_CHECK([RESAMPLE], [resample], [resample_open], [libresample.h], [-lm])
2606 AST_EXT_LIB_CHECK([FFTW3], [fftw3], [fftw_malloc], [fftw3.h])
2607 AST_EXT_LIB_CHECK([SNDFILE], [sndfile], [sf_open], [sndfile.h])
2608
2609 AST_C_COMPILE_CHECK([SPANDSP], [
2610 #if SPANDSP_RELEASE_DATE < 20080516
2611 #error "spandsp 0.0.5 or greater is required"
2612 #endif
2613 ], [spandsp/version.h], , [minimum version of SpanDSP])
2614
2615 if test "x${PBX_SPANDSP}" = "x1" ; then
2616 # We found the correct version in the header, now let's make sure it links
2617 # properly, and that libtiff is available
2618 PBX_SPANDSP=0
2619 AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [span_set_message_handler], [spandsp.h], [-ltiff])
2620 fi
2621
2622 if test "x${PBX_SPANDSP}" = "x1" ; then
2623 # We also need t38_terminal_init()
2624 PBX_SPANDSP=0
2625 AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [t38_terminal_init], [spandsp.h], [-ltiff])
2626 fi
2627
2628 # Check for libss7 v2.0 branch compatible version.
2629 AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_set_isup_timer], [libss7.h])
2630
2631 AST_EXT_LIB_CHECK([OPENR2], [openr2], [openr2_chan_new], [openr2.h])
2632
2633 AST_EXT_LIB_CHECK([OPUS], [opus], [opus_encoder_create], [opus/opus.h])
2634 # opusfile.h includes <opus_multistream.h> so we need to make sure that
2635 # either $OPUS_INCLUDE or /usr/include/opus is added to the search path.
2636 __opus_include=${OPUS_INCLUDE}
2637 if test -z "$__opus_include" -o x"$__opus_include" = x" " ; then
2638 __opus_include=-I/usr/include/opus
2639 fi
2640 AST_EXT_LIB_CHECK([OPUSFILE], [opusfile], [op_open_callbacks], [opus/opusfile.h], [], [$__opus_include])
2641
2642 for ver in ${LUA_VERSIONS:-5.4 5.3 5.2 5.1}; do
2643 AST_EXT_LIB_CHECK([LUA], lua${ver}, [luaL_newstate], lua${ver}/lua.h, [-lm])
2644 if test "x${PBX_LUA}" = "x1" ; then
2645 if test x"${LUA_DIR}" = x; then
2646 LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua${ver}"
2647 else
2648 LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua${ver}"
2649 fi
2650 break;
2651 fi
2652 done
2653
2654 # Some distributions (like openSUSE and NetBSD) remove the 5.x suffix.
2655 if test "x${LUA_VERSIONS}" = "x"; then
2656 AST_EXT_LIB_CHECK([LUA], [lua], [luaL_newstate], [lua.h], [-lm])
2657 fi
2658
2659 # Accept either RADIUS client library, their APIs are fully compatible,
2660 # just different header filenames and different SONAMEs
2661 AST_EXT_LIB_CHECK([RADIUS], [freeradius-client], [rc_read_config], [freeradius-client.h])
2662 if test "x${PBX_RADIUS}" = "x1"; then
2663 AC_DEFINE(RADIUS_HEADER_STR, [<freeradius-client.h>], [Name of RADIUS library include header])
2664 else
2665 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
2666 if test "x${PBX_RADIUS}" = "x1"; then
2667 AC_DEFINE(RADIUS_HEADER_STR, [<radiusclient-ng.h>], [Name of RADIUS library include header])
2668 else
2669 AST_EXT_LIB_CHECK([RADIUS], [radcli], [rc_read_config], [radcli/radcli.h])
2670 if test "x${PBX_RADIUS}" = "x1"; then
2671 AC_DEFINE(RADIUS_HEADER_STR, [<radcli/radcli.h>], [Name of RADIUS library include header])
2672 fi
2673 fi
2674 fi
2675
2676 AST_EXT_LIB_CHECK([CODEC2], [codec2], [codec2_create], [codec2/codec2.h])
2677
2678 AST_EXT_LIB_CHECK([COROSYNC], [cpg], [cpg_join], [corosync/cpg.h], [-lcpg -lcfg])
2679 AST_EXT_LIB_CHECK([COROSYNC_CFG_STATE_TRACK], [cfg], [corosync_cfg_state_track], [corosync/cfg.h], [-lcfg])
2680
2681 AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
2682
2683 # See if the main speex library contains the preprocess functions
2684 AST_EXT_LIB_CHECK([SPEEX_PREPROCESS], [speex], [speex_preprocess_ctl], [speex/speex.h], [-lm])
2685 if test "${PBX_SPEEX_PREPROCESS}" = 1; then
2686 PBX_SPEEX_PREPROCESS=1
2687 fi
2688
2689 AST_EXT_LIB_CHECK([SPEEXDSP], [speexdsp], [speex_preprocess_ctl], [speex/speex.h], [-lm])
2690 if test "${PBX_SPEEXDSP}" = 1; then
2691 PBX_SPEEX_PREPROCESS=1
2692 fi
2693
2694 AC_SUBST(PBX_SPEEX_PREPROCESS)
2695
2696 AST_EXT_LIB_CHECK([SQLITE3], [sqlite3], [sqlite3_open], [sqlite3.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
2697
2698 if test "${PBX_SQLITE3}" != 1; then
2699 AC_MSG_ERROR(*** Asterisk now uses SQLite3 for the internal Asterisk database.)
2700 AC_MSG_ERROR(*** Please install the SQLite3 development package.)
2701 exit 1
2702 fi
2703
2704 # Find crypt support
2705 # * -lcrypt on *NIX
2706 # * in libsystem on OS X
2707 AST_EXT_LIB_CHECK([LIBCRYPT], [crypt], [crypt], [crypt.h])
2708 AC_CHECK_FUNC([crypt], [SYSCRYPT=true], [SYSCRYPT=""])
2709
2710 if test "x$LIBCRYPT_LIB" != "x" ; then
2711 CRYPT_LIB="$LIBCRYPT_LIB"
2712 CRYPT_INCLUDE="$LIBCRYPT_INCLUDE"
2713 AC_DEFINE([HAVE_CRYPT], [1], [Define to 1 if you have the 'crypt' function.])
2714 elif test "x$SYSCRYPT" != "x" ; then
2715 CRYPT_LIB=""
2716 CRYPT_INCLUDE=""
2717 AC_DEFINE([HAVE_CRYPT], [1], [Define to 1 if you have the 'crypt' function.])
2718 fi
2719
2720 AC_SUBST(CRYPT_LIB)
2721 AC_SUBST(CRYPT_INCLUDE)
2722
2723 # Find crypt_r support
2724 AC_CHECK_LIB([crypt], [crypt_r],
2725 [AC_DEFINE([HAVE_CRYPT_R], [1], [Define to 1 if you have the 'crypt_r' function.])])
2726
2727 AST_EXT_LIB_CHECK([SRTP], [srtp2], [srtp_init], [srtp2/srtp.h], [], [], [2])
2728 AST_EXT_LIB_CHECK_SHARED([SRTP], [srtp2], [srtp_init], [srtp2/srtp.h], [], [], [], [
2729 AC_MSG_WARN([***])
2730 AC_MSG_WARN([*** libsrtp2 could not be linked as a shared object.])
2731 AC_MSG_WARN([*** Try compiling libsrtp2 manually. Configure libsrtp2])
2732 AC_MSG_WARN([*** with ./configure --prefix=/usr replacing /usr with])
2733 AC_MSG_WARN([*** the prefix of your choice, and then make with])
2734 AC_MSG_WARN([*** 'make libsrtp2.so'])
2735 AC_MSG_WARN([***])
2736 AC_MSG_WARN([*** After re-installing libsrtp2, re-run the Asterisk])
2737 AC_MSG_WARN([*** configure script.])
2738 AC_MSG_WARN([***])
2739 AC_MSG_WARN([*** If you do not need SRTP support re-run configure])
2740 AC_MSG_WARN([*** with the --without-srtp option.])
2741 exit 1
2742 ])
2743
2744 if test "x$PBX_SRTP" = x1;
2745 then
2746 AST_EXT_LIB_CHECK([SRTP_256], [srtp2], [srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80])
2747 AST_EXT_LIB_CHECK([SRTP_192], [srtp2], [srtp_crypto_policy_set_aes_cm_192_hmac_sha1_80])
2748 AST_EXT_LIB_CHECK([SRTP_GCM], [srtp2], [srtp_crypto_policy_set_aes_gcm_128_8_auth])
2749 AST_EXT_LIB_CHECK([SRTP_SHUTDOWN], [srtp2], [srtp_shutdown], [srtp2/srtp.h])
2750 AST_EXT_LIB_CHECK([SRTP_GET_VERSION], [srtp2], [srtp_get_version_string], [srtp2/srtp.h])
2751
2752 # libsrtp2 removed support for PRNG, so we require OpenSSL
2753 if test "x$PBX_OPENSSL" != x1;
2754 then
2755 AC_MSG_WARN([***])
2756 AC_MSG_WARN([*** OpenSSL required when using libsrtp2, checking for libsrtp instead.])
2757 AC_MSG_WARN([***])
2758 PBX_SRTP=0
2759 fi
2760 fi
2761
2762 if test "x$PBX_SRTP" != x1;
2763 then
2764 AST_EXT_LIB_CHECK([SRTP], [srtp], [srtp_init], [srtp/srtp.h], [], [], [1])
2765 AST_EXT_LIB_CHECK_SHARED([SRTP], [srtp], [srtp_init], [srtp/srtp.h], [], [], [], [
2766 AC_MSG_WARN([***])
2767 AC_MSG_WARN([*** libsrtp could not be linked as a shared object.])
2768 AC_MSG_WARN([*** Try compiling libsrtp manually. Configure libsrtp])
2769 AC_MSG_WARN([*** with ./configure CFLAGS=-fPIC --prefix=/usr])
2770 AC_MSG_WARN([*** replacing /usr with the prefix of your choice.])
2771 AC_MSG_WARN([*** After re-installing libsrtp, re-run the Asterisk])
2772 AC_MSG_WARN([*** configure script.])
2773 AC_MSG_WARN([***])
2774 AC_MSG_WARN([*** If you do not need SRTP support re-run configure])
2775 AC_MSG_WARN([*** with the --without-srtp option.])
2776 exit 1
2777 ])
2778
2779 if test "x$PBX_SRTP" = x1;
2780 then
2781 AST_EXT_LIB_CHECK([SRTP_256], [srtp], [crypto_policy_set_aes_cm_256_hmac_sha1_80])
2782 AST_EXT_LIB_CHECK([SRTP_192], [srtp], [crypto_policy_set_aes_cm_192_hmac_sha1_80])
2783 AST_EXT_LIB_CHECK([SRTP_GCM], [srtp], [crypto_policy_set_aes_gcm_128_8_auth])
2784 AST_EXT_LIB_CHECK([SRTP_SHUTDOWN], [srtp], [srtp_shutdown], [srtp/srtp.h])
2785 AST_EXT_LIB_CHECK([SRTP_GET_VERSION], [srtp], [srtp_get_version_string], [srtp/srtp.h])
2786 fi
2787 fi
2788
2789 for ver in 3.0 2.6 2.4 2.2 2.0; do
2790 AST_PKG_CONFIG_CHECK([GMIME], gmime-$ver)
2791 if test "$PBX_GMIME" = 1; then
2792 break;
2793 fi
2794 done
2795
2796 AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
2797
2798 AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
2799
2800 AC_CHECK_LIB([tonezone], [tone_zone_find_by_num], tonezone_does_not_need_lm=yes, tonezone_does_not_need_lm=no)
2801
2802 if test "${tonezone_does_not_need_lm}" = "no" ; then
2803 tonezone_extra="-lm"
2804 fi
2805
2806 AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
2807
2808 AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -lvorbisfile])
2809 AST_C_DECLARE_CHECK([VORBIS_OPEN_CALLBACKS], [OV_CALLBACKS_NOCLOSE], [vorbis/vorbisfile.h])
2810
2811 AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
2812
2813 if test "x${PBX_UNIXODBC}" = "x1" -o "x${PBX_IODBC}" = "x1"; then
2814 # Does ODBC support wide characters?
2815 AC_MSG_CHECKING(whether ODBC has support for Unicode types)
2816 AC_LINK_IFELSE(
2817 [AC_LANG_PROGRAM(
2818 [#include <sql.h>
2819 #include <sqlext.h>],
2820 [int foo = SQL_WCHAR])],
2821 AC_MSG_RESULT(yes)
2822 AC_DEFINE([HAVE_ODBC_WCHAR], [1], [Define to 1 if your ODBC library has wide (Unicode) types.]),
2823 AC_MSG_RESULT(no)
2824 )
2825 fi
2826
2827 AC_CHECK_HEADER([linux/compiler.h],
2828 [AC_DEFINE_UNQUOTED([HAVE_LINUX_COMPILER_H], 1, [Define to 1 if your system has linux/compiler.h.])])
2829
2830
2831 AST_EXT_TOOL_CHECK([SDL], [sdl-config])
2832 AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL_image.h], [${SDL_LIB}], [${SDL_INCLUDE}])
2833
2834 PBX_FFMPEG=0
2835 AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
2836 if test ! "x${PKGCONFIG}" = xNo; then
2837 FFMPEG_INCLUDE=$(${PKGCONFIG} libavcodec libswscale --cflags 2>/dev/null)
2838 FFMPEG_LIB=$(${PKGCONFIG} libavcodec libswscale --libs)
2839 PBX_FFMPEG=1
2840 AC_DEFINE([HAVE_FFMPEG], 1, [Define if your system has the FFmpeg libraries.])
2841 fi
2842 AC_SUBST(PBX_FFMPEG)
2843 AC_SUBST(FFMPEG_INCLUDE)
2844 AC_SUBST(FFMPEG_LIB)
2845
2846 # possible places for video4linux version 1
2847 AC_CHECK_HEADER([linux/videodev.h],
2848 [AC_DEFINE_UNQUOTED([HAVE_VIDEODEV_H], 1, [Define to 1 if your system has linux/videodev.h.])])
2849
2850 # possible places for X11
2851 AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],,, [standard_path])
2852 AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],, [-I/usr/X11R6/include], [X11R6])
2853
2854 PBX_LAUNCHD=0
2855 if test "${cross_compiling}" = "no";
2856 then
2857 AC_CHECK_FILE(/sbin/launchd,
2858 [PBX_LAUNCHD=1]
2859 AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
2860 fi
2861 AC_SUBST(PBX_LAUNCHD)
2862
2863 AST_PKG_CONFIG_CHECK([GTK2], [gtk+-2.0])
2864
2865 # build a GENERIC_ODBC result based on the presence of either UnixODBC (preferred)
2866 # or iODBC
2867
2868 PBX_GENERIC_ODBC=0
2869
2870 if test "${PBX_UNIXODBC}" = 1; then
2871 PBX_GENERIC_ODBC=1
2872 GENERIC_ODBC_LIB="${UNIXODBC_LIB}"
2873 GENERIC_ODBC_INCLUDE="${UNIXODBC_INCLUDE}"
2874 elif test "${PBX_IODBC}" = 1; then
2875 PBX_GENERIC_ODBC=1
2876 GENERIC_ODBC_LIB="${IODBC_LIB}"
2877 GENERIC_ODBC_INCLUDE="${IODBC_INCLUDE}"
2878 fi
2879
2880 AC_SUBST([GENERIC_ODBC_LIB])
2881 AC_SUBST([GENERIC_ODBC_INCLUDE])
2882 AC_SUBST([PBX_GENERIC_ODBC])
2883
2884 AC_SUBST([PBX_SYSTEMD])
2885 AC_SUBST([SYSTEMD_LIB])
2886 AC_SUBST([SYSTEMD_INCLUDE])
2887 AST_PKG_CONFIG_CHECK([SYSTEMD], [libsystemd])
2888
2889 PBX_SYSLOG=0
2890
2891 if test "${ac_cv_header_syslog_h}" = "yes"; then
2892 # syslog facilities
2893 AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_AUTH], [LOG_AUTH], [syslog.h])
2894 AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_AUTHPRIV], [LOG_AUTHPRIV], [syslog.h])
2895 AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_CRON], [LOG_CRON], [syslog.h])
2896 AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_DAEMON], [LOG_DAEMON], [syslog.h])
2897 AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_FTP], [LOG_FTP], [syslog.h])
2898 AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_KERN], [LOG_KERN], [syslog.h])
2899 AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LPR], [LOG_LPR], [syslog.h])
2900 AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_MAIL], [LOG_MAIL], [syslog.h])
2901 AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_NEWS], [LOG_NEWS], [syslog.h])
2902 AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_SYSLOG], [LOG_SYSLOG], [syslog.h])
2903 AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_UUCP], [LOG_UUCP], [syslog.h])
2904 PBX_SYSLOG=1
2905 fi
2906
2907 AC_SUBST([PBX_SYSLOG])
2908
2909 if test -f makeopts; then
2910 ${ac_cv_path_EGREP} 'CURSES|GTK2|OSARCH|NEWT' makeopts > makeopts.acbak
2911 else
2912 touch makeopts.acbak
2913 fi
2914
2915 # conf_bridge (binaural rendering): check if HRIRs are available
2916 # this check does not work when cross-compiling
2917 if test "${cross_compiling}" = "no"; then
2918 AC_CHECK_FILES([bridges/bridge_softmix/include/hrirs.h])
2919 fi
2920
2921 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts])
2922 AST_CHECK_MANDATORY
2923
2924 if test -f build_tools/menuselect-deps; then
2925 # extract old values of all PBX_ variables from menuselect-deps
2926 # and preserve them so that menuselect can determine whether
2927 # any previously-met dependencies are no longer met and warn
2928 # the user appropriately
2929 while IFS="=:" read var val old_val; do
2930 eval "PBX_${var}=\${PBX_${var}}:${val}"
2931 done < build_tools/menuselect-deps
2932 fi
2933
2934 AC_OUTPUT
2935
2936 ${ac_cv_path_EGREP} 'CURSES|GTK2|OSARCH|NEWT' makeopts > makeopts.acbak2
2937 if test "${ac_cv_path_CMP}" = ":"; then
2938 ( cd "`pwd`/menuselect" && ./configure )
2939 elif ${ac_cv_path_CMP} -s makeopts.acbak makeopts.acbak2; then : ; else
2940 ( cd "`pwd`/menuselect" && ./configure )
2941 fi
2942
2943 rm makeopts.acbak makeopts.acbak2
2944
2945
2946 if test "x${silent}" != "xyes" ; then
2947 echo
2948 echo " .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=.. "
2949 echo " .\$7\$7.. .7\$\$7:. "
2950 echo " .\$\$:. ,\$7.7 "
2951 echo " .\$7. 7\$\$\$\$ .\$\$77 "
2952 echo " ..\$\$. \$\$\$\$\$ .\$\$\$7 "
2953 echo " ..7\$ .?. \$\$\$\$\$ .?. 7\$\$\$."
2954 echo " \$.\$. .\$\$\$7. \$\$\$\$7 .7\$\$\$. .\$\$\$."
2955 echo " .777. .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7. \$\$\$,"
2956 echo " \$\$\$~ .7\$\$\$\$\$\$\$\$\$\$\$\$\$7. .\$\$\$."
2957 echo ".\$\$7 .7\$\$\$\$\$\$\$7: ?\$\$\$."
2958 echo "\$\$\$ ?7\$\$\$\$\$\$\$\$\$\$I .\$\$\$7 "
2959 echo "\$\$\$ .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$ :\$\$\$. "
2960 echo "\$\$\$ \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$ .\$\$\$. "
2961 echo "\$\$\$ \$\$\$ 7\$\$\$7 .\$\$\$ .\$\$\$. "
2962 echo "\$\$\$\$ \$\$\$\$7 .\$\$\$. "
2963 echo "7\$\$\$7 7\$\$\$\$ 7\$\$\$ "
2964 echo " \$\$\$\$\$ \$\$\$ "
2965 echo " \$\$\$\$7. \$\$ (TM) "
2966 echo " \$\$\$\$\$\$\$. .7\$\$\$\$\$\$ \$\$ "
2967 echo " \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$ "
2968 echo " \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$. "
2969 echo
2970 fi
2971
2972 if test "x${AST_IODBC_FOUND}" = "xyes"; then
2973 echo "WARNING: iodbc libs/headers found!"
2974 echo
2975 echo " If you plan to use ODBC functionality, you should consider"
2976 echo " switching to unixodbc instead."
2977 echo " See: https://issues.asterisk.org/jira/browse/ASTERISK-22459"
2978 echo
2979 fi
2980
2981 AC_MSG_NOTICE(Package configured for: )
2982 AC_MSG_NOTICE( OS type : $host_os)
2983 AC_MSG_NOTICE( Host CPU : $host_cpu)
2984 AC_MSG_NOTICE( build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :)
2985 AC_MSG_NOTICE( host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :)
2986 if test "${cross_compiling}" = "yes"; then
2987 AC_MSG_NOTICE( Cross Compilation = YES)
2988 fi