Disable strict XML documentation config checking; fix crash caused by sorcery
[asterisk/asterisk.git] / configure.ac
index 2f90be1..477e981 100644 (file)
@@ -47,7 +47,8 @@ AC_USE_SYSTEM_EXTENSIONS      dnl note- does not work on FreeBSD
 AC_SUBST([astsbindir],        ['${sbindir}'])dnl
 AC_SUBST([astetcdir],         ['${sysconfdir}/asterisk'])dnl
 AC_SUBST([astheaderdir],      ['${includedir}/asterisk'])dnl
-AC_SUBST([astlibdir],         ['${libdir}/asterisk'])dnl
+AC_SUBST([astlibdir],         ['${libdir}'])dnl
+AC_SUBST([astmoddir],         ['${libdir}/asterisk/modules'])dnl
 AC_SUBST([astmandir],         ['${mandir}'])dnl
 AC_SUBST([astvarlibdir],      ['${localstatedir}/lib/asterisk'])dnl
 AC_SUBST([astdatadir],        ['${astvarlibdir}'])dnl
@@ -93,7 +94,7 @@ case "${host_os}" in
      darwin*)
      ac_default_prefix=/usr/local
      if test ${prefix} = 'NONE'; then
-        astlibdir='/Library/Application Support/Asterisk/Modules'
+        astmoddir='/Library/Application Support/Asterisk/Modules'
         astvarlibdir='/Library/Application Support/Asterisk'
         astlogdir=/Library/Logs/Asterisk
         astvarrundir='/Library/Application Support/Asterisk/Run'
@@ -106,6 +107,7 @@ case "${host_os}" in
         astetcdir=/var/etc/asterisk
         astsbindir=/opt/asterisk/sbin
         astlibdir=/opt/asterisk/lib
+        astmoddir=/opt/asterisk/lib/modules
         astheaderdir=/opt/asterisk/include
         astmandir=/opt/asterisk/man
         astvarlibdir=/var/opt/asterisk
@@ -176,7 +178,7 @@ case "${host_os}" in
      OSARCH=cygwin
      PBX_WINARCH=1
      ;;
-     linux-gnueabi)
+     linux-gnueabi*)
      OSARCH=linux-gnu
      ;;
      kfreebsd*-gnu)
@@ -210,7 +212,7 @@ AH_BOTTOM(
 )
 
 # cross-compile checks
-if test "${cross_compiling}" = "yes"; 
+if test "${cross_compiling}" = "yes";
 then
    AC_CHECK_TOOL(CC, gcc, :)
    AC_CHECK_TOOL(CXX, g++, :)
@@ -234,8 +236,6 @@ AC_PROG_EGREP
 
 AC_CHECK_TOOLS([STRIP], [strip gstrip], :)
 AC_CHECK_TOOLS([AR], [ar gar], :)
-AC_CHECK_TOOLS([SHA1SUM], [sha1sum], $ac_aux_dir/build_tools/sha1sum-sh)
-AC_CHECK_TOOLS([OPENSSL], [openssl], :)
 
 GNU_LD=0
 if test "x$with_gnu_ld" = "xyes" ; then
@@ -247,12 +247,14 @@ AC_PATH_PROG([BISON], [bison], :)
 AC_PATH_PROG([CMP], [cmp], :)
 AC_PATH_PROG([FLEX], [flex], :)
 AC_PATH_PROG([GREP], [grep], :)
+AC_PATH_PROG([PYTHON], [python], :)
 AC_PATH_PROG([FIND], [find], :)
 AC_PATH_PROG([COMPRESS], [compress], :)
 AC_PATH_PROG([BASENAME], [basename], :)
 AC_PATH_PROG([DIRNAME], [dirname], :)
 AC_PATH_PROG([SHELL], [sh], :)
 AC_PATH_PROG([LN], [ln], :)
+AC_PATH_PROG([DOXYGEN], [doxygen], :)
 AC_PATH_PROG([DOT], [dot], :)
 AC_PATH_PROG([WGET], [wget], :)
 AC_PATH_PROG([CURL], [curl], :)
