change protocol for downloads as well
[asterisk-bristuff.git] / configure.ac
blobec0ec155e68802970a9a9dc4d808196840277924
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([VORBIS], [Vorbis], [vorbis])
208 AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
209 AST_EXT_LIB_SETUP([ZLIB], [zlib], [z])
210 AST_EXT_LIB_SETUP([ZAPTEL], [Zaptel], [zaptel])
212 # check for basic system features and functionality before
213 # checking for package libraries
215 AC_FUNC_ALLOCA
216 AC_HEADER_DIRENT
217 AC_HEADER_STDC
218 AC_HEADER_SYS_WAIT
219 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])
221 AC_SYS_LARGEFILE
223 # Checks for typedefs, structures, and compiler characteristics.
224 AC_HEADER_STDBOOL
225 AC_C_CONST
226 AC_TYPE_UID_T
227 AC_C_INLINE
228 AC_TYPE_MODE_T
229 AC_TYPE_OFF_T
230 AC_TYPE_PID_T
231 AC_TYPE_SIZE_T
232 AC_CHECK_MEMBERS([struct stat.st_blksize])
233 AC_HEADER_TIME
234 AC_STRUCT_TM
235 AC_C_VOLATILE
236 AC_CHECK_TYPES([ptrdiff_t])
238 # Checks for library functions.
239 AC_FUNC_CHOWN
240 AC_FUNC_CLOSEDIR_VOID
241 AC_FUNC_ERROR_AT_LINE
242 AST_FUNC_FORK
243 AC_FUNC_FSEEKO
244 AC_PROG_GCC_TRADITIONAL
245 # XXX: these are commented out until we determine whether it matters if our malloc()
246 # acts exactly like glibc's or not
247 # AC_FUNC_MALLOC
248 # AC_FUNC_REALLOC
249 AC_FUNC_MEMCMP
250 AC_FUNC_MKTIME
251 AC_FUNC_MMAP
252 AC_FUNC_SELECT_ARGTYPES
253 AC_FUNC_SETVBUF_REVERSED
254 AC_TYPE_SIGNAL
255 AC_FUNC_STAT
256 AC_FUNC_STRCOLL
257 AC_FUNC_STRFTIME
258 AC_FUNC_STRNLEN
259 AC_FUNC_STRTOD
260 AC_FUNC_UTIME_NULL
261 AC_FUNC_VPRINTF
262 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])
264 # some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
265 AC_CHECK_FUNCS([gethostbyname_r])
267 AC_MSG_CHECKING(for PTHREAD_RWLOCK_INITIALIZER)
268 AC_LINK_IFELSE(
269         AC_LANG_PROGRAM([#include <pthread.h>],
270                         [int foo = PTHREAD_RWLOCK_INITIALIZER;]),
271         AC_MSG_RESULT(yes)
272         AC_DEFINE([HAVE_PTHREAD_RWLOCK_INITIALIZER], 1, [Define to 1 if your system has PTHREAD_RWLOCK_INITIALIZER.]),
273         AC_MSG_RESULT(no)
276 AC_MSG_CHECKING(for PTHREAD_RWLOCK_PREFER_WRITER_NP)
277 AC_LINK_IFELSE(
278         AC_LANG_PROGRAM([#include <pthread.h>],
279                         [int foo = PTHREAD_RWLOCK_PREFER_WRITER_NP;]),
280         AC_MSG_RESULT(yes)
281         AC_DEFINE([HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP], 1, [Define to 1 if your system has PTHREAD_RWLOCK_PREFER_WRITER_NP.]),
282         AC_MSG_RESULT(no)
285 AC_MSG_CHECKING(for compiler atomic operations)
286 AC_LINK_IFELSE(
287 AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);]),
288 AC_MSG_RESULT(yes)
289 AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides atomic operations.]),
290 AC_MSG_RESULT(no)
293 AST_GCC_ATTRIBUTE(pure)
294 AST_GCC_ATTRIBUTE(malloc)
295 AST_GCC_ATTRIBUTE(const)
296 AST_GCC_ATTRIBUTE(unused)
297 AST_GCC_ATTRIBUTE(always_inline)
299 AC_MSG_CHECKING(for -ffunction-sections support)
300 saved_CFLAGS="${CFLAGS}"
301 CFLAGS="${CFLAGS} -ffunction-sections"
302 AC_COMPILE_IFELSE(
303         AC_LANG_PROGRAM([], [int x = 1;]),
304         AC_MSG_RESULT(yes)
305         [saved_LDFLAGS="${LDFLAGS}"]
306         [LDFLAGS="${LDFLAGS} -Wl,--gc-sections"]
307         AC_MSG_CHECKING(for --gc-sections support)
308         AC_LINK_IFELSE(
309                 AC_LANG_PROGRAM([], [int x = 1;]),
310                 AC_MSG_RESULT(yes)
311                 [GC_CFLAGS="-ffunction-sections"]
312                 [[GC_LDFLAGS="-Wl,--gc-sections"]],
313                 AC_MSG_RESULT(no)
314         )
315         [LDFLAGS="${saved_LDFLAGS}"],
316         AC_MSG_RESULT(no)
318 CFLAGS="${saved_CFLAGS}"
319 AC_SUBST(GC_CFLAGS)
320 AC_SUBST(GC_LDFLAGS)
322 AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
323 if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
324    AC_MSG_RESULT(yes)
325    AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
326 else
327         AC_MSG_RESULT(no)
328         AST_DECLARATION_AFTER_STATEMENT=
330 AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
332 AC_MSG_CHECKING(for res_ninit)
333 AC_LINK_IFELSE(
334         AC_LANG_PROGRAM([#include <resolv.h>],
335                         [int foo = res_ninit(NULL);]),
336         AC_MSG_RESULT(yes)
337         AC_DEFINE([HAVE_RES_NINIT], 1, [Define to 1 if your system has the re-entrant resolver functions.])
338         AC_MSG_CHECKING(for res_ndestroy)
339         AC_LINK_IFELSE(
340                 AC_LANG_PROGRAM([#include <resolv.h>],
341                                 [int foo = res_ndestroy(NULL);]),
342                 AC_MSG_RESULT(yes)
343                 AC_DEFINE([HAVE_RES_NDESTROY], 1, [Define to 1 if your system has the ndestroy resolver function.]),
344                 AC_MSG_RESULT(no)
345         ),
346         AC_MSG_RESULT(no)
349 AC_MSG_CHECKING(for RTLD_NOLOAD)
350 AC_LINK_IFELSE(
351         AC_LANG_PROGRAM([#include <dlfcn.h>],
352                         [int foo = RTLD_NOLOAD;]),
353         AC_MSG_RESULT(yes)
354         AC_DEFINE([HAVE_RTLD_NOLOAD], 1, [Define to 1 if your system has a dynamic linker that supports RTLD_NOLOAD.]),
355         AC_MSG_RESULT(no)
358 AC_MSG_CHECKING(for IP_MTU_DISCOVER)
359 AC_LINK_IFELSE(
360         AC_LANG_PROGRAM([#include <netinet/in.h>],
361                         [int foo = IP_MTU_DISCOVER;]),
362         AC_MSG_RESULT(yes)
363         AC_DEFINE([HAVE_IP_MTU_DISCOVER], 1, [Define to 1 if your system has PMTU discovery on UDP sockets.]),
364         AC_MSG_RESULT(no)
367 AC_CHECK_HEADER([libkern/OSAtomic.h],
368                 [AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
370 AC_CHECK_SIZEOF(int)
372 # do the package library checks now
374 AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
376 AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
378 GSM_INTERNAL="yes"
379 AC_SUBST(GSM_INTERNAL)
380 GSM_SYSTEM="yes"
381 if test "${USE_GSM}" != "no"; then
382    if test "${GSM_DIR}" = "internal"; then
383       GSM_SYSTEM="no"
384    elif test "${GSM_DIR}" != ""; then
385       GSM_INTERNAL="no"
386    fi
387    if test "${GSM_SYSTEM}" = "yes"; then
388       gsmlibdir=""
389       if test "x${GSM_DIR}" != "x"; then
390          if test -d ${GSM_DIR}/lib; then
391             gsmlibdir="-L${GSM_DIR}/lib"
392          else
393             gsmlibdir="-L${GSM_DIR}"
394          fi
395       fi
396       AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
397       [Define to indicate the GSM library]), [], ${gsmlibdir})
398       if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
399          if test "x${GSM_DIR}" != "x" ; then
400             AC_CHECK_HEADER([${GSM_DIR}/include/gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
401             AC_CHECK_HEADER([${GSM_DIR}/include/gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
402          else
403             AC_CHECK_HEADER([gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
404             AC_CHECK_HEADER([gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
405          fi
406          if test "${GSM_HEADER_FOUND}" = "0" ; then
407             if test "{GSM_GSM_HEADER_FOUND}" = "0" ; then
408                if test "x${GSM_MANDATORY}" = "xyes" ; then
409                   AC_MSG_NOTICE([***])
410                   AC_MSG_NOTICE([*** It appears that you do not have the gsm development package installed.])
411                   AC_MSG_NOTICE([*** Please install it to include ${GSM_DESCRIP} support, or re-run configure])
412                   AC_MSG_NOTICE([*** without explicitly specifying --with-${GSM_OPTION}])
413                   exit 1
414                fi
415             fi
416          fi
417          GSM_OK=0
418          if test "${GSM_HEADER_FOUND}" = "1" ; then
419             AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
420             GSM_OK=1
421          else
422             if test "${GSM_GSM_HEADER_FOUND}" = "1" ; then
423                AC_DEFINE_UNQUOTED([HAVE_GSM_GSM_HEADER], 1, [Define to indicate that gsm.h is in gsm/gsm.h])
424                GSM_OK=1
425             fi
426          fi
427          if test "${GSM_OK}" = "1" ; then
428             GSM_LIB="-lgsm"
429             if test "x${GSM_DIR}" != "x"; then
430                GSM_LIB="${gsmlibdir} ${GSM_LIB}"
431                GSM_INCLUDE="-I${GSM_DIR}/include"
432             fi
433             PBX_GSM=1
434             GSM_INTERNAL="no"
435          fi
436       fi
437    fi
438    if test "${GSM_INTERNAL}" = "yes"; then
439       PBX_GSM=1
440       AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
441    fi
444 AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h])
446 if test "${PBX_IKSEMEL}" = 1; then
447    AST_EXT_LIB_CHECK([GNUTLS], [gnutls], [gnutls_bye], [gnutls/gnutls.h], [-lz -lgcrypt -lgpg-error])
450 if test "${USE_IMAP_TK}" != "no"; then
451    if test "${IMAP_TK_DIR}" = ""; then
452       IMAP_TK_DIR=`pwd`"/../imap-2004g"
453       if test  -n "${IMAP_TK_MANDATORY}"; then
454          AC_MSG_NOTICE([The --with-imap option does not search your system for installed])
455          AC_MSG_NOTICE([c-client library/header files. Since you did not provide a path])
456          AC_MSG_NOTICE([the configure script will assume you have placed built the c-client])
457          AC_MSG_NOTICE([files at ${IMAP_TK_DIR}, as outlined in the doc/imapstorage.txt file.])
458       fi
459    fi
460    AC_MSG_CHECKING(for UW IMAP Toolkit c-client library)
461    saved_cppflags="${CPPFLAGS}"
462    saved_libs="${LIBS}"
463    if test -f ${IMAP_TK_DIR}/c-client/LDFLAGS ; then
464       imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
465    fi
466    CPPFLAGS="${CPPFLAGS} -I${IMAP_TK_DIR}/c-client"
467    LIBS="${LIBS} ${IMAP_TK_DIR}/c-client/c-client.a "`echo ${imap_ldflags}`
468    AC_LINK_IFELSE(
469         AC_LANG_PROGRAM(
470                 [#include "c-client.h"
471                 void mm_searched (MAILSTREAM *stream,unsigned long number)
472                 {
473                 }
474                 void mm_exists (MAILSTREAM *stream,unsigned long number)
475                 {
476                 }
477                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
478                 {
479                 }
480                 void mm_flags (MAILSTREAM *stream,unsigned long number)
481                 {
482                 }
483                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
484                 {
485                 }
486                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
487                 {
488                 }
489                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
490                 {
491                 }
492                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
493                 {
494                 }
495                 void mm_log (char *string,long errflg)
496                 {
497                 }
498                 void mm_dlog (char *string)
499                 {
500                 }
501                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
502                 {
503                 }
504                 void mm_critical (MAILSTREAM *stream)
505                 {
506                 }
507                 void mm_nocritical (MAILSTREAM *stream)
508                 {
509                 }
510                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
511                 {
512                 }
513                 void mm_fatal (char *string)
514                 {
515                 }],
516                 [
517                 MAILSTREAM *foo = mail_open(NULL, "", 0);
518                 ]
519         ),
520         [ac_cv_imap_tk="yes"],
521         [ac_cv_imap_tk="no"]
522    )
523    if test "${ac_cv_imap_tk}" = "yes"; then
524    AC_LINK_IFELSE(
525       AC_LANG_PROGRAM(
526          [#include "c-client.h"
527          void mm_searched (MAILSTREAM *stream,unsigned long number)
528          {
529          }
530          void mm_exists (MAILSTREAM *stream,unsigned long number)
531          {
532          }
533          void mm_expunged (MAILSTREAM *stream,unsigned long number)
534          {
535          }
536          void mm_flags (MAILSTREAM *stream,unsigned long number)
537          {
538          }
539          void mm_notify (MAILSTREAM *stream,char *string,long errflg)
540          {
541          }
542          void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
543          {
544          }
545          void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
546          {
547          }
548          void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
549          {
550          }
551          void mm_log (char *string,long errflg)
552          {
553          }
554          void mm_dlog (char *string)
555          {
556          }
557          void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
558          {
559          }
560          void mm_critical (MAILSTREAM *stream)
561          {
562          }
563          void mm_nocritical (MAILSTREAM *stream)
564          {
565          }
566          long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
567          {
568          }
569          void mm_fatal (char *string)
570          {
571          }],
572          [
573          long check = mail_expunge_full(NULL, "", 0);
574          ]
575       ),
576       [ac_cv_imap_tk2006="yes"],
577       [ac_cv_imap_tk2006="no"]
578   )
579   fi
580    CPPFLAGS="${saved_cppflags}"
581    LIBS="${saved_libs}"
582    if test "${ac_cv_imap_tk}" = "yes"; then
583       AC_MSG_RESULT(yes) 
584       IMAP_TK_LIB="${IMAP_TK_DIR}/c-client/c-client.a "`echo ${imap_ldflags}`
585       IMAP_TK_INCLUDE="-I${IMAP_TK_DIR}/c-client"
586       PBX_IMAP_TK=1
587       AC_DEFINE([HAVE_IMAP_TK], 1, [Define if your system has the UW IMAP Toolkit c-client library.])
588       if test "${ac_cv_imap_tk2006}" = "yes"; then
589          AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
590       fi
591    elif test -n "${IMAP_TK_MANDATORY}"; then
592       AC_MSG_RESULT(no) 
593       AC_MSG_NOTICE([***])
594       AC_MSG_NOTICE([*** The UW IMAP Toolkit installation on this system appears to be broken.])
595       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
596       AC_MSG_NOTICE([*** including --without-imap.])
597       exit 1
598    else
599       AC_MSG_RESULT(no) 
600    fi
603 # Needed by unixodbc
604 AST_EXT_LIB_CHECK([LTDL], [ltdl], [lt_dlinit], [ltdl.h], [])
606 AC_LANG_PUSH(C++)
608 if test "${USE_KDE}" != "no"; then
609    AC_MSG_CHECKING(for crashHandler in -lkdecore)
610    saved_libs="${LIBS}"
611    saved_cppflags="${CPPFLAGS}"
612    CPPFLAGS="${CPPFLAGS} -I${KDE_DIR}/include"
613    if test -d ${KDE_DIR}/lib; then
614       kdelibdir="${KDE_DIR}/lib"
615    else
616       kdelibdir="${KDE_DIR}"
617    fi
618    LIBS="${LIBS} -L${kdelibdir} -lkdecore"
620    AC_LINK_IFELSE(
621         [AC_LANG_PROGRAM(
622                         [#include "kcrash.h"],
623                         [KCrash::defaultCrashHandler(1);])
624         ],
625         [ac_cv_lib_kde_crash="yes"],
626         [ac_cv_lib_kde_crash="no"])
627                 
628    LIBS="${saved_libs}"
629    CPPFLAGS="${saved_cppflags}"
630         
631    if test "${ac_cv_lib_kde_crash}" = "yes"; then
632       AC_MSG_RESULT(yes) 
633       KDE_LIB="-lkdecore -lkdeui"
634       if test "${KDE_DIR}" != ""; then
635          KDE_LIB="-L${kdelibdir} ${KDE_LIB}"
636          KDE_INCLUDE="-I${KDE_DIR}/include"
637       fi
638       PBX_KDE=1
639       AC_DEFINE([HAVE_LIBKDE], 1, [Define if your system has the KDE libraries.])
640    elif test -n "${KDE_MANDATORY}"; then
641       AC_MSG_RESULT(no) 
642       AC_MSG_NOTICE([***])
643       AC_MSG_NOTICE([*** The KDE installation on this system appears to be broken.])
644       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
645       AC_MSG_NOTICE([*** including --without-kde.])
646       exit 1
647    else
648       AC_MSG_RESULT(no) 
649    fi
651 if test "${PBX_KDE}" = 1; then
652    AC_PATH_TOOL(KDEINIT, kdeinit, No)
653    if test ! x"${KDEINIT}" = xNo; then
654       KDEDIR=$(${DIRNAME} ${KDEINIT})
655       KDEDIR=$(${DIRNAME} ${KDEDIR})
656    fi
657    AC_SUBST([KDEDIR])
660 AC_LANG_POP
662 AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h])
664 if test "${PBX_MISDN}" = 1; then
665    AST_EXT_LIB_CHECK([ISDNNET], [isdnnet], [init_manager], [mISDNuser/isdn_net.h], [-lmISDN -lpthread])
666    AST_EXT_LIB_CHECK([SUPPSERV], [suppserv], [encodeFac], [mISDNuser/suppserv.h])
667    AC_CHECK_HEADER([linux/mISDNdsp.h], [AC_DEFINE_UNQUOTED([MISDN_1_2], 1, [Build chan_misdn for mISDN 1.2 or later.])])
670 AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
672 AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
674 NETSNMP_CONFIG=No
675 if test "${USE_NETSNMP}" != "no"; then  
676    if test "x${NETSNMP_DIR}" != "x"; then
677       AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No, [${NETSNMP_DIR}/bin])
678       if test x"${NETSNMP_CONFIG}" = xNo; then
679          AC_MSG_NOTICE([***])
680          AC_MSG_NOTICE([*** net-snmp-config was not found in the path you specified:])
681          AC_MSG_NOTICE([*** ${NETSNMP_DIR}/bin])
682          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
683          AC_MSG_NOTICE([*** including --without-netsnmp])
684          exit 1
685       fi
686    else
687       AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No)
688    fi
690 if test x"${NETSNMP_CONFIG}" != xNo; then
691    NETSNMP_libs=`${NETSNMP_CONFIG} --agent-libs`
692    
693    AC_CHECK_LIB([netsnmp], [snmp_register_callback], AC_DEFINE_UNQUOTED([HAVE_NETSNMP], 1,
694    [Define to indicate the Net-SNMP library]), [], ${NETSNMP_libs})
696    if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then
697       NETSNMP_LIB="${NETSNMP_libs}"
698       PBX_NETSNMP=1
699    elif test -n "${NETSNMP_MANDATORY}";
700    then
701       AC_MSG_NOTICE([***])
702       AC_MSG_NOTICE([*** The Net-SNMP installation on this system appears to be broken.])
703       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
704       AC_MSG_NOTICE([*** including --without-netsnmp])
705       exit 1
706    fi
707 elif test -n "${NETSNMP_MANDATORY}";
708 then
709    AC_MSG_NOTICE([***])
710    AC_MSG_NOTICE([*** The Net-SNMP installation on this system appears to be broken.])
711    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
712    AC_MSG_NOTICE([*** including --without-netsnmp])
713    exit 1
716 AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
718 AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
720 AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
722 if test "${USE_OSS}" != "no"; then
723 PBX_OSS=0
724 AC_CHECK_HEADER([linux/soundcard.h],
725                 [
726                 PBX_OSS=1
727                 AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
728                 ])
729 if test "$PBX_OSS" = "0"; then
730    AC_CHECK_HEADER([sys/soundcard.h],
731                    [
732                    PBX_OSS=1
733                    AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
734                    ])
736 if test "$PBX_OSS" = "0"; then
737    AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
741 PG_CONFIG=No
742 if test "${USE_PGSQL}" != "no"; then    
743    if test "x${PGSQL_DIR}" != "x"; then
744       AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
745       if test x"${PG_CONFIG}" = xNo; then
746          AC_MSG_NOTICE([***])
747          AC_MSG_NOTICE([*** pg_config was not found in the path you specified:])
748          AC_MSG_NOTICE([*** ${PGSQL_DIR}/bin])
749          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
750          AC_MSG_NOTICE([*** including --without-postgres])
751          exit 1
752       fi
753    else
754       AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
755    fi
757 if test "${PG_CONFIG}" != No; then
758    PGSQL_libdir=`${PG_CONFIG} --libdir`
759    PGSQL_includedir=`${PG_CONFIG} --includedir`
761    if test "x$?" != "x0" ; then
762       if test -n "${PGSQL_MANDATORY}" ; then
763          AC_MSG_NOTICE([***])
764          AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
765          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
766          AC_MSG_NOTICE([*** including --without-postgres])
767          exit 1
768           fi
769    else 
770       AC_CHECK_LIB([pq], [PQexec], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
771       [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
773       if test "${ac_cv_lib_pq_PQexec}" = "yes"; then
774          PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
775          PGSQL_INCLUDE="-I${PGSQL_includedir}"
776          PBX_PGSQL=1
777       elif test -n "${PGSQL_MANDATORY}";
778       then
779          AC_MSG_NOTICE([***])
780          AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
781          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
782          AC_MSG_NOTICE([*** including --without-postgres])
783          exit 1
784       fi
785    fi
786 elif test -n "${PGSQL_MANDATORY}";
787 then
788    AC_MSG_NOTICE([***])
789    AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
790    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
791    AC_MSG_NOTICE([*** including --without-postgres])
792    exit 1
795 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
797 AST_EXT_LIB_CHECK([PRI], [pri], [pri_keypad_facility], [libpri.h])
799 if test "${USE_PWLIB}" != "no"; then
800         if test -n "${PWLIB_DIR}"; then
801                 PWLIBDIR="${PWLIB_DIR}"
802         fi
803         AST_CHECK_PWLIB()
804         AST_CHECK_PWLIB_VERSION([PWLib], [PWLIB], [ptbuildopts.h], [1], [9], [2])
805                 
806         if test "${HAS_PWLIB:-unset}" != "unset"; then
807                 AST_CHECK_OPENH323_PLATFORM()
809                 PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
811                 AST_CHECK_PWLIB_BUILD([PWLib], [PWLIB],
812                         [Define if your system has the PWLib libraries.],
813                         [#include "ptlib.h"],
814                         [BOOL q = PTime::IsDaylightSavings();])
815         fi
818 if test "${USE_PWLIB}" != "no" -a "x${ac_cv_lib_PWLIB}" != "xyes" -a -n "${PWLIB_MANDATORY}"; then
819    AC_MSG_NOTICE([***])
820    AC_MSG_NOTICE([*** The PWLIB installation on this system appears to be broken.])
821    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
822    AC_MSG_NOTICE([*** including --without-pwlib])
823    exit 1
826 if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
827         if test -n "${OPENH323_DIR}"; then
828                 OPENH323DIR="${OPENH323_DIR}"
829         fi
830         AST_CHECK_OPENH323()
831         AST_CHECK_PWLIB_VERSION([OpenH323], [OPENH323], [openh323buildopts.h], [1], [17], [3])
832         AST_CHECK_OPENH323_BUILD()
833         PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
834         AST_CHECK_PWLIB_BUILD([OpenH323], [OPENH323],
835                 [Define if your system has the OpenH323 libraries.],
836                 [#include "ptlib.h"
837                 #include "h323.h"
838                 #include "h323ep.h"],
839                 [H323EndPoint ep = H323EndPoint();],
840                 [${PWLIB_INCLUDE}], [${PWLIB_LIB}])
842 if test "${USE_OPENH323}" != "no" -a "x${ac_cv_lib_OPENH323}" != "xyes" -a -n "${OPENH323_MANDATORY}"; then
843    AC_MSG_NOTICE([***])
844    AC_MSG_NOTICE([*** The OPENH323 installation on this system appears to be broken.])
845    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
846    AC_MSG_NOTICE([*** including --without-h323])
847    exit 1
851 AC_LANG_PUSH(C++)
853 if test "${USE_QT}" != "no"; then
854    AC_MSG_CHECKING(for QDate in -lqt)
855    saved_libs="${LIBS}"
856    saved_cppflags="${CPPFLAGS}"
857    if test "x${QT_DIR}" != "x"; then
858       LIBS="${LIBS} -L${QT_DIR}/lib"
859       CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
860    fi
861    LIBS="${LIBS} -lqt"
862    qtlib="qt"
863    AC_LINK_IFELSE(
864         [
865                 AC_LANG_PROGRAM(
866                 [#include <qt3/qdatetime.h>],
867                 [QDate date();])
868         ],
869         [ac_cv_lib_qt_qt_date="yes"],
870         [ac_cv_lib_qt_qt_date="no"])
871    LIBS="${saved_libs}"
872    CPPFLAGS="${saved_cppflags}"
873         
874    if test "${ac_cv_lib_qt_qt_date}" = "no"; then
875       saved_libs="${LIBS}"
876       saved_cppflags="${CPPFLAGS}"
877       if test "x${QT_DIR}" != "x"; then
878          LIBS="${LIBS} -L${QT_DIR}/lib"
879          CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
880       fi
881       LIBS="${LIBS} -lqt-mt"
882       qtlib="qt-mt"     
883       AC_LINK_IFELSE(
884                 [
885                         AC_LANG_PROGRAM(
886                         [#include <qt3/qdatetime.h>],
887                         [QDate date();])
888                 ],
889                 [ac_cv_lib_qt_qt_date="yes"],
890                 [ac_cv_lib_qt_qt_date="no"])
891       LIBS="${saved_libs}"
892       CPPFLAGS="${saved_cppflags}"
893    fi   
895    if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
896       AC_MSG_RESULT(yes) 
897    else
898       AC_MSG_RESULT(no) 
899    fi
900         
901    if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
902       QT_LIB="-l${qtlib}"
903       if test "${QT_DIR}" != ""; then
904          QT_LIB="-L${QT_DIR}/lib ${QT_LIB}"
905          QT_INCLUDE="-I${QT_DIR}/include"
906       fi
907       PBX_QT=1
908       AC_DEFINE([HAVE_QT], 1, [Define if your system has the Qt library])
909       AC_PATH_TOOL(QTMOC, moc, No)
910    elif test -n "${QT_MANDATORY}"; 
911    then
912       AC_MSG_NOTICE([***])
913       AC_MSG_NOTICE([*** The Qt installation on this system appears to be broken.])
914       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
915       AC_MSG_NOTICE([*** including --without-qt.])
916       exit 1
917    fi
920 AC_LANG_POP
922 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
924 AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
926 AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
928 AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl2_connect], [openssl/ssl.h], [-lcrypto])
929 if test "$PBX_OPENSSL" = "1";
930 then
931     AST_EXT_LIB_CHECK([OSPTK], [osptk], [OSPPCryptoDecrypt], [osp/osp.h], [-lcrypto -lssl])
934 AST_EXT_LIB_CHECK([FREETDS], [tds], [tds_version], [tds.h])
935 if test "${PBX_FREETDS}" != "0";
936 then
937     case `grep TDS_VERSION_NO ${FREETDS_DIR:-/usr}/include/tdsver.h` in
938         *0.64*)
939                 FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_64"
940         ;;
941     *0.63*)
942         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_63"
943         ;;
944     *0.62*)
945         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_62"
946         ;;
947     *)
948         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_PRE_0_62"
949         ;;
950     esac
953 AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
955 AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
957 if test "${host_os}" != "linux-gnu" ; then
958   tonezone_extra="-lm"
961 AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/tonezone.h], [${tonezone_extra}])
963 AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
965 AC_LANG_PUSH(C++)
967 if test "${USE_VPB}" != "no"; then
968    AC_MSG_CHECKING(for vpb_open in -lvpb)
969    saved_libs="${LIBS}"
970    saved_cppflags="${CPPFLAGS}"
971    if test "x${VPB_DIR}" != "x"; then
972       if test -d ${VPB_DIR}/lib; then
973          vpblibdir=${VPB_DIR}/lib
974       else
975          vpblibdir=${VPB_DIR}
976       fi
977       LIBS="${LIBS} -L${vpblibdir}"
978       CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
979    fi
980    LIBS="${LIBS} -lvpb -lpthread"
981    AC_LINK_IFELSE(
982         [
983         AC_LANG_PROGRAM(
984         [#include <vpbapi.h>],
985         [int q = vpb_open(0,0);])
986         ],
987         [       AC_MSG_RESULT(yes) 
988                 ac_cv_lib_vpb_vpb_open="yes" 
989         ],
990         [       AC_MSG_RESULT(no) 
991                 ac_cv_lib_vpb_vpb_open="no" 
992         ]
993         )
994    LIBS="${saved_libs}"
995    CPPFLAGS="${saved_cppflags}"
996    if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
997         VPB_LIB="-lvpb"
998         if test "${VPB_DIR}" != ""; then
999            VPB_LIB="-L${vpblibdir}  ${VPB_LIB}"
1000            VPB_INCLUDE="-I${VPB_DIR}/include"
1001         fi
1002         PBX_VPB=1
1003         AC_DEFINE([HAVE_VPB], 1, [Define if your system has the VoiceTronix API libraries.])
1004    elif test -n "${VPB_MANDATORY}"; then
1005       AC_MSG_NOTICE([***])
1006       AC_MSG_NOTICE([*** The VoiceTronix (vpb) installation on this system appears to be broken.])
1007       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1008       AC_MSG_NOTICE([*** including --without-vpb.])
1009       exit 1
1010    fi
1013 AC_LANG_POP
1015 AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
1017 if test "${USE_ZAPTEL}" != "no"; then
1018    AC_MSG_CHECKING(for ZT_DIAL_OP_CANCEL in zaptel/zaptel.h)
1019    saved_cppflags="${CPPFLAGS}"
1020    if test "x${ZAPTEL_DIR}" != "x"; then
1021       CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
1022    fi
1023    AC_COMPILE_IFELSE(
1024         [
1025         AC_LANG_PROGRAM(
1026         [#include <zaptel/zaptel.h>],
1027         [int foo = ZT_DIAL_OP_CANCEL;])
1028         ],
1029         [       AC_MSG_RESULT(yes) 
1030                 ac_cv_zaptel_h="yes" 
1031         ],
1032         [       AC_MSG_RESULT(no) 
1033                 ac_cv_zaptel_h="no" 
1034         ]
1035         )
1036    CPPFLAGS="${saved_cppflags}"
1037    if test "${ac_cv_zaptel_h}" = "yes"; then
1038         if test "${ZAPTEL_DIR}" != ""; then
1039            ZAPTEL_INCLUDE="-I${ZAPTEL_DIR}/include"
1040         fi
1041         PBX_ZAPTEL=1
1042         AC_DEFINE([HAVE_ZAPTEL], 1, [Define if your system has the Zaptel headers.])
1043    elif test -n "${ZAPTEL_MANDATORY}"; 
1044    then
1045       AC_MSG_NOTICE([***])
1046       AC_MSG_NOTICE([*** The Zaptel installation on this system appears to be broken.])
1047       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1048       AC_MSG_NOTICE([*** including --without-zaptel.])
1049       exit 1
1050    fi
1053 if test "${PBX_ZAPTEL}" = 1; then
1054    AC_MSG_CHECKING(for ZT_EVENT_REMOVED in zaptel/zaptel.h)
1055    saved_cppflags="${CPPFLAGS}"
1056    if test "x${ZAPTEL_DIR}" != "x"; then
1057       CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
1058    fi
1059    AC_COMPILE_IFELSE(
1060         [
1061         AC_LANG_PROGRAM(
1062         [#include <zaptel/zaptel.h>],
1063         [int foo = ZT_EVENT_REMOVED;])
1064         ],
1065         [       AC_MSG_RESULT(yes) 
1066                 ac_cv_zaptel_vldtmf="yes" 
1067         ],
1068         [       AC_MSG_RESULT(no) 
1069                 ac_cv_zaptel_vldtmf="no" 
1070         ]
1071         )
1072    CPPFLAGS="${saved_cppflags}"
1073    if test "${ac_cv_zaptel_vldtmf}" = "yes"; then
1074         PBX_ZAPTEL_VLDTMF=1
1075    fi
1076    AC_MSG_CHECKING(for ZT_TCOP_ALLOCATE in zaptel/zaptel.h)
1077    saved_cppflags="${CPPFLAGS}"
1078    if test "x${ZAPTEL_DIR}" != "x"; then
1079       CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
1080    fi
1081    AC_COMPILE_IFELSE(
1082         [
1083         AC_LANG_PROGRAM(
1084         [#include <zaptel/zaptel.h>],
1085         [int foo = ZT_TCOP_ALLOCATE;])
1086         ],
1087         [       AC_MSG_RESULT(yes) 
1088                 ac_cv_zaptel_transcode="yes" 
1089         ],
1090         [       AC_MSG_RESULT(no) 
1091                 ac_cv_zaptel_transcode="no" 
1092         ]
1093         )
1094    CPPFLAGS="${saved_cppflags}"
1095    if test "${ac_cv_zaptel_transcode}" = "yes"; then
1096         PBX_ZAPTEL_TRANSCODE=1
1097    fi
1099 AC_SUBST(PBX_ZAPTEL_VLDTMF)
1100 AC_SUBST(PBX_ZAPTEL_TRANSCODE)
1102 EDITLINE_LIB=""
1103 if test "x$TERMCAP_LIB" != "x" ; then
1104   EDITLINE_LIB="$TERMCAP_LIB"
1105 elif test "x$TINFO_LIB" != "x" ; then
1106   EDITLINE_LIB="$TINFO_LIB"
1107 elif test "x$CURSES_LIB" != "x" ; then
1108   EDITLINE_LIB="$CURSES_LIB"
1109 elif test "x$NCURSES_LIB" != "x" ; then
1110   EDITLINE_LIB="$NCURSES_LIB"
1111 else
1112   AC_MSG_ERROR(*** termcap support not found)
1114 AC_SUBST(EDITLINE_LIB)
1116 AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
1117 AC_SUBST(PBX_H323)
1119 AC_CHECK_HEADER([linux/compiler.h],
1120                 [AC_DEFINE_UNQUOTED([HAVE_LINUX_COMPILER_H], 1, [Define to 1 if your system has linux/compiler.h.])])
1122 AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
1123                                    #include <linux/version.h>
1124                                    #ifdef HAVE_LINUX_COMPILER_H
1125                                    #include <linux/compiler.h>
1126                                    #endif
1127                                    ])
1128 AC_SUBST(PBX_IXJUSER)
1130 PBX_GTK=0
1131 AC_CHECK_TOOL(GTKCONFIG, gtk-config, No)
1132 if test ! "x${GTKCONFIG}" = xNo; then
1133    GTK_INCLUDE=$(${GTKCONFIG} --cflags gthread)
1134    GTK_LIB=$(${GTKCONFIG} --libs gthread)
1135    PBX_GTK=1
1136    AC_DEFINE([HAVE_GTK], 1, [Define if your system has the GTK libraries.])
1138 AC_SUBST(PBX_GTK)
1139 AC_SUBST(GTK_INCLUDE)
1140 AC_SUBST(GTK_LIB)
1142 PBX_GTK2=0
1143 AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
1144 if test ! "x${PKGCONFIG}" = xNo; then
1145    GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null)
1146    GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs)
1147    PBX_GTK2=1
1148    AC_DEFINE([HAVE_GTK2], 1, [Define if your system has the GTK2 libraries.])
1150 AC_SUBST(PBX_GTK2)
1151 AC_SUBST(GTK2_INCLUDE)
1152 AC_SUBST(GTK2_LIB)
1154 if test "${USE_CURL}" != "no"; then
1155    AC_PATH_TOOL([CURL_CONFIG], [curl-config], No)
1156    if test ! x"${CURL_CONFIG}" = xNo; then
1157    # check for version
1158       if test $(printf "%d" 0x$(${CURL_CONFIG} --vernum)) -ge $(printf "%d" 0x070907); then
1159          CURL_INCLUDE=$(${CURL_CONFIG} --cflags)
1160          CURL_LIB=$(${CURL_CONFIG} --libs)
1162          AC_MSG_CHECKING(for curl_version() in curl/curl.h)
1163          saved_cppflags="${CPPFLAGS}"
1164          CPPFLAGS="${CPPFLAGS} ${CURL_INCLUDE}"
1165          AC_COMPILE_IFELSE(
1166             [AC_LANG_PROGRAM(
1167                 [#include <curl/curl.h>],
1168                     [curl_version();])
1169             ],[
1170                 AC_MSG_RESULT(yes)
1171                 ac_cv_curl_h="yes"
1172             ],[
1173                 AC_MSG_RESULT(no)
1174                 ac_cv_curl_h="no"
1175             ]
1176          )
1177          CPPFLAGS="${saved_cppflags}"
1178          if test "${ac_cv_curl_h}" = "yes"; then
1179              PBX_CURL=1
1180              AC_DEFINE([HAVE_CURL], 1, [Define if your system has the curl libraries.])
1181          fi
1182       fi
1183    fi
1186 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
1187 AC_OUTPUT
1189 if test "x${silent}" != "xyes" ; then
1190 echo
1191 echo "               .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=..      "
1192 echo "            .\$7\$7..          .7\$\$7:.    "
1193 echo "          .\$\$:.                 ,\$7.7   "
1194 echo "        .\$7.     7\$\$\$\$           .\$\$77  "
1195 echo "     ..\$\$.       \$\$\$\$\$            .\$\$\$7 "
1196 echo "    ..7\$   .?.   \$\$\$\$\$   .?.       7\$\$\$."
1197 echo "   \$.\$.   .\$\$\$7. \$\$\$\$7 .7\$\$\$.      .\$\$\$."
1198 echo " .777.   .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7.      \$\$\$,"
1199 echo " \$\$\$~      .7\$\$\$\$\$\$\$\$\$\$\$\$\$7.       .\$\$\$."
1200 echo ".\$\$7          .7\$\$\$\$\$\$\$7:          ?\$\$\$."
1201 echo "\$\$\$          ?7\$\$\$\$\$\$\$\$\$\$I        .\$\$\$7 "
1202 echo "\$\$\$       .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$      :\$\$\$. "
1203 echo "\$\$\$       \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$    .\$\$\$.  "
1204 echo "\$\$\$        \$\$\$   7\$\$\$7  .\$\$\$    .\$\$\$.   "
1205 echo "\$\$\$\$             \$\$\$\$7         .\$\$\$.    "
1206 echo "7\$\$\$7            7\$\$\$\$        7\$\$\$      "
1207 echo " \$\$\$\$\$                        \$\$\$       "
1208 echo "  \$\$\$\$7.                       \$\$  (TM)     "
1209 echo "   \$\$\$\$\$\$\$.           .7\$\$\$\$\$\$  \$\$      "
1210 echo "     \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$      "
1211 echo "       \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$.                "
1212 echo
1215 AC_MSG_NOTICE(Package configured for: )
1216 AC_MSG_NOTICE( OS type  : $host_os)
1217 AC_MSG_NOTICE( Host CPU : $host_cpu)
1218 if test "${cross_compiling}" = "yes"; then
1219    AC_MSG_NOTICE( Cross Compilation = YES)