emit a warning message when we drop a G.729B CNG frame destined for the transcoder
[asterisk-bristuff.git] / configure.ac
blob9edb685a119ac6172ea4e38de2c9441ea90daaca
1 # Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.60)
5 m4_define([PBX_VERSION],
6           m4_bpatsubst(m4_esyscmd([build_tools/make_version .]),
7                        [\([0-9.]*\)\(\w\|\W\)*],
8                        [\1]))
9 AC_INIT(asterisk, PBX_VERSION, www.asterisk.org)
11 # cross-compile macros
12 AC_CANONICAL_BUILD
13 AC_CANONICAL_HOST
15 # check existence of the package
16 AC_CONFIG_SRCDIR([main/asterisk.c])
18 # specify output header file
19 AC_CONFIG_HEADER(include/asterisk/autoconfig.h)
21 AC_COPYRIGHT("Asterisk")
22 AC_REVISION($Revision$)
24 AC_GNU_SOURCE
25 AC_USE_SYSTEM_EXTENSIONS        # note- does not work on FreeBSD
27 case "${host_os}" in
28      freebsd*)
29      ac_default_prefix=/usr/local
30      CPPFLAGS=-I/usr/local/include
31      LDFLAGS=-L/usr/local/lib
32      ;;
33      *)
34      ac_default_prefix=/usr
35      if test ${sysconfdir} = '${prefix}/etc'; then
36         sysconfdir=/etc
37      fi
38      if test ${mandir} = '${prefix}/man'; then
39         mandir=/usr/share/man
40      fi
41      ;;
42 esac
44 if test ${localstatedir} = '${prefix}/var'; then
45      localstatedir=/var
48 BUILD_PLATFORM=${build}
49 BUILD_CPU=${build_cpu}
50 BUILD_VENDOR=${build_vendor}
51 BUILD_OS=${build_os}
53 AC_SUBST(BUILD_PLATFORM)
54 AC_SUBST(BUILD_CPU)
55 AC_SUBST(BUILD_VENDOR)
56 AC_SUBST(BUILD_OS)
58 HOST_PLATFORM=${host}
59 HOST_CPU=${host_cpu}
60 HOST_VENDOR=${host_vendor}
61 HOST_OS=${host_os}
63 AC_SUBST(HOST_PLATFORM)
64 AC_SUBST(HOST_CPU)
65 AC_SUBST(HOST_VENDOR)
66 AC_SUBST(HOST_OS)
68 case "${host_os}" in
69      freebsd*)
70      OSARCH=FreeBSD
71      ;;
72      netbsd*)
73      OSARCH=NetBSD
74      ;;
75      openbsd*)
76      OSARCH=OpenBSD
77      ;;
78      solaris*)
79      OSARCH=SunOS
80      ;;
81      *)
82      OSARCH=${HOST_OS}
83      ;;
84 esac
86 AC_SUBST(OSARCH)
88 #  check for uname
89 AC_PATH_TOOL([UNAME], [uname], No)
90 if test ! x"${UNAME}" = xNo; then
91    PBX_OSREV=$(${UNAME} -r)
93 AC_SUBST(PBX_OSREV)
95 AH_TOP(
96 #ifndef ASTERISK_AUTOCONFIG_H
97 #define ASTERISK_AUTOCONFIG_H
99 #include "asterisk/buildopts.h"
103 AH_BOTTOM(
104 #endif
107 # cross-compile checks
108 if test "${cross_compiling}" = "yes"; 
109 then
110    AC_CHECK_TOOL(CC, gcc, :)
111    AC_CHECK_TOOL(CXX, g++, :)
112    AC_CHECK_TOOL(LD, ld, :)
113    AC_CHECK_TOOL(RANLIB, ranlib, :)
116 # Checks for programs.
117 AC_PROG_CC
118 AC_PROG_CXX
119 AC_PROG_CPP
120 AC_PROG_CXXCPP
121 # This macro is just copied into our local acinclude.m4 from libtool.m4 so that
122 # the developers regenerating the configure script don't have to install libtool.
123 AST_PROG_LD     # note - does not work on freebsd
124 AC_PROG_AWK
125 AC_PROG_INSTALL
126 AC_PROG_LN_S
127 AC_PROG_RANLIB
128 AST_CHECK_GNU_MAKE
130 AC_PATH_TOOL([STRIP], [strip], :)
131 AC_PATH_TOOL([AR], [ar], :)
133 GNU_LD=0
134 if test "x$with_gnu_ld" = "xyes" ; then
135    GNU_LD=1
137 AC_SUBST(GNU_LD)
139 AC_PATH_PROG([GREP], [grep], :)
140 AC_PATH_PROG([FIND], [find], :)
141 AC_PATH_PROG([COMPRESS], [compress], :)
142 AC_PATH_PROG([BASENAME], [basename], :)
143 AC_PATH_PROG([ID], [id], :)
144 AC_PATH_PROG([DIRNAME], [dirname], :)
145 AC_PATH_PROG([SHELL], [sh], :)
146 AC_PATH_PROG([LN], [ln], :)
147 AC_PATH_PROG([DOT], [dot], :)
148 AC_PATH_PROG([WGET], [wget], :)
149 if test "${WGET}" != ":" ; then
150   DOWNLOAD=${WGET}
151 else
152   AC_PATH_PROG([FETCH], [fetch], [:])
153   DOWNLOAD=${FETCH}
155 AC_SUBST(DOWNLOAD)
157 ACX_PTHREAD
159 AC_LANG(C)
161 AC_ARG_ENABLE(dev-mode,
162         [  --enable-dev-mode    Turn on developer mode],
163         [case "${enableval}" in
164               y|ye|yes) AST_DEVMODE=yes ;;
165               n|no)  AST_DEVMODE=no ;;
166               *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode)  ;;
167         esac])
168 AC_SUBST(AST_DEVMODE)
170 # package option names should be in alphabetical order
171 # by the --with option name, to make things easier for the users :-)
173 AST_EXT_LIB_SETUP([ALSA], [Advanced Linux Sound Architecture], [asound])
174 AST_EXT_LIB_SETUP([CURL], [cURL], [curl])
175 AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
176 AST_EXT_LIB_SETUP([GNUTLS], [GNU TLS support (used for iksemel only)], [gnutls])
177 AST_EXT_LIB_SETUP([GSM], [GSM], [gsm], [, or 'internal'])
178 AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber Library], [iksemel])
179 AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
180 AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux Library], [isdnnet])
181 AST_EXT_LIB_SETUP([KDE], [KDE], [kde])
182 AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl])
183 AST_EXT_LIB_SETUP([MISDN], [mISDN User Library], [misdn])
184 AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs])
185 AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
186 AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
187 AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
188 AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [odbc])
189 AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
190 AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
191 AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
192 AST_EXT_LIB_SETUP([POPT], [popt], [popt])
193 AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
194 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
195 AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
196 AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323])
197 AST_EXT_LIB_SETUP([QT], [Qt], [qt])
198 AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
199 AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
200 AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
201 AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
202 AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL], [ssl])
203 AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
204 AST_EXT_LIB_SETUP([TERMCAP], [Termcap], [termcap])
205 AST_EXT_LIB_SETUP([TINFO], [Term Info], [tinfo])
206 AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
207 AST_EXT_LIB_SETUP([USB], [usb], [usb])
208 AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
209 AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
210 AST_EXT_LIB_SETUP([ZLIB], [zlib], [z])
211 AST_EXT_LIB_SETUP([ZAPTEL], [Zaptel], [zaptel])
213 # check for basic system features and functionality before
214 # checking for package libraries
216 AC_FUNC_ALLOCA
217 AC_HEADER_DIRENT
218 AC_HEADER_STDC
219 AC_HEADER_SYS_WAIT
220 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/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h])
222 AC_SYS_LARGEFILE
224 # Checks for typedefs, structures, and compiler characteristics.
225 AC_HEADER_STDBOOL
226 AC_C_CONST
227 AC_TYPE_UID_T
228 AC_C_INLINE
229 AC_TYPE_MODE_T
230 AC_TYPE_OFF_T
231 AC_TYPE_PID_T
232 AC_TYPE_SIZE_T
233 AC_CHECK_MEMBERS([struct stat.st_blksize])
234 AC_HEADER_TIME
235 AC_STRUCT_TM
236 AC_C_VOLATILE
237 AC_CHECK_TYPES([ptrdiff_t])
239 # Checks for library functions.
240 AC_FUNC_CHOWN
241 AC_FUNC_CLOSEDIR_VOID
242 AC_FUNC_ERROR_AT_LINE
243 AST_FUNC_FORK
244 AC_FUNC_FSEEKO
245 AC_PROG_GCC_TRADITIONAL
246 # XXX: these are commented out until we determine whether it matters if our malloc()
247 # acts exactly like glibc's or not
248 # AC_FUNC_MALLOC
249 # AC_FUNC_REALLOC
250 AC_FUNC_MEMCMP
251 AC_FUNC_MKTIME
252 AC_FUNC_MMAP
253 AC_FUNC_SELECT_ARGTYPES
254 AC_FUNC_SETVBUF_REVERSED
255 AC_TYPE_SIGNAL
256 AC_FUNC_STAT
257 AC_FUNC_STRCOLL
258 AC_FUNC_STRFTIME
259 AC_FUNC_STRNLEN
260 AC_FUNC_STRTOD
261 AC_FUNC_UTIME_NULL
262 AC_FUNC_VPRINTF
263 AC_CHECK_FUNCS([asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf])
265 # some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
266 AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])
268 AC_MSG_CHECKING(for gethostbyname_r with 6 arguments)
269 AC_LINK_IFELSE(
270         AC_LANG_PROGRAM([#include <stdlib.h>
271                          #include <netdb.h>],
272                         [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);]),
273         AC_MSG_RESULT(yes)
274         AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]),
275         AC_MSG_RESULT(no)
278 AC_MSG_CHECKING(for gethostbyname_r with 5 arguments)
279 AC_LINK_IFELSE(
280         AC_LANG_PROGRAM([#include <stdlib.h>
281                          #include <netdb.h>],
282                         [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);]),
283         AC_MSG_RESULT(yes)
284         AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]),
285         AC_MSG_RESULT(no)
288 AC_MSG_CHECKING(for PTHREAD_RWLOCK_INITIALIZER)
289 AC_LINK_IFELSE(
290         AC_LANG_PROGRAM([#include <pthread.h>],
291                         [int foo = PTHREAD_RWLOCK_INITIALIZER;]),
292         AC_MSG_RESULT(yes)
293         AC_DEFINE([HAVE_PTHREAD_RWLOCK_INITIALIZER], 1, [Define to 1 if your system has PTHREAD_RWLOCK_INITIALIZER.]),
294         AC_MSG_RESULT(no)
297 AC_MSG_CHECKING(for PTHREAD_RWLOCK_PREFER_WRITER_NP)
298 AC_LINK_IFELSE(
299         AC_LANG_PROGRAM([#include <pthread.h>],
300                         [int foo = PTHREAD_RWLOCK_PREFER_WRITER_NP;]),
301         AC_MSG_RESULT(yes)
302         AC_DEFINE([HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP], 1, [Define to 1 if your system has PTHREAD_RWLOCK_PREFER_WRITER_NP.]),
303         AC_MSG_RESULT(no)
306 AC_MSG_CHECKING(for compiler atomic operations)
307 AC_LINK_IFELSE(
308 AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);]),
309 AC_MSG_RESULT(yes)
310 AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides atomic operations.]),
311 AC_MSG_RESULT(no)
314 AST_GCC_ATTRIBUTE(pure)
315 AST_GCC_ATTRIBUTE(malloc)
316 AST_GCC_ATTRIBUTE(const)
317 AST_GCC_ATTRIBUTE(unused)
318 AST_GCC_ATTRIBUTE(always_inline)
319 AST_GCC_ATTRIBUTE(deprecated)
321 AC_MSG_CHECKING(for -ffunction-sections support)
322 saved_CFLAGS="${CFLAGS}"
323 CFLAGS="${CFLAGS} -ffunction-sections"
324 AC_COMPILE_IFELSE(
325         AC_LANG_PROGRAM([], [int x = 1;]),
326         AC_MSG_RESULT(yes)
327         [saved_LDFLAGS="${LDFLAGS}"]
328         [LDFLAGS="${LDFLAGS} -Wl,--gc-sections"]
329         AC_MSG_CHECKING(for --gc-sections support)
330         AC_LINK_IFELSE(
331                 AC_LANG_PROGRAM([], [int x = 1;]),
332                 AC_MSG_RESULT(yes)
333                 [GC_CFLAGS="-ffunction-sections"]
334                 [[GC_LDFLAGS="-Wl,--gc-sections"]],
335                 AC_MSG_RESULT(no)
336         )
337         [LDFLAGS="${saved_LDFLAGS}"],
338         AC_MSG_RESULT(no)
340 CFLAGS="${saved_CFLAGS}"
341 AC_SUBST(GC_CFLAGS)
342 AC_SUBST(GC_LDFLAGS)
344 AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
345 if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
346    AC_MSG_RESULT(yes)
347    AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
348 else
349         AC_MSG_RESULT(no)
350         AST_DECLARATION_AFTER_STATEMENT=
352 AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
354 AC_MSG_CHECKING(for res_ninit)
355 AC_LINK_IFELSE(
356         AC_LANG_PROGRAM([#include <resolv.h>],
357                         [int foo = res_ninit(NULL);]),
358         AC_MSG_RESULT(yes)
359         AC_DEFINE([HAVE_RES_NINIT], 1, [Define to 1 if your system has the re-entrant resolver functions.])
360         AC_MSG_CHECKING(for res_ndestroy)
361         AC_LINK_IFELSE(
362                 AC_LANG_PROGRAM([#include <resolv.h>],
363                                 [int foo = res_ndestroy(NULL);]),
364                 AC_MSG_RESULT(yes)
365                 AC_DEFINE([HAVE_RES_NDESTROY], 1, [Define to 1 if your system has the ndestroy resolver function.]),
366                 AC_MSG_RESULT(no)
367         ),
368         AC_MSG_RESULT(no)
371 AC_MSG_CHECKING(for RTLD_NOLOAD)
372 AC_LINK_IFELSE(
373         AC_LANG_PROGRAM([#include <dlfcn.h>],
374                         [int foo = RTLD_NOLOAD;]),
375         AC_MSG_RESULT(yes)
376         AC_DEFINE([HAVE_RTLD_NOLOAD], 1, [Define to 1 if your system has a dynamic linker that supports RTLD_NOLOAD.]),
377         AC_MSG_RESULT(no)
380 AC_MSG_CHECKING(for IP_MTU_DISCOVER)
381 AC_LINK_IFELSE(
382         AC_LANG_PROGRAM([#include <netinet/in.h>],
383                         [int foo = IP_MTU_DISCOVER;]),
384         AC_MSG_RESULT(yes)
385         AC_DEFINE([HAVE_IP_MTU_DISCOVER], 1, [Define to 1 if your system has PMTU discovery on UDP sockets.]),
386         AC_MSG_RESULT(no)
389 AC_CHECK_HEADER([libkern/OSAtomic.h],
390                 [AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
392 AC_CHECK_SIZEOF(int)
394 # do the package library checks now
396 AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
398 AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
400 GSM_INTERNAL="yes"
401 AC_SUBST(GSM_INTERNAL)
402 GSM_SYSTEM="yes"
403 if test "${USE_GSM}" != "no"; then
404    if test "${GSM_DIR}" = "internal"; then
405       GSM_SYSTEM="no"
406    elif test "${GSM_DIR}" != ""; then
407       GSM_INTERNAL="no"
408    fi
409    if test "${GSM_SYSTEM}" = "yes"; then
410       gsmlibdir=""
411       if test "x${GSM_DIR}" != "x"; then
412          if test -d ${GSM_DIR}/lib; then
413             gsmlibdir="-L${GSM_DIR}/lib"
414          else
415             gsmlibdir="-L${GSM_DIR}"
416          fi
417       fi
418       AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
419       [Define to indicate the GSM library]), [], ${gsmlibdir})
420       if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
421          if test "x${GSM_DIR}" != "x" ; then
422             AC_CHECK_HEADER([${GSM_DIR}/include/gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
423             AC_CHECK_HEADER([${GSM_DIR}/include/gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
424          else
425             AC_CHECK_HEADER([gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
426             AC_CHECK_HEADER([gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
427          fi
428          if test "${GSM_HEADER_FOUND}" = "0" ; then
429             if test "{GSM_GSM_HEADER_FOUND}" = "0" ; then
430                if test "x${GSM_MANDATORY}" = "xyes" ; then
431                   AC_MSG_NOTICE([***])
432                   AC_MSG_NOTICE([*** It appears that you do not have the gsm development package installed.])
433                   AC_MSG_NOTICE([*** Please install it to include ${GSM_DESCRIP} support, or re-run configure])
434                   AC_MSG_NOTICE([*** without explicitly specifying --with-${GSM_OPTION}])
435                   exit 1
436                fi
437             fi
438          fi
439          GSM_OK=0
440          if test "${GSM_HEADER_FOUND}" = "1" ; then
441             AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
442             GSM_OK=1
443          else
444             if test "${GSM_GSM_HEADER_FOUND}" = "1" ; then
445                AC_DEFINE_UNQUOTED([HAVE_GSM_GSM_HEADER], 1, [Define to indicate that gsm.h is in gsm/gsm.h])
446                GSM_OK=1
447             fi
448          fi
449          if test "${GSM_OK}" = "1" ; then
450             GSM_LIB="-lgsm"
451             if test "x${GSM_DIR}" != "x"; then
452                GSM_LIB="${gsmlibdir} ${GSM_LIB}"
453                GSM_INCLUDE="-I${GSM_DIR}/include"
454             fi
455             PBX_GSM=1
456             GSM_INTERNAL="no"
457          fi
458       fi
459    fi
460    if test "${GSM_INTERNAL}" = "yes"; then
461       PBX_GSM=1
462       AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
463    fi
466 AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h])
468 if test "${PBX_IKSEMEL}" = 1; then
469    AST_EXT_LIB_CHECK([GNUTLS], [gnutls], [gnutls_bye], [gnutls/gnutls.h], [-lz -lgcrypt -lgpg-error])
472 if test "${USE_IMAP_TK}" != "no"; then
473    if test "${IMAP_TK_DIR}" = ""; then
474       IMAP_TK_DIR=`pwd`"/../imap-2004g"
475       if test  -n "${IMAP_TK_MANDATORY}"; then
476          AC_MSG_NOTICE([The --with-imap option does not search your system for installed])
477          AC_MSG_NOTICE([c-client library/header files. Since you did not provide a path])
478          AC_MSG_NOTICE([the configure script will assume you have placed built the c-client])
479          AC_MSG_NOTICE([files at ${IMAP_TK_DIR}, as outlined in the doc/imapstorage.txt file.])
480       fi
481    fi
482    AC_MSG_CHECKING(for UW IMAP Toolkit c-client library)
483    saved_cppflags="${CPPFLAGS}"
484    saved_libs="${LIBS}"
485    if test -f ${IMAP_TK_DIR}/c-client/LDFLAGS ; then
486       imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
487    fi
488    CPPFLAGS="${CPPFLAGS} -I${IMAP_TK_DIR}/c-client"
489    LIBS="${LIBS} ${IMAP_TK_DIR}/c-client/c-client.a "`echo ${imap_ldflags}`
490    AC_LINK_IFELSE(
491         AC_LANG_PROGRAM(
492                 [#include "c-client.h"
493                 void mm_searched (MAILSTREAM *stream,unsigned long number)
494                 {
495                 }
496                 void mm_exists (MAILSTREAM *stream,unsigned long number)
497                 {
498                 }
499                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
500                 {
501                 }
502                 void mm_flags (MAILSTREAM *stream,unsigned long number)
503                 {
504                 }
505                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
506                 {
507                 }
508                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
509                 {
510                 }
511                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
512                 {
513                 }
514                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
515                 {
516                 }
517                 void mm_log (char *string,long errflg)
518                 {
519                 }
520                 void mm_dlog (char *string)
521                 {
522                 }
523                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
524                 {
525                 }
526                 void mm_critical (MAILSTREAM *stream)
527                 {
528                 }
529                 void mm_nocritical (MAILSTREAM *stream)
530                 {
531                 }
532                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
533                 {
534                 }
535                 void mm_fatal (char *string)
536                 {
537                 }],
538                 [
539                 MAILSTREAM *foo = mail_open(NULL, "", 0);
540                 ]
541         ),
542         [ac_cv_imap_tk="yes"],
543         [ac_cv_imap_tk="no"]
544    )
545    if test "${ac_cv_imap_tk}" = "yes"; then
546    AC_LINK_IFELSE(
547       AC_LANG_PROGRAM(
548          [#include "c-client.h"
549          void mm_searched (MAILSTREAM *stream,unsigned long number)
550          {
551          }
552          void mm_exists (MAILSTREAM *stream,unsigned long number)
553          {
554          }
555          void mm_expunged (MAILSTREAM *stream,unsigned long number)
556          {
557          }
558          void mm_flags (MAILSTREAM *stream,unsigned long number)
559          {
560          }
561          void mm_notify (MAILSTREAM *stream,char *string,long errflg)
562          {
563          }
564          void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
565          {
566          }
567          void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
568          {
569          }
570          void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
571          {
572          }
573          void mm_log (char *string,long errflg)
574          {
575          }
576          void mm_dlog (char *string)
577          {
578          }
579          void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
580          {
581          }
582          void mm_critical (MAILSTREAM *stream)
583          {
584          }
585          void mm_nocritical (MAILSTREAM *stream)
586          {
587          }
588          long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
589          {
590          }
591          void mm_fatal (char *string)
592          {
593          }],
594          [
595          long check = mail_expunge_full(NULL, "", 0);
596          ]
597       ),
598       [ac_cv_imap_tk2006="yes"],
599       [ac_cv_imap_tk2006="no"]
600   )
601   fi
602    CPPFLAGS="${saved_cppflags}"
603    LIBS="${saved_libs}"
604    if test "${ac_cv_imap_tk}" = "yes"; then
605       AC_MSG_RESULT(yes) 
606       IMAP_TK_LIB="${IMAP_TK_DIR}/c-client/c-client.a "`echo ${imap_ldflags}`
607       IMAP_TK_INCLUDE="-I${IMAP_TK_DIR}/c-client"
608       PBX_IMAP_TK=1
609       AC_DEFINE([HAVE_IMAP_TK], 1, [Define if your system has the UW IMAP Toolkit c-client library.])
610       if test "${ac_cv_imap_tk2006}" = "yes"; then
611          AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
612       fi
613    elif test -n "${IMAP_TK_MANDATORY}"; then
614       AC_MSG_RESULT(no) 
615       AC_MSG_NOTICE([***])
616       AC_MSG_NOTICE([*** The UW IMAP Toolkit installation on this system appears to be broken.])
617       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
618       AC_MSG_NOTICE([*** including --without-imap.])
619       exit 1
620    else
621       AC_MSG_RESULT(no) 
622    fi
625 # Needed by unixodbc
626 AST_EXT_LIB_CHECK([LTDL], [ltdl], [lt_dlinit], [ltdl.h], [])
628 AC_LANG_PUSH(C++)
630 if test "${USE_KDE}" != "no"; then
631    AC_MSG_CHECKING(for crashHandler in -lkdecore)
632    saved_libs="${LIBS}"
633    saved_cppflags="${CPPFLAGS}"
634    CPPFLAGS="${CPPFLAGS} -I${KDE_DIR}/include"
635    if test -d ${KDE_DIR}/lib; then
636       kdelibdir="${KDE_DIR}/lib"
637    else
638       kdelibdir="${KDE_DIR}"
639    fi
640    LIBS="${LIBS} -L${kdelibdir} -lkdecore"
642    AC_LINK_IFELSE(
643         [AC_LANG_PROGRAM(
644                         [#include "kcrash.h"],
645                         [KCrash::defaultCrashHandler(1);])
646         ],
647         [ac_cv_lib_kde_crash="yes"],
648         [ac_cv_lib_kde_crash="no"])
649                 
650    LIBS="${saved_libs}"
651    CPPFLAGS="${saved_cppflags}"
652         
653    if test "${ac_cv_lib_kde_crash}" = "yes"; then
654       AC_MSG_RESULT(yes) 
655       KDE_LIB="-lkdecore -lkdeui"
656       if test "${KDE_DIR}" != ""; then
657          KDE_LIB="-L${kdelibdir} ${KDE_LIB}"
658          KDE_INCLUDE="-I${KDE_DIR}/include"
659       fi
660       PBX_KDE=1
661       AC_DEFINE([HAVE_LIBKDE], 1, [Define if your system has the KDE libraries.])
662    elif test -n "${KDE_MANDATORY}"; then
663       AC_MSG_RESULT(no) 
664       AC_MSG_NOTICE([***])
665       AC_MSG_NOTICE([*** The KDE installation on this system appears to be broken.])
666       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
667       AC_MSG_NOTICE([*** including --without-kde.])
668       exit 1
669    else
670       AC_MSG_RESULT(no) 
671    fi
673 if test "${PBX_KDE}" = 1; then
674    AC_PATH_TOOL(KDEINIT, kdeinit, No)
675    if test ! x"${KDEINIT}" = xNo; then
676       KDEDIR=$(${DIRNAME} ${KDEINIT})
677       KDEDIR=$(${DIRNAME} ${KDEDIR})
678    fi
679    AC_SUBST([KDEDIR])
682 AC_LANG_POP
684 AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h])
686 if test "${PBX_MISDN}" = 1; then
687    AST_EXT_LIB_CHECK([ISDNNET], [isdnnet], [init_manager], [mISDNuser/isdn_net.h], [-lmISDN -lpthread])
688    AST_EXT_LIB_CHECK([SUPPSERV], [suppserv], [encodeFac], [mISDNuser/suppserv.h])
689    AC_CHECK_HEADER([linux/mISDNdsp.h], [AC_DEFINE_UNQUOTED([MISDN_1_2], 1, [Build chan_misdn for mISDN 1.2 or later.])])
692 AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
694 AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
696 NETSNMP_CONFIG=No
697 if test "${USE_NETSNMP}" != "no"; then  
698    if test "x${NETSNMP_DIR}" != "x"; then
699       AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No, [${NETSNMP_DIR}/bin])
700       if test x"${NETSNMP_CONFIG}" = xNo; then
701          AC_MSG_NOTICE([***])
702          AC_MSG_NOTICE([*** net-snmp-config was not found in the path you specified:])
703          AC_MSG_NOTICE([*** ${NETSNMP_DIR}/bin])
704          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
705          AC_MSG_NOTICE([*** including --without-netsnmp])
706          exit 1
707       fi
708    else
709       AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No)
710    fi
712 if test x"${NETSNMP_CONFIG}" != xNo; then
713    NETSNMP_libs=`${NETSNMP_CONFIG} --agent-libs`
714    
715    AC_CHECK_LIB([netsnmp], [snmp_register_callback], AC_DEFINE_UNQUOTED([HAVE_NETSNMP], 1,
716    [Define to indicate the Net-SNMP library]), [], ${NETSNMP_libs})
718    if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then
719       NETSNMP_LIB="${NETSNMP_libs}"
720       PBX_NETSNMP=1
721    elif test -n "${NETSNMP_MANDATORY}";
722    then
723       AC_MSG_NOTICE([***])
724       AC_MSG_NOTICE([*** The Net-SNMP installation on this system appears to be broken.])
725       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
726       AC_MSG_NOTICE([*** including --without-netsnmp])
727       exit 1
728    fi
729 elif test -n "${NETSNMP_MANDATORY}";
730 then
731    AC_MSG_NOTICE([***])
732    AC_MSG_NOTICE([*** The Net-SNMP installation on this system appears to be broken.])
733    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
734    AC_MSG_NOTICE([*** including --without-netsnmp])
735    exit 1
738 AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
740 AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
742 AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
744 if test "${USE_OSS}" != "no"; then
745 PBX_OSS=0
746 AC_CHECK_HEADER([linux/soundcard.h],
747                 [
748                 PBX_OSS=1
749                 AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
750                 ])
751 if test "$PBX_OSS" = "0"; then
752    AC_CHECK_HEADER([sys/soundcard.h],
753                    [
754                    PBX_OSS=1
755                    AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
756                    ])
758 if test "$PBX_OSS" = "0"; then
759    AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
763 PG_CONFIG=No
764 if test "${USE_PGSQL}" != "no"; then    
765    if test "x${PGSQL_DIR}" != "x"; then
766       AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
767       if test x"${PG_CONFIG}" = xNo; then
768          AC_MSG_NOTICE([***])
769          AC_MSG_NOTICE([*** pg_config was not found in the path you specified:])
770          AC_MSG_NOTICE([*** ${PGSQL_DIR}/bin])
771          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
772          AC_MSG_NOTICE([*** including --without-postgres])
773          exit 1
774       fi
775    else
776       AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
777    fi
779 if test "${PG_CONFIG}" != No; then
780    PGSQL_libdir=`${PG_CONFIG} --libdir`
781    PGSQL_includedir=`${PG_CONFIG} --includedir`
783    if test "x$?" != "x0" ; then
784       if test -n "${PGSQL_MANDATORY}" ; then
785          AC_MSG_NOTICE([***])
786          AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
787          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
788          AC_MSG_NOTICE([*** including --without-postgres])
789          exit 1
790           fi
791    else 
792       AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
793       [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
795       if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
796          PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
797          PGSQL_INCLUDE="-I${PGSQL_includedir}"
798          PBX_PGSQL=1
799       elif test -n "${PGSQL_MANDATORY}";
800       then
801          AC_MSG_NOTICE([***])
802          AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
803          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
804          AC_MSG_NOTICE([*** including --without-postgres])
805          exit 1
806       fi
807    fi
808 elif test -n "${PGSQL_MANDATORY}";
809 then
810    AC_MSG_NOTICE([***])
811    AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
812    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
813    AC_MSG_NOTICE([*** including --without-postgres])
814    exit 1
817 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
819 AST_EXT_LIB_CHECK([PRI], [pri], [pri_keypad_facility], [libpri.h])
821 if test "${USE_PWLIB}" != "no"; then
822         if test -n "${PWLIB_DIR}"; then
823                 PWLIBDIR="${PWLIB_DIR}"
824         fi
825         AST_CHECK_PWLIB()
826         AST_CHECK_PWLIB_VERSION([PWLib], [PWLIB], [ptbuildopts.h], [1], [9], [2])
827                 
828         if test "${HAS_PWLIB:-unset}" != "unset"; then
829                 AST_CHECK_OPENH323_PLATFORM()
831                 PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
833                 AST_CHECK_PWLIB_BUILD([PWLib], [PWLIB],
834                         [Define if your system has the PWLib libraries.],
835                         [#include "ptlib.h"],
836                         [BOOL q = PTime::IsDaylightSavings();])
837         fi
840 if test "${USE_PWLIB}" != "no" -a "x${ac_cv_lib_PWLIB}" != "xyes" -a -n "${PWLIB_MANDATORY}"; then
841    AC_MSG_NOTICE([***])
842    AC_MSG_NOTICE([*** The PWLIB installation on this system appears to be broken.])
843    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
844    AC_MSG_NOTICE([*** including --without-pwlib])
845    exit 1
848 if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
849         if test -n "${OPENH323_DIR}"; then
850                 OPENH323DIR="${OPENH323_DIR}"
851         fi
852         AST_CHECK_OPENH323()
853         AST_CHECK_PWLIB_VERSION([OpenH323], [OPENH323], [openh323buildopts.h], [1], [17], [3])
854         AST_CHECK_OPENH323_BUILD()
855         PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
856         AST_CHECK_PWLIB_BUILD([OpenH323], [OPENH323],
857                 [Define if your system has the OpenH323 libraries.],
858                 [#include "ptlib.h"
859                 #include "h323.h"
860                 #include "h323ep.h"],
861                 [H323EndPoint ep = H323EndPoint();],
862                 [${PWLIB_INCLUDE}], [${PWLIB_LIB}])
864 if test "${USE_OPENH323}" != "no" -a "x${ac_cv_lib_OPENH323}" != "xyes" -a -n "${OPENH323_MANDATORY}"; then
865    AC_MSG_NOTICE([***])
866    AC_MSG_NOTICE([*** The OPENH323 installation on this system appears to be broken.])
867    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
868    AC_MSG_NOTICE([*** including --without-h323])
869    exit 1
873 AC_LANG_PUSH(C++)
875 if test "${USE_QT}" != "no"; then
876    AC_MSG_CHECKING(for QDate in -lqt)
877    saved_libs="${LIBS}"
878    saved_cppflags="${CPPFLAGS}"
879    if test "x${QT_DIR}" != "x"; then
880       LIBS="${LIBS} -L${QT_DIR}/lib"
881       CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
882    fi
883    LIBS="${LIBS} -lqt"
884    qtlib="qt"
885    AC_LINK_IFELSE(
886         [
887                 AC_LANG_PROGRAM(
888                 [#include <qt3/qdatetime.h>],
889                 [QDate date();])
890         ],
891         [ac_cv_lib_qt_qt_date="yes"],
892         [ac_cv_lib_qt_qt_date="no"])
893    LIBS="${saved_libs}"
894    CPPFLAGS="${saved_cppflags}"
895         
896    if test "${ac_cv_lib_qt_qt_date}" = "no"; then
897       saved_libs="${LIBS}"
898       saved_cppflags="${CPPFLAGS}"
899       if test "x${QT_DIR}" != "x"; then
900          LIBS="${LIBS} -L${QT_DIR}/lib"
901          CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
902       fi
903       LIBS="${LIBS} -lqt-mt"
904       qtlib="qt-mt"     
905       AC_LINK_IFELSE(
906                 [
907                         AC_LANG_PROGRAM(
908                         [#include <qt3/qdatetime.h>],
909                         [QDate date();])
910                 ],
911                 [ac_cv_lib_qt_qt_date="yes"],
912                 [ac_cv_lib_qt_qt_date="no"])
913       LIBS="${saved_libs}"
914       CPPFLAGS="${saved_cppflags}"
915    fi   
917    if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
918       AC_MSG_RESULT(yes) 
919    else
920       AC_MSG_RESULT(no) 
921    fi
922         
923    if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
924       QT_LIB="-l${qtlib}"
925       if test "${QT_DIR}" != ""; then
926          QT_LIB="-L${QT_DIR}/lib ${QT_LIB}"
927          QT_INCLUDE="-I${QT_DIR}/include"
928       fi
929       PBX_QT=1
930       AC_DEFINE([HAVE_QT], 1, [Define if your system has the Qt library])
931       AC_PATH_TOOL(QTMOC, moc, No)
932    elif test -n "${QT_MANDATORY}"; 
933    then
934       AC_MSG_NOTICE([***])
935       AC_MSG_NOTICE([*** The Qt installation on this system appears to be broken.])
936       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
937       AC_MSG_NOTICE([*** including --without-qt.])
938       exit 1
939    fi
942 AC_LANG_POP
944 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
946 AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
948 AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
950 AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl2_connect], [openssl/ssl.h], [-lcrypto])
951 if test "$PBX_OPENSSL" = "1";
952 then
953     AST_EXT_LIB_CHECK([OSPTK], [osptk], [OSPPCryptoDecrypt], [osp/osp.h], [-lcrypto -lssl])
956 AST_EXT_LIB_CHECK([FREETDS], [tds], [tds_version], [tds.h])
957 if test "${PBX_FREETDS}" != "0";
958 then
959     case `grep TDS_VERSION_NO ${FREETDS_DIR:-/usr}/include/tdsver.h` in
960         *0.64*)
961                 FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_64"
962         ;;
963     *0.63*)
964         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_63"
965         ;;
966     *0.62*)
967         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_62"
968         ;;
969     *)
970         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_PRE_0_62"
971         ;;
972     esac
975 AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
977 AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
979 if test "${host_os}" != "linux-gnu" ; then
980   tonezone_extra="-lm"
983 AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/tonezone.h], [${tonezone_extra}])
985 AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
987 AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
989 AC_LANG_PUSH(C++)
991 if test "${USE_VPB}" != "no"; then
992    AC_MSG_CHECKING(for vpb_open in -lvpb)
993    saved_libs="${LIBS}"
994    saved_cppflags="${CPPFLAGS}"
995    if test "x${VPB_DIR}" != "x"; then
996       if test -d ${VPB_DIR}/lib; then
997          vpblibdir=${VPB_DIR}/lib
998       else
999          vpblibdir=${VPB_DIR}
1000       fi
1001       LIBS="${LIBS} -L${vpblibdir}"
1002       CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
1003    fi
1004    LIBS="${LIBS} -lvpb -lpthread"
1005    AC_LINK_IFELSE(
1006         [
1007         AC_LANG_PROGRAM(
1008         [#include <vpbapi.h>],
1009         [int q = vpb_open(0,0);])
1010         ],
1011         [       AC_MSG_RESULT(yes) 
1012                 ac_cv_lib_vpb_vpb_open="yes" 
1013         ],
1014         [       AC_MSG_RESULT(no) 
1015                 ac_cv_lib_vpb_vpb_open="no" 
1016         ]
1017         )
1018    LIBS="${saved_libs}"
1019    CPPFLAGS="${saved_cppflags}"
1020    if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
1021         VPB_LIB="-lvpb"
1022         if test "${VPB_DIR}" != ""; then
1023            VPB_LIB="-L${vpblibdir}  ${VPB_LIB}"
1024            VPB_INCLUDE="-I${VPB_DIR}/include"
1025         fi
1026         PBX_VPB=1
1027         AC_DEFINE([HAVE_VPB], 1, [Define if your system has the VoiceTronix API libraries.])
1028    elif test -n "${VPB_MANDATORY}"; then
1029       AC_MSG_NOTICE([***])
1030       AC_MSG_NOTICE([*** The VoiceTronix (vpb) installation on this system appears to be broken.])
1031       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1032       AC_MSG_NOTICE([*** including --without-vpb.])
1033       exit 1
1034    fi
1037 AC_LANG_POP
1039 AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
1041 if test "${USE_ZAPTEL}" != "no"; then
1042    AC_MSG_CHECKING(for ZT_DIAL_OP_CANCEL in zaptel/zaptel.h)
1043    saved_cppflags="${CPPFLAGS}"
1044    if test "x${ZAPTEL_DIR}" != "x"; then
1045       CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
1046    fi
1047    AC_COMPILE_IFELSE(
1048         [
1049         AC_LANG_PROGRAM(
1050         [#include <zaptel/zaptel.h>],
1051         [int foo = ZT_DIAL_OP_CANCEL;])
1052         ],
1053         [       AC_MSG_RESULT(yes) 
1054                 ac_cv_zaptel_h="yes" 
1055         ],
1056         [       AC_MSG_RESULT(no) 
1057                 ac_cv_zaptel_h="no" 
1058         ]
1059         )
1060    CPPFLAGS="${saved_cppflags}"
1061    if test "${ac_cv_zaptel_h}" = "yes"; then
1062         if test "${ZAPTEL_DIR}" != ""; then
1063            ZAPTEL_INCLUDE="-I${ZAPTEL_DIR}/include"
1064         fi
1065         PBX_ZAPTEL=1
1066         AC_DEFINE([HAVE_ZAPTEL], 1, [Define if your system has the Zaptel headers.])
1067    elif test -n "${ZAPTEL_MANDATORY}"; 
1068    then
1069       AC_MSG_NOTICE([***])
1070       AC_MSG_NOTICE([*** The Zaptel installation on this system appears to be broken.])
1071       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1072       AC_MSG_NOTICE([*** including --without-zaptel.])
1073       exit 1
1074    fi
1077 if test "${PBX_ZAPTEL}" = 1; then
1078    AC_MSG_CHECKING(for ZT_EVENT_REMOVED in zaptel/zaptel.h)
1079    saved_cppflags="${CPPFLAGS}"
1080    if test "x${ZAPTEL_DIR}" != "x"; then
1081       CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
1082    fi
1083    AC_COMPILE_IFELSE(
1084         [
1085         AC_LANG_PROGRAM(
1086         [#include <zaptel/zaptel.h>],
1087         [int foo = ZT_EVENT_REMOVED;])
1088         ],
1089         [       AC_MSG_RESULT(yes) 
1090                 ac_cv_zaptel_vldtmf="yes" 
1091         ],
1092         [       AC_MSG_RESULT(no) 
1093                 ac_cv_zaptel_vldtmf="no" 
1094         ]
1095         )
1096    CPPFLAGS="${saved_cppflags}"
1097    if test "${ac_cv_zaptel_vldtmf}" = "yes"; then
1098         PBX_ZAPTEL_VLDTMF=1
1099    fi
1100    AC_MSG_CHECKING(for ZT_TCOP_ALLOCATE in zaptel/zaptel.h)
1101    saved_cppflags="${CPPFLAGS}"
1102    if test "x${ZAPTEL_DIR}" != "x"; then
1103       CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
1104    fi
1105    AC_COMPILE_IFELSE(
1106         [
1107         AC_LANG_PROGRAM(
1108         [#include <zaptel/zaptel.h>],
1109         [int foo = ZT_TCOP_ALLOCATE;])
1110         ],
1111         [       AC_MSG_RESULT(yes) 
1112                 ac_cv_zaptel_transcode="yes" 
1113         ],
1114         [       AC_MSG_RESULT(no) 
1115                 ac_cv_zaptel_transcode="no" 
1116         ]
1117         )
1118    CPPFLAGS="${saved_cppflags}"
1119    if test "${ac_cv_zaptel_transcode}" = "yes"; then
1120         PBX_ZAPTEL_TRANSCODE=1
1121    fi
1123 AC_SUBST(PBX_ZAPTEL_VLDTMF)
1124 AC_SUBST(PBX_ZAPTEL_TRANSCODE)
1126 EDITLINE_LIB=""
1127 if test "x$TERMCAP_LIB" != "x" ; then
1128   EDITLINE_LIB="$TERMCAP_LIB"
1129 elif test "x$TINFO_LIB" != "x" ; then
1130   EDITLINE_LIB="$TINFO_LIB"
1131 elif test "x$CURSES_LIB" != "x" ; then
1132   EDITLINE_LIB="$CURSES_LIB"
1133 elif test "x$NCURSES_LIB" != "x" ; then
1134   EDITLINE_LIB="$NCURSES_LIB"
1135 else
1136   AC_MSG_ERROR(*** termcap support not found)
1138 AC_SUBST(EDITLINE_LIB)
1140 AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
1141 AC_SUBST(PBX_H323)
1143 AC_CHECK_HEADER([linux/compiler.h],
1144                 [AC_DEFINE_UNQUOTED([HAVE_LINUX_COMPILER_H], 1, [Define to 1 if your system has linux/compiler.h.])])
1146 AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
1147                                    #include <linux/version.h>
1148                                    #ifdef HAVE_LINUX_COMPILER_H
1149                                    #include <linux/compiler.h>
1150                                    #endif
1151                                    ])
1152 AC_SUBST(PBX_IXJUSER)
1154 PBX_GTK=0
1155 AC_CHECK_TOOL(GTKCONFIG, gtk-config, No)
1156 if test ! "x${GTKCONFIG}" = xNo; then
1157    GTK_INCLUDE=$(${GTKCONFIG} --cflags gthread)
1158    GTK_LIB=$(${GTKCONFIG} --libs gthread)
1159    PBX_GTK=1
1160    AC_DEFINE([HAVE_GTK], 1, [Define if your system has the GTK libraries.])
1162 AC_SUBST(PBX_GTK)
1163 AC_SUBST(GTK_INCLUDE)
1164 AC_SUBST(GTK_LIB)
1166 PBX_GTK2=0
1167 AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
1168 if test ! "x${PKGCONFIG}" = xNo; then
1169    GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null)
1170    GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs)
1171    PBX_GTK2=1
1172    AC_DEFINE([HAVE_GTK2], 1, [Define if your system has the GTK2 libraries.])
1174 AC_SUBST(PBX_GTK2)
1175 AC_SUBST(GTK2_INCLUDE)
1176 AC_SUBST(GTK2_LIB)
1178 if test "${USE_CURL}" != "no"; then
1179    AC_PATH_TOOL([CURL_CONFIG], [curl-config], No)
1180    if test ! x"${CURL_CONFIG}" = xNo; then
1181    # check for version
1182       if test $(printf "%d" 0x$(${CURL_CONFIG} --vernum)) -ge $(printf "%d" 0x070907); then
1183          CURL_INCLUDE=$(${CURL_CONFIG} --cflags)
1184          CURL_LIB=$(${CURL_CONFIG} --libs)
1186          AC_MSG_CHECKING(for curl_version() in curl/curl.h)
1187          saved_cppflags="${CPPFLAGS}"
1188          CPPFLAGS="${CPPFLAGS} ${CURL_INCLUDE}"
1189          AC_COMPILE_IFELSE(
1190             [AC_LANG_PROGRAM(
1191                 [#include <curl/curl.h>],
1192                     [curl_version();])
1193             ],[
1194                 AC_MSG_RESULT(yes)
1195                 ac_cv_curl_h="yes"
1196             ],[
1197                 AC_MSG_RESULT(no)
1198                 ac_cv_curl_h="no"
1199             ]
1200          )
1201          CPPFLAGS="${saved_cppflags}"
1202          if test "${ac_cv_curl_h}" = "yes"; then
1203              PBX_CURL=1
1204              AC_DEFINE([HAVE_CURL], 1, [Define if your system has the curl libraries.])
1205          fi
1206       fi
1207    fi
1210 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
1211 AC_OUTPUT
1213 if test "x${silent}" != "xyes" ; then
1214 echo
1215 echo "               .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=..      "
1216 echo "            .\$7\$7..          .7\$\$7:.    "
1217 echo "          .\$\$:.                 ,\$7.7   "
1218 echo "        .\$7.     7\$\$\$\$           .\$\$77  "
1219 echo "     ..\$\$.       \$\$\$\$\$            .\$\$\$7 "
1220 echo "    ..7\$   .?.   \$\$\$\$\$   .?.       7\$\$\$."
1221 echo "   \$.\$.   .\$\$\$7. \$\$\$\$7 .7\$\$\$.      .\$\$\$."
1222 echo " .777.   .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7.      \$\$\$,"
1223 echo " \$\$\$~      .7\$\$\$\$\$\$\$\$\$\$\$\$\$7.       .\$\$\$."
1224 echo ".\$\$7          .7\$\$\$\$\$\$\$7:          ?\$\$\$."
1225 echo "\$\$\$          ?7\$\$\$\$\$\$\$\$\$\$I        .\$\$\$7 "
1226 echo "\$\$\$       .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$      :\$\$\$. "
1227 echo "\$\$\$       \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$    .\$\$\$.  "
1228 echo "\$\$\$        \$\$\$   7\$\$\$7  .\$\$\$    .\$\$\$.   "
1229 echo "\$\$\$\$             \$\$\$\$7         .\$\$\$.    "
1230 echo "7\$\$\$7            7\$\$\$\$        7\$\$\$      "
1231 echo " \$\$\$\$\$                        \$\$\$       "
1232 echo "  \$\$\$\$7.                       \$\$  (TM)     "
1233 echo "   \$\$\$\$\$\$\$.           .7\$\$\$\$\$\$  \$\$      "
1234 echo "     \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$      "
1235 echo "       \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$.                "
1236 echo
1239 AC_MSG_NOTICE(Package configured for: )
1240 AC_MSG_NOTICE( OS type  : $host_os)
1241 AC_MSG_NOTICE( Host CPU : $host_cpu)
1242 if test "${cross_compiling}" = "yes"; then
1243    AC_MSG_NOTICE( Cross Compilation = YES)