@@ -261,6 +263,7 @@ AC_PATH_PROG([CATDVI], [catdvi], :)
 AC_PATH_PROG([KPATHSEA], [kpsewhich], :)
 AC_PATH_PROG([XMLLINT], [xmllint], :)
 AC_PATH_PROG([XMLSTARLET], [xmlstarlet], :)
+AC_PATH_PROG([GIT], [git], :)
 if test "${WGET}" != ":" ; then
   DOWNLOAD=${WGET}
 else if test "${CURL}" != ":" ; then
@@ -271,6 +274,9 @@ else
 fi
 fi
 AC_SUBST(DOWNLOAD)
+AC_PATH_PROG([LDCONFIG], [ldconfig], :)
+AC_PATH_PROG([SHA1SUM], [sha1sum], $ac_aux_dir/build_tools/sha1sum-sh)
+AC_PATH_PROG([OPENSSL], [openssl], :)
 
 AC_CACHE_CHECK([for bison that supports parse-param], [ac_cv_path_BISON2], [
        if test "x$BISON" != "x:" ; then
@@ -323,7 +329,7 @@ fi
 AC_CHECK_PROGS([MD5], [md5 md5sum gmd5sum digest])
 
 if test "${MD5}" = "digest" ; then
-   MD5="${MD5} -a md5"   
+   MD5="${MD5} -a md5"
 fi
 
 ACX_PTHREAD
@@ -340,10 +346,15 @@ AC_ARG_ENABLE([dev-mode],
              AST_DEVMODE=yes
              NOISY_BUILD=yes
              ;;
+             strict)
+             AST_DEVMODE=yes
+             AST_DEVMODE_STRICT=yes
+             ;;
              *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode)  ;;
        esac])
 AC_SUBST(NOISY_BUILD)
 AC_SUBST(AST_DEVMODE)
+AC_SUBST(AST_DEVMODE_STRICT)
 
 AST_CODE_COVERAGE=no
 AC_ARG_ENABLE([coverage],
@@ -374,11 +385,15 @@ AST_EXT_LIB_SETUP([BFD], [Debug symbol decoding], [bfd])
 AST_EXT_LIB_SETUP([BKTR], [Stack Backtrace], [execinfo])
 AST_EXT_LIB_SETUP([BLUETOOTH], [Bluetooth], [bluetooth])
 AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capabilities], [cap])
+AST_EXT_LIB_SETUP([COROSYNC], [Corosync], [cpg])
+AST_EXT_LIB_SETUP_OPTIONAL([COROSYNC_CFG_STATE_TRACK], [A callback only in corosync 1.x], [COROSYNC], [cfg])
 AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
 AST_EXT_LIB_SETUP([CRYPTO], [OpenSSL Cryptography], [crypto])
+AST_EXT_LIB_SETUP_OPTIONAL([OPENSSL_SRTP], [OpenSSL SRTP Extension Support], [CRYPTO], [crypto])
 AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
 AST_EXT_LIB_SETUP([FFMPEG], [Ffmpeg and avcodec], [avcodec])
 AST_EXT_LIB_SETUP([GSM], [External GSM], [gsm], [, use 'internal' GSM otherwise])
+AST_EXT_LIB_SETUP([ILBC], [System iLBC], [ilbc], [, use 'internal' iLBC otherwise])
 AST_EXT_LIB_SETUP([GTK2], [gtk2], [gtk2])
 AST_EXT_LIB_SETUP([GMIME], [GMime], [gmime])
 AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323])
@@ -391,9 +406,11 @@ AST_EXT_LIB_SETUP([INOTIFY], [inotify support], [inotify])
 AST_EXT_LIB_SETUP([IODBC], [iODBC], [iodbc])
 AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux], [isdnnet])
 AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
