Merged revisions 134649 via svnmerge from
[asterisk/asterisk.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2 #
3 # Make sure we use autoconf 2.60 to generate the "configure" script,
4 # in case we want to commit it. Other than that, version 2.59 is
5 # perfectly fine for our purposes, so people who want to modify
6 # this file just have to remember to set the AC_PREREQ argument
7 # to something that suits their needs.
8
9 AC_PREREQ(2.60)
10
11 AC_INIT(asterisk, 1.6, www.asterisk.org)
12
13 # cross-compile macros
14 AC_CANONICAL_BUILD
15 AC_CANONICAL_HOST
16
17 # check existence of the package
18 AC_CONFIG_SRCDIR([main/asterisk.c])
19
20 # specify output header file
21 AC_CONFIG_HEADER(include/asterisk/autoconfig.h)
22
23 AC_COPYRIGHT("Asterisk")
24 AC_REVISION($Revision$)
25
26 AC_GNU_SOURCE
27 AC_USE_SYSTEM_EXTENSIONS        # note- does not work on FreeBSD
28
29 case "${host_os}" in
30      freebsd*)
31      ac_default_prefix=/usr/local
32      CPPFLAGS=-I/usr/local/include
33      LDFLAGS=-L/usr/local/lib
34      ;;
35
36      *)
37      ac_default_prefix=/usr
38      if test ${prefix} = '/usr' || test ${prefix} = 'NONE'; then
39         if test ${sysconfdir} = '${prefix}/etc'; then
40            sysconfdir=/etc
41         fi
42         if test ${mandir} = '${prefix}/man'; then
43            mandir=/usr/share/man
44         fi
45      fi
46      ;;
47 esac
48
49 if test ${localstatedir} = '${prefix}/var'; then
50      localstatedir=/var
51 fi
52
53 BUILD_PLATFORM=${build}
54 BUILD_CPU=${build_cpu}
55 BUILD_VENDOR=${build_vendor}
56 BUILD_OS=${build_os}
57
58 AC_SUBST(BUILD_PLATFORM)
59 AC_SUBST(BUILD_CPU)
60 AC_SUBST(BUILD_VENDOR)
61 AC_SUBST(BUILD_OS)
62
63 HOST_PLATFORM=${host}
64 HOST_CPU=${host_cpu}
65 HOST_VENDOR=${host_vendor}
66 HOST_OS=${host_os}
67
68 AC_SUBST(HOST_PLATFORM)
69 AC_SUBST(HOST_CPU)
70 AC_SUBST(HOST_VENDOR)
71 AC_SUBST(HOST_OS)
72
73 WINARCH=0
74
75 case "${host_os}" in
76      freebsd*)
77      OSARCH=FreeBSD
78      ;;
79      netbsd*)
80      OSARCH=NetBSD
81      ;;
82      openbsd*)
83      OSARCH=OpenBSD
84      ;;
85      solaris*)
86      OSARCH=SunOS
87      ;;
88      mingw32)
89      OSARCH=mingw32
90      WINARCH=1
91      ;;
92      cygwin)
93      OSARCH=cygwin
94      WINARCH=1
95      ;;
96      *)
97      OSARCH=${host_os}
98      ;;
99 esac
100
101 AC_SUBST(OSARCH)
102 AC_SUBST(WINARCH)
103
104 #  check for uname
105 AC_PATH_TOOL([UNAME], [uname], No)
106 if test ! x"${UNAME}" = xNo; then
107    PBX_OSREV=$(${UNAME} -r)
108 fi
109 AC_SUBST(PBX_OSREV)
110
111 AH_TOP(
112 #ifndef ASTERISK_AUTOCONFIG_H
113 #define ASTERISK_AUTOCONFIG_H
114
115 #include "asterisk/buildopts.h"
116
117 )
118
119 AH_BOTTOM(
120 #endif
121 )
122
123 # cross-compile checks
124 if test "${cross_compiling}" = "yes"; 
125 then
126    AC_CHECK_TOOL(CC, gcc, :)
127    AC_CHECK_TOOL(CXX, g++, :)
128    AC_CHECK_TOOL(LD, ld, :)
129    AC_CHECK_TOOL(RANLIB, ranlib, :)
130 fi
131
132 # Checks for programs.
133 AC_PROG_CC
134 AC_PROG_CXX
135 AC_PROG_CPP
136 AC_PROG_CXXCPP
137 # This macro is just copied into our local acinclude.m4 from libtool.m4 so that
138 # the developers regenerating the configure script don't have to install libtool.
139 AST_PROG_LD     # note, does not work on FreeBSD
140 AC_PROG_AWK
141 AC_PROG_INSTALL
142 AC_PROG_LN_S
143 AC_PROG_RANLIB
144 AST_CHECK_GNU_MAKE
145
146 AC_PATH_TOOL([STRIP], [strip], :)
147 AC_PATH_TOOL([AR], [ar], :)
148
149 GNU_LD=0
150 if test "x$with_gnu_ld" = "xyes" ; then
151    GNU_LD=1
152 fi
153 AC_SUBST(GNU_LD)
154
155 AC_PATH_PROG([GREP], [grep], :)
156 AC_PATH_PROG([FIND], [find], :)
157 AC_PATH_PROG([COMPRESS], [compress], :)
158 AC_PATH_PROG([BASENAME], [basename], :)
159 AC_PATH_PROG([ID], [id], :)
160 AC_PATH_PROG([DIRNAME], [dirname], :)
161 AC_PATH_PROG([SHELL], [sh], :)
162 AC_PATH_PROG([LN], [ln], :)
163 AC_PATH_PROG([DOT], [dot], :)
164 AC_PATH_PROG([WGET], [wget], :)
165 AC_PATH_PROG([RUBBER], [rubber], :)
166 AC_PATH_PROG([KPATHSEA], [kpsewhich], :)
167 if test "${WGET}" != ":" ; then
168   DOWNLOAD=${WGET}
169 else
170   AC_PATH_PROG([FETCH], [fetch], [:])
171   DOWNLOAD=${FETCH}
172 fi
173 AC_SUBST(DOWNLOAD)
174
175 AC_CHECK_TOOL([SOXMIX], [soxmix], [:])
176 if test "${SOXMIX}" != ":" ; then
177         AC_DEFINE([HAVE_SOXMIX], 1, [Define to 1 if your system has soxmix application.])
178 fi
179
180 ACX_PTHREAD
181
182 AC_LANG(C)
183
184 AC_ARG_ENABLE(dev-mode,
185         [  --enable-dev-mode    Turn on developer mode],
186         [case "${enableval}" in
187               y|ye|yes) AST_DEVMODE=yes ;;
188               n|no)  AST_DEVMODE=no ;;
189               *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode)  ;;
190         esac])
191 AC_SUBST(AST_DEVMODE)
192
193 # AST_EXT_LIB_SETUP is used to tell configure to handle variables for
194 # various packages.
195 # $1 is the prefix for the variables in makeopts and autoconfig.h
196 # $2 is the short comment, $4 is the long comment
197 # $3 is the name used in --with- or --without- flags for configure.
198 #
199 # Package option names should be in alphabetical order
200 # by the --with option name (the third field),
201 # to make things easier for the users.
202
203 AST_EXT_LIB_SETUP([ALSA], [Advanced Linux Sound Architecture], [asound])
204
205 # BKTR is used for backtrace support on platforms that do not
206 # have it natively.
207 AST_EXT_LIB_SETUP([BKTR], [Stack Backtrace support], [execinfo])
208 AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capabilities], [cap])
209 AST_EXT_LIB_SETUP([CURL], [cURL], [curl])
210 AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
211 AST_EXT_LIB_SETUP([CRYPTO], [OpenSSL Cryptography support], [crypto])
212 AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
213 AST_EXT_LIB_SETUP([FFMPEG], [Ffmpeg and avcodec library], [avcodec])
214 AST_EXT_LIB_SETUP([GSM], [External GSM library], [gsm], [, use 'internal' GSM otherwise])
215 AST_EXT_LIB_SETUP([GTK], [gtk libraries], [gtk])
216 AST_EXT_LIB_SETUP([GTK2], [gtk2 libraries], [gtk2])
217 AST_EXT_LIB_SETUP([GMIME], [GMime library], [gmime])
218 AST_EXT_LIB_SETUP([ICONV], [Iconv Library], [iconv])
219 AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber Library], [iksemel])
220 AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
221 AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux Library], [isdnnet])
222 AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
223 AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
224 AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl])
225 AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
226 AST_EXT_LIB_SETUP([MISDN], [mISDN User Library], [misdn])
227 AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs])
228 AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
229 AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
230 AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
231 AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [odbc])
232 AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
233 AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
234 AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
235 AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
236 AST_EXT_LIB_SETUP([POPT], [popt], [popt])
237 AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
238 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
239 AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
240 AST_EXT_LIB_SETUP([SPANDSP], [SPANDSP], [spandsp])
241 AST_EXT_LIB_SETUP([SS7], [ISDN SS7], [ss7])
242 AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
243 AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323])
244 AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
245 AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
246 AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image library], [SDL_image])
247 AST_EXT_LIB_SETUP([OPENAIS], [OpenAIS], [openais])
248 AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
249 AST_EXT_LIB_SETUP([SPEEXDSP], [Speexdsp], [speexdsp])
250 AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
251 AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
252 AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
253 AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer support], [ssl])
254 AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
255 AST_EXT_LIB_SETUP([TERMCAP], [Termcap], [termcap])
256 AST_EXT_LIB_SETUP([TINFO], [Term Info], [tinfo])
257 AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
258 AST_EXT_LIB_SETUP([USB], [usb], [usb])
259 AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
260 AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
261 AST_EXT_LIB_SETUP([X11], [X11 support], [x11])
262 AST_EXT_LIB_SETUP([ZLIB], [zlib], [z])
263
264 # check for basic system features and functionality before
265 # checking for package libraries
266
267 AC_FUNC_ALLOCA
268 AC_HEADER_DIRENT
269 AC_HEADER_STDC
270 AC_HEADER_SYS_WAIT
271 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 arpa/nameser.h])
272
273 AC_CHECK_HEADERS([winsock.h winsock2.h])
274
275 AC_SYS_LARGEFILE
276
277 # Checks for typedefs, structures, and compiler characteristics.
278 AC_HEADER_STDBOOL
279 AC_C_CONST
280 AC_TYPE_UID_T
281 AC_C_INLINE
282 AC_TYPE_MODE_T
283 AC_TYPE_OFF_T
284 AC_TYPE_PID_T
285 AC_TYPE_SIZE_T
286 AC_CHECK_MEMBERS([struct stat.st_blksize])
287 AC_HEADER_TIME
288 AC_STRUCT_TM
289 AC_C_VOLATILE
290 AC_CHECK_TYPES([ptrdiff_t])
291
292 # Checks for library functions.
293 AC_FUNC_CHOWN
294 AC_FUNC_CLOSEDIR_VOID
295 AC_FUNC_ERROR_AT_LINE
296 AST_FUNC_FORK
297 AC_FUNC_FSEEKO
298 AC_PROG_GCC_TRADITIONAL
299 # XXX: these are commented out until we determine whether it matters if our malloc()
300 # acts exactly like glibc's or not
301 # AC_FUNC_MALLOC
302 # AC_FUNC_REALLOC
303 AC_FUNC_MEMCMP
304 AC_FUNC_MMAP
305 AC_FUNC_SELECT_ARGTYPES
306 AC_FUNC_SETVBUF_REVERSED
307 AC_TYPE_SIGNAL
308 AC_FUNC_STAT
309 AC_FUNC_STRCOLL
310 AC_FUNC_STRFTIME
311 AC_FUNC_STRNLEN
312 AC_FUNC_STRTOD
313 AC_FUNC_UTIME_NULL
314 AC_FUNC_VPRINTF
315 AC_CHECK_FUNCS([asprintf atexit bzero dup2 endpwent ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf])
316
317 AC_CHECK_FUNCS([glob])
318
319 AC_MSG_CHECKING(for timersub in time.h)
320 AC_LINK_IFELSE(
321         AC_LANG_PROGRAM([#include <sys/time.h>],
322                 [struct timeval *a; timersub(a, a, a);]),
323         AC_MSG_RESULT(yes)
324                 AC_DEFINE([HAVE_TIMERSUB], 1, [Define to 1 if your system defines timersub.]),
325         AC_MSG_RESULT(no)
326 )
327
328 AC_CHECK_HEADER([sys/poll.h], 
329    [HAS_POLL=1]
330    AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]),
331    )
332
333 AC_ARG_ENABLE(internal-poll,
334         [  --enable-internal-poll       Use Asterisk's poll implementation],
335         [case "${enableval}" in
336                 y|ye|yes) HAS_POLL="";;
337                 n|no) HAS_POLL="${HAS_POLL}" ;;
338                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-internal-poll) ;;
339         esac])
340 AC_SUBST(HAS_POLL)
341
342
343
344 # https support (in main/http.c) uses funopen on BSD systems,
345 # fopencookie on linux
346 AC_CHECK_FUNCS([funopen fopencookie])
347
348 AC_CHECK_FUNCS([inet_aton])
349
350 # check if we have IP_PKTINFO constant defined
351 AC_MSG_CHECKING(for IP_PKTINFO)
352 AC_LINK_IFELSE(
353                 AC_LANG_PROGRAM([#include <netinet/in.h>],
354                                                 [int pi = IP_PKTINFO;]),
355                 AC_MSG_RESULT(yes)
356                 AC_DEFINE([HAVE_PKTINFO], 1, [Define to 1 if your system defines IP_PKTINFO.]),
357                 AC_MSG_RESULT(no)
358 )
359
360 # some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
361 AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])
362
363 AC_MSG_CHECKING(for gethostbyname_r with 6 arguments)
364 AC_LINK_IFELSE(
365         AC_LANG_PROGRAM([#include <stdlib.h>
366                          #include <netdb.h>],
367                         [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);]),
368         AC_MSG_RESULT(yes)
369         AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]),
370         AC_MSG_RESULT(no)
371 )
372
373 AC_MSG_CHECKING(for gethostbyname_r with 5 arguments)
374 AC_LINK_IFELSE(
375         AC_LANG_PROGRAM([#include <stdlib.h>
376                          #include <netdb.h>],
377                         [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);]),
378         AC_MSG_RESULT(yes)
379         AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]),
380         AC_MSG_RESULT(no)
381 )
382
383 AC_CHECK_HEADER([byteswap.h], [AC_DEFINE_UNQUOTED([HAVE_BYTESWAP_H], 1, [Define to 1 if byteswap.h macros are available.])])
384
385 AC_MSG_CHECKING(for __swap16 variant of <sys/endian.h> byteswapping macros)
386 AC_LINK_IFELSE(
387 AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = __swap16(a);]),
388 AC_MSG_RESULT(yes)
389 AC_DEFINE([HAVE_SYS_ENDIAN_SWAP16], 1, [Define to 1 if your sys/endian.h header file provides the __swap16 macro.]),
390 AC_MSG_RESULT(no)
391 )
392
393 AC_MSG_CHECKING(for bswap16 variant of <sys/endian.h> byteswapping macros)
394 AC_LINK_IFELSE(
395 AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = bswap16(a);]),
396 AC_MSG_RESULT(yes)
397 AC_DEFINE([HAVE_SYS_ENDIAN_BSWAP16], 1, [Define to 1 if your sys/endian.h header file provides the bswap16 macro.]),
398 AC_MSG_RESULT(no)
399 )
400
401 if test "${cross_compiling}" = "no";
402 then
403   AC_CHECK_FILE(/dev/urandom, AC_DEFINE([HAVE_DEV_URANDOM], 1, [Define to 1 if your system has /dev/urandom.]))
404 fi
405
406 AST_C_DEFINE_CHECK([PTHREAD_RWLOCK_INITIALIZER], [PTHREAD_RWLOCK_INITIALIZER], [pthread.h])
407
408 AC_MSG_CHECKING(for PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h)
409 AC_LINK_IFELSE(
410 AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_RWLOCK_PREFER_WRITER_NP;]),
411 AC_MSG_RESULT(yes)
412 AC_DEFINE([HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP], 1, [Define to 1 if your system defines PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h]),
413 AC_MSG_RESULT(no)
414 )
415
416 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h)
417 AC_LINK_IFELSE(
418 AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_MUTEX_RECURSIVE_NP;]),
419 AC_MSG_RESULT(yes)
420 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1, [Define to 1 if your system defines PTHREAD_MUTEX_RECURSIVE_NP in pthread.h]),
421 AC_MSG_RESULT(no)
422 )
423
424 AST_C_DEFINE_CHECK([PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [pthread.h])
425
426 #if test "${cross_compiling}" = "no";
427 #then
428 #AC_MSG_CHECKING(for working epoll support)
429 #AC_LINK_IFELSE(
430 #AC_LANG_PROGRAM([#include <sys/epoll.h>], [int res = epoll_create(10);
431 #                                         if (res < 0)
432 #                                            return 1;
433 #                                         close (res);
434 #                                         return 0;]),
435 #AC_MSG_RESULT(yes)
436 #AC_DEFINE([HAVE_EPOLL], 1, [Define to 1 if your system has working epoll support.]),
437 #AC_MSG_RESULT(no)
438 #)
439 #fi
440
441 AC_MSG_CHECKING(for compiler atomic operations)
442 AC_LINK_IFELSE(
443 AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);]),
444 AC_MSG_RESULT(yes)
445 AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides atomic operations.]),
446 AC_MSG_RESULT(no)
447 )
448
449 AST_GCC_ATTRIBUTE(pure)
450 AST_GCC_ATTRIBUTE(malloc)
451 AST_GCC_ATTRIBUTE(const)
452 AST_GCC_ATTRIBUTE(unused)
453 AST_GCC_ATTRIBUTE(always_inline)
454 AST_GCC_ATTRIBUTE(deprecated)
455 AST_GCC_ATTRIBUTE(sentinel)
456 AST_GCC_ATTRIBUTE(warn_unused_result)
457
458 AC_MSG_CHECKING(for -ffunction-sections support)
459 saved_CFLAGS="${CFLAGS}"
460 CFLAGS="${CFLAGS} -ffunction-sections"
461 AC_COMPILE_IFELSE(
462         AC_LANG_PROGRAM([], [int x = 1;]),
463         AC_MSG_RESULT(yes)
464         [saved_LDFLAGS="${LDFLAGS}"]
465         [LDFLAGS="${LDFLAGS} -Wl,--gc-sections"]
466         AC_MSG_CHECKING(for --gc-sections support)
467         AC_LINK_IFELSE(
468                 AC_LANG_PROGRAM([], [int x = 1;]),
469                 AC_MSG_RESULT(yes)
470                 [GC_CFLAGS="-ffunction-sections"]
471                 [[GC_LDFLAGS="-Wl,--gc-sections"]],
472                 AC_MSG_RESULT(no)
473         )
474         [LDFLAGS="${saved_LDFLAGS}"],
475         AC_MSG_RESULT(no)
476 )
477 CFLAGS="${saved_CFLAGS}"
478 AC_SUBST(GC_CFLAGS)
479 AC_SUBST(GC_LDFLAGS)
480
481 AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
482 if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
483         AC_MSG_RESULT(yes)
484         AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
485 else
486         AC_MSG_RESULT(no)
487         AST_DECLARATION_AFTER_STATEMENT=
488 fi
489 AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
490
491 AC_MSG_CHECKING(for -fno-strict-overflow)
492 if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
493    AC_MSG_RESULT(yes)
494    AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
495 else
496         AC_MSG_RESULT(no)
497         AST_NO_STRICT_OVERFLOW=
498 fi
499 AC_SUBST(AST_NO_STRICT_OVERFLOW)
500
501 AC_MSG_CHECKING(for sysinfo)
502 AC_LINK_IFELSE(
503         AC_LANG_PROGRAM([#include <sys/sysinfo.h>],
504                         [struct sysinfo sys_info; int uptime = sys_info.uptime]),
505         AC_MSG_RESULT(yes)
506         AC_DEFINE([HAVE_SYSINFO], 1, [Define to 1 if your system has sysinfo support]),
507         AC_MSG_RESULT(no)
508 )
509
510 AC_SEARCH_LIBS(res_9_ninit, resolv)
511 AC_MSG_CHECKING(for res_ninit)
512 AC_LINK_IFELSE(
513         AC_LANG_PROGRAM([
514                         #ifdef HAVE_SYS_SOCKET_H
515                         #include <sys/socket.h>
516                         #endif
517                         #ifdef HAVE_NETINET_IN_H
518                         #include <netinet/in.h>
519                         #endif
520                         #ifdef HAVE_ARPA_NAMESER_H
521                         #include <arpa/nameser.h>
522                         #endif
523                         #include <resolv.h>],
524                         [int foo = res_ninit(NULL);]),
525         AC_MSG_RESULT(yes)
526         AC_DEFINE([HAVE_RES_NINIT], 1, [Define to 1 if your system has the re-entrant resolver functions.])
527         AC_SEARCH_LIBS(res_9_ndestroy, resolv)
528         AC_MSG_CHECKING(for res_ndestroy)
529         AC_LINK_IFELSE(
530                 AC_LANG_PROGRAM([
531                                 #ifdef HAVE_SYS_SOCKET_H
532                                 #include <sys/socket.h>
533                                 #endif
534                                 #ifdef HAVE_NETINET_IN_H
535                                 #include <netinet/in.h>
536                                 #endif
537                                 #ifdef HAVE_ARPA_NAMESER_H
538                                 #include <arpa/nameser.h>
539                                 #endif
540                                 #include <resolv.h>],
541                                 [res_ndestroy(NULL);]),
542                 AC_MSG_RESULT(yes)
543                 AC_DEFINE([HAVE_RES_NDESTROY], 1, [Define to 1 if your system has the ndestroy resolver function.]),
544                 AC_MSG_RESULT(no)
545         ),
546         AC_MSG_RESULT(no)
547 )
548
549 AST_C_DEFINE_CHECK([RTLD_NOLOAD], [RTLD_NOLOAD], [dlfcn.h])
550
551 AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [IP_MTU_DISCOVER], [netinet/in.h])
552
553 AC_CHECK_HEADER([libkern/OSAtomic.h],
554                 [AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
555
556 AC_CHECK_SIZEOF(int)
557
558 # do the package library checks now
559
560 AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
561
562 AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
563
564 if test "x${host_os}" = "xlinux-gnu" ; then
565   AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
566 fi
567
568 AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h])
569
570 # BSD might not have exp2, and/or log2
571 AST_EXT_LIB_CHECK([EXP2L], [m], [exp2l])
572 AST_EXT_LIB_CHECK([LOG2L], [m], [log2l])
573 AST_EXT_LIB_CHECK([EXP10L], [m], [exp10l])
574 AST_EXT_LIB_CHECK([LOG10L], [m], [log10l])
575 AST_EXT_LIB_CHECK([SINL], [m], [sinl])
576 AST_EXT_LIB_CHECK([COSL], [m], [cosl])
577 AST_EXT_LIB_CHECK([TANL], [m], [tanl])
578 AST_EXT_LIB_CHECK([ASINL], [m], [asinl])
579 AST_EXT_LIB_CHECK([ACOSL], [m], [acosl])
580 AST_EXT_LIB_CHECK([ATANL], [m], [atanl])
581 AST_EXT_LIB_CHECK([ATAN2L], [m], [atan2l])
582 AST_EXT_LIB_CHECK([POWL], [m], [powl])
583 AST_EXT_LIB_CHECK([SQRTL], [m], [sqrtl])
584 AST_EXT_LIB_CHECK([RINTL], [m], [rintl])
585 AST_EXT_LIB_CHECK([EXPL], [m], [expl])
586 AST_EXT_LIB_CHECK([LOGL], [m], [logl])
587 AST_EXT_LIB_CHECK([REMAINDERL], [m], [remainderl])
588 AST_EXT_LIB_CHECK([FMODL], [m], [fmodl])
589 AST_EXT_LIB_CHECK([ROUNDL], [m], [roundl])
590 AST_EXT_LIB_CHECK([TRUNCL], [m], [truncl])
591 AST_EXT_LIB_CHECK([STRTOLD], [c], [strtold], [stdlib.h])
592 AST_EXT_LIB_CHECK([FLOORL], [m], [floorl])
593 AST_EXT_LIB_CHECK([CEILL], [m], [ceill])
594 AST_EXT_LIB_CHECK([EXP2], [m], [exp2])
595 AST_EXT_LIB_CHECK([LOG2], [m], [log2])
596 AST_EXT_LIB_CHECK([EXP10], [m], [exp10])
597 AST_EXT_LIB_CHECK([LOG10], [m], [log10])
598 AST_EXT_LIB_CHECK([SIN], [m], [sin])
599 AST_EXT_LIB_CHECK([COS], [m], [cos])
600 AST_EXT_LIB_CHECK([TAN], [m], [tan])
601 AST_EXT_LIB_CHECK([ASIN], [m], [asin])
602 AST_EXT_LIB_CHECK([ACOS], [m], [acos])
603 AST_EXT_LIB_CHECK([ATAN], [m], [atan])
604 AST_EXT_LIB_CHECK([ATAN2], [m], [atan2])
605 AST_EXT_LIB_CHECK([POW], [m], [pow])
606 AST_EXT_LIB_CHECK([SQRT], [m], [sqrt])
607 AST_EXT_LIB_CHECK([RINT], [m], [rint])
608 AST_EXT_LIB_CHECK([EXP], [m], [exp])
609 AST_EXT_LIB_CHECK([LOG], [m], [log])
610 AST_EXT_LIB_CHECK([REMAINDER], [m], [remainder])
611 AST_EXT_LIB_CHECK([FMOD], [m], [fmod])
612 AST_EXT_LIB_CHECK([ROUND], [m], [round])
613 AST_EXT_LIB_CHECK([TRUNC], [m], [trunc])
614 AST_EXT_LIB_CHECK([STRTOD], [c], [strtod], [stdlib.h])
615 AST_EXT_LIB_CHECK([FLOOR], [m], [floor])
616 AST_EXT_LIB_CHECK([CEIL], [m], [ceil])
617
618 AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h], , [getifaddrs() support])
619
620 GSM_INTERNAL="yes"
621 AC_SUBST(GSM_INTERNAL)
622 GSM_SYSTEM="yes"
623 if test "${USE_GSM}" != "no"; then
624    if test "${GSM_DIR}" = "internal"; then
625       GSM_SYSTEM="no"
626    elif test "${GSM_DIR}" != ""; then
627       GSM_INTERNAL="no"
628    fi
629    if test "${GSM_SYSTEM}" = "yes"; then
630       gsmlibdir=""
631       if test "x${GSM_DIR}" != "x"; then
632          if test -d ${GSM_DIR}/lib; then
633             gsmlibdir="-L${GSM_DIR}/lib"
634          else
635             gsmlibdir="-L${GSM_DIR}"
636          fi
637       fi
638       AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
639       [Define to indicate the GSM library]), [], ${gsmlibdir})
640       if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
641          if test "x${GSM_DIR}" != "x" ; then
642             AC_CHECK_HEADER([${GSM_DIR}/include/gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
643             AC_CHECK_HEADER([${GSM_DIR}/include/gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
644          else
645             AC_CHECK_HEADER([gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
646             AC_CHECK_HEADER([gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
647          fi
648          if test "${GSM_HEADER_FOUND}" = "0" ; then
649             if test "{GSM_GSM_HEADER_FOUND}" = "0" ; then
650                if test "x${GSM_MANDATORY}" = "xyes" ; then
651                   AC_MSG_NOTICE([***])
652                   AC_MSG_NOTICE([*** It appears that you do not have the gsm development package installed.])
653                   AC_MSG_NOTICE([*** Please install it to include ${GSM_DESCRIP} support, or re-run configure])
654                   AC_MSG_NOTICE([*** without explicitly specifying --with-${GSM_OPTION}])
655                   exit 1
656                fi
657             fi
658          fi
659          GSM_OK=0
660          if test "${GSM_HEADER_FOUND}" = "1" ; then
661             AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
662             GSM_OK=1
663          else
664             if test "${GSM_GSM_HEADER_FOUND}" = "1" ; then
665                AC_DEFINE_UNQUOTED([HAVE_GSM_GSM_HEADER], 1, [Define to indicate that gsm.h is in gsm/gsm.h])
666                GSM_OK=1
667             fi
668          fi
669          if test "${GSM_OK}" = "1" ; then
670             GSM_LIB="-lgsm"
671             if test "x${GSM_DIR}" != "x"; then
672                GSM_LIB="${gsmlibdir} ${GSM_LIB}"
673                GSM_INCLUDE="-I${GSM_DIR}/include"
674             fi
675             PBX_GSM=1
676             GSM_INTERNAL="no"
677          fi
678       fi
679    fi
680    if test "${GSM_INTERNAL}" = "yes"; then
681       PBX_GSM=1
682       AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
683    fi
684 fi
685
686 if test "${host_os}" != "linux-gnu" ; then
687   AST_EXT_LIB_CHECK([ICONV], [iconv], [iconv_open], [iconv.h])
688 else
689   PBX_ICONV=1
690 fi
691
692 AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h])
693
694 if test "${USE_IMAP_TK}" != "no"; then
695         saved_cppflags="${CPPFLAGS}"
696         saved_libs="${LIBS}"
697         switch_to_system_on_failure="no"
698         if test "${IMAP_TK_DIR}" = ""; then
699                 IMAP_TK_DIR=`pwd`"/../imap-2004g"
700                 switch_to_system_on_failure="yes"
701         fi
702         if test "${IMAP_TK_DIR}" != "system"; then
703                 AC_MSG_CHECKING(for UW IMAP Toolkit c-client library)
704                 if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then
705                 imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
706                 fi
707                 imap_libs="${IMAP_TK_DIR}/c-client/c-client.a"
708                 imap_include="-I${IMAP_TK_DIR}/c-client"
709         CPPFLAGS="${CPPFLAGS} ${imap_include}"
710                 LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
711                 AC_LINK_IFELSE(
712                 AC_LANG_PROGRAM(
713                                 [#include "c-client.h"
714                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
715                                 {
716                                 }
717                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
718                                 {
719                                 }
720                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
721                                 {
722                                 }
723                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
724                                 {
725                                 }
726                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
727                                 {
728                                 }
729                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
730                                 {
731                                 }
732                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
733                                 {
734                                 }
735                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
736                                 {
737                                 }
738                                 void mm_log (char *string,long errflg)
739                                 {
740                                 }
741                                 void mm_dlog (char *string)
742                                 {
743                                 }
744                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
745                                 {
746                                 }
747                                 void mm_critical (MAILSTREAM *stream)
748                                 {
749                                 }
750                                 void mm_nocritical (MAILSTREAM *stream)
751                                 {
752                                 }
753                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
754                                 {
755                                 }
756                                 void mm_fatal (char *string)
757                                 {
758                                 }],
759                                 [
760                                 MAILSTREAM *foo = mail_open(NULL, "", 0);
761                                 ]
762                         ),
763                         [ac_cv_imap_tk="yes"],
764                         [ac_cv_imap_tk="no"]
765                 )
766                 if test "${ac_cv_imap_tk}" = "yes"; then
767                         AC_LINK_IFELSE(
768                                 AC_LANG_PROGRAM(
769                                         [#include "c-client.h"
770                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
771                                         {
772                                         }
773                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
774                                         {
775                                         }
776                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
777                                         {
778                                         }
779                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
780                                         {
781                                         }
782                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
783                                         {
784                                         }
785                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
786                                         {
787                                         }
788                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
789                                         {
790                                         }
791                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
792                                         {
793                                         }
794                                         void mm_log (char *string,long errflg)
795                                         {
796                                         }
797                                         void mm_dlog (char *string)
798                                         {
799                                         }
800                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
801                                         {
802                                         }
803                                         void mm_critical (MAILSTREAM *stream)
804                                         {
805                                         }
806                                         void mm_nocritical (MAILSTREAM *stream)
807                                         {
808                                         }
809                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
810                                         {
811                                         }
812                                         void mm_fatal (char *string)
813                                         {
814                                         }],
815                                         [
816                                         long check = mail_expunge_full(NULL, "", 0);
817                                         ]
818                                 ),
819                                 [ac_cv_imap_tk2006="yes"],
820                                 [ac_cv_imap_tk2006="no"]
821                         )
822                 fi
823                 CPPFLAGS="${saved_cppflags}"
824                 LIBS="${saved_libs}"
825                 if test "${ac_cv_imap_tk}" = "no"; then
826                         AC_MSG_RESULT(no)
827                         if test "${switch_to_system_on_failure}" = "yes"; then
828                                 IMAP_TK_DIR="system"
829                         else #This means they specified a directory. Search for a package installation there too
830                                 AC_MSG_CHECKING([for system c-client library...])
831                                 CPPFLAGS="${saved_cppflags}"
832                                 LIBS="${saved_libs}"
833                                 imap_include="-I${IMAP_TK_DIR}/include"
834                                 imap_ldflags="-L${IMAP_TK_DIR}/lib"
835                                 imap_libs="-lc-client"
836                                 CPPFLAGS="${CPPFLAGS} ${imap_include}"
837                                 LIBS="${LIBS} ${imap_libs} ${imap_ldflags}"
838                                 AC_LINK_IFELSE(
839                                 AC_LANG_PROGRAM(
840                                                 [#include "c-client.h"
841                                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
842                                                 {
843                                                 }
844                                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
845                                                 {
846                                                 }
847                                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
848                                                 {
849                                                 }
850                                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
851                                                 {
852                                                 }
853                                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
854                                                 {
855                                                 }
856                                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
857                                                 {
858                                                 }
859                                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
860                                                 {
861                                                 }
862                                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
863                                                 {
864                                                 }
865                                                 void mm_log (char *string,long errflg)
866                                                 {
867                                                 }
868                                                 void mm_dlog (char *string)
869                                                 {
870                                                 }
871                                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
872                                                 {
873                                                 }
874                                                 void mm_critical (MAILSTREAM *stream)
875                                                 {
876                                                 }
877                                                 void mm_nocritical (MAILSTREAM *stream)
878                                                 {
879                                                 }
880                                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
881                                                 {
882                                                 }
883                                                 void mm_fatal (char *string)
884                                                 {
885                                                 }],
886                                                 [
887                                                 MAILSTREAM *foo = mail_open(NULL, "", 0);
888                                                 ]
889                                         ),
890                                         [ac_cv_imap_tk="yes"],
891                                         [ac_cv_imap_tk="no"]
892                                 )
893                                 if test "${ac_cv_imap_tk}" = "yes"; then
894                                         AC_LINK_IFELSE(
895                                                 AC_LANG_PROGRAM(
896                                                         [#include "c-client.h"
897                                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
898                                                         {
899                                                         }
900                                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
901                                                         {
902                                                         }
903                                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
904                                                         {
905                                                         }
906                                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
907                                                         {
908                                                         }
909                                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
910                                                         {
911                                                         }
912                                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
913                                                         {
914                                                         }
915                                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
916                                                         {
917                                                         }
918                                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
919                                                         {
920                                                         }
921                                                         void mm_log (char *string,long errflg)
922                                                         {
923                                                         }
924                                                         void mm_dlog (char *string)
925                                                         {
926                                                         }
927                                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
928                                                         {
929                                                         }
930                                                         void mm_critical (MAILSTREAM *stream)
931                                                         {
932                                                         }
933                                                         void mm_nocritical (MAILSTREAM *stream)
934                                                         {
935                                                         }
936                                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
937                                                         {
938                                                         }
939                                                         void mm_fatal (char *string)
940                                                         {
941                                                         }],
942                                                         [
943                                                         long check = mail_expunge_full(NULL, "", 0);
944                                                         ]
945                                                 ),
946                                                 [ac_cv_imap_tk2006="yes"],
947                                                 [ac_cv_imap_tk2006="no"]
948                                         )
949                                 fi
950                         fi
951                 fi
952         fi 
953         if test "${IMAP_TK_DIR}" = "system"; then
954                 #We will enter here if user specified "system" or if any of above checks failed
955                 AC_MSG_CHECKING([for system c-client library...])
956                 CPPFLAGS="${saved_cppflags}"
957                 LIBS="${saved_libs}"
958                 imap_ldflags=""
959                 imap_libs="-lc-client"
960                 imap_include="-DUSE_SYSTEM_IMAP" #Try the imap directory first
961                 CPPFLAGS="${CPPFLAGS} ${imap_include}"
962                 LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
963                 AC_LINK_IFELSE(
964                 AC_LANG_PROGRAM(
965                                 [#include <stdio.h>
966                                 #include <imap/c-client.h>
967                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
968                                 {
969                                 }
970                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
971                                 {
972                                 }
973                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
974                                 {
975                                 }
976                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
977                                 {
978                                 }
979                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
980                                 {
981                                 }
982                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
983                                 {
984                                 }
985                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
986                                 {
987                                 }
988                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
989                                 {
990                                 }
991                                 void mm_log (char *string,long errflg)
992                                 {
993                                 }
994                                 void mm_dlog (char *string)
995                                 {
996                                 }
997                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
998                                 {
999                                 }
1000                                 void mm_critical (MAILSTREAM *stream)
1001                                 {
1002                                 }
1003                                 void mm_nocritical (MAILSTREAM *stream)
1004                                 {
1005                                 }
1006                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1007                                 {
1008                                 }
1009                                 void mm_fatal (char *string)
1010                                 {
1011                                 }],
1012                                 [
1013                                 MAILSTREAM *foo = mail_open(NULL, "", 0);
1014                                 ]
1015                         ),
1016                         [ac_cv_imap_tk="yes"],
1017                         [ac_cv_imap_tk="no"]
1018                 )
1019                 if test "${ac_cv_imap_tk}" = "yes"; then
1020                         AC_LINK_IFELSE(
1021                                 AC_LANG_PROGRAM(
1022                                         [#include <stdio.h>
1023                                         #include <imap/c-client.h>
1024                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
1025                                         {
1026                                         }
1027                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
1028                                         {
1029                                         }
1030                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
1031                                         {
1032                                         }
1033                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
1034                                         {
1035                                         }
1036                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1037                                         {
1038                                         }
1039                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1040                                         {
1041                                         }
1042                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1043                                         {
1044                                         }
1045                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1046                                         {
1047                                         }
1048                                         void mm_log (char *string,long errflg)
1049                                         {
1050                                         }
1051                                         void mm_dlog (char *string)
1052                                         {
1053                                         }
1054                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1055                                         {
1056                                         }
1057                                         void mm_critical (MAILSTREAM *stream)
1058                                         {
1059                                         }
1060                                         void mm_nocritical (MAILSTREAM *stream)
1061                                         {
1062                                         }
1063                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1064                                         {
1065                                         }
1066                                         void mm_fatal (char *string)
1067                                         {
1068                                         }],
1069                                         [
1070                                         long check = mail_expunge_full(NULL, "", 0);
1071                                         ]
1072                                 ),
1073                                 [ac_cv_imap_tk2006="yes"],
1074                                 [ac_cv_imap_tk2006="no"]
1075                         )
1076                 else #looking in imap directory didn't work, try c-client
1077                         imap_ldflags=""
1078                         imap_libs="-lc-client"
1079                         imap_include="-DUSE_SYSTEM_CCLIENT"
1080                         CPPFLAGS="${saved_cppflags}"
1081                         LIBS="${saved_libs}"
1082                         CPPFLAGS="${CPPFLAGS} ${imap_include}"
1083                         LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
1084                         AC_LINK_IFELSE(
1085                         AC_LANG_PROGRAM(
1086                                         [#include <stdio.h>
1087                                         #include <c-client/c-client.h>
1088                                         void mm_searched (MAILSTREAM *stream,unsigned long number)
1089                                         {
1090                                         }
1091                                         void mm_exists (MAILSTREAM *stream,unsigned long number)
1092                                         {
1093                                         }
1094                                         void mm_expunged (MAILSTREAM *stream,unsigned long number)
1095                                         {
1096                                         }
1097                                         void mm_flags (MAILSTREAM *stream,unsigned long number)
1098                                         {
1099                                         }
1100                                         void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1101                                         {
1102                                         }
1103                                         void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1104                                         {
1105                                         }
1106                                         void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1107                                         {
1108                                         }
1109                                         void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1110                                         {
1111                                         }
1112                                         void mm_log (char *string,long errflg)
1113                                         {
1114                                         }
1115                                         void mm_dlog (char *string)
1116                                         {
1117                                         }
1118                                         void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1119                                         {
1120                                         }
1121                                         void mm_critical (MAILSTREAM *stream)
1122                                         {
1123                                         }
1124                                         void mm_nocritical (MAILSTREAM *stream)
1125                                         {
1126                                         }
1127                                         long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1128                                         {
1129                                         }
1130                                         void mm_fatal (char *string)
1131                                         {
1132                                         }],
1133                                         [
1134                                         MAILSTREAM *foo = mail_open(NULL, "", 0);
1135                                         ]
1136                                 ),
1137                                 [ac_cv_imap_tk="yes"],
1138                                 [ac_cv_imap_tk="no"]
1139                         )
1140                         if test "${ac_cv_imap_tk}" = "yes"; then
1141                                 AC_LINK_IFELSE(
1142                                         AC_LANG_PROGRAM(
1143                                                 [#include <stdio.h>
1144                                                 #include <c-client/c-client.h>
1145                                                 void mm_searched (MAILSTREAM *stream,unsigned long number)
1146                                                 {
1147                                                 }
1148                                                 void mm_exists (MAILSTREAM *stream,unsigned long number)
1149                                                 {
1150                                                 }
1151                                                 void mm_expunged (MAILSTREAM *stream,unsigned long number)
1152                                                 {
1153                                                 }
1154                                                 void mm_flags (MAILSTREAM *stream,unsigned long number)
1155                                                 {
1156                                                 }
1157                                                 void mm_notify (MAILSTREAM *stream,char *string,long errflg)
1158                                                 {
1159                                                 }
1160                                                 void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1161                                                 {
1162                                                 }
1163                                                 void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
1164                                                 {
1165                                                 }
1166                                                 void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
1167                                                 {
1168                                                 }
1169                                                 void mm_log (char *string,long errflg)
1170                                                 {
1171                                                 }
1172                                                 void mm_dlog (char *string)
1173                                                 {
1174                                                 }
1175                                                 void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
1176                                                 {
1177                                                 }
1178                                                 void mm_critical (MAILSTREAM *stream)
1179                                                 {
1180                                                 }
1181                                                 void mm_nocritical (MAILSTREAM *stream)
1182                                                 {
1183                                                 }
1184                                                 long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
1185                                                 {
1186                                                 }
1187                                                 void mm_fatal (char *string)
1188                                                 {
1189                                                 }],
1190                                                 [
1191                                                 long check = mail_expunge_full(NULL, "", 0);
1192                                                 ]
1193                                         ),
1194                                         [ac_cv_imap_tk2006="yes"],
1195                                         [ac_cv_imap_tk2006="no"]
1196                                 )
1197                         fi
1198                 fi
1199         fi
1200         if test "${ac_cv_imap_tk}" = "yes"; then
1201                 AC_MSG_RESULT(yes)
1202                 IMAP_TK_LIB="${imap_libs} "`echo ${imap_ldflags}`
1203                 IMAP_TK_INCLUDE="${imap_include}"
1204                 PBX_IMAP_TK=1
1205                 AC_DEFINE([HAVE_IMAP_TK], 1, [Define if your system has the UW IMAP Toolkit c-client library.])
1206                 if test "${ac_cv_imap_tk2006}" = "yes"; then
1207                         AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
1208                 fi
1209         else
1210                 AC_MSG_RESULT(no) 
1211         fi
1212         CPPFLAGS="${saved_cppflags}"
1213         LIBS="${saved_libs}"
1214 fi
1215
1216 AST_EXT_LIB_CHECK([JACK], [jack], [jack_activate], [jack/jack.h])
1217
1218 # Needed by unixodbc
1219 AST_EXT_LIB_CHECK([LTDL], [ltdl], [lt_dlinit], [ltdl.h], [])
1220
1221 AST_EXT_LIB_CHECK([LDAP], [ldap], [ldap_initialize], [ldap.h])
1222
1223 AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h])
1224
1225 if test "${PBX_MISDN}" = 1; then
1226    AST_EXT_LIB_CHECK([ISDNNET], [isdnnet], [init_manager], [mISDNuser/isdn_net.h], [-lmISDN -lpthread])
1227    AST_EXT_LIB_CHECK([SUPPSERV], [suppserv], [encodeFac], [mISDNuser/suppserv.h])
1228    AST_C_DEFINE_CHECK([MISDN_FAC_RESULT], [Fac_RESULT], [mISDNuser/suppserv.h])
1229    AST_C_DEFINE_CHECK([MISDN_FAC_ERROR], [Fac_ERROR], [mISDNuser/suppserv.h])
1230    AC_CHECK_HEADER([linux/mISDNdsp.h], [AC_DEFINE_UNQUOTED([MISDN_1_2], 1, [Build chan_misdn for mISDN 1.2 or later.])])
1231 fi
1232
1233 AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
1234
1235 AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
1236
1237 AST_EXT_TOOL_CHECK([NETSNMP], [net-snmp], , [--agent-libs],
1238 [#include <net-snmp/net-snmp-config.h>
1239 #include <net-snmp/net-snmp-includes.h>
1240 #include <net-snmp/agent/net-snmp-agent-includes.h>],
1241 [int callback = snmp_register_callback(0, 0, NULL, NULL)])
1242
1243 AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
1244
1245 AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
1246
1247 AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
1248
1249 # Non-glibc platforms require libexecinfo for backtrace support
1250 AST_EXT_LIB_CHECK([BKTR], [execinfo], [backtrace], [execinfo.h])
1251 # Linux, however, has backtrace directly in glibc
1252 AST_EXT_LIB_CHECK([BKTR], [c], [backtrace], [execinfo.h])
1253
1254 # possible places for oss definitions
1255 AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [linux/soundcard.h])
1256 AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [sys/soundcard.h])
1257 AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
1258
1259 PG_CONFIG=No
1260 if test "${USE_PGSQL}" != "no"; then    
1261    if test "x${PGSQL_DIR}" != "x"; then
1262       AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
1263       if test x"${PG_CONFIG}" = xNo; then
1264          AC_MSG_NOTICE([***])
1265          AC_MSG_NOTICE([*** pg_config was not found in the path you specified:])
1266          AC_MSG_NOTICE([*** ${PGSQL_DIR}/bin])
1267          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1268          AC_MSG_NOTICE([*** including --without-postgres])
1269          exit 1
1270       fi
1271    else
1272       AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
1273    fi
1274 fi
1275 if test "${PG_CONFIG}" != No; then
1276    PGSQL_libdir=`${PG_CONFIG} --libdir`
1277    PGSQL_includedir=`${PG_CONFIG} --includedir`
1278    if test "x$?" != "x0" ; then
1279       if test -n "${PGSQL_MANDATORY}" ; then
1280          AC_MSG_NOTICE([***])
1281          AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
1282          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1283          AC_MSG_NOTICE([*** including --without-postgres])
1284          exit 1
1285           fi
1286    else 
1287       AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
1288       [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
1289
1290       if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
1291          PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
1292          PGSQL_INCLUDE="-I${PGSQL_includedir}"
1293          PBX_PGSQL=1
1294       elif test -n "${PGSQL_MANDATORY}";
1295       then
1296          AC_MSG_NOTICE([***])
1297          AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
1298          AC_MSG_NOTICE([*** Either correct the installation, or run configure])
1299          AC_MSG_NOTICE([*** including --without-postgres])
1300          exit 1
1301       fi
1302    fi
1303 fi
1304
1305 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
1306
1307 AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
1308
1309 AST_EXT_LIB_CHECK([PRI], [pri], [pri_get_version], [libpri.h])
1310
1311 AST_EXT_LIB_CHECK([PRI_INBANDDISCONNECT], [pri], [pri_set_inbanddisconnect], [libpri.h])
1312
1313 AST_EXT_LIB_CHECK([RESAMPLE], [resample], [resample_open], [libresample.h], [-lm])
1314
1315 AST_C_COMPILE_CHECK([SPANDSP], [
1316                 #if SPANDSP_RELEASE_DATE < 20080516
1317                 #error "spandsp 0.0.5 or greater is required"
1318                 #endif
1319         ], [spandsp/version.h], , [minimum version of SpanDSP])
1320
1321 if test "x${PBX_SPANDSP}" = "x1" ; then
1322         # We found the correct version in the header, now let's make sure it links
1323         # properly, and that libtiff is available
1324         PBX_SPANDSP=0
1325         AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [span_set_message_handler], [spandsp.h], [-ltiff])
1326 fi
1327
1328 AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_pollflags], [libss7.h])
1329
1330 if test "${USE_PWLIB}" != "no"; then
1331         if test -n "${PWLIB_DIR}"; then
1332                 PWLIBDIR="${PWLIB_DIR}"
1333         fi
1334         AST_CHECK_PWLIB()
1335         AST_CHECK_PWLIB_VERSION([PWLib], [PWLIB], [ptbuildopts.h], [1], [9], [2])
1336                 
1337         if test "${HAS_PWLIB:-unset}" != "unset"; then
1338                 AST_CHECK_OPENH323_PLATFORM()
1339
1340                 PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
1341
1342                 AST_CHECK_PWLIB_BUILD([PWLib], [PWLIB],
1343                         [Define if your system has the PWLib libraries.],
1344                         [#include "ptlib.h"],
1345                         [BOOL q = PTime::IsDaylightSavings();])
1346         fi
1347 fi
1348
1349 if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
1350         if test -n "${OPENH323_DIR}"; then
1351                 OPENH323DIR="${OPENH323_DIR}"
1352         fi
1353         AST_CHECK_OPENH323()
1354         AST_CHECK_PWLIB_VERSION([OpenH323], [OPENH323], [openh323buildopts.h], [1], [17], [3])
1355         AST_CHECK_OPENH323_BUILD()
1356         PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
1357         AST_CHECK_PWLIB_BUILD([OpenH323], [OPENH323],
1358                 [Define if your system has the OpenH323 libraries.],
1359                 [#include "ptlib.h"
1360                 #include "h323.h"
1361                 #include "h323ep.h"],
1362                 [H323EndPoint ep = H323EndPoint();],
1363                 [${PWLIB_INCLUDE}], [${PWLIB_LIB}])
1364 fi
1365
1366 AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h]) 
1367
1368 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
1369
1370 # This is a bit complex... in reality, Asterisk's AIS support is dependent on finding
1371 # *any* implementation of AIS, not just OpenAIS. However, the configure script needs
1372 # to know the specifics of each possible implementation, and then represent the one
1373 # that was found as 'AIS'.
1374
1375 PBX_AIS=0
1376
1377 # OpenAIS installs its libraries into /usr/lib/openais by default, so check there
1378
1379 AST_EXT_LIB_CHECK([OPENAIS], [SaClm], [saClmInitialize], [openais/saClm.h], [-L/usr/lib/openais])
1380
1381 if test "${PBX_OPENAIS}" = 1; then
1382    PBX_AIS=1
1383    if test -n "${OPENAIS_DIR}"; then
1384       AIS_INCLUDE="${OPENAIS_INCLUDE}/openais"
1385       AIS_LIB="-lSaEvt ${OPENAIS_LIB}"
1386    else
1387       AIS_INCLUDE="-I/usr/include/openais"
1388       AIS_LIB="-lSaClm -lSaEvt -L/usr/lib/openais"
1389    fi
1390 fi
1391
1392 AC_SUBST(PBX_AIS)
1393 AC_SUBST(AIS_INCLUDE)
1394 AC_SUBST(AIS_LIB)
1395
1396 AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
1397
1398 # See if the main speex library contains the preprocess functions
1399 AST_EXT_LIB_CHECK([SPEEX_PREPROCESS], [speex], [speex_preprocess_ctl], [speex/speex.h], [-lm])
1400 if test "${PBX_SPEEX_PREPROCESS}" = 1; then
1401    PBX_SPEEX_PREPROCESS=1
1402 fi
1403
1404 AST_EXT_LIB_CHECK([SPEEXDSP], [speexdsp], [speex_preprocess_ctl], [speex/speex.h], [-lm])
1405 if test "${PBX_SPEEXDSP}" = 1; then
1406    PBX_SPEEX_PREPROCESS=1
1407 fi
1408
1409 AC_SUBST(PBX_SPEEX_PREPROCESS)
1410
1411 AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
1412
1413 AST_EXT_LIB_CHECK([SQLITE3], [sqlite3], [sqlite3_open], [sqlite3.h])
1414
1415 AST_EXT_LIB_CHECK([CRYPTO], [crypto], [AES_encrypt], [openssl/aes.h])
1416
1417 if test "$PBX_CRYPTO" = "1";
1418 then
1419     AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl2_connect], [openssl/ssl.h], [-lcrypto])
1420 fi
1421
1422 if test "$PBX_OPENSSL" = "1";
1423 then
1424     AST_EXT_LIB_CHECK([OSPTK], [osptk], [OSPPCryptoDecrypt], [osp/osp.h], [-lcrypto -lssl])
1425 fi
1426
1427 AST_EXT_TOOL_CHECK([GMIME], [gmime])
1428
1429 AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
1430
1431 AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
1432
1433 AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
1434
1435 if test "${host_os}" != "linux-gnu" ; then
1436   tonezone_extra="-lm"
1437 fi
1438
1439 AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
1440
1441 AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
1442
1443 AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
1444
1445 AC_LANG_PUSH(C++)
1446
1447 if test "${USE_VPB}" != "no"; then
1448    AC_MSG_CHECKING(for vpb_open in -lvpb)
1449    saved_libs="${LIBS}"
1450    saved_cppflags="${CPPFLAGS}"
1451    if test "x${VPB_DIR}" != "x"; then
1452       if test -d ${VPB_DIR}/lib; then
1453          vpblibdir=${VPB_DIR}/lib
1454       else
1455          vpblibdir=${VPB_DIR}
1456       fi
1457       LIBS="${LIBS} -L${vpblibdir}"
1458       CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
1459    fi
1460    LIBS="${LIBS} -lvpb -lpthread"
1461    AC_LINK_IFELSE(
1462         [
1463         AC_LANG_PROGRAM(
1464         [#include <vpbapi.h>],
1465         [int q = vpb_open(0,0);])
1466         ],
1467         [       AC_MSG_RESULT(yes) 
1468                 ac_cv_lib_vpb_vpb_open="yes" 
1469         ],
1470         [       AC_MSG_RESULT(no) 
1471                 ac_cv_lib_vpb_vpb_open="no" 
1472         ]
1473         )
1474    LIBS="${saved_libs}"
1475    CPPFLAGS="${saved_cppflags}"
1476    if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
1477         VPB_LIB="-lvpb"
1478         if test "${VPB_DIR}" != ""; then
1479            VPB_LIB="-L${vpblibdir}  ${VPB_LIB}"
1480            VPB_INCLUDE="-I${VPB_DIR}/include"
1481         fi
1482         PBX_VPB=1
1483         AC_DEFINE([HAVE_VPB], 1, [Define if your system has the VoiceTronix API libraries.])
1484    fi
1485 fi
1486
1487 AC_LANG_POP
1488
1489 AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
1490
1491 EDITLINE_LIB=""
1492 if test "x$TERMCAP_LIB" != "x" ; then
1493   EDITLINE_LIB="$TERMCAP_LIB"
1494 elif test "x$TINFO_LIB" != "x" ; then
1495   EDITLINE_LIB="$TINFO_LIB"
1496 elif test "x$CURSES_LIB" != "x" ; then
1497   EDITLINE_LIB="$CURSES_LIB"
1498 elif test "x$NCURSES_LIB" != "x" ; then
1499   EDITLINE_LIB="$NCURSES_LIB"
1500 else
1501   AC_MSG_ERROR(*** termcap support not found)
1502 fi
1503 AC_SUBST(EDITLINE_LIB)
1504
1505 AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
1506 AC_SUBST(PBX_H323)
1507
1508 AC_CHECK_HEADER([linux/compiler.h],
1509                 [AC_DEFINE_UNQUOTED([HAVE_LINUX_COMPILER_H], 1, [Define to 1 if your system has linux/compiler.h.])])
1510
1511 AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
1512                                    #include <linux/version.h>
1513                                    #ifdef HAVE_LINUX_COMPILER_H
1514                                    #include <linux/compiler.h>
1515                                    #endif
1516                                    ])
1517 AC_SUBST(PBX_IXJUSER)
1518
1519 AST_EXT_TOOL_CHECK([SDL], [sdl])
1520 AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL_image.h], [${SDL_LIB}], [${SDL_INCLUDE}])
1521 AST_EXT_LIB_CHECK([FFMPEG], [avcodec], [sws_getContext], [ffmpeg/avcodec.h], [-lpthread -lz -lm])
1522
1523 # possible places for video4linux version 1
1524 AC_CHECK_HEADER([linux/videodev.h],
1525         [AC_DEFINE_UNQUOTED([HAVE_VIDEODEV_H], 1, [Define to 1 if your system has linux/videodev.h.])])
1526
1527 # possible places for X11
1528 AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],,, [standard_path])
1529 AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],, [-I/usr/X11R6/include], [X11R6])
1530
1531 if test "${cross_compiling}" = "no";
1532 then
1533   AC_CHECK_FILE(/sbin/launchd, AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
1534 fi
1535
1536 PBX_GTK=0
1537 AST_EXT_TOOL_CHECK([GTK], [gtk], [--cflags gthread], [--libs gthread])
1538
1539 PBX_GTK2=0
1540 AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
1541 if test ! "x${PKGCONFIG}" = xNo; then
1542    GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null)
1543    GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs)
1544    PBX_GTK2=1
1545    AC_DEFINE([HAVE_GTK2], 1, [Define if your system has the GTK2 libraries.])
1546 fi
1547 AC_SUBST(PBX_GTK2)
1548 AC_SUBST(GTK2_INCLUDE)
1549 AC_SUBST(GTK2_LIB)
1550
1551 if test "${USE_CURL}" != "no"; then
1552    AC_PATH_TOOL([CURL_CONFIG], [curl-config], No)
1553    if test ! x"${CURL_CONFIG}" = xNo; then
1554    # check for version
1555       if test $(printf "%d" 0x$(${CURL_CONFIG} --vernum)) -ge $(printf "%d" 0x070907); then
1556          CURL_INCLUDE=$(${CURL_CONFIG} --cflags)
1557          CURL_LIB=$(${CURL_CONFIG} --libs)
1558
1559          AC_MSG_CHECKING(for curl_version() in curl/curl.h)
1560          saved_cppflags="${CPPFLAGS}"
1561          CPPFLAGS="${CPPFLAGS} ${CURL_INCLUDE}"
1562          AC_COMPILE_IFELSE(
1563             [AC_LANG_PROGRAM(
1564                 [#include <curl/curl.h>],
1565                     [curl_version();])
1566             ],[
1567                 AC_MSG_RESULT(yes)
1568                 ac_cv_curl_h="yes"
1569             ],[
1570                 AC_MSG_RESULT(no)
1571                 ac_cv_curl_h="no"
1572             ]
1573          )
1574          CPPFLAGS="${saved_cppflags}"
1575          if test "${ac_cv_curl_h}" = "yes"; then
1576              PBX_CURL=1
1577              AC_DEFINE([HAVE_CURL], 1, [Define if your system has the curl libraries.])
1578          fi
1579       fi
1580    fi
1581 fi
1582
1583 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
1584 AST_CHECK_MANDATORY
1585
1586 AC_OUTPUT
1587
1588 if test "x${silent}" != "xyes" ; then
1589 echo
1590 echo "               .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=..      "
1591 echo "            .\$7\$7..          .7\$\$7:.    "
1592 echo "          .\$\$:.                 ,\$7.7   "
1593 echo "        .\$7.     7\$\$\$\$           .\$\$77  "
1594 echo "     ..\$\$.       \$\$\$\$\$            .\$\$\$7 "
1595 echo "    ..7\$   .?.   \$\$\$\$\$   .?.       7\$\$\$."
1596 echo "   \$.\$.   .\$\$\$7. \$\$\$\$7 .7\$\$\$.      .\$\$\$."
1597 echo " .777.   .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7.      \$\$\$,"
1598 echo " \$\$\$~      .7\$\$\$\$\$\$\$\$\$\$\$\$\$7.       .\$\$\$."
1599 echo ".\$\$7          .7\$\$\$\$\$\$\$7:          ?\$\$\$."
1600 echo "\$\$\$          ?7\$\$\$\$\$\$\$\$\$\$I        .\$\$\$7 "
1601 echo "\$\$\$       .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$      :\$\$\$. "
1602 echo "\$\$\$       \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$    .\$\$\$.  "
1603 echo "\$\$\$        \$\$\$   7\$\$\$7  .\$\$\$    .\$\$\$.   "
1604 echo "\$\$\$\$             \$\$\$\$7         .\$\$\$.    "
1605 echo "7\$\$\$7            7\$\$\$\$        7\$\$\$      "
1606 echo " \$\$\$\$\$                        \$\$\$       "
1607 echo "  \$\$\$\$7.                       \$\$  (TM)     "
1608 echo "   \$\$\$\$\$\$\$.           .7\$\$\$\$\$\$  \$\$      "
1609 echo "     \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$      "
1610 echo "       \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$.                "
1611 echo
1612 fi
1613
1614 AC_MSG_NOTICE(Package configured for: )
1615 AC_MSG_NOTICE( OS type  : $host_os)
1616 AC_MSG_NOTICE( Host CPU : $host_cpu)
1617 AC_MSG_NOTICE( build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :) 
1618 AC_MSG_NOTICE( host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :) 
1619 if test "${cross_compiling}" = "yes"; then
1620    AC_MSG_NOTICE( Cross Compilation = YES)
1621 fi