merge new_loader_completion branch, including (at least):
[asterisk-bristuff.git] / configure.ac
blob0a68a6ed81fdff8cb0325607a033e50ecef0fa2b
1 # Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.59)
5 m4_define([PBX_VERSION],
6           m4_bpatsubst(m4_esyscmd([build_tools/make_version .]),
7                        [\([0-9.]*\)\(\w\|\W\)*],
8                        [\1]))
9 AC_INIT(asterisk, PBX_VERSION, www.asterisk.org)
11 # cross-compile macros
12 AC_CANONICAL_BUILD
13 AC_CANONICAL_HOST
15 # check existence of the package
16 AC_CONFIG_SRCDIR([main/asterisk.c])
18 # specify output header file
19 AC_CONFIG_HEADER(include/asterisk/autoconfig.h)
21 AC_COPYRIGHT("Asterisk")
22 AC_REVISION($Revision$)
24 case "${host_os}" in
25      freebsd)
26      ac_default_prefix=/usr/local
27      ;;
28      *)
29      ac_default_prefix=/usr
30      if test ${sysconfdir} = '${prefix}/etc'; then
31         sysconfdir=/etc
32      fi
33      if test ${mandir} = '${prefix}/man'; then
34         mandir=/usr/share/man
35      fi
36      ;;
37 esac
39 if test ${localstatedir} = '${prefix}/var'; then
40      localstatedir=/var
43 BUILD_PLATFORM=${build}
44 BUILD_CPU=${build_cpu}
45 BUILD_VENDOR=${build_vendor}
46 BUILD_OS=${build_os}
48 AC_SUBST(BUILD_PLATFORM)
49 AC_SUBST(BUILD_CPU)
50 AC_SUBST(BUILD_VENDOR)
51 AC_SUBST(BUILD_OS)
53 HOST_PLATFORM=${host}
54 HOST_CPU=${host_cpu}
55 HOST_VENDOR=${host_vendor}
56 HOST_OS=${host_os}
58 AC_SUBST(HOST_PLATFORM)
59 AC_SUBST(HOST_CPU)
60 AC_SUBST(HOST_VENDOR)
61 AC_SUBST(HOST_OS)
63 #  check for uname
64 AC_PATH_TOOL([UNAME], [uname], No)
65 if test ! x"${UNAME}" = xNo; then
66    PBX_OSREV=$(${UNAME} -r)
68 AC_SUBST(PBX_OSREV)
70 # This needs to be before any macros that use the C compiler
71 AC_GNU_SOURCE
73 AH_TOP(
74 #ifndef ASTERISK_AUTOCONFIG_H
75 #define ASTERISK_AUTOCONFIG_H
77 #ifndef MENUSELECT
78 #include "asterisk/buildopts.h"
79 #endif
81 #ifndef _REENTRANT
82 #define _REENTRANT
83 #endif
86 AH_BOTTOM(
87 #endif
90 # cross-compile checks
91 if test "${cross_compiling}" = "yes"; 
92 then
93    AC_CHECK_TOOL(CC, gcc, :)
94    AC_CHECK_TOOL(CXX, g++, :)
95    AC_CHECK_TOOL(LD, ld, :)
96    AC_CHECK_TOOL(RANLIB, ranlib, :)
97    AC_CHECK_TOOL(AR, ar, :)
100 # Checks for programs.
101 AC_PROG_CC
102 AC_PROG_CXX
103 AC_PROG_CPP
104 AC_PROG_CXXCPP
105 AC_PROG_AWK
106 AC_PROG_INSTALL
107 AC_PROG_LN_S
108 AC_PROG_RANLIB
109 AST_CHECK_GNU_MAKE
111 AC_PATH_PROG([GREP], [grep], :)
112 AC_PATH_PROG([AR], [ar], :)
113 AC_PATH_PROG([FIND], [find], :)
114 AC_PATH_PROG([COMPRESS], [compress], :)
115 AC_PATH_PROG([BASENAME], [basename], :)
116 AC_PATH_PROG([DIRNAME], [dirname], :)
117 AC_PATH_PROG([SHELL], [sh], :)
118 AC_PATH_PROG([LN], [ln], :)
119 AC_PATH_PROG([DOT], [dot], :)
121 AC_LANG(C)
123 AC_ARG_ENABLE(dev-mode,
124         [  --enable-dev-mode    Turn on developer mode],
125         [case "${enableval}" in
126               y|ye|yes) AST_DEVMODE=yes ;;
127               n|no)  AST_DEVMODE=no ;;
128               *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode)  ;;
129         esac])
130 AC_SUBST(AST_DEVMODE)
132 # package option names should be in alphabetical order
133 # by the --with option name, to make things easier for the users :-)
135 AST_EXT_LIB_SETUP([ALSA], [Advanced Linux Sound Architecture], [asound])
136 AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
137 AST_EXT_LIB_SETUP([GNUTLS], [GNU TLS support (used for iksemel only)], [gnutls])
138 AST_EXT_LIB_SETUP([GSM], [GSM], [gsm], [, or 'internal'])
139 AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber Library], [iksemel])
140 AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
141 AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux Library], [isdnnet])
142 AST_EXT_LIB_SETUP([KDE], [KDE], [kde])
143 AST_EXT_LIB_SETUP([MISDN], [mISDN User Library], [misdn])
144 AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs])
145 AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
146 AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
147 AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
148 AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [odbc])
149 AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
150 AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
151 AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
152 AST_EXT_LIB_SETUP([POPT], [popt], [popt])
153 AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
154 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
155 AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
156 AST_EXT_LIB_SETUP([QT], [Qt], [qt])
157 AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
158 AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
159 AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
160 AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
161 AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL], [ssl])
162 AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
163 AST_EXT_LIB_SETUP([TERMCAP], [Termcap], [termcap])
164 AST_EXT_LIB_SETUP([TINFO], [Term Info], [tinfo])
165 AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
166 AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
167 AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
168 AST_EXT_LIB_SETUP([ZLIB], [zlib], [z])
169 AST_EXT_LIB_SETUP([ZAPTEL], [Zaptel], [zaptel])
171 # check for basic system features and functionality before
172 # checking for package libraries
174 AC_FUNC_ALLOCA
175 AC_HEADER_DIRENT
176 AC_HEADER_STDC
177 AC_HEADER_SYS_WAIT
178 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])
180 AC_SYS_LARGEFILE
182 # Checks for typedefs, structures, and compiler characteristics.
183 AC_HEADER_STDBOOL
184 AC_C_CONST
185 AC_TYPE_UID_T
186 AC_C_INLINE
187 AC_TYPE_MODE_T
188 AC_TYPE_OFF_T
189 AC_TYPE_PID_T
190 AC_TYPE_SIZE_T
191 AC_CHECK_MEMBERS([struct stat.st_blksize])
192 AC_HEADER_TIME
193 AC_STRUCT_TM
194 AC_C_VOLATILE
195 AC_CHECK_TYPES([ptrdiff_t])
197 # Checks for library functions.
198 AC_FUNC_CHOWN
199 AC_FUNC_CLOSEDIR_VOID
200 AC_FUNC_ERROR_AT_LINE
201 AC_FUNC_FORK
202 AC_FUNC_FSEEKO
203 AC_PROG_GCC_TRADITIONAL
204 # XXX: these are commented out until we determine whether it matters if our malloc()
205 # acts exactly like glibc's or not
206 # AC_FUNC_MALLOC
207 # AC_FUNC_REALLOC
208 AC_FUNC_MEMCMP
209 AC_FUNC_MKTIME
210 AC_FUNC_MMAP
211 AC_FUNC_SELECT_ARGTYPES
212 AC_FUNC_SETVBUF_REVERSED
213 AC_TYPE_SIGNAL
214 AC_FUNC_STAT
215 AC_FUNC_STRCOLL
216 AC_FUNC_STRFTIME
217 AC_FUNC_STRNLEN
218 AC_FUNC_STRTOD
219 AC_FUNC_UTIME_NULL
220 AC_FUNC_VPRINTF
221 AC_CHECK_FUNCS([atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strchr strcspn strdup strerror strncasecmp strndup strnlen strrchr strsep strspn strstr strtol unsetenv utime strtoq strcasestr asprintf vasprintf])
223 AC_MSG_CHECKING(checking for compiler atomic operations)
224 AC_LINK_IFELSE(
225 AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);]),
226 AC_MSG_RESULT(yes)
227 AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides atomic operations.]),
228 AC_MSG_RESULT(no)
231 AC_MSG_CHECKING(checking for res_ninit)
232 AC_LINK_IFELSE(
233         AC_LANG_PROGRAM([#include <resolv.h>],
234                         [int foo = res_ninit(NULL);]),
235         AC_MSG_RESULT(yes)
236         AC_DEFINE([HAVE_RES_NINIT], 1, [Define to 1 if your system has the re-entrant resolver functions.]),
237         AC_MSG_RESULT(no)
240 AST_GCC_ATTRIBUTE(pure)
241 AST_GCC_ATTRIBUTE(malloc)
242 AST_GCC_ATTRIBUTE(const)
243 AST_GCC_ATTRIBUTE(unused)
244 AST_GCC_ATTRIBUTE(always_inline)
246 AC_CHECK_HEADER([libkern/OSAtomic.h],
247                 [AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
249 AC_CHECK_SIZEOF(int)
251 # do the package library checks now
253 AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
255 AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
257 GSM_INTERNAL="yes"
258 AC_SUBST(GSM_INTERNAL)
259 GSM_SYSTEM="yes"
260 if test "${USE_GSM}" != "no"; then
261    if test "${GSM_DIR}" = "internal"; then
262       GSM_SYSTEM="no"
263    elif test "${GSM_DIR}" != ""; then
264       GSM_INTERNAL="no"
265    fi
266    if test "${GSM_SYSTEM}" = "yes"; then
267       gsmlibdir=""
268       if test "x${GSM_DIR}" != "x"; then
269          if test -d ${GSM_DIR}/lib; then
270             gsmlibdir="-L${GSM_DIR}/lib"
271          else
272             gsmlibdir="-L${GSM_DIR}"
273          fi
274       fi
275       AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
276       [Define to indicate the GSM library]), [], ${gsmlibdir})
277       if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
278          GSM_LIB="-lgsm"
279          if test "x${GSM_DIR}" != "x"; then
280             GSM_LIB="${gsmlibdir} ${GSM_LIB}"
281             GSM_INCLUDE="-I${GSM_DIR}/include"
282          fi
283          PBX_GSM=1
284          GSM_INTERNAL="no"
285       fi
286    fi
287    if test "${GSM_INTERNAL}" = "yes"; then
288       PBX_GSM=1
289    fi
292 AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h])
294 if test "${PBX_IKSEMEL}" = 1; then
295    AST_EXT_LIB_CHECK([GNUTLS], [gnutls], [gnutls_bye])
296    if test "${PBX_GNUTLS}" = 1; then
297       IKSEMEL_LIB="${IKSEMEL_LIB} -lgnutls -ltasn1 -lz -lgcrypt -lnsl -lgpg-error"
298    fi
301 if test "${USE_IMAP_TK}" != "no"; then
302    if test "${IMAP_TK_DIR}" = ""; then
303       IMAP_TK_DIR=`pwd`"/../imap-2004g"
304    fi
305    AC_MSG_CHECKING(checking for UW IMAP Toolkit c-client library)
306    saved_cppflags="${CPPFLAGS}"
307    saved_libs="${LIBS}"
308    if test -f ${IMAP_TK_DIR}/c-client/LDFLAGS ; then
309       imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
310    fi
311    CPPFLAGS="${CPPFLAGS} -I${IMAP_TK_DIR}/c-client"
312    LIBS="${LIBS} ${IMAP_TK_DIR}/c-client/c-client.a "`echo ${imap_ldflags}`
313    AC_LINK_IFELSE(
314         AC_LANG_PROGRAM(
315                 [#include "c-client.h"
316                 void mm_searched (MAILSTREAM *stream,unsigned long number)
317                 {
318                 }
319                 void mm_exists (MAILSTREAM *stream,unsigned long number)
320                 {
321                 }
322                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
323                 {
324                 }
325                 void mm_flags (MAILSTREAM *stream,unsigned long number)
326                 {
327                 }
328                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
329                 {
330                 }
331                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
332                 {
333                 }
334                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
335                 {
336                 }
337                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
338                 {
339                 }
340                 void mm_log (char *string,long errflg)
341                 {
342                 }
343                 void mm_dlog (char *string)
344                 {
345                 }
346                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
347                 {
348                 }
349                 void mm_critical (MAILSTREAM *stream)
350                 {
351                 }
352                 void mm_nocritical (MAILSTREAM *stream)
353                 {
354                 }
355                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
356                 {
357                 }
358                 void mm_fatal (char *string)
359                 {
360                 }],
361                 [
362                 MAILSTREAM *foo = mail_open(NULL, "", 0);
363                 ]
364         ),
365         [ac_cv_imap_tk="yes"],
366         [ac_cv_imap_tk="no"]
367    )
368    if test "${ac_cv_imap_tk}" = "yes"; then
369    AC_LINK_IFELSE(
370       AC_LANG_PROGRAM(
371          [#include "c-client.h"
372          void mm_searched (MAILSTREAM *stream,unsigned long number)
373          {
374          }
375          void mm_exists (MAILSTREAM *stream,unsigned long number)
376          {
377          }
378          void mm_expunged (MAILSTREAM *stream,unsigned long number)
379          {
380          }
381          void mm_flags (MAILSTREAM *stream,unsigned long number)
382          {
383          }
384          void mm_notify (MAILSTREAM *stream,char *string,long errflg)
385          {
386          }
387          void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
388          {
389          }
390          void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
391          {
392          }
393          void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
394          {
395          }
396          void mm_log (char *string,long errflg)
397          {
398          }
399          void mm_dlog (char *string)
400          {
401          }
402          void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
403          {
404          }
405          void mm_critical (MAILSTREAM *stream)
406          {
407          }
408          void mm_nocritical (MAILSTREAM *stream)
409          {
410          }
411          long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
412          {
413          }
414          void mm_fatal (char *string)
415          {
416          }],
417          [
418          long check = mail_expunge_full(NULL, "", 0);
419          ]
420       ),
421       [ac_cv_imap_tk2006="yes"],
422       [ac_cv_imap_tk2006="no"]
423   )
424   fi
425    CPPFLAGS="${saved_cppflags}"
426    LIBS="${saved_libs}"
427    if test "${ac_cv_imap_tk}" = "yes"; then
428       AC_MSG_RESULT(yes) 
429       IMAP_TK_LIB="${IMAP_TK_DIR}/c-client/c-client.a "`echo ${imap_ldflags}`
430       IMAP_TK_INCLUDE="-I${IMAP_TK_DIR}/c-client"
431       PBX_IMAP_TK=1
432       AC_DEFINE([HAVE_IMAP_TK], 1, [Define if your system has the UW IMAP Toolkit c-client library.])
433       if test "${ac_cv_imap_tk2006}" = "yes"; then
434          AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
435       fi
436    elif test ! -z "${IMAP_TK_MANDATORY}"; then
437       AC_MSG_RESULT(no) 
438       AC_MSG_NOTICE(***)
439       AC_MSG_NOTICE(*** The UW IMAP Toolkit installation on this system appears to be broken.)
440       AC_MSG_NOTICE(*** Either correct the installation, or run configure)
441       AC_MSG_NOTICE(*** including --without-imap.)
442       exit 1
443    else
444       AC_MSG_RESULT(no) 
445    fi
448 AC_LANG_PUSH(C++)
450 if test "${USE_KDE}" != "no"; then
451    AC_MSG_CHECKING(checking for crashHandler in -lkdecore)
452    saved_libs="${LIBS}"
453    saved_cppflags="${CPPFLAGS}"
454    CPPFLAGS="${CPPFLAGS} -I${KDE_DIR}/include"
455    if test -d ${KDE_DIR}/lib; then
456       kdelibdir="${KDE_DIR}/lib"
457    else
458       kdelibdir="${KDE_DIR}"
459    fi
460    LIBS="${LIBS} -L${kdelibdir} -lkdecore"
462    AC_LINK_IFELSE(
463         [AC_LANG_PROGRAM(
464                         [#include "kcrash.h"],
465                         [KCrash::defaultCrashHandler(1);])
466         ],
467         [ac_cv_lib_kde_crash="yes"],
468         [ac_cv_lib_kde_crash="no"])
469                 
470    LIBS="${saved_libs}"
471    CPPFLAGS="${saved_cppflags}"
472         
473    if test "${ac_cv_lib_kde_crash}" = "yes"; then
474       AC_MSG_RESULT(yes) 
475       KDE_LIB="-lkdecore -lkdeui"
476       if test "${KDE_DIR}" != ""; then
477          KDE_LIB="-L${kdelibdir} ${KDE_LIB}"
478          KDE_INCLUDE="-I${KDE_DIR}/include"
479       fi
480       PBX_KDE=1
481       AC_DEFINE([HAVE_LIBKDE], 1, [Define if your system has the KDE libraries.])
482    elif test ! -z "${KDE_MANDATORY}"; then
483       AC_MSG_RESULT(no) 
484       AC_MSG_NOTICE(***)
485       AC_MSG_NOTICE(*** The KDE installation on this system appears to be broken.)
486       AC_MSG_NOTICE(*** Either correct the installation, or run configure)
487       AC_MSG_NOTICE(*** including --without-kde.)
488       exit 1
489    else
490       AC_MSG_RESULT(no) 
491    fi
493 if test "${PBX_KDE}" = 1; then
494    AC_PATH_TOOL(KDEINIT, kdeinit, No)
495    if test ! x"${KDEINIT}" = xNo; then
496       KDEDIR=$(${DIRNAME} ${KDEINIT})
497       KDEDIR=$(${DIRNAME} ${KDEDIR})
498    fi
499    AC_SUBST([KDEDIR])
502 AC_LANG_POP
504 AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h])
506 if test "${PBX_MISDN}" = 1; then
507    AST_EXT_LIB_CHECK([ISDNNET], [isdnnet], [init_manager], [mISDNuser/isdn_net.h], [-lmISDN -lpthread])
508    AST_EXT_LIB_CHECK([SUPPSERV], [suppserv], [encodeFac], [mISDNuser/suppserv.h])
511 AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
513 AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
515 NETSNMP_CONFIG=No
516 if test "${USE_NETSNMP}" != "no"; then  
517    if test "x${NETSNMP_DIR}" != "x"; then
518       AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No, [${NETSNMP_DIR}/bin])
519       if test x"${NETSNMP_CONFIG}" = xNo; then
520          AC_MSG_NOTICE(***)
521          AC_MSG_NOTICE(*** net-snmp-config was not found in the path you specified:)
522          AC_MSG_NOTICE(*** ${NETSNMP_DIR}/bin)
523          AC_MSG_NOTICE(*** Either correct the installation, or run configure)
524          AC_MSG_NOTICE(*** including --without-netsnmp)
525          exit 1
526       fi
527    else
528       AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No)
529    fi
531 if test x"${NETSNMP_CONFIG}" != xNo; then
532    NETSNMP_libs=`net-snmp-config --agent-libs`
533    
534    AC_CHECK_LIB([netsnmp], [snmp_register_callback], AC_DEFINE_UNQUOTED([HAVE_NETSNMP], 1,
535    [Define to indicate the Net-SNMP library]), [], ${NETSNMP_libs})
537    if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then
538       NETSNMP_LIB="${NETSNMP_libs}"
539       PBX_NETSNMP=1
540    elif test ! -z "${NETSNMP_MANDATORY}";
541    then
542       AC_MSG_NOTICE(***)
543       AC_MSG_NOTICE(*** The Net-SNMP installation on this system appears to be broken.)
544       AC_MSG_NOTICE(*** Either correct the installation, or run configure)
545       AC_MSG_NOTICE(*** including --without-netsnmp)
546       exit 1
547    fi
548 elif test ! -z "${NETSNMP_MANDATORY}";
549 then
550    AC_MSG_NOTICE(***)
551    AC_MSG_NOTICE(*** The Net-SNMP installation on this system appears to be broken.)
552    AC_MSG_NOTICE(*** Either correct the installation, or run configure)
553    AC_MSG_NOTICE(*** including --without-netsnmp)
554    exit 1
557 AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
559 AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [-lltdl])
561 AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
563 AST_EXT_LIB_CHECK([OSPTK], [osptk], [OSPPCryptoDecrypt], [osp/osp.h], [-lcrypto -lssl])
565 PBX_OSS=0
566 AC_CHECK_HEADER([linux/soundcard.h],
567                 [
568                 PBX_OSS=1
569                 AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
570                 ])
571 if test "$PBX_OSS" = "0"; then
572    AC_CHECK_HEADER([sys/soundcard.h],
573                    [
574                    PBX_OSS=1
575                    AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
576                    ])
578 if test "$PBX_OSS" = "0"; then
579    AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
582 PG_CONFIG=No
583 if test "${USE_PGSQL}" != "no"; then    
584    if test "x${PGSQL_DIR}" != "x"; then
585       AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
586       if test x"${PG_CONFIG}" = xNo; then
587          AC_MSG_NOTICE(***)
588          AC_MSG_NOTICE(*** pg_config was not found in the path you specified:)
589          AC_MSG_NOTICE(*** ${PGSQL_DIR}/bin)
590          AC_MSG_NOTICE(*** Either correct the installation, or run configure)
591          AC_MSG_NOTICE(*** including --without-postgres)
592          exit 1
593       fi
594    else
595       AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
596    fi
598 if test "${PG_CONFIG}" != No; then
599    PGSQL_libdir=`pg_config --libdir`
600    PGSQL_includedir=`pg_config --includedir`
601    
602    AC_CHECK_LIB([pq], [PQexec], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
603    [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
605    if test "${ac_cv_lib_pq_PQexec}" = "yes"; then
606       PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz -lcrypt"
607       PGSQL_INCLUDE="-I${PGSQL_includedir}"
608       PBX_PGSQL=1
609    elif test ! -z "${PGSQL_MANDATORY}";
610    then
611       AC_MSG_NOTICE(***)
612       AC_MSG_NOTICE(*** The PostgreSQL installation on this system appears to be broken.)
613       AC_MSG_NOTICE(*** Either correct the installation, or run configure)
614       AC_MSG_NOTICE(*** including --without-postgres)
615       exit 1
616    fi
617 elif test ! -z "${PGSQL_MANDATORY}";
618 then
619    AC_MSG_NOTICE(***)
620    AC_MSG_NOTICE(*** The PostgreSQL installation on this system appears to be broken.)
621    AC_MSG_NOTICE(*** Either correct the installation, or run configure)
622    AC_MSG_NOTICE(*** including --without-postgres)
623    exit 1
626 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
628 AST_EXT_LIB_CHECK([PRI], [pri], [pri_call], [libpri.h])
630 PLATFORM_PTLIB="ptlib_${OSTYPE}_${MACHTYPE}_r"
631 if test "${USE_PWLIB}" != "no"; then
632    AC_MSG_CHECKING(checking for existence of pwlib)
633         
634    saved_cppflags="${CPPFLAGS}"
635    saved_libs="${LIBS}"
636    LIBS="${LIBS} -L${PWLIB_DIR} -l${PLATFORM_PTLIB}"
637    CPPFLAGS="${CPPFLAGS} -I${PWLIB_DIR}/include"
638         
639    AC_LINK_IFELSE(
640         [
641         AC_LANG_PROGRAM(
642         [#include "ptime.h"],
643         [int q = PTime::IsDaylightSaving();])
644         ],
645         [       AC_MSG_RESULT(yes) 
646                 ac_cv_lib_pwlib="yes" 
647         ],
648         [       AC_MSG_RESULT(no) 
649                 ac_cv_lib_pwlib="no" 
650         ]
651         )
653    LIBS="${saved_libs}"
654    CPPFLAGS="${saved_cppflags}"
656    if test "${ac_cv_lib_pwlib}" = "yes"; then
657       PWLIB_LIB="-l{PLATFORM_PWLIB}"
658       if test "${PWLIB_DIR}" != ""; then
659          PWLIB_LIB="-L${PWLIB_DIR}/lib ${PWLIB_LIB}"
660          PWLIB_INCLUDE="-I${PWLIB_DIR}/include"
661       fi
662         PBX_PWLIB=1
663         AC_DEFINE([HAVE_PWLIB], 1, [Define if your system has the pwlib libraries.])
664    elif test ! -z "${PWLIB_MANDATORY}"; then
665       AC_MSG_NOTICE(***)
666       AC_MSG_NOTICE(*** The PWLIB installation on this system appears to be broken.)
667       AC_MSG_NOTICE(*** Either correct the installation, or run configure)
668       AC_MSG_NOTICE(*** including --without-pwlib)
669       exit 1
670    fi
673 AC_LANG_PUSH(C++)
675 if test "${USE_QT}" != "no"; then
676    AC_MSG_CHECKING(checking for QDate in -lqt)
677    saved_libs="${LIBS}"
678    saved_cppflags="${CPPFLAGS}"
679    if test "x${QT_DIR}" != "x"; then
680       LIBS="${LIBS} -L${QT_DIR}/lib"
681       CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
682    fi
683    LIBS="${LIBS} -lqt"
684    qtlib="qt"
685    AC_LINK_IFELSE(
686         [
687                 AC_LANG_PROGRAM(
688                 [#include <qt3/qdatetime.h>],
689                 [QDate date();])
690         ],
691         [ac_cv_lib_qt_qt_date="yes"],
692         [ac_cv_lib_qt_qt_date="no"])
693    LIBS="${saved_libs}"
694    CPPFLAGS="${saved_cppflags}"
695         
696    if test "${ac_cv_lib_qt_qt_date}" = "no"; then
697       saved_libs="${LIBS}"
698       saved_cppflags="${CPPFLAGS}"
699       if test "x${QT_DIR}" != "x"; then
700          LIBS="${LIBS} -L${QT_DIR}/lib"
701          CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
702       fi
703       LIBS="${LIBS} -lqt-mt"
704       qtlib="qt-mt"     
705       AC_LINK_IFELSE(
706                 [
707                         AC_LANG_PROGRAM(
708                         [#include <qt3/qdatetime.h>],
709                         [QDate date();])
710                 ],
711                 [ac_cv_lib_qt_qt_date="yes"],
712                 [ac_cv_lib_qt_qt_date="no"])
713       LIBS="${saved_libs}"
714       CPPFLAGS="${saved_cppflags}"
715    fi   
717    if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
718       AC_MSG_RESULT(yes) 
719    else
720       AC_MSG_RESULT(no) 
721    fi
722         
723    if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
724       QT_LIB="-l${qtlib}"
725       if test "${QT_DIR}" != ""; then
726          QT_LIB="-L${QT_DIR}/lib ${QT_LIB}"
727          QT_INCLUDE="-I${QT_DIR}/include"
728       fi
729       PBX_QT=1
730       AC_DEFINE([HAVE_QT], 1, [Define if your system has the Qt library])
731       AC_PATH_TOOL(QTMOC, moc, No)
732    elif test ! -z "${QT_MANDATORY}"; 
733    then
734       AC_MSG_NOTICE(***)
735       AC_MSG_NOTICE(*** The Qt installation on this system appears to be broken.)
736       AC_MSG_NOTICE(*** Either correct the installation, or run configure)
737       AC_MSG_NOTICE(*** including --without-qt.)
738       exit 1
739    fi
742 AC_LANG_POP
744 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
746 AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
748 AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
750 AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl2_connect], [openssl/ssl.h], [-lcrypto])
752 AST_EXT_LIB_CHECK([FREETDS], [tds], [tds_version], [tds.h])
753 if test "${PBX_FREETDS}" != "0";
754 then
755     case `grep TDS_VERSION_NO ${FREETDS_DIR:-/usr/include}/tdsver.h` in
756     *0.63*)
757         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_63"
758         ;;
759     *0.62*)
760         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_62"
761         ;;
762     *)
763         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_PRE_0_62"
764         ;;
765     esac
768 AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
770 AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
772 if test "${host_os}" != "linux-gnu" ; then
773   tonezone_extra="-lm"
776 AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/tonezone.h], [${tonezone_extra}])
778 AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
780 AC_LANG_PUSH(C++)
782 if test "${USE_VPB}" != "no"; then
783    AC_MSG_CHECKING(checking for vpb_open in -lvpb)
784    saved_libs="${LIBS}"
785    saved_cppflags="${CPPFLAGS}"
786    if test "x${VPB_DIR}" != "x"; then
787       if test -d ${VPB_DIR}/lib; then
788          vpblibdir=${VPB_DIR}/lib
789       else
790          vpblibdir=${VPB_DIR}
791       fi
792       LIBS="${LIBS} -L${vpblibdir}"
793       CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
794    fi
795    LIBS="${LIBS} -lvpb -lpthread"
796    AC_LINK_IFELSE(
797         [
798         AC_LANG_PROGRAM(
799         [#include <vpbapi.h>],
800         [int q = vpb_open(0,0);])
801         ],
802         [       AC_MSG_RESULT(yes) 
803                 ac_cv_lib_vpb_vpb_open="yes" 
804         ],
805         [       AC_MSG_RESULT(no) 
806                 ac_cv_lib_vpb_vpb_open="no" 
807         ]
808         )
809    LIBS="${saved_libs}"
810    CPPFLAGS="${saved_cppflags}"
811    if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
812         VPB_LIB="-lvpb"
813         if test "${VPB_DIR}" != ""; then
814            VPB_LIB="-L${vpblibdir}  ${VPB_LIB}"
815            VPB_INCLUDE="-I${VPB_DIR}/include"
816         fi
817         PBX_VPB=1
818         AC_DEFINE([HAVE_VPB], 1, [Define if your system has the VoiceTronix API libraries.])
819    elif test ! -z "${VPB_MANDATORY}"; then
820       AC_MSG_NOTICE(***)
821       AC_MSG_NOTICE(*** The VoiceTronix (vpb) installation on this system appears to be broken.)
822       AC_MSG_NOTICE(*** Either correct the installation, or run configure)
823       AC_MSG_NOTICE(*** including --without-vpb.)
824       exit 1
825    fi
828 AC_LANG_POP
830 AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
832 if test "${USE_ZAPTEL}" != "no"; then
833    AC_MSG_CHECKING(checking for zt_transcode_header in zaptel.h)
834    saved_cppflags="${CPPFLAGS}"
835    if test "x${ZAPTEL_DIR}" != "x"; then
836       CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
837    fi
838    AC_COMPILE_IFELSE(
839         [
840         AC_LANG_PROGRAM(
841         [#include <zaptel/zaptel.h>],
842         [struct zt_transcode_header test;])
843         ],
844         [       AC_MSG_RESULT(yes) 
845                 ac_cv_zaptel_h="yes" 
846         ],
847         [       AC_MSG_RESULT(no) 
848                 ac_cv_zaptel_h="no" 
849         ]
850         )
851    CPPFLAGS="${saved_cppflags}"
852    if test "${ac_cv_zaptel_h}" = "yes"; then
853         if test "${ZAPTEL_DIR}" != ""; then
854            ZAPTEL_INCLUDE="-I${ZAPTEL_DIR}/include"
855         fi
856         PBX_ZAPTEL=1
857         AC_DEFINE([HAVE_ZAPTEL], 1, [Define if your system has the Zaptel headers.])
858    elif test ! -z "${ZAPTEL_MANDATORY}"; 
859    then
860       AC_MSG_NOTICE(***)
861       AC_MSG_NOTICE(*** The Zaptel installation on this system appears to be broken.)
862       AC_MSG_NOTICE(*** Either correct the installation, or run configure)
863       AC_MSG_NOTICE(*** including --without-zaptel.)
864       exit 1
865    fi
868 EDITLINE_LIB=""
869 if test "x$TERMCAP_LIB" != "x" ; then
870   EDITLINE_LIB="$TERMCAP_LIB"
871 elif test "x$TINFO_LIB" != "x" ; then
872   EDITLINE_LIB="$TINFO_LIB"
873 elif test "x$CURSES_LIB" != "x" ; then
874   EDITLINE_LIB="$CURSES_LIB"
875 elif test "x$NCURSES_LIB" != "x" ; then
876   EDITLINE_LIB="$NCURSES_LIB"
877 else
878   AC_MSG_ERROR(*** termcap support not found)
880 AC_SUBST(EDITLINE_LIB)
882 AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
883 AC_SUBST(PBX_H323)
885 AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
886                                    #include <linux/version.h>
887                                    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
888                                    #include <linux/compiler.h>
889                                    #endif
890                                    ])
891 AC_SUBST(PBX_IXJUSER)
893 PBX_GTK=0
894 AC_CHECK_TOOL(GTKCONFIG, gtk-config, No)
895 if test ! "x${GTKCONFIG}" = xNo; then
896    GTK_INCLUDE=$(${GTKCONFIG} --cflags gthread)
897    GTK_LIB=$(${GTKCONFIG} --libs gthread)
898    PBX_GTK=1
899    AC_DEFINE([HAVE_GTK], 1, [Define if your system has the GTK libraries.])
901 AC_SUBST(PBX_GTK)
902 AC_SUBST(GTK_INCLUDE)
903 AC_SUBST(GTK_LIB)
905 PBX_CURL=0
906 AC_PATH_TOOL([CURL], [curl-config], No)
907 if test ! x"${CURL}" = xNo; then
908 # check for version
909    if test "${host_os}" = "SunOS"; then
910       if [[ 0x`curl-config --vernum` -ge 0x70907 ]]; then
911          CURLLIB=$(${CURL} --libs)
912          PBX_CURL=1
913          AC_DEFINE([HAVE_CURL], 1, [Define if your system has the curl libraries.])
914       fi
915    else
916       if [[[ 0x`curl-config --vernum` -ge 0x70907 ]]]; then
917          CURLLIB=$(${CURL} --libs)
918          PBX_CURL=1
919          AC_DEFINE([HAVE_CURL], 1, [Define if your system has the curl libraries.])
920       fi
921    fi
923 AC_SUBST(PBX_CURL)
924 AC_SUBST(CURLLIB)
926 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts])
927 AC_OUTPUT
929 if test "x${silent}" != "xyes" ; then
930 echo
931 echo "               .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=..      "
932 echo "            .\$7\$7..          .7\$\$7:.    "
933 echo "          .\$\$:.                 ,\$7.7   "
934 echo "        .\$7.     7\$\$\$\$           .\$\$77  "
935 echo "     ..\$\$.       \$\$\$\$\$            .\$\$\$7 "
936 echo "    ..7\$   .?.   \$\$\$\$\$   .?.       7\$\$\$."
937 echo "   \$.\$.   .\$\$\$7. \$\$\$\$7 .7\$\$\$.      .\$\$\$."
938 echo " .777.   .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7.      \$\$\$,"
939 echo " \$\$\$~      .7\$\$\$\$\$\$\$\$\$\$\$\$\$7.       .\$\$\$."
940 echo ".\$\$7          .7\$\$\$\$\$\$\$7:          ?\$\$\$."
941 echo "\$\$\$          ?7\$\$\$\$\$\$\$\$\$\$I        .\$\$\$7 "
942 echo "\$\$\$       .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$      :\$\$\$. "
943 echo "\$\$\$       \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$    .\$\$\$.  "
944 echo "\$\$\$        \$\$\$   7\$\$\$7  .\$\$\$    .\$\$\$.   "
945 echo "\$\$\$\$             \$\$\$\$7         .\$\$\$.    "
946 echo "7\$\$\$7            7\$\$\$\$        7\$\$\$      "
947 echo " \$\$\$\$\$                        \$\$\$       "
948 echo "  \$\$\$\$7.                       \$\$  (TM)     "
949 echo "   \$\$\$\$\$\$\$.           .7\$\$\$\$\$\$  \$\$      "
950 echo "     \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$      "
951 echo "       \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$.                "
952 echo
955 AC_MSG_NOTICE(Package configured for: )
956 AC_MSG_NOTICE( OS type  : $host_os)
957 AC_MSG_NOTICE( Host CPU : $host_cpu)
958 if test "${cross_compiling}" = "yes"; then
959    AC_MSG_NOTICE( Cross Compilation = YES)
962 if test ${GNU_MAKE_VERSION_MAJOR} -lt 3 || test ${GNU_MAKE_VERSION_MINOR} -lt 81 ; then
963    AC_MSG_NOTICE()
964    AC_MSG_NOTICE(***** WARNING ******)
965    AC_MSG_NOTICE(You are currently using GNU Make version ${GNU_MAKE_VERSION_MAJOR}.${GNU_MAKE_VERSION_MINOR}.)
966    AC_MSG_NOTICE(The Asterisk build system uses features that may not work correctly prior to 3.81.)
967    AC_MSG_NOTICE(Please consider upgrading GNU Make or you may experience problems.)
968    AC_MSG_NOTICE(********************)
969    AC_MSG_NOTICE()