+AST_EXT_LIB_SETUP([JANSSON], [Jansson JSON library], [jansson])
 AST_EXT_LIB_SETUP([KQUEUE], [kqueue support], [kqueue])
 AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
 AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
+AST_EXT_LIB_SETUP([LIBEDIT], [NetBSD Editline library], [libedit], [, use 'internal' Editline otherwise])
 AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
 AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl])
 AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
@@ -406,7 +423,6 @@ AST_EXT_LIB_SETUP([NEON29], [neon29], [neon29])
 AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
 AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
 AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
-AST_EXT_LIB_SETUP([OPENAIS], [OpenAIS], [openais])
 AST_EXT_LIB_SETUP([OPENR2], [MFR2], [openr2])
 AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
 AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
@@ -460,7 +476,6 @@ AST_EXT_LIB_SETUP([TIMERFD], [timerfd], [timerfd])
 AST_EXT_LIB_SETUP([TINFO], [Term Info], [tinfo])
 AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
 AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [unixodbc])
-AST_EXT_LIB_SETUP([USB], [usb], [usb])
 AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
 AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
 AST_EXT_LIB_SETUP([X11], [X11], [x11])
@@ -475,11 +490,12 @@ AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 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/event.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 sys/io.h])
 
-# Any one of these 4 packages support a mandatory requirement, so we want to check on them as early as possible.
+# Any one of these 5 packages support a mandatory requirement, so we want to check on them as early as possible.
 AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
 AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
 AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
 AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
+AST_EXT_LIB_CHECK([UUID], [uuid], [uuid_generate_random], [uuid/uuid.h], [-luuid])
 
 EDITLINE_LIB=""
 if test "x$TERMCAP_LIB" != "x" ; then
@@ -495,10 +511,14 @@ else
 fi
 AC_SUBST(EDITLINE_LIB)
 
+if test "x$UUID_LIB" == "x"; then
+  AC_MSG_ERROR([*** uuid support not found (this typically means the uuid development package is missing)])
+fi
+
 # Another mandatory item (unless it's explicitly disabled)
 AC_ARG_ENABLE([xmldoc],
        [AS_HELP_STRING([--disable-xmldoc],
-               [Explicity disable XML documentation])],
+               [Explicitly disable XML documentation])],
        [case "${enableval}" in
                y|ye|yes) disable_xmldoc=no ;;
                n|no)  disable_xmldoc=yes ;;
@@ -577,7 +597,7 @@ AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll
 # so that AC_CHECK_FUNCS can detect functions in that library.
 AC_CHECK_LIB([m], [sqrt])
 # BSD might not have exp2, and/or log2
-AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round trunc floor ceil])
+AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round roundf trunc floor ceil])
 
 # Certain architectures don't really have long double, even though
 # AC_CHECK_FUNCS would otherwise find the following functions.
@@ -622,7 +642,7 @@ AC_SUBST(PBX_DYNAMIC_LIST)
 LDFLAGS=${old_LDFLAGS}
 rm -f conftest.dynamics
 
-AC_CHECK_HEADER([sys/poll.h], 
+AC_CHECK_HEADER([sys/poll.h],
    [HAS_POLL=1]
    AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]),
    )
@@ -637,7 +657,15 @@ AC_ARG_ENABLE([internal-poll],
        esac])
 AC_SUBST(HAS_POLL)
 
-
+AC_ARG_ENABLE([asteriskssl],
+       [AS_HELP_STRING([--disable-asteriskssl],
+               [Disable Asterisk's SSL wrapper library])],
+       [case "${enableval}" in
+               y|ye|yes) AST_ASTERISKSSL=yes ;;
+               n|no)  AST_ASTERISKSSL=no ;;
+               *) AC_MSG_ERROR(bad value ${enableval} for --disable-asteriskssl)  ;;
+       esac], [AST_ASTERISKSSL=yes])
+AC_SUBST(AST_ASTERISKSSL)
 
 # https support (in main/http.c) uses funopen on BSD systems,
 # fopencookie on linux
