Fixed make clean when configured --disable-asteriskssl
[asterisk/asterisk.git] / configure.ac
index d276a6f..032b7a0 100644 (file)
@@ -247,6 +247,7 @@ 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], :)
@@ -383,11 +384,13 @@ 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([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])
@@ -403,6 +406,7 @@ AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
 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])
@@ -979,6 +983,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)
@@ -1009,15 +1023,20 @@ 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)
 
 AC_MSG_CHECKING(for sysinfo)
 AC_LINK_IFELSE(
@@ -1136,7 +1155,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
@@ -1145,6 +1164,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
@@ -1228,6 +1252,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])
@@ -1935,7 +1999,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])
 
@@ -1990,6 +2055,7 @@ AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm])
 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
 
 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])
 
@@ -2067,21 +2133,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], [])
 
@@ -2202,16 +2260,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