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