@@ -696,11 +724,6 @@ AC_DEFINE([HAVE_SYS_ENDIAN_BSWAP16], 1, [Define to 1 if your sys/endian.h header
 AC_MSG_RESULT(no)
 )
 
-if test "${cross_compiling}" = "no";
-then
-  AC_CHECK_FILE(/dev/urandom, AC_DEFINE([HAVE_DEV_URANDOM], 1, [Define to 1 if your system has /dev/urandom.]))
-fi
-
 AC_MSG_CHECKING(for locale_t in locale.h)
 AC_LINK_IFELSE(
 [AC_LANG_PROGRAM([#include <locale.h>], [locale_t lt = NULL])],
@@ -964,6 +987,16 @@ else
 fi
 AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
 
+AC_MSG_CHECKING(for -Wtrampolines support)
+if $(${CC} -Wtrampolines -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+       AC_MSG_RESULT(yes)
+       AST_TRAMPOLINES=-Wtrampolines
+else
+       AC_MSG_RESULT(no)
+       AST_TRAMPOLINES=
+fi
+AC_SUBST(AST_TRAMPOLINES)
+
 AC_MSG_CHECKING(for _FORTIFY_SOURCE support)
 if $(${CC} -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
        AC_MSG_RESULT(yes)
@@ -994,15 +1027,53 @@ else
 fi
 AC_SUBST(AST_SHADOW_WARNINGS)
 
-AC_MSG_CHECKING(for -march=native)
+AC_MSG_CHECKING(for -march=native support)
 if $(${CC} -march=native -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
-       AC_MSG_RESULT(yes)
-       AST_MARCH_NATIVE="-march=native"
+       if test "${CONFIG_CFLAGS}" = ""; then
+               AC_MSG_RESULT(yes)
+               AST_NATIVE_ARCH=1
+       else
+               AC_MSG_RESULT(user CFLAGS present)
+               AST_NATIVE_ARCH=
+       fi
 else
        AC_MSG_RESULT(no)
-       AST_MARCH_NATIVE=
+       AST_NATIVE_ARCH=
 fi
-AC_SUBST(AST_MARCH_NATIVE)
+AC_SUBST(AST_NATIVE_ARCH)
+
+dnl Nested functions required for RAII implementation
+AC_MSG_CHECKING(for -fnested-functions)
+AC_COMPILE_IFELSE(
+       dnl Prototype needed due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36774
+       [AC_LANG_PROGRAM([], [auto void foo(void); void foo(void) {}])],
+       AC_MSG_RESULT(no)
+       [AST_NESTED_FUNCTIONS=],
+       AC_MSG_RESULT(required)
+       [AST_NESTED_FUNCTIONS=-fnested-functions]
+)
+AC_SUBST(AST_NESTED_FUNCTIONS)
+
+dnl Check to see if rpath should be set in LDFLAGS
+AC_ARG_ENABLE(rpath,
+       [AC_HELP_STRING([--disable-rpath],
+                       [Disables rpath linker option checking])],
+       [case "${enableval}" in
+               y|ye|yes) check_rpath=yes ;;
+               n|no) check_rpath=no ;;
+                *) AC_MSG_ERROR(bad value ${enableval} for --disable-rpath) ;;
+       esac], [check_rpath=yes])
+
+AC_MSG_CHECKING(whether to use rpath)
+AST_RPATH=
+if test "${check_rpath}" != yes; then
+       AC_MSG_RESULT(skipped)
+elif test "${prefix}" = /usr || test "${prefix}" = NONE; then
+       AC_MSG_RESULT(not needed)
+else
+       AST_RPATH="-Wl,-rpath,${libdir}"
+fi
+AC_SUBST(AST_RPATH)
 
 AC_MSG_CHECKING(for sysinfo)
 AC_LINK_IFELSE(
@@ -1121,7 +1192,7 @@ AC_LINK_IFELSE(
 LIBS=${old_LIBS}
 
 # PKGCONFIG is used in later tests
-AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
+PKG_PROG_PKG_CONFIG()
 
 
 # do the package library checks now
@@ -1130,6 +1201,11 @@ AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -l
 
 AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h])
 
+if test "${PBX_BFD}" = "0"; then
+  # Fedora/RedHat/CentOS require extra libraries
+  AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_check_format], [bfd.h], [-ldl -liberty])
+fi
+
 if test "x${OSARCH}" = "xlinux-gnu" ; then
   AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
 fi
@@ -1213,6 +1289,46 @@ if test "${USE_GSM}" != "no"; then
    fi
 fi
 
+ILBC_INTERNAL="yes"
+AC_SUBST(ILBC_INTERNAL)
+ILBC_SYSTEM="yes"
+if test "${USE_ILBC}" != "no"; then
+   if test "${ILBC_DIR}" = "internal"; then
+      ILBC_SYSTEM="no"
+   elif test "${ILBC_DIR}" != ""; then
+      ILBC_INTERNAL="no"
+   fi
+   if test "${ILBC_SYSTEM}" = "yes"; then
+      AST_PKG_CONFIG_CHECK(ILBC, libilbc)
+      if test "$PBX_ILBC" = "1"; then
+        ILBC_INTERNAL="no"
+      fi
+   fi
+   if test "${ILBC_INTERNAL}" = "yes"; then
+      PBX_ILBC=1
+   fi
+fi
+
+LIBEDIT_INTERNAL="yes"
+AC_SUBST(LIBEDIT_INTERNAL)
+LIBEDIT_SYSTEM="yes"
+if test "${USE_LIBEDIT}" != "no"; then
+   if test "${LIBEDIT_DIR}" = "internal"; then
+      LIBEDIT_SYSTEM="no"
+   elif test "${LIBEDIT_DIR}" != ""; then
+      LIBEDIT_INTERNAL="no"
+   fi
+   if test "${LIBEDIT_SYSTEM}" = "yes"; then
+      AST_PKG_CONFIG_CHECK(LIBEDIT, libedit)
+      if test "$PBX_LIBEDIT" = "1"; then
+        LIBEDIT_INTERNAL="no"
+      fi
+   fi
+   if test "${LIBEDIT_INTERNAL}" = "yes"; then
+      PBX_LIBEDIT=1
+   fi
+fi
+
 AST_EXT_LIB_CHECK([ICONV], [iconv], [iconv_open], [iconv.h])
 # GNU libiconv #define's iconv_open to libiconv_open, so we need to search for that symbol
 AST_EXT_LIB_CHECK([ICONV], [iconv], [libiconv_open], [iconv.h])
@@ -1482,7 +1598,7 @@ if test "${USE_IMAP_TK}" != "no"; then
                                fi
                        fi
                fi
-       fi 
+       fi
        if test "${IMAP_TK_DIR}" = "system"; then
                #We will enter here if user specified "system" or if any of above checks failed
                AC_MSG_CHECKING([for system c-client library...])
@@ -1740,7 +1856,7 @@ if test "${USE_IMAP_TK}" != "no"; then
                        AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
                fi
        else
-               AC_MSG_RESULT(no) 
+               AC_MSG_RESULT(no)
        fi
        CPPFLAGS="${saved_cppflags}"
        LIBS="${saved_libs}"
@@ -1752,6 +1868,8 @@ AST_EXT_LIB_CHECK([INOTIFY], [c], [inotify_init], [sys/inotify.h])
 
 AST_EXT_LIB_CHECK([JACK], [jack], [jack_activate], [jack/jack.h])
 
+AST_EXT_LIB_CHECK([JANSSON], [jansson], [json_dumps], [jansson.h])
+
 # BSD (and OS X) equivalent of inotify
 AST_EXT_LIB_CHECK([KQUEUE], [c], [kqueue], [sys/event.h])
 
@@ -1811,7 +1929,7 @@ AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [sys/soundcard.h])
 AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
 
 PG_CONFIG=No
-if test "${USE_PGSQL}" != "no"; then   
+if test "${USE_PGSQL}" != "no"; then
    if test "x${PGSQL_DIR}" != "x"; then
       AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
       if test x"${PG_CONFIG}" = xNo; then
@@ -1837,7 +1955,7 @@ if test "${PG_CONFIG}" != No; then
          AC_MSG_NOTICE([*** including --without-postgres])
          exit 1
          fi
-   else 
+   else
       AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
       [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
 
@@ -1920,7 +2038,8 @@ if test "x${PBX_SPANDSP}" = "x1" ; then
        AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [t38_terminal_init], [spandsp.h], [-ltiff])
 fi
 
-AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_pollflags], [libss7.h])
+# Check for libss7 v1.0 branch compatible version.
+AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_set_adjpc], [libss7.h])
 
 AST_EXT_LIB_CHECK([OPENR2], [openr2], [openr2_chan_new], [openr2.h])
 
