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