Add ETSI Malicious Call ID support.
[asterisk/asterisk.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2 #
3 # Make sure we use autoconf 2.60 to generate the "configure" script,
4 # in case we want to commit it. Other than that, version 2.59 is
5 # perfectly fine for our purposes, so people who want to modify
6 # this file just have to remember to set the AC_PREREQ argument
7 # to something that suits their needs.
8
9 AC_PREREQ(2.60)
10
11 AC_INIT(asterisk, 1.6, www.asterisk.org)
12
13 # cross-compile macros
14 AC_CANONICAL_BUILD
15 AC_CANONICAL_HOST
16
17 # check existence of the package
18 AC_CONFIG_SRCDIR([main/asterisk.c])
19
20 AC_CONFIG_AUX_DIR(`pwd`)
21
22 AC_COPYRIGHT("Asterisk")
23 AC_REVISION($Revision$)
24
25 # preserve any CFLAGS or LDFLAGS that may be set
26 # NOTE: This must be done before calling any macros that end up
27 # calling AC_PROG_CC or the like, since they will set a default
28 # set of CFLAGS ("-g -O2") if the user did not supply any, and
29 # we don't want those default flags to be carried over into the
30 # rest of the build system since we have other means of controlling
31 # debugging symbol generation and optimization.
32 CONFIG_CFLAGS="${CFLAGS}"
33 CONFIG_LDFLAGS="${LDFLAGS}"
34 AC_SUBST(CONFIG_CFLAGS)
35 AC_SUBST(CONFIG_LDFLAGS)
36
37 # specify output header file
38 AC_CONFIG_HEADER(include/asterisk/autoconfig.h)
39
40 AC_USE_SYSTEM_EXTENSIONS        # note- does not work on FreeBSD
41
42 case "${host_os}" in
43      freebsd*)
44      ac_default_prefix=/usr/local
45      CPPFLAGS=-I/usr/local/include
46      LDFLAGS=-L/usr/local/lib
47      ;;
48      openbsd*)
49      ac_default_prefix=/usr/local
50      if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
51         if test ${sysconfdir} = '${prefix}/etc'; then
52            sysconfdir=/etc
53         fi
54         if test ${mandir} = '${prefix}/man'; then
55            mandir=/usr/share/man
56         fi
57      fi
58      CPPFLAGS=-I/usr/local/include
59      LDFLAGS=-L/usr/local/lib
60      ;;
61      darwin*)
62      AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.])
63      ;;
64      *)
65      ac_default_prefix=/usr
66      if test ${prefix} = '/usr' || test ${prefix} = 'NONE'; then
67         if test ${sysconfdir} = '${prefix}/etc'; then
68            sysconfdir=/etc
69         fi
70         if test ${mandir} = '${prefix}/man'; then
71            mandir=/usr/share/man
72         fi
73      fi
74      ;;
75 esac
76
77 if test ${prefix} = ${ac_default_prefix} || test ${prefix} = 'NONE'; then
78      if test ${localstatedir} = '${prefix}/var'; then
79         localstatedir=/var
80      fi
81 fi
82
83 BUILD_PLATFORM=${build}
84 BUILD_CPU=${build_cpu}
85 BUILD_VENDOR=${build_vendor}
86 BUILD_OS=${build_os}
87
88 AC_SUBST(BUILD_PLATFORM)
89 AC_SUBST(BUILD_CPU)
90 AC_SUBST(BUILD_VENDOR)
91 AC_SUBST(BUILD_OS)
92
93 HOST_PLATFORM=${host}
94 HOST_CPU=${host_cpu}
95 HOST_VENDOR=${host_vendor}
96 HOST_OS=${host_os}
97
98 AC_SUBST(HOST_PLATFORM)
99 AC_SUBST(HOST_CPU)
100 AC_SUBST(HOST_VENDOR)
101 AC_SUBST(HOST_OS)
102
103 PBX_WINARCH=0
104
105 case "${host_os}" in
106      freebsd*)
107      OSARCH=FreeBSD
108      ;;
109      netbsd*)
110      OSARCH=NetBSD
111      ;;
112      openbsd*)
113      OSARCH=OpenBSD
114      ;;
115      solaris*)
116      OSARCH=SunOS
117      ;;
118      mingw32)
119      OSARCH=mingw32
120      PBX_WINARCH=1
121      ;;
122      cygwin)
123      OSARCH=cygwin
124      PBX_WINARCH=1
125      ;;
126      linux-gnueabi)
127      OSARCH=linux-gnu
128      ;;
129      *)
130      OSARCH=${host_os}
131      ;;
132 esac
133
134 AC_SUBST(OSARCH)
135 AC_SUBST(PBX_WINARCH)
136
137 #  check for uname
138 AC_PATH_TOOL([UNAME], [uname], No)
139 if test ! x"${UNAME}" = xNo; then
140    PBX_OSREV=$(${UNAME} -r)
141 fi
142 AC_SUBST(PBX_OSREV)
143
144 AH_TOP(
145 #ifndef ASTERISK_AUTOCONFIG_H
146 #define ASTERISK_AUTOCONFIG_H
147
148 #include "asterisk/buildopts.h"
149
150 )
151
152 AH_BOTTOM(
153 #endif
154 )
155
156 # cross-compile checks
157 if test "${cross_compiling}" = "yes"; 
158 then
159    AC_CHECK_TOOL(CC, gcc, :)
160    AC_CHECK_TOOL(CXX, g++, :)
161    AC_CHECK_TOOL(LD, ld, :)
162    AC_CHECK_TOOL(RANLIB, ranlib, :)
163 fi
164
165 # Checks for programs.
166 AC_PROG_CC
167 AC_PROG_CXX
168 AC_PROG_CPP
169 AC_PROG_CXXCPP
170 # This macro is just copied into our local acinclude.m4 from libtool.m4 so that
171 # the developers regenerating the configure script don't have to install libtool.
172 AST_PROG_LD     # note, does not work on FreeBSD
173 AC_PROG_AWK
174 AC_PROG_INSTALL
175 AC_PROG_LN_S
176 AC_PROG_RANLIB
177 AST_CHECK_GNU_MAKE
178
179 AC_CHECK_TOOLS([STRIP], [strip gstrip], :)
180 AC_CHECK_TOOLS([AR], [ar gar], :)
181 AC_CHECK_TOOLS([SHA1SUM], [sha1sum], $ac_aux_dir/build_tools/sha1sum-sh)
182 AC_CHECK_TOOLS([OPENSSL], [openssl], :)
183
184 GNU_LD=0
185 if test "x$with_gnu_ld" = "xyes" ; then
186    GNU_LD=1
187 fi
188 AC_SUBST(GNU_LD)
189
190 AC_PATH_PROG([BISON], [bison], :)
191 AC_PATH_PROG([FLEX], [flex], :)
192 AC_PATH_PROG([GREP], [grep], :)
193 AC_PATH_PROG([FIND], [find], :)
194 AC_PATH_PROG([COMPRESS], [compress], :)
195 AC_PATH_PROG([BASENAME], [basename], :)
196 AC_PATH_PROG([DIRNAME], [dirname], :)
197 AC_PATH_PROG([SHELL], [sh], :)
198 AC_PATH_PROG([LN], [ln], :)
199 AC_PATH_PROG([DOT], [dot], :)
200 AC_PATH_PROG([WGET], [wget], :)
201 AC_PATH_PROG([CURL], [curl], :)
202 AC_PATH_PROG([RUBBER], [rubber], :)
203 AC_PATH_PROG([CATDVI], [catdvi], :)
204 AC_PATH_PROG([KPATHSEA], [kpsewhich], :)
205 AC_PATH_PROG([XMLSTARLET], [xmlstarlet], :)
206 if test "${WGET}" != ":" ; then
207   DOWNLOAD=${WGET}
208 else if test "${CURL}" != ":" ; then
209   DOWNLOAD="${CURL} -O --progress-bar -w \"%{url_effective}\n\""
210 else
211   AC_PATH_PROG([FETCH], [fetch], [:])
212   DOWNLOAD=${FETCH}
213 fi
214 fi
215 AC_SUBST(DOWNLOAD)
216
217 AC_CACHE_CHECK([for bison that supports parse-param], [ac_cv_path_BISON2], [
218         if test "x$BISON" != "x:" ; then
219                 # Create a temporary directory $tmp in $TMPDIR (default /tmp).
220                 # Use mktemp if possible; otherwise fall back on mkdir,
221                 # with $RANDOM to make collisions less likely.
222                 : ${TMPDIR=/tmp}
223                 {
224                   tmp=`
225                     (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
226                   ` &&
227                   test -n "$tmp" && test -d "$tmp"
228                 } || {
229                   tmp=$TMPDIR/foo$$-$RANDOM
230                   (umask 077 && mkdir "$tmp")
231                 } || exit $?
232                 cat >$tmp/test.y <<__EOL__
233 %parse-param {struct parse_io *parseio}
234 %%
235 file : { \$\$ = parseio->pval = 1; }
236         ;
237 %%
238 __EOL__
239                 ${BISON} -o ${tmp}/test.tab.c ${tmp}/test.y >/dev/null 2>&1
240                 if test -e "${tmp}/test.tab.c"; then
241                         ac_cv_path_BISON2=${BISON}
242                 fi
243                 rm -rf ${tmp}
244         fi
245         ])
246 if test "x${ac_cv_path_BISON2}" = "x" ; then
247         BISON=:
248         PBX_BISON=0
249 else
250         PBX_BISON=1
251 fi
252 AC_SUBST(PBX_BISON)
253 if test "x${FLEX}" = "x:" ; then
254         PBX_FLEX=0
255 else
256         PBX_FLEX=1
257 fi
258 AC_SUBST(PBX_FLEX)
259
260 AC_CHECK_TOOL([SOXMIX], [soxmix], [:])
261 if test "${SOXMIX}" != ":" ; then
262         AC_DEFINE([HAVE_SOXMIX], 1, [Define to 1 if your system has soxmix application.])
263 fi
264
265 AC_CHECK_PROGS([MD5], [md5 md5sum gmd5sum digest])
266
267 if test "${MD5}" = "digest" ; then
268    MD5="${MD5} -a md5"   
269 fi
270
271 ACX_PTHREAD
272
273 AC_LANG(C)
274
275 AC_ARG_ENABLE([dev-mode],
276         [AS_HELP_STRING([--enable-dev-mode],
277                 [Turn on developer mode])],
278         [case "${enableval}" in
279               y|ye|yes) AST_DEVMODE=yes ;;
280               n|no)  AST_DEVMODE=no ;;
281               noisy)
282               AST_DEVMODE=yes
283               NOISY_BUILD=yes
284               ;;
285               *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode)  ;;
286         esac])
287 AC_SUBST(NOISY_BUILD)
288 AC_SUBST(AST_DEVMODE)
289
290 # AST_EXT_LIB_SETUP is used to tell configure to handle variables for
291 # various packages.
292 # $1 is the prefix for the variables in makeopts and autoconfig.h
293 # $2 is the short comment, $4 is the long comment
294 # $3 is the name used in --with- or --without- flags for configure.
295 #
296 # Package option names should be in alphabetical order
297 # by the --with option name (the third field),
298 # to make things easier for the users.
299
300 AST_EXT_LIB_SETUP([ALSA], [Advanced Linux Sound Architecture], [asound])
301
302 # BKTR is used for backtrace support on platforms that do not
303 # have it natively.
304 AST_EXT_LIB_SETUP([BKTR], [Stack Backtrace], [execinfo])
305 AST_EXT_LIB_SETUP([BLUETOOTH], [Bluetooth], [bluetooth])
306 AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capabilities], [cap])
307 AST_EXT_LIB_SETUP([CURL], [cURL], [curl])
308 AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
309 AST_EXT_LIB_SETUP([CRYPTO], [OpenSSL Cryptography], [crypto])
310 AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
311 AST_EXT_LIB_SETUP([FFMPEG], [Ffmpeg and avcodec], [avcodec])
312 AST_EXT_LIB_SETUP([GSM], [External GSM], [gsm], [, use 'internal' GSM otherwise])
313 AST_EXT_LIB_SETUP([GTK2], [gtk2], [gtk2])
314 AST_EXT_LIB_SETUP([GMIME], [GMime], [gmime])
315 AST_EXT_LIB_SETUP([HOARD], [Hoard Memory Allocator], [hoard])
316 AST_EXT_LIB_SETUP([ICAL], [iCal], [ical])
317 AST_EXT_LIB_SETUP([ICONV], [Iconv], [iconv])
318 AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber], [iksemel])
319 AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
320 AST_EXT_LIB_SETUP([INOTIFY], [inotify support], [inotify])
321 AST_EXT_LIB_SETUP([IODBC], [iODBC], [iodbc])
322 AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux], [isdnnet])
323 AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
324 AST_EXT_LIB_SETUP([KQUEUE], [kqueue support], [kqueue])
325 AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
326 AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
327 AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl])
328 AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
329 AST_EXT_LIB_SETUP([MISDN], [mISDN user], [misdn])
330 AST_EXT_LIB_SETUP([MYSQLCLIENT], [MySQL client], [mysqlclient])
331 AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs])
332 AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
333 AST_EXT_LIB_SETUP([NEON], [neon], [neon])
334 AST_EXT_LIB_SETUP([NEON29], [neon29], [neon29])
335 AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
336 AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
337 AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
338 AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
339 AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
340 AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
341 AST_EXT_LIB_SETUP([POPT], [popt], [popt])
342 AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
343 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
344 AST_EXT_LIB_SETUP_DEPENDENT([PRI_MCID], [ISDN PRI Malicious Call ID], [PRI], [pri])
345 AST_EXT_LIB_SETUP_DEPENDENT([PRI_CALL_WAITING], [ISDN PRI call waiting supplementary service], [PRI], [pri])
346 AST_EXT_LIB_SETUP_DEPENDENT([PRI_AOC_EVENTS], [ISDN PRI advice of charge supplementary service events], [PRI], [pri])
347 AST_EXT_LIB_SETUP_DEPENDENT([PRI_TRANSFER], [ISDN PRI call transfer supplementary service], [PRI], [pri])
348 AST_EXT_LIB_SETUP_DEPENDENT([PRI_CCSS], [ISDN PRI call completion supplementary service], [PRI], [pri])
349 AST_EXT_LIB_SETUP_DEPENDENT([PRI_HANGUP_FIX], [ISDN PRI hangup fix], [PRI], [pri])
350 AST_EXT_LIB_SETUP_DEPENDENT([PRI_SUBADDR], [ISDN PRI subaddressing], [PRI], [pri])
351 AST_EXT_LIB_SETUP_DEPENDENT([PRI_CALL_HOLD], [ISDN PRI call hold], [PRI], [pri])
352 AST_EXT_LIB_SETUP_DEPENDENT([PRI_CALL_REROUTING], [ISDN PRI call rerouting and call deflection], [PRI], [pri])
353 AST_EXT_LIB_SETUP_DEPENDENT([PRI_SETUP_KEYPAD], [ISDN PRI keypad facility in SETUP], [PRI], [pri])
354 # ------------------------------------v
355 # TODO: The code can be changed to always include these features now.
356 # These features will always be present if pri_connected_line_update is available.
357 AST_EXT_LIB_SETUP_DEPENDENT([PRI_INBANDDISCONNECT], [ISDN PRI set_inbanddisconnect], [PRI], [pri])
358 AST_EXT_LIB_SETUP_DEPENDENT([PRI_PROG_W_CAUSE], [ISDN progress with cause], [PRI], [pri])
359 AST_EXT_LIB_SETUP_DEPENDENT([PRI_SERVICE_MESSAGES], [ISDN service messages], [PRI], [pri])
360 AST_EXT_LIB_SETUP_DEPENDENT([PRI_REVERSE_CHARGE], [ISDN reverse charge], [PRI], [pri])
361 # ------------------------------------^
362 AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
363 AST_OPTION_ONLY([sounds-cache], [SOUNDS_CACHE_DIR], [cached sound tarfiles], [${HOME}/.asterisk_sounds_cache])
364 AST_EXT_LIB_SETUP([SPANDSP], [SPANDSP], [spandsp])
365 AST_EXT_LIB_SETUP([SS7], [ISDN SS7], [ss7])
366 AST_EXT_LIB_SETUP([OPENR2], [MFR2], [openr2])
367 AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
368 AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323])
369 AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
370 AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
371 AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image], [SDL_image])
372 AST_EXT_LIB_SETUP([OPENAIS], [OpenAIS], [openais])
373 AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
374 AST_EXT_LIB_SETUP([SPEEX_PREPROCESS], [Speex preprocess routines], [speex])
375 AST_EXT_LIB_SETUP([SPEEXDSP], [SpeexDSP], [speexdsp])
376 AST_EXT_LIB_SETUP_DEPENDENT([SPEEX_PREPROCESS], [speex_preprocess_ctl], [], [speex])
377 AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
378 AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
379 AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
380 AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer], [ssl])
381 AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
382 AST_EXT_LIB_SETUP([TERMCAP], [Termcap], [termcap])
383 AST_EXT_LIB_SETUP([TINFO], [Term Info], [tinfo])
384 AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
385 AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [unixodbc])
386 AST_EXT_LIB_SETUP([USB], [usb], [usb])
387 AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
388 AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
389 AST_EXT_LIB_SETUP([X11], [X11], [x11])
390 AST_EXT_LIB_SETUP([ZLIB], [zlib compression], [z])
391 AST_EXT_LIB_SETUP([TIMERFD], [timerfd], [timerfd])
392
393 # check for basic system features and functionality before
394 # checking for package libraries
395
396 AC_FUNC_ALLOCA
397 AC_HEADER_DIRENT
398 AC_HEADER_STDC
399 AC_HEADER_SYS_WAIT
400 AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/event.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h arpa/nameser.h sys/io.h])
401
402 AC_CHECK_HEADERS([winsock.h winsock2.h])
403
404 AC_CHECK_HEADER([sys/poll.h],
405          [],
406      AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.]))
407
408 AC_SYS_LARGEFILE
409
410 # Checks for typedefs, structures, and compiler characteristics.
411 AC_HEADER_STDBOOL
412 AC_C_CONST
413 AC_TYPE_UID_T
414 AC_C_INLINE
415 AC_TYPE_LONG_DOUBLE_WIDER
416 AC_TYPE_MODE_T
417 AC_TYPE_OFF_T
418 AC_TYPE_PID_T
419 AC_TYPE_SIZE_T
420 AC_CHECK_MEMBERS([struct stat.st_blksize])
421 AC_HEADER_TIME
422 AC_STRUCT_TM
423 AC_C_VOLATILE
424 AC_CHECK_TYPES([ptrdiff_t])
425
426 # Checks for library functions.
427 AC_FUNC_CHOWN
428 AC_FUNC_CLOSEDIR_VOID
429 AC_FUNC_ERROR_AT_LINE
430 AST_FUNC_FORK
431 AC_FUNC_FSEEKO
432 AC_PROG_GCC_TRADITIONAL
433 # XXX: these are commented out until we determine whether it matters if our malloc()
434 # acts exactly like glibc's or not
435 # AC_FUNC_MALLOC
436 # AC_FUNC_REALLOC
437 AC_FUNC_MEMCMP
438 AC_FUNC_MMAP
439 AC_FUNC_SELECT_ARGTYPES
440 AC_FUNC_SETVBUF_REVERSED
441 AC_TYPE_SIGNAL
442 AC_FUNC_STAT
443 AC_FUNC_STRCOLL
444 AC_FUNC_STRFTIME
445 AC_FUNC_STRNLEN
446 AC_FUNC_STRTOD
447 AC_FUNC_UTIME_NULL
448 AC_FUNC_VPRINTF
449 AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll newlocale 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 utime vasprintf getpeereid sysctl swapctl])
450
451 # NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
452 # so that AC_CHECK_FUNCS can detect functions in that library.
453 AC_CHECK_LIB([m], [sqrt])
454 # BSD might not have exp2, and/or log2
455 AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round trunc floor ceil])
456
457 # Certain architectures don't really have long double, even though
458 # AC_CHECK_FUNCS would otherwise find the following functions.
459 if test "x${ac_cv_type_long_double_wider}" = "xyes" ; then
460         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])
461 fi
462
463 AC_MSG_CHECKING(for timersub in time.h)
464 AC_LINK_IFELSE(
465         AC_LANG_PROGRAM([#include <sys/time.h>],
466                 [struct timeval *a; timersub(a, a, a);]),
467         AC_MSG_RESULT(yes)
468                 AC_DEFINE([HAVE_TIMERSUB], 1, [Define to 1 if your system defines timersub.]),
469         AC_MSG_RESULT(no)
470 )
471
472 AC_CHECK_HEADER([sys/poll.h], 
473    [HAS_POLL=1]
474    AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]),
475    )
476
477 AC_ARG_ENABLE([internal-poll],
478         [AS_HELP_STRING([--enable-internal-poll],
479                 [Use Asterisk's poll implementation])],
480         [case "${enableval}" in
481                 y|ye|yes) HAS_POLL="";;
482                 n|no) HAS_POLL="${HAS_POLL}" ;;
483                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-internal-poll) ;;
484         esac])
485 AC_SUBST(HAS_POLL)
486
487
488
489 # https support (in main/http.c) uses funopen on BSD systems,
490 # fopencookie on linux
491 AC_CHECK_FUNCS([funopen fopencookie])
492
493 AC_CHECK_FUNCS([inet_aton])
494
495 # check if we have IP_PKTINFO constant defined
496 AC_MSG_CHECKING(for IP_PKTINFO)
497 AC_LINK_IFELSE(
498                 AC_LANG_PROGRAM([#include <netinet/in.h>],
499                                                 [int pi = IP_PKTINFO;]),
500                 AC_MSG_RESULT(yes)
501                 AC_DEFINE([HAVE_PKTINFO], 1, [Define to 1 if your system defines IP_PKTINFO.]),
502                 AC_MSG_RESULT(no)
503 )
504
505 # some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
506 AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])
507
508 AC_MSG_CHECKING(for gethostbyname_r with 6 arguments)
509 AC_LINK_IFELSE(
510         AC_LANG_PROGRAM([#include <stdlib.h>
511                          #include <netdb.h>],
512                         [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);]),
513         AC_MSG_RESULT(yes)
514         AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]),
515         AC_MSG_RESULT(no)
516 )
517
518 AC_MSG_CHECKING(for gethostbyname_r with 5 arguments)
519 AC_LINK_IFELSE(
520         AC_LANG_PROGRAM([#include <stdlib.h>
521                          #include <netdb.h>],
522                         [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);]),
523         AC_MSG_RESULT(yes)
524         AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]),
525         AC_MSG_RESULT(no)
526 )
527
528 AC_CHECK_HEADER([byteswap.h], [AC_DEFINE_UNQUOTED([HAVE_BYTESWAP_H], 1, [Define to 1 if byteswap.h macros are available.])])
529
530 AC_MSG_CHECKING(for __swap16 variant of <sys/endian.h> byteswapping macros)
531 AC_LINK_IFELSE(
532 AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = __swap16(a);]),
533 AC_MSG_RESULT(yes)
534 AC_DEFINE([HAVE_SYS_ENDIAN_SWAP16], 1, [Define to 1 if your sys/endian.h header file provides the __swap16 macro.]),
535 AC_MSG_RESULT(no)
536 )
537
538 AC_MSG_CHECKING(for bswap16 variant of <sys/endian.h> byteswapping macros)
539 AC_LINK_IFELSE(
540 AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = bswap16(a);]),
541 AC_MSG_RESULT(yes)
542 AC_DEFINE([HAVE_SYS_ENDIAN_BSWAP16], 1, [Define to 1 if your sys/endian.h header file provides the bswap16 macro.]),
543 AC_MSG_RESULT(no)
544 )
545
546 if test "${cross_compiling}" = "no";
547 then
548   AC_CHECK_FILE(/dev/urandom, AC_DEFINE([HAVE_DEV_URANDOM], 1, [Define to 1 if your system has /dev/urandom.]))
549 fi
550
551 AC_MSG_CHECKING(for O_EVTONLY in fcntl.h)
552 AC_LINK_IFELSE(
553 AC_LANG_PROGRAM([#include <fcntl.h>], [int a = O_EVTONLY;]),
554 AC_MSG_RESULT(yes)
555 AC_DEFINE([HAVE_O_EVTONLY], 1, [Define to 1 if your system defines the file flag O_EVTONLY in fcntl.h]),
556 AC_MSG_RESULT(no)
557 )
558
559 AC_MSG_CHECKING(for O_SYMLINK in fcntl.h)
560 AC_LINK_IFELSE(
561 AC_LANG_PROGRAM([#include <fcntl.h>], [int a = O_SYMLINK;]),
562 AC_MSG_RESULT(yes)
563 AC_DEFINE([HAVE_O_SYMLINK], 1, [Define to 1 if your system defines the file flag O_SYMLINK in fcntl.h]),
564 AC_MSG_RESULT(no)
565 )
566
567 AST_C_DEFINE_CHECK([PTHREAD_RWLOCK_INITIALIZER], [PTHREAD_RWLOCK_INITIALIZER], [pthread.h])
568
569 AC_MSG_CHECKING(for PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h)
570 AC_LINK_IFELSE(
571 AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_RWLOCK_PREFER_WRITER_NP;]),
572 AC_MSG_RESULT(yes)
573 AC_DEFINE([HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP], 1, [Define to 1 if your system defines PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h]),
574 AC_MSG_RESULT(no)
575 )
576
577 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h)
578 AC_LINK_IFELSE(
579 AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_MUTEX_RECURSIVE_NP;]),
580 AC_MSG_RESULT(yes)
581 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1, [Define to 1 if your system defines PTHREAD_MUTEX_RECURSIVE_NP in pthread.h]),
582 AC_MSG_RESULT(no)
583 )
584
585 AC_MSG_CHECKING(for pthread_rwlock_timedwrlock() in pthread.h)
586 save_LIBS="$LIBS"
587 save_CFLAGS="$CFLAGS"
588 LIBS="$PTHREAD_LIBS $LIBS"
589 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
590 AC_LINK_IFELSE(
591   [AC_LANG_PROGRAM(
592     [#include <pthread.h>
593      #include <time.h>],
594     [pthread_rwlock_t foo; struct timespec bar; pthread_rwlock_timedwrlock(&foo, &bar)])
595   ],[
596     AC_MSG_RESULT(yes)
597     ac_cv_pthread_rwlock_timedwrlock="yes"
598   ],[
599     AC_MSG_RESULT(no)
600     ac_cv_pthread_rwlock_timedwrlock="no"
601   ]
602 )
603 LIBS="$save_LIBS"
604 CFLAGS="$save_CFLAGS"
605 if test "${ac_cv_pthread_rwlock_timedwrlock}" = "yes"; then
606   AC_DEFINE([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK], 1, [Define if your system has pthread_rwlock_timedwrlock()])
607 fi
608
609 AC_MSG_CHECKING(if PTHREAD_ONCE_INIT needs braces)
610 saved_CFLAGS="${CFLAGS}"
611 CFLAGS="${CFLAGS} -Werror -Wmissing-braces"
612 AC_COMPILE_IFELSE(
613   [AC_LANG_PROGRAM(
614     [#include <pthread.h>
615      void empty(){}],
616         [pthread_once_t once = PTHREAD_ONCE_INIT; pthread_once(&once, empty);])
617   ],[
618     AC_MSG_RESULT(no)
619     ac_cv_pthread_once_needsbraces="no"
620   ],[
621     AC_MSG_RESULT(yes)
622     ac_cv_pthread_once_needsbraces="yes"
623   ]
624 )
625 CFLAGS="${saved_CFLAGS}"
626 if test "${ac_cv_pthread_once_needsbraces}" = "yes"; then
627   AC_DEFINE([PTHREAD_ONCE_INIT_NEEDS_BRACES], 1, [Define if your system needs braces around PTHREAD_ONCE_INIT])
628 fi
629
630 AST_C_DEFINE_CHECK([PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [pthread.h])
631
632 # Can we compare a mutex to its initial value?
633 # Generally yes on OpenBSD/FreeBSD and no on Mac OS X.
634 AC_MSG_CHECKING(whether we can compare a mutex to its initial value)
635 AC_LINK_IFELSE(
636         AC_LANG_PROGRAM([#include <pthread.h>], [pthread_mutex_t lock;
637         if ((lock) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
638                 return 0;
639         }
640         return 0]),
641         AC_MSG_RESULT(yes)
642         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.]),
643         AC_MSG_RESULT(no)
644 )
645
646 #if test "${cross_compiling}" = "no";
647 #then
648 #AC_MSG_CHECKING(for working epoll support)
649 #AC_LINK_IFELSE(
650 #AC_LANG_PROGRAM([#include <sys/epoll.h>], [int res = epoll_create(10);
651 #                                         if (res < 0)
652 #                                            return 1;
653 #                                         close (res);
654 #                                         return 0;]),
655 #AC_MSG_RESULT(yes)
656 #AC_DEFINE([HAVE_EPOLL], 1, [Define to 1 if your system has working epoll support.]),
657 #AC_MSG_RESULT(no)
658 #)
659 #fi
660
661 AC_MSG_CHECKING(for compiler atomic operations)
662 AC_LINK_IFELSE(
663 AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);]),
664 AC_MSG_RESULT(yes)
665 AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides atomic operations.]),
666 AC_MSG_RESULT(no)
667 )
668
669 # glibc, AFAIK, is the only C library that makes printing a NULL to a string safe.
670 AC_MSG_CHECKING([if your system printf is NULL-safe.])
671 AC_RUN_IFELSE(
672         AC_LANG_PROGRAM([#include <stdio.h>],
673                 [printf("%s", NULL)]),
674         AC_DEFINE([HAVE_NULLSAFE_PRINTF], 1, [Define to 1 if your C library can safely print NULL to string formats.])
675         AC_MSG_RESULT(yes),
676         AC_MSG_RESULT(no),
677         # It's unlikely an embedded system will have this.
678         AC_MSG_RESULT(unknown)
679 )
680
681 AST_GCC_ATTRIBUTE(pure)
682 AST_GCC_ATTRIBUTE(malloc)
683 AST_GCC_ATTRIBUTE(const)
684 AST_GCC_ATTRIBUTE(unused)
685 AST_GCC_ATTRIBUTE(always_inline)
686 AST_GCC_ATTRIBUTE(deprecated)
687 AST_GCC_ATTRIBUTE(sentinel)
688 AST_GCC_ATTRIBUTE(warn_unused_result)
689 AST_GCC_ATTRIBUTE(weakref, [weakref("foo")], static)
690 AST_GCC_ATTRIBUTE(weak_import)
691
692 AC_MSG_CHECKING(for -ffunction-sections support)
693 saved_CFLAGS="${CFLAGS}"
694 CFLAGS="${CFLAGS} -ffunction-sections"
695 AC_COMPILE_IFELSE(
696         AC_LANG_PROGRAM([], [int x = 1;]),
697         AC_MSG_RESULT(yes)
698         [saved_LDFLAGS="${LDFLAGS}"]
699         [LDFLAGS="${LDFLAGS} -Wl,--gc-sections"]
700         AC_MSG_CHECKING(for --gc-sections support)
701         AC_LINK_IFELSE(
702                 AC_LANG_PROGRAM([], [int x = 1;]),
703                 AC_MSG_RESULT(yes)
704                 [GC_CFLAGS="-ffunction-sections"]
705                 [[GC_LDFLAGS="-Wl,--gc-sections"]],
706                 AC_MSG_RESULT(no)
707         )
708         [LDFLAGS="${saved_LDFLAGS}"],
709         AC_MSG_RESULT(no)
710 )
711 CFLAGS="${saved_CFLAGS}"
712 AC_SUBST(GC_CFLAGS)
713 AC_SUBST(GC_LDFLAGS)
714
715 AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
716 if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
717         AC_MSG_RESULT(yes)
718         AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
719 else
720         AC_MSG_RESULT(no)
721         AST_DECLARATION_AFTER_STATEMENT=
722 fi
723 AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
724
725 AC_MSG_CHECKING(for _FORTIFY_SOURCE support)
726 if $(${CC} -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
727         AC_MSG_RESULT(yes)
728         AST_FORTIFY_SOURCE=-D_FORTIFY_SOURCE=2
729 else
730         AC_MSG_RESULT(no)
731         AST_FORTIFY_SOURCE=
732 fi
733 AC_SUBST(AST_FORTIFY_SOURCE)
734
735 AC_MSG_CHECKING(for -fno-strict-overflow)
736 if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
737         AC_MSG_RESULT(yes)
738         AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
739 else
740         AC_MSG_RESULT(no)
741         AST_NO_STRICT_OVERFLOW=
742 fi
743 AC_SUBST(AST_NO_STRICT_OVERFLOW)
744
745 AC_MSG_CHECKING(for -Wshadow)
746 if $(${CC} -Wshadow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
747         AC_MSG_RESULT(yes)
748         AST_SHADOW_WARNINGS=-Wshadow
749 else
750         AC_MSG_RESULT(no)
751         AST_SHADOW_WARNINGS=
752 fi
753 AC_SUBST(AST_SHADOW_WARNINGS)
754
755 AC_MSG_CHECKING(for sysinfo)
756 AC_LINK_IFELSE(
757         AC_LANG_PROGRAM([#include <sys/sysinfo.h>],
758                         [struct sysinfo sys_info; int uptime = sys_info.uptime]),
759         AC_MSG_RESULT(yes)
760         AC_DEFINE([HAVE_SYSINFO], 1, [Define to 1 if your system has sysinfo support]),
761         AC_MSG_RESULT(no)
762 )
763
764 AC_SEARCH_LIBS(res_9_ninit, resolv)
765 AC_MSG_CHECKING(for res_ninit)
766 AC_LINK_IFELSE(
767         AC_LANG_PROGRAM([
768                         #ifdef HAVE_SYS_SOCKET_H
769                         #include <sys/socket.h>
770                         #endif
771                         #ifdef HAVE_NETINET_IN_H
772                         #include <netinet/in.h>
773                         #endif
774                         #ifdef HAVE_ARPA_NAMESER_H
775                         #include <arpa/nameser.h>
776                         #endif
777                         #include <resolv.h>],
778                         [int foo = res_ninit(NULL);]),
779         AC_MSG_RESULT(yes)
780         AC_DEFINE([HAVE_RES_NINIT], 1, [Define to 1 if your system has the re-entrant resolver functions.])
781         AC_SEARCH_LIBS(res_9_ndestroy, resolv)
782         AC_MSG_CHECKING(for res_ndestroy)
783         AC_LINK_IFELSE(
784                 AC_LANG_PROGRAM([
785                                 #ifdef HAVE_SYS_SOCKET_H
786                                 #include <sys/socket.h>
787                                 #endif
788                                 #ifdef HAVE_NETINET_IN_H
789                                 #include <netinet/in.h>
790                                 #endif
791                                 #ifdef HAVE_ARPA_NAMESER_H
792                                 #include <arpa/nameser.h>
793                                 #endif
794                                 #include <resolv.h>],
795                                 [res_ndestroy(NULL);]),
796                 AC_MSG_RESULT(yes)
797                 AC_DEFINE([HAVE_RES_NDESTROY], 1, [Define to 1 if your system has the ndestroy resolver function.]),
798                 AC_MSG_RESULT(no)
799         )
800         AC_SEARCH_LIBS(res_9_close, resolv)
801         AC_MSG_CHECKING(for res_close)
802         AC_LINK_IFELSE(
803                 AC_LANG_PROGRAM([
804                                 #ifdef HAVE_SYS_SOCKET_H
805                                 #include <sys/socket.h>
806                                 #endif
807                                 #ifdef HAVE_NETINET_IN_H
808                                 #include <netinet/in.h>
809                                 #endif
810                                 #ifdef HAVE_ARPA_NAMESER_H
811                                 #include <arpa/nameser.h>
812                                 #endif
813                                 #include <resolv.h>],
814                                 [res_close();]),
815                 AC_MSG_RESULT(yes)
816                 AC_DEFINE([HAVE_RES_CLOSE], 1, [Define to 1 if your system has the close resolver function.]),
817                 AC_MSG_RESULT(no)
818         ),
819         AC_MSG_RESULT(no)
820 )
821
822 AST_C_DEFINE_CHECK([GLOB_NOMAGIC], [GLOB_NOMAGIC], [glob.h])
823
824 AST_C_DEFINE_CHECK([GLOB_BRACE], [GLOB_BRACE], [glob.h])
825
826 AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [IP_MTU_DISCOVER], [netinet/in.h])
827
828 AC_CHECK_HEADER([libkern/OSAtomic.h],
829                 [AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
830
831 AC_CHECK_SIZEOF([int])
832 AC_CHECK_SIZEOF([long])
833 AC_CHECK_SIZEOF([long long])
834 AC_CHECK_SIZEOF([char *])
835
836 # do the package library checks now
837
838 AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
839
840 AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
841
842 if test "x${OSARCH}" = "xlinux-gnu" ; then
843   AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
844 fi
845
846 AST_C_DEFINE_CHECK([DAHDI], [DAHDI_RESET_COUNTERS], [dahdi/user.h], [230])
847 AST_C_DEFINE_CHECK([DAHDI], [DAHDI_DEFAULT_MTU_MRU], [dahdi/user.h], [220])
848 AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h], [200])
849
850 AST_C_DEFINE_CHECK([DAHDI_HALF_FULL], [DAHDI_POLICY_HALF_FULL], [dahdi/user.h])
851
852 AST_C_COMPILE_CHECK([DAHDI_LINEREVERSE_VMWI], [struct dahdi_vmwi_info booger], [dahdi/user.h], , [enhanced dahdi vmwi support])
853
854 AST_C_COMPILE_CHECK([DAHDI_ECHOCANCEL_FAX_MODE], [int foo = DAHDI_ECHOCANCEL_FAX_MODE], [dahdi/user.h])
855
856 AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h], , [getifaddrs() support])
857 AST_C_COMPILE_CHECK([TIMERFD], [timerfd_create(0,0); timerfd_settime(0,0,NULL,NULL);], [sys/timerfd.h], , [timerfd support])
858
859 GSM_INTERNAL="yes"
860 AC_SUBST(GSM_INTERNAL)
861 GSM_SYSTEM="yes"
862 if test "${USE_GSM}" != "no"; then
863    if test "${GSM_DIR}" = "internal"; then
864       GSM_SYSTEM="no"
865    elif test "${GSM_DIR}" != ""; then
866       GSM_INTERNAL="no"
867    fi
868    if test "${GSM_SYSTEM}" = "yes"; then
869       gsmlibdir=""
870       if test "x${GSM_DIR}" != "x"; then
871          if test -d ${GSM_DIR}/lib; then
872             gsmlibdir="-L${GSM_DIR}/lib"
873          else
874             gsmlibdir="-L${GSM_DIR}"
875          fi
876       fi
877       AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
878       [Define to indicate the GSM library]), [], ${gsmlibdir})
879       if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
880          if test "x${GSM_DIR}" != "x" ; then
881             AC_CHECK_HEADER([${GSM_DIR}/include/gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
882             AC_CHECK_HEADER([${GSM_DIR}/include/gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
883          else
884             AC_CHECK_HEADER([gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
885             AC_CHECK_HEADER([gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
886          fi
887          if test "${GSM_HEADER_FOUND}" = "0" ; then
888             if test "{GSM_GSM_HEADER_FOUND}" = "0" ; then
889                if test "x${GSM_MANDATORY}" = "xyes" ; then
890                   AC_MSG_NOTICE([***])
891                   AC_MSG_NOTICE([*** It appears that you do not have the gsm development package installed.])
892                   AC_MSG_NOTICE([*** Please install it to include ${GSM_DESCRIP} support, or re-run configure])
893                   AC_MSG_NOTICE([*** without explicitly specifying --with-${GSM_OPTION}])
894                   exit 1
895                fi
896             fi
897          fi
898          GSM_OK=0
899          if test "${GSM_HEADER_FOUND}" = "1" ; then
900             AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
901             GSM_OK=1
902          else
903             if test "${GSM_GSM_HEADER_FOUND}" = "1" ; then
904                AC_DEFINE_UNQUOTED([HAVE_GSM_GSM_HEADER], 1, [Define to indicate that gsm.h is in gsm/gsm.h])
905                GSM_OK=1
906             fi
907          fi
908          if test "${GSM_OK}" = "1" ; then
909             GSM_LIB="-lgsm"
910             if test "x${GSM_DIR}" != "x"; then
911                GSM_LIB="${gsmlibdir} ${GSM_LIB}"
912                GSM_INCLUDE="-I${GSM_DIR}/include"
913             fi
914             PBX_GSM=1
915             GSM_INTERNAL="no"
916          fi
917       fi
918    fi
919    if test "${GSM_INTERNAL}" = "yes"; then
920       PBX_GSM=1
921       AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
922    fi
923 fi
924
925 AST_EXT_LIB_CHECK([ICONV], [iconv], [iconv_open], [iconv.h])
926 # Some versions of Linux package iconv in glibc
927 AST_EXT_LIB_CHECK([ICONV], [c], [iconv_close], [iconv.h])
928
929 # Some distributions (like RedHat) add a libical subdirectory for the headers
930 AST_EXT_LIB_CHECK([ICAL], [ical], [icaltimezone_get_utc_timezone], [libical/ical.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
931
932 AST_EXT_LIB_CHECK([ICAL], [ical], [icaltimezone_new], [ical.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
933
934 AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h])
935
936 if test "${USE_IMAP_TK}" != "no"; then
937         saved_cppflags="${CPPFLAGS}"
938         saved_libs="${LIBS}"
939         switch_to_system_on_failure="no"
940         if test "${IMAP_TK_DIR}" = ""; then
941                 IMAP_TK_DIR=`pwd`"/../imap-2004g"
942                 switch_to_system_on_failure="yes"
943         fi
944         if test "${IMAP_TK_DIR}" != "system"; then
945                 AC_MSG_CHECKING(for UW IMAP Toolkit c-client library)
946                 if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then
947                 imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
948                 fi
949                 imap_libs="${IMAP_TK_DIR}/c-client/c-client.a"
950                 imap_include="-I${IMAP_TK_DIR}/c-client"
951         CPPFLAGS="${CPPFLAGS} ${imap_include}"
952                 LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
953                 AC_LINK_IFELSE(
954                 AC_LANG_PROGRAM(
955                                 [#include "c-client.h"
956                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
957                                 {
958                                 }
959                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
960                                 {
961                                 }
962                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
963                                 {
964                                 }
965                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
966                                 {
967                                 }
968                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
969                                 {
970                                 }
971                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
972                                 {
973                                 }
974                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
975                                 {
976                                 }
977                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
978                                 {
979                                 }
980                                 void mm_log (char *string,long errflg)
981                                 {
982                                 }
983                                 void mm_dlog (char *string)
984                                 {
985                                 }
986                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
987                                 {
988                                 }
989                                 void mm_critical (MAILSTREAM *stream)
990                                 {
991                                 }
992                                 void mm_nocritical (MAILSTREAM *stream)
993                                 {
994                                 }
995                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
996                                 {
997                                 }
998                                 void mm_fatal (char *string)
999                                 {
1000                                 }],
1001                                 [
1002                                 MAILSTREAM *foo = mail_open(NULL, "", 0);
1003                                 ]
1004                         ),
1005                         [ac_cv_imap_tk="yes"],
1006                         [ac_cv_imap_tk="no"]
1007                 )
1008                 if test "${ac_cv_imap_tk}" = "yes"; then
1009                         AC_LINK_IFELSE(
1010                                 AC_LANG_PROGRAM(
1011                                         [#include "c-client.h"
1012                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
1013                                         {
1014                                         }
1015                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
1016                                         {
1017                                         }
1018                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
1019                                         {
1020                                         }
1021                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
1022                                         {
1023                                         }
1024                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1025                                         {
1026                                         }
1027                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1028                                         {
1029                                         }
1030                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1031                                         {
1032                                         }
1033                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1034                                         {
1035                                         }
1036                                         void mm_log (char *string,long errflg)
1037                                         {
1038                                         }
1039                                         void mm_dlog (char *string)
1040                                         {
1041                                         }
1042                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1043                                         {
1044                                         }
1045                                         void mm_critical (MAILSTREAM *stream)
1046                                         {
1047                                         }
1048                                         void mm_nocritical (MAILSTREAM *stream)
1049                                         {
1050                                         }
1051                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1052                                         {
1053                                         }
1054                                         void mm_fatal (char *string)
1055                                         {
1056                                         }],
1057                                         [
1058                                         long check = mail_expunge_full(NULL, "", 0);
1059                                         ]
1060                                 ),
1061                                 [ac_cv_imap_tk2006="yes"],
1062                                 [ac_cv_imap_tk2006="no"]
1063                         )
1064                 fi
1065                 CPPFLAGS="${saved_cppflags}"
1066                 LIBS="${saved_libs}"
1067                 if test "${ac_cv_imap_tk}" = "no"; then
1068                         AC_MSG_RESULT(no)
1069                         if test "${switch_to_system_on_failure}" = "yes"; then
1070                                 IMAP_TK_DIR="system"
1071                         else #This means they specified a directory. Search for a package installation there too
1072                                 AC_MSG_CHECKING([for system c-client library...])
1073                                 CPPFLAGS="${saved_cppflags}"
1074                                 LIBS="${saved_libs}"
1075                                 imap_include="-I${IMAP_TK_DIR}/include"
1076                                 imap_ldflags="-L${IMAP_TK_DIR}/lib"
1077                                 imap_libs="-lc-client"
1078                                 CPPFLAGS="${CPPFLAGS} ${imap_include}"
1079                                 LIBS="${LIBS} ${imap_libs} ${imap_ldflags}"
1080                                 AC_LINK_IFELSE(
1081                                 AC_LANG_PROGRAM(
1082                                                 [#include "c-client.h"
1083                                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
1084                                                 {
1085                                                 }
1086                                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
1087                                                 {
1088                                                 }
1089                                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
1090                                                 {
1091                                                 }
1092                                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
1093                                                 {
1094                                                 }
1095                                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1096                                                 {
1097                                                 }
1098                                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1099                                                 {
1100                                                 }
1101                                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1102                                                 {
1103                                                 }
1104                                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1105                                                 {
1106                                                 }
1107                                                 void mm_log (char *string,long errflg)
1108                                                 {
1109                                                 }
1110                                                 void mm_dlog (char *string)
1111                                                 {
1112                                                 }
1113                                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1114                                                 {
1115                                                 }
1116                                                 void mm_critical (MAILSTREAM *stream)
1117                                                 {
1118                                                 }
1119                                                 void mm_nocritical (MAILSTREAM *stream)
1120                                                 {
1121                                                 }
1122                                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1123                                                 {
1124                                                 }
1125                                                 void mm_fatal (char *string)
1126                                                 {
1127                                                 }],
1128                                                 [
1129                                                 MAILSTREAM *foo = mail_open(NULL, "", 0);
1130                                                 ]
1131                                         ),
1132                                         [ac_cv_imap_tk="yes"],
1133                                         [ac_cv_imap_tk="no"]
1134                                 )
1135                                 if test "${ac_cv_imap_tk}" = "yes"; then
1136                                         AC_LINK_IFELSE(
1137                                                 AC_LANG_PROGRAM(
1138                                                         [#include "c-client.h"
1139                                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
1140                                                         {
1141                                                         }
1142                                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
1143                                                         {
1144                                                         }
1145                                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
1146                                                         {
1147                                                         }
1148                                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
1149                                                         {
1150                                                         }
1151                                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1152                                                         {
1153                                                         }
1154                                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1155                                                         {
1156                                                         }
1157                                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1158                                                         {
1159                                                         }
1160                                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1161                                                         {
1162                                                         }
1163                                                         void mm_log (char *string,long errflg)
1164                                                         {
1165                                                         }
1166                                                         void mm_dlog (char *string)
1167                                                         {
1168                                                         }
1169                                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1170                                                         {
1171                                                         }
1172                                                         void mm_critical (MAILSTREAM *stream)
1173                                                         {
1174                                                         }
1175                                                         void mm_nocritical (MAILSTREAM *stream)
1176                                                         {
1177                                                         }
1178                                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1179                                                         {
1180                                                         }
1181                                                         void mm_fatal (char *string)
1182                                                         {
1183                                                         }],
1184                                                         [
1185                                                         long check = mail_expunge_full(NULL, "", 0);
1186                                                         ]
1187                                                 ),
1188                                                 [ac_cv_imap_tk2006="yes"],
1189                                                 [ac_cv_imap_tk2006="no"]
1190                                         )
1191                                 fi
1192                         fi
1193                 fi
1194         fi 
1195         if test "${IMAP_TK_DIR}" = "system"; then
1196                 #We will enter here if user specified "system" or if any of above checks failed
1197                 AC_MSG_CHECKING([for system c-client library...])
1198                 CPPFLAGS="${saved_cppflags}"
1199                 LIBS="${saved_libs}"
1200                 imap_ldflags=""
1201                 imap_libs="-lc-client"
1202                 imap_include="-DUSE_SYSTEM_IMAP" #Try the imap directory first
1203                 CPPFLAGS="${CPPFLAGS} ${imap_include}"
1204                 LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
1205                 AC_LINK_IFELSE(
1206                 AC_LANG_PROGRAM(
1207                                 [#include <stdio.h>
1208                                 #include <imap/c-client.h>
1209                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
1210                                 {
1211                                 }
1212                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
1213                                 {
1214                                 }
1215                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
1216                                 {
1217                                 }
1218                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
1219                                 {
1220                                 }
1221                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1222                                 {
1223                                 }
1224                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1225                                 {
1226                                 }
1227                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1228                                 {
1229                                 }
1230                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1231                                 {
1232                                 }
1233                                 void mm_log (char *string,long errflg)
1234                                 {
1235                                 }
1236                                 void mm_dlog (char *string)
1237                                 {
1238                                 }
1239                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1240                                 {
1241                                 }
1242                                 void mm_critical (MAILSTREAM *stream)
1243                                 {
1244                                 }
1245                                 void mm_nocritical (MAILSTREAM *stream)
1246                                 {
1247                                 }
1248                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1249                                 {
1250                                 }
1251                                 void mm_fatal (char *string)
1252                                 {
1253                                 }],
1254                                 [
1255                                 MAILSTREAM *foo = mail_open(NULL, "", 0);
1256                                 ]
1257                         ),
1258                         [ac_cv_imap_tk="yes"],
1259                         [ac_cv_imap_tk="no"]
1260                 )
1261                 if test "${ac_cv_imap_tk}" = "yes"; then
1262                         AC_LINK_IFELSE(
1263                                 AC_LANG_PROGRAM(
1264                                         [#include <stdio.h>
1265                                         #include <imap/c-client.h>
1266                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
1267                                         {
1268                                         }
1269                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
1270                                         {
1271                                         }
1272                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
1273                                         {
1274                                         }
1275                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
1276                                         {
1277                                         }
1278                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1279                                         {
1280                                         }
1281                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1282                                         {
1283                                         }
1284                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1285                                         {
1286                                         }
1287                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1288                                         {
1289                                         }
1290                                         void mm_log (char *string,long errflg)
1291                                         {
1292                                         }
1293                                         void mm_dlog (char *string)
1294                                         {
1295                                         }
1296                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1297                                         {
1298                                         }
1299                                         void mm_critical (MAILSTREAM *stream)
1300                                         {
1301                                         }
1302                                         void mm_nocritical (MAILSTREAM *stream)
1303                                         {
1304                                         }
1305                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1306                                         {
1307                                         }
1308                                         void mm_fatal (char *string)
1309                                         {
1310                                         }],
1311                                         [
1312                                         long check = mail_expunge_full(NULL, "", 0);
1313                                         ]
1314                                 ),
1315                                 [ac_cv_imap_tk2006="yes"],
1316                                 [ac_cv_imap_tk2006="no"]
1317                         )
1318                 else #looking in imap directory didn't work, try c-client
1319                         imap_ldflags=""
1320                         imap_libs="-lc-client"
1321                         imap_include="-DUSE_SYSTEM_CCLIENT"
1322                         CPPFLAGS="${saved_cppflags}"
1323                         LIBS="${saved_libs}"
1324                         CPPFLAGS="${CPPFLAGS} ${imap_include}"
1325                         LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
1326                         AC_LINK_IFELSE(
1327                         AC_LANG_PROGRAM(
1328                                         [#include <stdio.h>
1329                                         #include <c-client/c-client.h>
1330                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
1331                                         {
1332                                         }
1333                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
1334                                         {
1335                                         }
1336                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
1337                                         {
1338                                         }
1339                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
1340                                         {
1341                                         }
1342                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1343                                         {
1344                                         }
1345                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1346                                         {
1347                                         }
1348                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1349                                         {
1350                                         }
1351                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1352                                         {
1353                                         }
1354                                         void mm_log (char *string,long errflg)
1355                                         {
1356                                         }
1357                                         void mm_dlog (char *string)
1358                                         {
1359                                         }
1360                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1361                                         {
1362                                         }
1363                                         void mm_critical (MAILSTREAM *stream)
1364                                         {
1365                                         }
1366                                         void mm_nocritical (MAILSTREAM *stream)
1367                                         {
1368                                         }
1369                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1370                                         {
1371                                         }
1372                                         void mm_fatal (char *string)
1373                                         {
1374                                         }],
1375                                         [
1376                                         MAILSTREAM *foo = mail_open(NULL, "", 0);
1377                                         ]
1378                                 ),
1379                                 [ac_cv_imap_tk="yes"],
1380                                 [ac_cv_imap_tk="no"]
1381                         )
1382                         if test "${ac_cv_imap_tk}" = "yes"; then
1383                                 AC_LINK_IFELSE(
1384                                         AC_LANG_PROGRAM(
1385                                                 [#include <stdio.h>
1386                                                 #include <c-client/c-client.h>
1387                                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
1388                                                 {
1389                                                 }
1390                                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
1391                                                 {
1392                                                 }
1393                                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
1394                                                 {
1395                                                 }
1396                                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
1397                                                 {
1398                                                 }
1399                                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1400                                                 {
1401                                                 }
1402                                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1403                                                 {
1404                                                 }
1405                                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1406                                                 {
1407                                                 }
1408                                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1409                                                 {
1410                                                 }
1411                                                 void mm_log (char *string,long errflg)
1412                                                 {
1413                                                 }
1414                                                 void mm_dlog (char *string)
1415                                                 {
1416                                                 }
1417                                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1418                                                 {
1419                                                 }
1420                                                 void mm_critical (MAILSTREAM *stream)
1421                                                 {
1422                                                 }
1423                                                 void mm_nocritical (MAILSTREAM *stream)
1424                                                 {
1425                                                 }
1426                                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1427                                                 {
1428                                                 }
1429                                                 void mm_fatal (char *string)
1430                                                 {
1431                                                 }],
1432                                                 [
1433                                                 long check = mail_expunge_full(NULL, "", 0);
1434                                                 ]
1435                                         ),
1436                                         [ac_cv_imap_tk2006="yes"],
1437                                         [ac_cv_imap_tk2006="no"]
1438                                 )
1439                         fi
1440                 fi
1441         fi
1442         if test "${ac_cv_imap_tk}" = "yes"; then
1443                 AC_MSG_RESULT(yes)
1444                 IMAP_TK_LIB="${imap_libs} "`echo ${imap_ldflags}`
1445                 IMAP_TK_INCLUDE="${imap_include}"
1446                 PBX_IMAP_TK=1
1447                 AC_DEFINE([HAVE_IMAP_TK], 1, [Define if your system has the UW IMAP Toolkit c-client library.])
1448                 if test "${ac_cv_imap_tk2006}" = "yes"; then
1449                         AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
1450                 fi
1451         else
1452                 AC_MSG_RESULT(no) 
1453         fi
1454         CPPFLAGS="${saved_cppflags}"
1455         LIBS="${saved_libs}"
1456 fi
1457
1458 AST_EXT_LIB_CHECK([IODBC], [iodbc], [SQLConnect], [sql.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
1459
1460 AST_EXT_LIB_CHECK([INOTIFY], [c], [inotify_init], [sys/inotify.h])
1461
1462 AST_EXT_LIB_CHECK([JACK], [jack], [jack_activate], [jack/jack.h])
1463
1464 # BSD (and OS X) equivalent of inotify
1465 AST_EXT_LIB_CHECK([KQUEUE], [c], [kqueue], [sys/event.h])
1466
1467 # 64-bit version of kevent (from kqueue) on OS X
1468 AC_CHECK_FUNCS([kevent64])
1469
1470 # Needed by unixodbc
1471 AST_EXT_LIB_CHECK([LTDL], [ltdl], [lt_dlinit], [ltdl.h], [])
1472
1473 AST_EXT_LIB_CHECK([LDAP], [ldap], [ldap_initialize], [ldap.h])
1474
1475 AC_ARG_ENABLE([xmldoc],
1476         [AS_HELP_STRING([--disable-xmldoc],
1477                 [Explicity disable XML documentation])],
1478         [case "${enableval}" in
1479                 y|ye|yes) disable_xmldoc=no ;;
1480                 n|no)  disable_xmldoc=yes ;;
1481                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-xmldoc)  ;;
1482         esac], [disable_xmldoc=no])
1483
1484 if test "${disable_xmldoc}" != "yes"; then
1485         AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
1486         [#include <libxml/tree.h>
1487         #include <libxml/parser.h>],
1488         [LIBXML_TEST_VERSION])
1489         if test "${PBX_LIBXML2}" != 1; then
1490                 AC_MSG_NOTICE(*** XML documentation will not be available because the 'libxml2' development package is missing.)
1491                 AC_MSG_NOTICE(*** Please run the 'configure' script with the '--disable-xmldoc' parameter option)
1492                 AC_MSG_NOTICE(*** or install the 'libxml2' development package.)
1493                 exit 1
1494         fi
1495 fi
1496
1497 AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h])
1498
1499 if test "${PBX_MISDN}" = 1; then
1500    AST_EXT_LIB_CHECK([ISDNNET], [isdnnet], [init_manager], [mISDNuser/isdn_net.h], [-lmISDN -lpthread])
1501    AST_EXT_LIB_CHECK([SUPPSERV], [suppserv], [encodeFac], [mISDNuser/suppserv.h])
1502    AST_C_DEFINE_CHECK([MISDN_FAC_RESULT], [Fac_RESULT], [mISDNuser/suppserv.h])
1503    AST_C_DEFINE_CHECK([MISDN_FAC_ERROR], [Fac_ERROR], [mISDNuser/suppserv.h])
1504    AC_CHECK_HEADER([linux/mISDNdsp.h], [AC_DEFINE_UNQUOTED([MISDN_1_2], 1, [Build chan_misdn for mISDN 1.2 or later.])])
1505    AC_CHECK_MEMBER([Q931_info_t.redirect_dn], [], [PBX_MISDN=0], [#include <mISDNuser/mISDNlib.h>])
1506 fi
1507
1508 AST_EXT_TOOL_CHECK([MYSQLCLIENT], [mysql_config])
1509
1510 AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
1511
1512 AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
1513
1514 AST_EXT_TOOL_CHECK([NEON], [neon-config])
1515
1516 AST_EXT_TOOL_CHECK([NEON29], [neon-config], , [--libs],
1517 [#include <ne_auth.h>],
1518 [#ifndef NE_AUTH_NTLM
1519 #error Need libneon >= 0.29.0
1520 #endif])
1521
1522 AST_EXT_TOOL_CHECK([NETSNMP], [net-snmp-config], , [--agent-libs],
1523 [#include <net-snmp/net-snmp-config.h>
1524 #include <net-snmp/net-snmp-includes.h>
1525 #include <net-snmp/agent/net-snmp-agent-includes.h>],
1526 [int callback = snmp_register_callback(0, 0, NULL, NULL)])
1527
1528 AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
1529
1530 AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
1531
1532 AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
1533
1534 # Non-glibc platforms require libexecinfo for backtrace support
1535 AST_EXT_LIB_CHECK([BKTR], [execinfo], [backtrace], [execinfo.h])
1536 # Linux, however, has backtrace directly in glibc
1537 AST_EXT_LIB_CHECK([BKTR], [c], [backtrace], [execinfo.h])
1538
1539 AST_EXT_LIB_CHECK([BLUETOOTH], [bluetooth], [ba2str], [bluetooth/bluetooth.h])
1540
1541 # possible places for oss definitions
1542 AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [linux/soundcard.h])
1543 AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [sys/soundcard.h])
1544 AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
1545
1546 PG_CONFIG=No
1547 if test "${USE_PGSQL}" != "no"; then    
1548    if test "x${PGSQL_DIR}" != "x"; then
1549       AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
1550       if test x"${PG_CONFIG}" = xNo; then
1551          AC_MSG_NOTICE([***])
1552          AC_MSG_NOTICE([*** pg_config was not found in the path you specified:])
1553          AC_MSG_NOTICE([*** ${PGSQL_DIR}/bin])
1554          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1555          AC_MSG_NOTICE([*** including --without-postgres])
1556          exit 1
1557       fi
1558    else
1559       AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
1560    fi
1561 fi
1562 if test "${PG_CONFIG}" != No; then
1563    PGSQL_libdir=`${PG_CONFIG} --libdir`
1564    PGSQL_includedir=`${PG_CONFIG} --includedir`
1565    if test "x$?" != "x0" ; then
1566       if test -n "${PGSQL_MANDATORY}" ; then
1567          AC_MSG_NOTICE([***])
1568          AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
1569          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1570          AC_MSG_NOTICE([*** including --without-postgres])
1571          exit 1
1572           fi
1573    else 
1574       AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
1575       [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
1576
1577       if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
1578          PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
1579          PGSQL_INCLUDE="-I${PGSQL_includedir}"
1580          PBX_PGSQL=1
1581       elif test -n "${PGSQL_MANDATORY}";
1582       then
1583          AC_MSG_NOTICE([***])
1584          AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
1585          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1586          AC_MSG_NOTICE([*** including --without-postgres])
1587          exit 1
1588       fi
1589    fi
1590 fi
1591
1592 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
1593
1594 AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
1595
1596 AST_EXT_LIB_CHECK([PRI], [pri], [pri_connected_line_update], [libpri.h])
1597 AST_EXT_LIB_CHECK([PRI_MCID], [pri], [pri_mcid_enable], [libpri.h])
1598 AST_EXT_LIB_CHECK([PRI_CALL_WAITING], [pri], [pri_connect_ack_enable], [libpri.h])
1599 AST_EXT_LIB_CHECK([PRI_AOC_EVENTS], [pri], [pri_aoc_events_enable], [libpri.h])
1600 AST_EXT_LIB_CHECK([PRI_TRANSFER], [pri], [pri_transfer_enable], [libpri.h])
1601 AST_EXT_LIB_CHECK([PRI_CCSS], [pri], [pri_cc_enable], [libpri.h])
1602 AST_EXT_LIB_CHECK([PRI_HANGUP_FIX], [pri], [pri_hangup_fix_enable], [libpri.h])
1603 AST_EXT_LIB_CHECK([PRI_SUBADDR], [pri], [pri_sr_set_called_subaddress], [libpri.h])
1604 AST_EXT_LIB_CHECK([PRI_CALL_HOLD], [pri], [pri_hold_enable], [libpri.h])
1605 AST_EXT_LIB_CHECK([PRI_CALL_REROUTING], [pri], [pri_reroute_enable], [libpri.h])
1606 AST_EXT_LIB_CHECK([PRI_SETUP_KEYPAD], [pri], [pri_sr_set_keypad_digits], [libpri.h])
1607
1608 # ------------------------------------v
1609 # TODO: The code can be changed to always include these features now.
1610 # These features will always be present if pri_connected_line_update is available.
1611 AST_EXT_LIB_CHECK([PRI_PROG_W_CAUSE], [pri], [pri_progress_with_cause], [libpri.h])
1612 AST_EXT_LIB_CHECK([PRI_INBANDDISCONNECT], [pri], [pri_set_inbanddisconnect], [libpri.h])
1613 AST_EXT_LIB_CHECK([PRI_SERVICE_MESSAGES], [pri], [pri_maintenance_service], [libpri.h])
1614 AST_EXT_LIB_CHECK([PRI_REVERSE_CHARGE], [pri], [pri_sr_set_reversecharge], [libpri.h])
1615 # ------------------------------------^
1616
1617 AST_EXT_LIB_CHECK([RESAMPLE], [resample], [resample_open], [libresample.h], [-lm])
1618
1619 AST_C_COMPILE_CHECK([SPANDSP], [
1620                 #if SPANDSP_RELEASE_DATE < 20080516
1621                 #error "spandsp 0.0.5 or greater is required"
1622                 #endif
1623         ], [spandsp/version.h], , [minimum version of SpanDSP])
1624
1625 if test "x${PBX_SPANDSP}" = "x1" ; then
1626         # We found the correct version in the header, now let's make sure it links
1627         # properly, and that libtiff is available
1628         PBX_SPANDSP=0
1629         AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [span_set_message_handler], [spandsp.h], [-ltiff])
1630 fi
1631
1632 if test "x${PBX_SPANDSP}" = "x1" ; then
1633         # We also need t38_terminal_init()
1634         PBX_SPANDSP=0
1635         AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [t38_terminal_init], [spandsp.h], [-ltiff])
1636 fi
1637
1638 AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_pollflags], [libss7.h])
1639
1640 AST_EXT_LIB_CHECK([OPENR2], [openr2], [openr2_chan_new], [openr2.h])
1641
1642 if test "${USE_PWLIB}" != "no"; then
1643         if test -n "${PWLIB_DIR}"; then
1644                 PWLIBDIR="${PWLIB_DIR}"
1645         fi
1646         AST_CHECK_PWLIB()
1647         AST_CHECK_PWLIB_VERSION([PWLib], [PWLIB], [ptbuildopts.h], [1], [9], [2], [P[[WT]]LIB_VERSION])
1648                 
1649         if test "${HAS_PWLIB:-unset}" != "unset"; then
1650                 AST_CHECK_PWLIB_PLATFORM()
1651
1652                 PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
1653
1654                 AST_CHECK_PWLIB_BUILD([PWLib], [PWLIB],
1655                         [Define if your system has the PWLib libraries.],
1656                         [#include "ptlib.h"],
1657                         [int q = (int) PTime::IsDaylightSavings();])
1658         fi
1659 fi
1660
1661 if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
1662         if test -n "${OPENH323_DIR}"; then
1663                 OPENH323DIR="${OPENH323_DIR}"
1664         fi
1665         AST_CHECK_OPENH323()
1666         AST_CHECK_PWLIB_VERSION([OpenH323], [OPENH323], [openh323buildopts.h], [1], [17], [3])
1667         AST_CHECK_OPENH323_BUILD()
1668         PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
1669         AST_CHECK_PWLIB_BUILD([OpenH323], [OPENH323],
1670                 [Define if your system has the OpenH323 libraries.],
1671                 [#include "ptlib.h"
1672                 #include "h323.h"
1673                 #include "h323ep.h"],
1674                 [H323EndPoint ep = H323EndPoint();],
1675                 [${PWLIB_INCLUDE}], [${PWLIB_LIB}])
1676 fi
1677
1678 AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm]) 
1679 if test "x${PBX_LUA}" = "x1" ; then
1680         if test x"${LUA_DIR}" = x; then
1681                 LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.1"
1682         else
1683                 LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.1"
1684         fi
1685 fi
1686         
1687 # Some distributions (like SuSE) remove the 5.1 suffix.
1688 AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm]) 
1689
1690 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
1691
1692 # This is a bit complex... in reality, Asterisk's AIS support is dependent on finding
1693 # *any* implementation of AIS, not just OpenAIS. However, the configure script needs
1694 # to know the specifics of each possible implementation, and then represent the one
1695 # that was found as 'AIS'.
1696
1697 PBX_AIS=0
1698
1699 # OpenAIS installs its libraries into /usr/lib/openais by default, so check there
1700
1701 AST_EXT_LIB_CHECK([OPENAIS], [SaClm], [saClmInitialize], [openais/saClm.h], [-L/usr/lib/openais -L/usr/lib64/openais])
1702
1703 if test "${PBX_OPENAIS}" = 1; then
1704    PBX_AIS=1
1705    if test -n "${OPENAIS_DIR}"; then
1706       AIS_INCLUDE="${OPENAIS_INCLUDE}/openais"
1707       AIS_LIB="-lSaEvt ${OPENAIS_LIB}"
1708    else
1709       AIS_INCLUDE="-I/usr/include/openais"
1710       AIS_LIB="-lSaClm -lSaEvt -L/usr/lib/openais -L/usr/lib64/openais"
1711    fi
1712 fi
1713
1714 AC_SUBST(PBX_AIS)
1715 AC_SUBST(AIS_INCLUDE)
1716 AC_SUBST(AIS_LIB)
1717
1718 AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
1719
1720 # See if the main speex library contains the preprocess functions
1721 AST_EXT_LIB_CHECK([SPEEX_PREPROCESS], [speex], [speex_preprocess_ctl], [speex/speex.h], [-lm])
1722 if test "${PBX_SPEEX_PREPROCESS}" = 1; then
1723    PBX_SPEEX_PREPROCESS=1
1724 fi
1725
1726 AST_EXT_LIB_CHECK([SPEEXDSP], [speexdsp], [speex_preprocess_ctl], [speex/speex.h], [-lm])
1727 if test "${PBX_SPEEXDSP}" = 1; then
1728    PBX_SPEEX_PREPROCESS=1
1729 fi
1730
1731 AC_SUBST(PBX_SPEEX_PREPROCESS)
1732
1733 AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
1734
1735 AST_EXT_LIB_CHECK([SQLITE3], [sqlite3], [sqlite3_open], [sqlite3.h])
1736
1737 AST_EXT_LIB_CHECK([CRYPTO], [crypto], [AES_encrypt], [openssl/aes.h])
1738
1739 if test "$PBX_CRYPTO" = "1";
1740 then
1741     AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl2_connect], [openssl/ssl.h], [-lcrypto])
1742 fi
1743
1744 if test "$PBX_OPENSSL" = "1";
1745 then
1746     AST_CHECK_OSPTK([3], [6], [0])
1747 fi
1748
1749 AST_EXT_TOOL_CHECK([GMIME], [gmime-config], [], [], [#include <gmime/gmime.h>], [gboolean q = g_mime_check_version(0,0,0);])
1750
1751 AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
1752
1753 AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
1754
1755 AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
1756
1757 AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
1758
1759 AC_CHECK_LIB([tonezone], [tone_zone_find_by_num], tonezone_does_not_need_lm=yes, tonezone_does_not_need_lm=no)
1760
1761 if test "${tonezone_does_not_need_lm}" = "no" ; then
1762   tonezone_extra="-lm"
1763 fi
1764
1765 AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
1766
1767 AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
1768
1769 if test "${OSARCH}" = "OpenBSD";
1770 then
1771         AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -logg])
1772 else
1773         AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
1774 fi
1775
1776 AC_LANG_PUSH(C++)
1777
1778 if test "${USE_VPB}" != "no"; then
1779    AC_MSG_CHECKING(for vpb_open in -lvpb)
1780    saved_libs="${LIBS}"
1781    saved_cppflags="${CPPFLAGS}"
1782    if test "x${VPB_DIR}" != "x"; then
1783       if test -d ${VPB_DIR}/lib; then
1784          vpblibdir=${VPB_DIR}/lib
1785       else
1786          vpblibdir=${VPB_DIR}
1787       fi
1788       LIBS="${LIBS} -L${vpblibdir}"
1789       CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
1790    fi
1791    LIBS="${PTHREAD_LIBS} ${LIBS} -lvpb"
1792    CPPFLAGS="${CPPFLAGS} ${PTHREAD_CFLAGS}"
1793    AC_LINK_IFELSE(
1794         [
1795         AC_LANG_PROGRAM(
1796         [#include <vpbapi.h>],
1797         [int q = vpb_open(0,0);])
1798         ],
1799         [       AC_MSG_RESULT(yes) 
1800                 ac_cv_lib_vpb_vpb_open="yes" 
1801         ],
1802         [       AC_MSG_RESULT(no) 
1803                 ac_cv_lib_vpb_vpb_open="no" 
1804         ]
1805         )
1806    LIBS="${saved_libs}"
1807    CPPFLAGS="${saved_cppflags}"
1808    if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
1809         VPB_LIB="-lvpb"
1810         if test "${VPB_DIR}" != ""; then
1811            VPB_LIB="-L${vpblibdir}  ${VPB_LIB}"
1812            VPB_INCLUDE="-I${VPB_DIR}/include"
1813         fi
1814         PBX_VPB=1
1815         AC_DEFINE([HAVE_VPB], 1, [Define if your system has the VoiceTronix API libraries.])
1816    fi
1817 fi
1818
1819 AC_LANG_POP
1820
1821 AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
1822
1823 EDITLINE_LIB=""
1824 if test "x$TERMCAP_LIB" != "x" ; then
1825   EDITLINE_LIB="$TERMCAP_LIB"
1826 elif test "x$TINFO_LIB" != "x" ; then
1827   EDITLINE_LIB="$TINFO_LIB"
1828 elif test "x$CURSES_LIB" != "x" ; then
1829   EDITLINE_LIB="$CURSES_LIB"
1830 elif test "x$NCURSES_LIB" != "x" ; then
1831   EDITLINE_LIB="$NCURSES_LIB"
1832 else
1833   AC_MSG_ERROR([*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)])
1834 fi
1835 AC_SUBST(EDITLINE_LIB)
1836
1837 if test "x${PBX_UNIXODBC}" = "x1" -o "x${PBX_IODBC}" = "x1"; then
1838         # Does ODBC support wide characters?
1839         AC_MSG_CHECKING(whether ODBC has support for Unicode types)
1840         AC_LINK_IFELSE(
1841                 AC_LANG_PROGRAM(
1842                         [#include <sql.h>
1843 #include <sqlext.h>],
1844                         [int foo = SQL_WCHAR]),
1845                 AC_MSG_RESULT(yes)
1846                         AC_DEFINE([HAVE_ODBC_WCHAR], [1], [Define to 1 if your ODBC library has wide (Unicode) types.]),
1847                 AC_MSG_RESULT(no)
1848         )
1849 fi
1850
1851 AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
1852 AC_SUBST(PBX_H323)
1853
1854 AC_CHECK_HEADER([linux/compiler.h],
1855                 [AC_DEFINE_UNQUOTED([HAVE_LINUX_COMPILER_H], 1, [Define to 1 if your system has linux/compiler.h.])])
1856
1857 AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
1858                                    #include <linux/version.h>
1859                                    #ifdef HAVE_LINUX_COMPILER_H
1860                                    #include <linux/compiler.h>
1861                                    #endif
1862                                    ])
1863 AC_SUBST(PBX_IXJUSER)
1864
1865 # Used in res/res_pktccops
1866 AST_C_DEFINE_CHECK([MSG_NOSIGNAL], [MSG_NOSIGNAL], [sys/socket.h])
1867 AST_C_DEFINE_CHECK([SO_NOSIGPIPE], [SO_NOSIGPIPE], [sys/socket.h])
1868
1869 AST_EXT_TOOL_CHECK([SDL], [sdl-config])
1870 AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL_image.h], [${SDL_LIB}], [${SDL_INCLUDE}])
1871 AST_EXT_LIB_CHECK([FFMPEG], [avcodec], [sws_getContext], [ffmpeg/avcodec.h], [${PTHREAD_LIBS} -lz -lm], [${PTHREAD_CFLAGS}])
1872
1873 # possible places for video4linux version 1
1874 AC_CHECK_HEADER([linux/videodev.h],
1875         [AC_DEFINE_UNQUOTED([HAVE_VIDEODEV_H], 1, [Define to 1 if your system has linux/videodev.h.])])
1876
1877 # possible places for X11
1878 AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],,, [standard_path])
1879 AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],, [-I/usr/X11R6/include], [X11R6])
1880
1881 if test "${cross_compiling}" = "no";
1882 then
1883   AC_CHECK_FILE(/sbin/launchd, AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
1884 fi
1885
1886 PBX_GTK2=0
1887 AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
1888 if test ! "x${PKGCONFIG}" = xNo; then
1889    GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null)
1890    GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs)
1891    PBX_GTK2=1
1892    AC_DEFINE([HAVE_GTK2], 1, [Define if your system has the GTK2 libraries.])
1893 fi
1894 AC_SUBST(PBX_GTK2)
1895 AC_SUBST(GTK2_INCLUDE)
1896 AC_SUBST(GTK2_LIB)
1897
1898 AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
1899
1900 # build a GENERIC_ODBC result based on the presence of either UnixODBC (preferred)
1901 # or iODBC
1902
1903 PBX_GENERIC_ODBC=0
1904
1905 if test "${PBX_UNIXODBC}" = 1; then
1906    PBX_GENERIC_ODBC=1
1907    GENERIC_ODBC_LIB="${UNIXODBC_LIB}"
1908    GENERIC_ODBC_INCLUDE="${UNIXODBC_INCLUDE}"
1909 elif test "${PBX_IODBC}" = 1; then
1910    PBX_GENERIC_ODBC=1
1911    GENERIC_ODBC_LIB="${IODBC_LIB}"
1912    GENERIC_ODBC_INCLUDE="${IODBC_INCLUDE}"
1913 fi
1914
1915 AC_SUBST([GENERIC_ODBC_LIB])
1916 AC_SUBST([GENERIC_ODBC_INCLUDE])
1917 AC_SUBST([PBX_GENERIC_ODBC])
1918
1919 PBX_SYSLOG=0
1920
1921 if test "${ac_cv_header_syslog_h}" = "yes"; then
1922    # syslog facilities
1923    AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_AUTH],     [LOG_AUTH],     [syslog.h])
1924    AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_AUTHPRIV], [LOG_AUTHPRIV], [syslog.h])
1925    AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_CRON],     [LOG_CRON],     [syslog.h])
1926    AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_DAEMON],   [LOG_DAEMON],   [syslog.h])
1927    AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_FTP],      [LOG_FTP],      [syslog.h])
1928    AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_KERN],     [LOG_KERN],     [syslog.h])
1929    AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LPR],      [LOG_LPR],      [syslog.h])
1930    AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_MAIL],     [LOG_MAIL],     [syslog.h])
1931    AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_NEWS],     [LOG_NEWS],     [syslog.h])
1932    AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_SYSLOG],   [LOG_SYSLOG],   [syslog.h])
1933    AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_UUCP],     [LOG_UUCP],     [syslog.h])
1934    PBX_SYSLOG=1
1935 fi
1936
1937 AC_SUBST([PBX_SYSLOG])
1938
1939 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
1940 AST_CHECK_MANDATORY
1941
1942 if test -f build_tools/menuselect-deps; then
1943     # extract old values of all PBX_ variables from menuselect-deps
1944     # and preserve them so that menuselect can determine whether
1945     # any previously-met dependencies are no longer met and warn
1946     # the user appropriately
1947     while IFS="=:" read var val old_val; do
1948         eval "PBX_${var}=\${PBX_${var}}:${val}"
1949     done < build_tools/menuselect-deps
1950 fi
1951
1952 AC_OUTPUT
1953
1954 if test "x${silent}" != "xyes" ; then
1955 echo
1956 echo "               .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=..      "
1957 echo "            .\$7\$7..          .7\$\$7:.    "
1958 echo "          .\$\$:.                 ,\$7.7   "
1959 echo "        .\$7.     7\$\$\$\$           .\$\$77  "
1960 echo "     ..\$\$.       \$\$\$\$\$            .\$\$\$7 "
1961 echo "    ..7\$   .?.   \$\$\$\$\$   .?.       7\$\$\$."
1962 echo "   \$.\$.   .\$\$\$7. \$\$\$\$7 .7\$\$\$.      .\$\$\$."
1963 echo " .777.   .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7.      \$\$\$,"
1964 echo " \$\$\$~      .7\$\$\$\$\$\$\$\$\$\$\$\$\$7.       .\$\$\$."
1965 echo ".\$\$7          .7\$\$\$\$\$\$\$7:          ?\$\$\$."
1966 echo "\$\$\$          ?7\$\$\$\$\$\$\$\$\$\$I        .\$\$\$7 "
1967 echo "\$\$\$       .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$      :\$\$\$. "
1968 echo "\$\$\$       \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$    .\$\$\$.  "
1969 echo "\$\$\$        \$\$\$   7\$\$\$7  .\$\$\$    .\$\$\$.   "
1970 echo "\$\$\$\$             \$\$\$\$7         .\$\$\$.    "
1971 echo "7\$\$\$7            7\$\$\$\$        7\$\$\$      "
1972 echo " \$\$\$\$\$                        \$\$\$       "
1973 echo "  \$\$\$\$7.                       \$\$  (TM)     "
1974 echo "   \$\$\$\$\$\$\$.           .7\$\$\$\$\$\$  \$\$      "
1975 echo "     \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$      "
1976 echo "       \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$.                "
1977 echo
1978 fi
1979
1980 AC_MSG_NOTICE(Package configured for: )
1981 AC_MSG_NOTICE( OS type  : $host_os)
1982 AC_MSG_NOTICE( Host CPU : $host_cpu)
1983 AC_MSG_NOTICE( build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :) 
1984 AC_MSG_NOTICE( host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :) 
1985 if test "${cross_compiling}" = "yes"; then
1986    AC_MSG_NOTICE( Cross Compilation = YES)
1987 fi