@@ -1930,7 +2049,7 @@ if test "${USE_PWLIB}" != "no"; then
        fi
        AST_CHECK_PWLIB()
        AST_CHECK_PWLIB_VERSION([PWLib], [PWLIB], [ptbuildopts.h], [1], [9], [2], [P[[WT]]LIB_VERSION])
-               
+
        if test "${HAS_PWLIB:-unset}" != "unset"; then
                AST_CHECK_PWLIB_PLATFORM()
 
@@ -1960,7 +2079,7 @@ if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
                [${PWLIB_INCLUDE}], [${PWLIB_LIB}])
 fi
 
-AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm]) 
+AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm])
 if test "x${PBX_LUA}" = "x1" ; then
        if test x"${LUA_DIR}" = x; then
                LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.1"
@@ -1968,37 +2087,14 @@ if test "x${PBX_LUA}" = "x1" ; then
                LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.1"
        fi
 fi
-       
+
 # Some distributions (like SuSE) remove the 5.1 suffix.
-AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm]) 
+AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm])
 
 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
 
-# This is a bit complex... in reality, Asterisk's AIS support is dependent on finding
-# *any* implementation of AIS, not just OpenAIS. However, the configure script needs
-# to know the specifics of each possible implementation, and then represent the one
-# that was found as 'AIS'.
-
-PBX_AIS=0
-
-# OpenAIS installs its libraries into /usr/lib/openais by default, so check there
-
-AST_EXT_LIB_CHECK([OPENAIS], [SaClm], [saClmInitialize], [openais/saClm.h], [-L/usr/lib/openais -L/usr/lib64/openais])
-
-if test "${PBX_OPENAIS}" = 1; then
-   PBX_AIS=1
-   if test -n "${OPENAIS_DIR}"; then
-      AIS_INCLUDE="${OPENAIS_INCLUDE}/openais"
-      AIS_LIB="-lSaEvt ${OPENAIS_LIB}"
-   else
-      AIS_INCLUDE="-I/usr/include/openais"
-      AIS_LIB="-lSaClm -lSaEvt -L/usr/lib/openais -L/usr/lib64/openais"
-   fi
-fi
-
-AC_SUBST(PBX_AIS)
-AC_SUBST(AIS_INCLUDE)
-AC_SUBST(AIS_LIB)
+AST_EXT_LIB_CHECK([COROSYNC], [cpg], [cpg_join], [corosync/cpg.h], [-lcfg])
+AST_EXT_LIB_CHECK([COROSYNC_CFG_STATE_TRACK], [cfg], [corosync_cfg_state_track], [corosync/cfg.h], [-lcfg])
 
 AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
 
