fallback to standard English prompts properly when using new prompt directory layout
[asterisk-bristuff.git] / configure.ac
blob545852f0a7559376c53c2f51938fc802226ac99c
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 AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h])
409 GSM_INTERNAL="yes"
410 AC_SUBST(GSM_INTERNAL)
411 GSM_SYSTEM="yes"
412 if test "${USE_GSM}" != "no"; then
413    if test "${GSM_DIR}" = "internal"; then
414       GSM_SYSTEM="no"
415    elif test "${GSM_DIR}" != ""; then
416       GSM_INTERNAL="no"
417    fi
418    if test "${GSM_SYSTEM}" = "yes"; then
419       gsmlibdir=""
420       if test "x${GSM_DIR}" != "x"; then
421          if test -d ${GSM_DIR}/lib; then
422             gsmlibdir="-L${GSM_DIR}/lib"
423          else
424             gsmlibdir="-L${GSM_DIR}"
425          fi
426       fi
427       AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
428       [Define to indicate the GSM library]), [], ${gsmlibdir})
429       if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
430          if test "x${GSM_DIR}" != "x" ; then
431             AC_CHECK_HEADER([${GSM_DIR}/include/gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
432             AC_CHECK_HEADER([${GSM_DIR}/include/gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
433          else
434             AC_CHECK_HEADER([gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
435             AC_CHECK_HEADER([gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
436          fi
437          if test "${GSM_HEADER_FOUND}" = "0" ; then
438             if test "{GSM_GSM_HEADER_FOUND}" = "0" ; then
439                if test "x${GSM_MANDATORY}" = "xyes" ; then
440                   AC_MSG_NOTICE([***])
441                   AC_MSG_NOTICE([*** It appears that you do not have the gsm development package installed.])
442                   AC_MSG_NOTICE([*** Please install it to include ${GSM_DESCRIP} support, or re-run configure])
443                   AC_MSG_NOTICE([*** without explicitly specifying --with-${GSM_OPTION}])
444                   exit 1
445                fi
446             fi
447          fi
448          GSM_OK=0
449          if test "${GSM_HEADER_FOUND}" = "1" ; then
450             AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
451             GSM_OK=1
452          else
453             if test "${GSM_GSM_HEADER_FOUND}" = "1" ; then
454                AC_DEFINE_UNQUOTED([HAVE_GSM_GSM_HEADER], 1, [Define to indicate that gsm.h is in gsm/gsm.h])
455                GSM_OK=1
456             fi
457          fi
458          if test "${GSM_OK}" = "1" ; then
459             GSM_LIB="-lgsm"
460             if test "x${GSM_DIR}" != "x"; then
461                GSM_LIB="${gsmlibdir} ${GSM_LIB}"
462                GSM_INCLUDE="-I${GSM_DIR}/include"
463             fi
464             PBX_GSM=1
465             GSM_INTERNAL="no"
466          fi
467       fi
468    fi
469    if test "${GSM_INTERNAL}" = "yes"; then
470       PBX_GSM=1
471       AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
472    fi
475 AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h])
477 if test "${PBX_IKSEMEL}" = 1; then
478    AST_EXT_LIB_CHECK([GNUTLS], [gnutls], [gnutls_bye], [gnutls/gnutls.h], [-lz -lgcrypt -lgpg-error])
481 if test "${USE_IMAP_TK}" != "no"; then
482         saved_cppflags="${CPPFLAGS}"
483         saved_libs="${LIBS}"
484         switch_to_system_on_failure="no"
485         if test "${IMAP_TK_DIR}" = ""; then
486                 IMAP_TK_DIR=`pwd`"/../imap-2004g"
487                 switch_to_system_on_failure="yes"
488         fi
489         if test "${IMAP_TK_DIR}" != "system"; then
490                 AC_MSG_CHECKING(for UW IMAP Toolkit c-client library)
491                 if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then
492                 imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
493                 fi
494                 imap_libs="${IMAP_TK_DIR}/c-client/c-client.a"
495                 imap_include="-I${IMAP_TK_DIR}/c-client"
496         CPPFLAGS="${CPPFLAGS} ${imap_include}"
497                 LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
498                 AC_LINK_IFELSE(
499                 AC_LANG_PROGRAM(
500                                 [#include "c-client.h"
501                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
502                                 {
503                                 }
504                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
505                                 {
506                                 }
507                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
508                                 {
509                                 }
510                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
511                                 {
512                                 }
513                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
514                                 {
515                                 }
516                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
517                                 {
518                                 }
519                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
520                                 {
521                                 }
522                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
523                                 {
524                                 }
525                                 void mm_log (char *string,long errflg)
526                                 {
527                                 }
528                                 void mm_dlog (char *string)
529                                 {
530                                 }
531                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
532                                 {
533                                 }
534                                 void mm_critical (MAILSTREAM *stream)
535                                 {
536                                 }
537                                 void mm_nocritical (MAILSTREAM *stream)
538                                 {
539                                 }
540                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
541                                 {
542                                 }
543                                 void mm_fatal (char *string)
544                                 {
545                                 }],
546                                 [
547                                 MAILSTREAM *foo = mail_open(NULL, "", 0);
548                                 ]
549                         ),
550                         [ac_cv_imap_tk="yes"],
551                         [ac_cv_imap_tk="no"]
552                 )
553                 if test "${ac_cv_imap_tk}" = "yes"; then
554                         AC_LINK_IFELSE(
555                                 AC_LANG_PROGRAM(
556                                         [#include "c-client.h"
557                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
558                                         {
559                                         }
560                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
561                                         {
562                                         }
563                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
564                                         {
565                                         }
566                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
567                                         {
568                                         }
569                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
570                                         {
571                                         }
572                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
573                                         {
574                                         }
575                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
576                                         {
577                                         }
578                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
579                                         {
580                                         }
581                                         void mm_log (char *string,long errflg)
582                                         {
583                                         }
584                                         void mm_dlog (char *string)
585                                         {
586                                         }
587                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
588                                         {
589                                         }
590                                         void mm_critical (MAILSTREAM *stream)
591                                         {
592                                         }
593                                         void mm_nocritical (MAILSTREAM *stream)
594                                         {
595                                         }
596                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
597                                         {
598                                         }
599                                         void mm_fatal (char *string)
600                                         {
601                                         }],
602                                         [
603                                         long check = mail_expunge_full(NULL, "", 0);
604                                         ]
605                                 ),
606                                 [ac_cv_imap_tk2006="yes"],
607                                 [ac_cv_imap_tk2006="no"]
608                         )
609                 fi
610                 CPPFLAGS="${saved_cppflags}"
611                 LIBS="${saved_libs}"
612                 if test "${ac_cv_imap_tk}" = "no"; then
613                         AC_MSG_RESULT(no)
614                         if test "${switch_to_system_on_failure}" = "yes"; then 
615                                 IMAP_TK_DIR="system"
616                         else #This means they specified a directory. Search for a package installation there too
617                                 AC_MSG_CHECKING([for system c-client library...])
618                                 CPPFLAGS="${saved_cppflags}"
619                                 LIBS="${saved_libs}"
620                                 imap_include="-I${IMAP_TK_DIR}/include"
621                                 imap_ldflags="-I${IMAP_TK_DIR}/lib"
622                                 imap_libs="-lc-client"
623                                 CPPFLAGS="${CPPFLAGS} ${imap_include}"
624                                 LIBS="${LIBS} ${imap_libs} ${imap_ldflags}"
625                                 AC_LINK_IFELSE(
626                                 AC_LANG_PROGRAM(
627                                                 [#include "c-client.h"
628                                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
629                                                 {
630                                                 }
631                                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
632                                                 {
633                                                 }
634                                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
635                                                 {
636                                                 }
637                                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
638                                                 {
639                                                 }
640                                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
641                                                 {
642                                                 }
643                                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
644                                                 {
645                                                 }
646                                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
647                                                 {
648                                                 }
649                                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
650                                                 {
651                                                 }
652                                                 void mm_log (char *string,long errflg)
653                                                 {
654                                                 }
655                                                 void mm_dlog (char *string)
656                                                 {
657                                                 }
658                                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
659                                                 {
660                                                 }
661                                                 void mm_critical (MAILSTREAM *stream)
662                                                 {
663                                                 }
664                                                 void mm_nocritical (MAILSTREAM *stream)
665                                                 {
666                                                 }
667                                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
668                                                 {
669                                                 }
670                                                 void mm_fatal (char *string)
671                                                 {
672                                                 }],
673                                                 [
674                                                 MAILSTREAM *foo = mail_open(NULL, "", 0);
675                                                 ]
676                                         ),
677                                         [ac_cv_imap_tk="yes"],
678                                         [ac_cv_imap_tk="no"]
679                                 )
680                                 if test "${ac_cv_imap_tk}" = "yes"; then
681                                         AC_LINK_IFELSE(
682                                                 AC_LANG_PROGRAM(
683                                                         [#include "c-client.h"
684                                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
685                                                         {
686                                                         }
687                                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
688                                                         {
689                                                         }
690                                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
691                                                         {
692                                                         }
693                                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
694                                                         {
695                                                         }
696                                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
697                                                         {
698                                                         }
699                                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
700                                                         {
701                                                         }
702                                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
703                                                         {
704                                                         }
705                                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
706                                                         {
707                                                         }
708                                                         void mm_log (char *string,long errflg)
709                                                         {
710                                                         }
711                                                         void mm_dlog (char *string)
712                                                         {
713                                                         }
714                                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
715                                                         {
716                                                         }
717                                                         void mm_critical (MAILSTREAM *stream)
718                                                         {
719                                                         }
720                                                         void mm_nocritical (MAILSTREAM *stream)
721                                                         {
722                                                         }
723                                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
724                                                         {
725                                                         }
726                                                         void mm_fatal (char *string)
727                                                         {
728                                                         }],
729                                                         [
730                                                         long check = mail_expunge_full(NULL, "", 0);
731                                                         ]
732                                                 ),
733                                                 [ac_cv_imap_tk2006="yes"],
734                                                 [ac_cv_imap_tk2006="no"]
735                                         )
736                                 fi
737                         fi
738                 fi
739         fi 
740         if test "${IMAP_TK_DIR}" = "system"; then
741                 #We will enter here if user specified "system" or if any of above checks failed
742                 AC_MSG_CHECKING([for system c-client library...])
743                 CPPFLAGS="${saved_cppflags}"
744                 LIBS="${saved_libs}"
745                 imap_ldflags=""
746                 imap_libs="-lc-client"
747                 imap_include="-DUSE_SYSTEM_IMAP" #Try the imap directory first
748                 CPPFLAGS="${CPPFLAGS} ${imap_include}"
749                 LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
750                 AC_LINK_IFELSE(
751                 AC_LANG_PROGRAM(
752                                 [#include <stdio.h>
753                                 #include <imap/c-client.h>
754                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
755                                 {
756                                 }
757                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
758                                 {
759                                 }
760                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
761                                 {
762                                 }
763                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
764                                 {
765                                 }
766                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
767                                 {
768                                 }
769                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
770                                 {
771                                 }
772                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
773                                 {
774                                 }
775                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
776                                 {
777                                 }
778                                 void mm_log (char *string,long errflg)
779                                 {
780                                 }
781                                 void mm_dlog (char *string)
782                                 {
783                                 }
784                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
785                                 {
786                                 }
787                                 void mm_critical (MAILSTREAM *stream)
788                                 {
789                                 }
790                                 void mm_nocritical (MAILSTREAM *stream)
791                                 {
792                                 }
793                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
794                                 {
795                                 }
796                                 void mm_fatal (char *string)
797                                 {
798                                 }],
799                                 [
800                                 MAILSTREAM *foo = mail_open(NULL, "", 0);
801                                 ]
802                         ),
803                         [ac_cv_imap_tk="yes"],
804                         [ac_cv_imap_tk="no"]
805                 )
806                 if test "${ac_cv_imap_tk}" = "yes"; then
807                         AC_LINK_IFELSE(
808                                 AC_LANG_PROGRAM(
809                                         [#include <stdio.h>
810                                         #include <imap/c-client.h>
811                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
812                                         {
813                                         }
814                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
815                                         {
816                                         }
817                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
818                                         {
819                                         }
820                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
821                                         {
822                                         }
823                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
824                                         {
825                                         }
826                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
827                                         {
828                                         }
829                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
830                                         {
831                                         }
832                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
833                                         {
834                                         }
835                                         void mm_log (char *string,long errflg)
836                                         {
837                                         }
838                                         void mm_dlog (char *string)
839                                         {
840                                         }
841                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
842                                         {
843                                         }
844                                         void mm_critical (MAILSTREAM *stream)
845                                         {
846                                         }
847                                         void mm_nocritical (MAILSTREAM *stream)
848                                         {
849                                         }
850                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
851                                         {
852                                         }
853                                         void mm_fatal (char *string)
854                                         {
855                                         }],
856                                         [
857                                         long check = mail_expunge_full(NULL, "", 0);
858                                         ]
859                                 ),
860                                 [ac_cv_imap_tk2006="yes"],
861                                 [ac_cv_imap_tk2006="no"]
862                         )
863                 else #looking in imap directory didn't work, try c-client
864                         imap_ldflags=""
865                         imap_libs="-lc-client"
866                         imap_include="-DUSE_SYSTEM_CCLIENT"
867                         CPPFLAGS="${saved_cppflags}"
868                         LIBS="${saved_libs}"
869                         CPPFLAGS="${CPPFLAGS} ${imap_include}"
870                         LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
871                         AC_LINK_IFELSE(
872                         AC_LANG_PROGRAM(
873                                         [#include <stdio.h>
874                                         #include <c-client/c-client.h>
875                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
876                                         {
877                                         }
878                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
879                                         {
880                                         }
881                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
882                                         {
883                                         }
884                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
885                                         {
886                                         }
887                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
888                                         {
889                                         }
890                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
891                                         {
892                                         }
893                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
894                                         {
895                                         }
896                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
897                                         {
898                                         }
899                                         void mm_log (char *string,long errflg)
900                                         {
901                                         }
902                                         void mm_dlog (char *string)
903                                         {
904                                         }
905                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
906                                         {
907                                         }
908                                         void mm_critical (MAILSTREAM *stream)
909                                         {
910                                         }
911                                         void mm_nocritical (MAILSTREAM *stream)
912                                         {
913                                         }
914                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
915                                         {
916                                         }
917                                         void mm_fatal (char *string)
918                                         {
919                                         }],
920                                         [
921                                         MAILSTREAM *foo = mail_open(NULL, "", 0);
922                                         ]
923                                 ),
924                                 [ac_cv_imap_tk="yes"],
925                                 [ac_cv_imap_tk="no"]
926                         )
927                         if test "${ac_cv_imap_tk}" = "yes"; then
928                                 AC_LINK_IFELSE(
929                                         AC_LANG_PROGRAM(
930                                                 [#include <stdio.h>
931                                                 #include <c-client/c-client.h>
932                                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
933                                                 {
934                                                 }
935                                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
936                                                 {
937                                                 }
938                                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
939                                                 {
940                                                 }
941                                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
942                                                 {
943                                                 }
944                                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
945                                                 {
946                                                 }
947                                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
948                                                 {
949                                                 }
950                                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
951                                                 {
952                                                 }
953                                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
954                                                 {
955                                                 }
956                                                 void mm_log (char *string,long errflg)
957                                                 {
958                                                 }
959                                                 void mm_dlog (char *string)
960                                                 {
961                                                 }
962                                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
963                                                 {
964                                                 }
965                                                 void mm_critical (MAILSTREAM *stream)
966                                                 {
967                                                 }
968                                                 void mm_nocritical (MAILSTREAM *stream)
969                                                 {
970                                                 }
971                                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
972                                                 {
973                                                 }
974                                                 void mm_fatal (char *string)
975                                                 {
976                                                 }],
977                                                 [
978                                                 long check = mail_expunge_full(NULL, "", 0);
979                                                 ]
980                                         ),
981                                         [ac_cv_imap_tk2006="yes"],
982                                         [ac_cv_imap_tk2006="no"]
983                                 )
984                         fi
985                 fi
986         fi
987         if test "${ac_cv_imap_tk}" = "yes"; then
988                 AC_MSG_RESULT(yes)
989                 IMAP_TK_LIB="${imap_libs} "`echo ${imap_ldflags}`
990                 IMAP_TK_INCLUDE="${imap_include}"
991                 PBX_IMAP_TK=1
992                 AC_DEFINE([HAVE_IMAP_TK], 1, [Define if your system has the UW IMAP Toolkit c-client library.])
993                 if test "${ac_cv_imap_tk2006}" = "yes"; then
994                         AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
995                 fi
996         elif test -n "${IMAP_TK_MANDATORY}"; then
997                 AC_MSG_RESULT(no) 
998                 AC_MSG_NOTICE([***])
999                 AC_MSG_NOTICE([*** The UW IMAP Toolkit installation on this system appears to be broken.])
1000                 AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1001                 AC_MSG_NOTICE([*** including --without-imap.])
1002                 exit 1
1003         else
1004                 AC_MSG_RESULT(no)
1005         fi
1006         CPPFLAGS="${saved_cppflags}"
1007         LIBS="${saved_libs}"
1010 # Needed by unixodbc
1011 AST_EXT_LIB_CHECK([LTDL], [ltdl], [lt_dlinit], [ltdl.h], [])
1013 AC_LANG_PUSH(C++)
1015 if test "${USE_KDE}" != "no"; then
1016    AC_MSG_CHECKING(for crashHandler in -lkdecore)
1017    saved_libs="${LIBS}"
1018    saved_cppflags="${CPPFLAGS}"
1019    CPPFLAGS="${CPPFLAGS} -I${KDE_DIR}/include"
1020    if test -d ${KDE_DIR}/lib; then
1021       kdelibdir="${KDE_DIR}/lib"
1022    else
1023       kdelibdir="${KDE_DIR}"
1024    fi
1025    LIBS="${LIBS} -L${kdelibdir} -lkdecore"
1027    AC_LINK_IFELSE(
1028         [AC_LANG_PROGRAM(
1029                         [#include "kcrash.h"],
1030                         [KCrash::defaultCrashHandler(1);])
1031         ],
1032         [ac_cv_lib_kde_crash="yes"],
1033         [ac_cv_lib_kde_crash="no"])
1034                 
1035    LIBS="${saved_libs}"
1036    CPPFLAGS="${saved_cppflags}"
1037         
1038    if test "${ac_cv_lib_kde_crash}" = "yes"; then
1039       AC_MSG_RESULT(yes) 
1040       KDE_LIB="-lkdecore -lkdeui"
1041       if test "${KDE_DIR}" != ""; then
1042          KDE_LIB="-L${kdelibdir} ${KDE_LIB}"
1043          KDE_INCLUDE="-I${KDE_DIR}/include"
1044       fi
1045       PBX_KDE=1
1046       AC_DEFINE([HAVE_LIBKDE], 1, [Define if your system has the KDE libraries.])
1047    elif test -n "${KDE_MANDATORY}"; then
1048       AC_MSG_RESULT(no) 
1049       AC_MSG_NOTICE([***])
1050       AC_MSG_NOTICE([*** The KDE installation on this system appears to be broken.])
1051       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1052       AC_MSG_NOTICE([*** including --without-kde.])
1053       exit 1
1054    else
1055       AC_MSG_RESULT(no) 
1056    fi
1058 if test "${PBX_KDE}" = 1; then
1059    AC_PATH_TOOL(KDEINIT, kdeinit, No)
1060    if test ! x"${KDEINIT}" = xNo; then
1061       KDEDIR=$(${DIRNAME} ${KDEINIT})
1062       KDEDIR=$(${DIRNAME} ${KDEDIR})
1063    fi
1064    AC_SUBST([KDEDIR])
1067 AC_LANG_POP
1069 AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h])
1071 if test "${PBX_MISDN}" = 1; then
1072    AST_EXT_LIB_CHECK([ISDNNET], [isdnnet], [init_manager], [mISDNuser/isdn_net.h], [-lmISDN -lpthread])
1073    AST_EXT_LIB_CHECK([SUPPSERV], [suppserv], [encodeFac], [mISDNuser/suppserv.h])
1074    AC_CHECK_HEADER([linux/mISDNdsp.h], [AC_DEFINE_UNQUOTED([MISDN_1_2], 1, [Build chan_misdn for mISDN 1.2 or later.])])
1077 AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
1079 AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
1081 NETSNMP_CONFIG=No
1082 if test "${USE_NETSNMP}" != "no"; then  
1083    if test "x${NETSNMP_DIR}" != "x"; then
1084       AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No, [${NETSNMP_DIR}/bin])
1085       if test x"${NETSNMP_CONFIG}" = xNo; then
1086          AC_MSG_NOTICE([***])
1087          AC_MSG_NOTICE([*** net-snmp-config was not found in the path you specified:])
1088          AC_MSG_NOTICE([*** ${NETSNMP_DIR}/bin])
1089          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1090          AC_MSG_NOTICE([*** including --without-netsnmp])
1091          exit 1
1092       fi
1093    else
1094       AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No)
1095    fi
1097 if test x"${NETSNMP_CONFIG}" != xNo; then
1098    NETSNMP_libs=`${NETSNMP_CONFIG} --agent-libs`
1099    
1100    AC_CHECK_LIB([netsnmp], [snmp_register_callback], AC_DEFINE_UNQUOTED([HAVE_NETSNMP], 1,
1101    [Define to indicate the Net-SNMP library]), [], ${NETSNMP_libs})
1103    if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then
1104       NETSNMP_LIB="${NETSNMP_libs}"
1105       PBX_NETSNMP=1
1106    elif test -n "${NETSNMP_MANDATORY}";
1107    then
1108       AC_MSG_NOTICE([***])
1109       AC_MSG_NOTICE([*** The Net-SNMP installation on this system appears to be broken.])
1110       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1111       AC_MSG_NOTICE([*** including --without-netsnmp])
1112       exit 1
1113    fi
1114 elif test -n "${NETSNMP_MANDATORY}";
1115 then
1116    AC_MSG_NOTICE([***])
1117    AC_MSG_NOTICE([*** The Net-SNMP installation on this system appears to be broken.])
1118    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1119    AC_MSG_NOTICE([*** including --without-netsnmp])
1120    exit 1
1123 AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
1125 AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
1127 AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
1129 if test "${USE_OSS}" != "no"; then
1130 PBX_OSS=0
1131 AC_CHECK_HEADER([linux/soundcard.h],
1132                 [
1133                 PBX_OSS=1
1134                 AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
1135                 ])
1136 if test "$PBX_OSS" = "0"; then
1137    AC_CHECK_HEADER([sys/soundcard.h],
1138                    [
1139                    PBX_OSS=1
1140                    AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
1141                    ])
1143 if test "$PBX_OSS" = "0"; then
1144    AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
1148 PG_CONFIG=No
1149 if test "${USE_PGSQL}" != "no"; then    
1150    if test "x${PGSQL_DIR}" != "x"; then
1151       AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
1152       if test x"${PG_CONFIG}" = xNo; then
1153          AC_MSG_NOTICE([***])
1154          AC_MSG_NOTICE([*** pg_config was not found in the path you specified:])
1155          AC_MSG_NOTICE([*** ${PGSQL_DIR}/bin])
1156          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1157          AC_MSG_NOTICE([*** including --without-postgres])
1158          exit 1
1159       fi
1160    else
1161       AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
1162    fi
1164 if test "${PG_CONFIG}" != No; then
1165    PGSQL_libdir=`${PG_CONFIG} --libdir`
1166    PGSQL_includedir=`${PG_CONFIG} --includedir`
1168    if test "x$?" != "x0" ; then
1169       if test -n "${PGSQL_MANDATORY}" ; then
1170          AC_MSG_NOTICE([***])
1171          AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
1172          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1173          AC_MSG_NOTICE([*** including --without-postgres])
1174          exit 1
1175           fi
1176    else 
1177       AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
1178       [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
1180       if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
1181          PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
1182          PGSQL_INCLUDE="-I${PGSQL_includedir}"
1183          PBX_PGSQL=1
1184       elif test -n "${PGSQL_MANDATORY}";
1185       then
1186          AC_MSG_NOTICE([***])
1187          AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
1188          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1189          AC_MSG_NOTICE([*** including --without-postgres])
1190          exit 1
1191       fi
1192    fi
1193 elif test -n "${PGSQL_MANDATORY}";
1194 then
1195    AC_MSG_NOTICE([***])
1196    AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
1197    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1198    AC_MSG_NOTICE([*** including --without-postgres])
1199    exit 1
1202 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
1204 AST_EXT_LIB_CHECK([PRI], [pri], [pri_keypad_facility], [libpri.h])
1206 if test "${USE_PWLIB}" != "no"; then
1207         if test -n "${PWLIB_DIR}"; then
1208                 PWLIBDIR="${PWLIB_DIR}"
1209         fi
1210         AST_CHECK_PWLIB()
1211         AST_CHECK_PWLIB_VERSION([PWLib], [PWLIB], [ptbuildopts.h], [1], [9], [2])
1212                 
1213         if test "${HAS_PWLIB:-unset}" != "unset"; then
1214                 AST_CHECK_OPENH323_PLATFORM()
1216                 PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
1218                 AST_CHECK_PWLIB_BUILD([PWLib], [PWLIB],
1219                         [Define if your system has the PWLib libraries.],
1220                         [#include "ptlib.h"],
1221                         [BOOL q = PTime::IsDaylightSavings();])
1222         fi
1225 if test "${USE_PWLIB}" != "no" -a "x${ac_cv_lib_PWLIB}" != "xyes" -a -n "${PWLIB_MANDATORY}"; then
1226    AC_MSG_NOTICE([***])
1227    AC_MSG_NOTICE([*** The PWLIB installation on this system appears to be broken.])
1228    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1229    AC_MSG_NOTICE([*** including --without-pwlib])
1230    exit 1
1233 if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
1234         if test -n "${OPENH323_DIR}"; then
1235                 OPENH323DIR="${OPENH323_DIR}"
1236         fi
1237         AST_CHECK_OPENH323()
1238         AST_CHECK_PWLIB_VERSION([OpenH323], [OPENH323], [openh323buildopts.h], [1], [17], [3])
1239         AST_CHECK_OPENH323_BUILD()
1240         PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
1241         AST_CHECK_PWLIB_BUILD([OpenH323], [OPENH323],
1242                 [Define if your system has the OpenH323 libraries.],
1243                 [#include "ptlib.h"
1244                 #include "h323.h"
1245                 #include "h323ep.h"],
1246                 [H323EndPoint ep = H323EndPoint();],
1247                 [${PWLIB_INCLUDE}], [${PWLIB_LIB}])
1249 if test "${USE_OPENH323}" != "no" -a "x${ac_cv_lib_OPENH323}" != "xyes" -a -n "${OPENH323_MANDATORY}"; then
1250    AC_MSG_NOTICE([***])
1251    AC_MSG_NOTICE([*** The OPENH323 installation on this system appears to be broken.])
1252    AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1253    AC_MSG_NOTICE([*** including --without-h323])
1254    exit 1
1257 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
1259 AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
1261 AST_EXT_LIB_CHECK([SPEEXDSP], [speexdsp], [speex_preprocess_ctl], [speex/speex.h], [-lm])
1263 AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
1265 AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl2_connect], [openssl/ssl.h], [-lcrypto])
1266 if test "$PBX_OPENSSL" = "1";
1267 then
1268     AST_EXT_LIB_CHECK([OSPTK], [osptk], [OSPPCryptoDecrypt], [osp/osp.h], [-lcrypto -lssl])
1271 AST_EXT_LIB_CHECK([FREETDS], [tds], [tds_version], [tds.h])
1272 if test "${PBX_FREETDS}" != "0";
1273 then
1274     case `grep TDS_VERSION_NO ${FREETDS_DIR:-/usr}/include/tdsver.h` in
1275         *0.64*)
1276                 FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_64"
1277         ;;
1278     *0.63*)
1279         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_63"
1280         ;;
1281     *0.62*)
1282         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_62"
1283         ;;
1284     *)
1285         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_PRE_0_62"
1286         ;;
1287     esac
1290 AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
1292 AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
1294 if test "${host_os}" != "linux-gnu" ; then
1295   tonezone_extra="-lm"
1298 AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/tonezone.h], [${tonezone_extra}])
1300 AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
1302 AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
1304 AC_LANG_PUSH(C++)
1306 if test "${USE_VPB}" != "no"; then
1307    AC_MSG_CHECKING(for vpb_open in -lvpb)
1308    saved_libs="${LIBS}"
1309    saved_cppflags="${CPPFLAGS}"
1310    if test "x${VPB_DIR}" != "x"; then
1311       if test -d ${VPB_DIR}/lib; then
1312          vpblibdir=${VPB_DIR}/lib
1313       else
1314          vpblibdir=${VPB_DIR}
1315       fi
1316       LIBS="${LIBS} -L${vpblibdir}"
1317       CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
1318    fi
1319    LIBS="${LIBS} -lvpb -lpthread"
1320    AC_LINK_IFELSE(
1321         [
1322         AC_LANG_PROGRAM(
1323         [#include <vpbapi.h>],
1324         [int q = vpb_open(0,0);])
1325         ],
1326         [       AC_MSG_RESULT(yes) 
1327                 ac_cv_lib_vpb_vpb_open="yes" 
1328         ],
1329         [       AC_MSG_RESULT(no) 
1330                 ac_cv_lib_vpb_vpb_open="no" 
1331         ]
1332         )
1333    LIBS="${saved_libs}"
1334    CPPFLAGS="${saved_cppflags}"
1335    if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
1336         VPB_LIB="-lvpb"
1337         if test "${VPB_DIR}" != ""; then
1338            VPB_LIB="-L${vpblibdir}  ${VPB_LIB}"
1339            VPB_INCLUDE="-I${VPB_DIR}/include"
1340         fi
1341         PBX_VPB=1
1342         AC_DEFINE([HAVE_VPB], 1, [Define if your system has the VoiceTronix API libraries.])
1343    elif test -n "${VPB_MANDATORY}"; then
1344       AC_MSG_NOTICE([***])
1345       AC_MSG_NOTICE([*** The VoiceTronix (vpb) installation on this system appears to be broken.])
1346       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1347       AC_MSG_NOTICE([*** including --without-vpb.])
1348       exit 1
1349    fi
1352 AC_LANG_POP
1354 AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
1356 if test "${USE_ZAPTEL}" != "no"; then
1357    AC_MSG_CHECKING(for ZT_DIAL_OP_CANCEL in zaptel/zaptel.h)
1358    saved_cppflags="${CPPFLAGS}"
1359    if test "x${ZAPTEL_DIR}" != "x"; then
1360       CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
1361    fi
1362    AC_COMPILE_IFELSE(
1363         [
1364         AC_LANG_PROGRAM(
1365         [#include <zaptel/zaptel.h>],
1366         [int foo = ZT_DIAL_OP_CANCEL;])
1367         ],
1368         [       AC_MSG_RESULT(yes) 
1369                 ac_cv_zaptel_h="yes" 
1370         ],
1371         [       AC_MSG_RESULT(no) 
1372                 ac_cv_zaptel_h="no" 
1373         ]
1374         )
1375    CPPFLAGS="${saved_cppflags}"
1376    if test "${ac_cv_zaptel_h}" = "yes"; then
1377         if test "${ZAPTEL_DIR}" != ""; then
1378            ZAPTEL_INCLUDE="-I${ZAPTEL_DIR}/include"
1379         fi
1380         PBX_ZAPTEL=1
1381         AC_DEFINE([HAVE_ZAPTEL], 1, [Define if your system has the Zaptel headers.])
1382    elif test -n "${ZAPTEL_MANDATORY}"; 
1383    then
1384       AC_MSG_NOTICE([***])
1385       AC_MSG_NOTICE([*** The Zaptel installation on this system appears to be broken.])
1386       AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1387       AC_MSG_NOTICE([*** including --without-zaptel.])
1388       exit 1
1389    fi
1392 if test "${PBX_ZAPTEL}" = 1; then
1393    AC_MSG_CHECKING(for ZT_EVENT_REMOVED in zaptel/zaptel.h)
1394    saved_cppflags="${CPPFLAGS}"
1395    if test "x${ZAPTEL_DIR}" != "x"; then
1396       CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
1397    fi
1398    AC_COMPILE_IFELSE(
1399         [
1400         AC_LANG_PROGRAM(
1401         [#include <zaptel/zaptel.h>],
1402         [int foo = ZT_EVENT_REMOVED;])
1403         ],
1404         [       AC_MSG_RESULT(yes) 
1405                 ac_cv_zaptel_vldtmf="yes" 
1406         ],
1407         [       AC_MSG_RESULT(no) 
1408                 ac_cv_zaptel_vldtmf="no" 
1409         ]
1410         )
1411    CPPFLAGS="${saved_cppflags}"
1412    if test "${ac_cv_zaptel_vldtmf}" = "yes"; then
1413         PBX_ZAPTEL_VLDTMF=1
1414    fi
1415    AC_MSG_CHECKING(for ZT_TCOP_ALLOCATE in zaptel/zaptel.h)
1416    saved_cppflags="${CPPFLAGS}"
1417    if test "x${ZAPTEL_DIR}" != "x"; then
1418       CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
1419    fi
1420    AC_COMPILE_IFELSE(
1421         [
1422         AC_LANG_PROGRAM(
1423         [#include <zaptel/zaptel.h>],
1424         [int foo = ZT_TCOP_ALLOCATE;])
1425         ],
1426         [       AC_MSG_RESULT(yes) 
1427                 ac_cv_zaptel_transcode="yes" 
1428         ],
1429         [       AC_MSG_RESULT(no) 
1430                 ac_cv_zaptel_transcode="no" 
1431         ]
1432         )
1433    CPPFLAGS="${saved_cppflags}"
1434    if test "${ac_cv_zaptel_transcode}" = "yes"; then
1435         PBX_ZAPTEL_TRANSCODE=1
1436    fi
1438 AC_SUBST(PBX_ZAPTEL_VLDTMF)
1439 AC_SUBST(PBX_ZAPTEL_TRANSCODE)
1441 EDITLINE_LIB=""
1442 if test "x$TERMCAP_LIB" != "x" ; then
1443   EDITLINE_LIB="$TERMCAP_LIB"
1444 elif test "x$TINFO_LIB" != "x" ; then
1445   EDITLINE_LIB="$TINFO_LIB"
1446 elif test "x$CURSES_LIB" != "x" ; then
1447   EDITLINE_LIB="$CURSES_LIB"
1448 elif test "x$NCURSES_LIB" != "x" ; then
1449   EDITLINE_LIB="$NCURSES_LIB"
1450 else
1451   AC_MSG_ERROR(*** termcap support not found)
1453 AC_SUBST(EDITLINE_LIB)
1455 AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
1456 AC_SUBST(PBX_H323)
1458 AC_CHECK_HEADER([linux/compiler.h],
1459                 [AC_DEFINE_UNQUOTED([HAVE_LINUX_COMPILER_H], 1, [Define to 1 if your system has linux/compiler.h.])])
1461 AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
1462                                    #include <linux/version.h>
1463                                    #ifdef HAVE_LINUX_COMPILER_H
1464                                    #include <linux/compiler.h>
1465                                    #endif
1466                                    ])
1467 AC_SUBST(PBX_IXJUSER)
1469 if test "${cross_compiling}" = "no";
1470 then
1471   AC_CHECK_FILE(/sbin/launchd, AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
1474 PBX_GTK=0
1475 AC_CHECK_TOOL(GTKCONFIG, gtk-config, No)
1476 if test ! "x${GTKCONFIG}" = xNo; then
1477    GTK_INCLUDE=$(${GTKCONFIG} --cflags gthread)
1478    GTK_LIB=$(${GTKCONFIG} --libs gthread)
1479    PBX_GTK=1
1480    AC_DEFINE([HAVE_GTK], 1, [Define if your system has the GTK libraries.])
1482 AC_SUBST(PBX_GTK)
1483 AC_SUBST(GTK_INCLUDE)
1484 AC_SUBST(GTK_LIB)
1486 PBX_GTK2=0
1487 AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
1488 if test ! "x${PKGCONFIG}" = xNo; then
1489    GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null)
1490    GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs)
1491    PBX_GTK2=1
1492    AC_DEFINE([HAVE_GTK2], 1, [Define if your system has the GTK2 libraries.])
1494 AC_SUBST(PBX_GTK2)
1495 AC_SUBST(GTK2_INCLUDE)
1496 AC_SUBST(GTK2_LIB)
1498 if test "${USE_CURL}" != "no"; then
1499    AC_PATH_TOOL([CURL_CONFIG], [curl-config], No)
1500    if test ! x"${CURL_CONFIG}" = xNo; then
1501    # check for version
1502       if test $(printf "%d" 0x$(${CURL_CONFIG} --vernum)) -ge $(printf "%d" 0x070907); then
1503          CURL_INCLUDE=$(${CURL_CONFIG} --cflags)
1504          CURL_LIB=$(${CURL_CONFIG} --libs)
1506          AC_MSG_CHECKING(for curl_version() in curl/curl.h)
1507          saved_cppflags="${CPPFLAGS}"
1508          CPPFLAGS="${CPPFLAGS} ${CURL_INCLUDE}"
1509          AC_COMPILE_IFELSE(
1510             [AC_LANG_PROGRAM(
1511                 [#include <curl/curl.h>],
1512                     [curl_version();])
1513             ],[
1514                 AC_MSG_RESULT(yes)
1515                 ac_cv_curl_h="yes"
1516             ],[
1517                 AC_MSG_RESULT(no)
1518                 ac_cv_curl_h="no"
1519             ]
1520          )
1521          CPPFLAGS="${saved_cppflags}"
1522          if test "${ac_cv_curl_h}" = "yes"; then
1523              PBX_CURL=1
1524              AC_DEFINE([HAVE_CURL], 1, [Define if your system has the curl libraries.])
1525          fi
1526       fi
1527    fi
1530 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
1531 AC_OUTPUT
1533 if test "x${silent}" != "xyes" ; then
1534 echo
1535 echo "               .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=..      "
1536 echo "            .\$7\$7..          .7\$\$7:.    "
1537 echo "          .\$\$:.                 ,\$7.7   "
1538 echo "        .\$7.     7\$\$\$\$           .\$\$77  "
1539 echo "     ..\$\$.       \$\$\$\$\$            .\$\$\$7 "
1540 echo "    ..7\$   .?.   \$\$\$\$\$   .?.       7\$\$\$."
1541 echo "   \$.\$.   .\$\$\$7. \$\$\$\$7 .7\$\$\$.      .\$\$\$."
1542 echo " .777.   .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7.      \$\$\$,"
1543 echo " \$\$\$~      .7\$\$\$\$\$\$\$\$\$\$\$\$\$7.       .\$\$\$."
1544 echo ".\$\$7          .7\$\$\$\$\$\$\$7:          ?\$\$\$."
1545 echo "\$\$\$          ?7\$\$\$\$\$\$\$\$\$\$I        .\$\$\$7 "
1546 echo "\$\$\$       .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$      :\$\$\$. "
1547 echo "\$\$\$       \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$    .\$\$\$.  "
1548 echo "\$\$\$        \$\$\$   7\$\$\$7  .\$\$\$    .\$\$\$.   "
1549 echo "\$\$\$\$             \$\$\$\$7         .\$\$\$.    "
1550 echo "7\$\$\$7            7\$\$\$\$        7\$\$\$      "
1551 echo " \$\$\$\$\$                        \$\$\$       "
1552 echo "  \$\$\$\$7.                       \$\$  (TM)     "
1553 echo "   \$\$\$\$\$\$\$.           .7\$\$\$\$\$\$  \$\$      "
1554 echo "     \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$      "
1555 echo "       \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$.                "
1556 echo
1559 AC_MSG_NOTICE(Package configured for: )
1560 AC_MSG_NOTICE( OS type  : $host_os)
1561 AC_MSG_NOTICE( Host CPU : $host_cpu)
1562 if test "${cross_compiling}" = "yes"; then
1563    AC_MSG_NOTICE( Cross Compilation = YES)