@@ -2034,7 +2130,8 @@ fi
 
 if test "$PBX_OPENSSL" = "1";
 then
-    AST_CHECK_OSPTK([4], [0], [0])
+        AST_CHECK_OSPTK([4], [0], [0])
+        AST_EXT_LIB_CHECK([OPENSSL_SRTP], [ssl], [SSL_CTX_set_tlsext_use_srtp], [openssl/ssl.h], [-lcrypto])
 fi
 
 AST_EXT_LIB_CHECK([SRTP], [srtp], [srtp_init], [srtp/srtp.h])
@@ -2076,21 +2173,13 @@ then
     CFLAGS="${saved_cflags}"
 fi
 
-AST_EXT_TOOL_CHECK([GMIME], [gmime-config], [], [], [#include <gmime/gmime.h>], [gboolean q = g_mime_check_version(0,0,0);])
-if test "x${PBX_GMIME}" = "x0" -a "${PKGCONFIG}" != "No"; then
-       # Later versions of GMime use pkg-config
-       for ver in 2.0 2.2 2.4; do
-               if ! ${PKGCONFIG} --exists gmime-$ver; then
-                       continue
-               fi
-               # If we got here, we have this version:
-               GMIME_INCLUDE=$(${PKGCONFIG} gmime-$ver --cflags 2>/dev/null)
-               GMIME_LIB=$(${PKGCONFIG} gmime-$ver --libs)
-               PBX_GMIME=1
-               AC_DEFINE([HAVE_GMIME], 1, [Define if your system has the GMIME libraries.])
+
+for ver in 2.0 2.2 2.4 2.6; do
+       AST_PKG_CONFIG_CHECK([GMIME], gmime-$ver)
+       if test "$PBX_GMIME" = 1; then
                break;
-       done
-fi
+       fi
+done
 
 AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
 
@@ -2104,14 +2193,13 @@ fi
 
 AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
 
-AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
-
 if test "${OSARCH}" = "OpenBSD";
 then
-       AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -logg])
+       AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -lvorbisfile -logg])
 else
-       AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
+       AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -lvorbisfile])
 fi
+AST_C_DECLARE_CHECK([VORBIS_OPEN_CALLBACKS], [OV_CALLBACKS_NOCLOSE], [vorbis/vorbisfile.h])
 
 AC_LANG_PUSH(C++)
 
@@ -2136,11 +2224,11 @@ if test "${USE_VPB}" != "no"; then
        [#include <vpbapi.h>],
        [int q = vpb_open(0,0);])
        ],
-       [       AC_MSG_RESULT(yes) 
-               ac_cv_lib_vpb_vpb_open="yes" 
+       [       AC_MSG_RESULT(yes)
+               ac_cv_lib_vpb_vpb_open="yes"
        ],
-       [       AC_MSG_RESULT(no) 
-               ac_cv_lib_vpb_vpb_open="no" 
+       [       AC_MSG_RESULT(no)
+               ac_cv_lib_vpb_vpb_open="no"
        ]
        )
    LIBS="${saved_libs}"
@@ -2212,16 +2300,7 @@ then
 fi
 AC_SUBST(PBX_LAUNCHD)
 
-PBX_GTK2=0
-if test "${PKGCONFIG}" != "No"; then
-   GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null)
-   GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs)
-   PBX_GTK2=1
-   AC_DEFINE([HAVE_GTK2], 1, [Define if your system has the GTK2 libraries.])
-fi
-AC_SUBST(PBX_GTK2)
-AC_SUBST(GTK2_INCLUDE)
-AC_SUBST(GTK2_LIB)
+AST_PKG_CONFIG_CHECK([GTK2], [gtk+-2.0])
 
 # build a GENERIC_ODBC result based on the presence of either UnixODBC (preferred)
 # or iODBC
@@ -2322,8 +2401,8 @@ fi
 AC_MSG_NOTICE(Package configured for: )
 AC_MSG_NOTICE( OS type  : $host_os)
 AC_MSG_NOTICE( Host CPU : $host_cpu)
-AC_MSG_NOTICE( build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :) 
-AC_MSG_NOTICE( host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :) 
+AC_MSG_NOTICE( build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :)
+AC_MSG_NOTICE( host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :)
 if test "${cross_compiling}" = "yes"; then
    AC_MSG_NOTICE( Cross Compilation = YES)
 fi