Skip to content
Snippets Groups Projects
configure.ac 94.6 KiB
Newer Older
  • Learn to ignore specific revisions
  • 					void mm_searched (MAILSTREAM *stream,unsigned long number)
    					{
    					}
    					void mm_exists (MAILSTREAM *stream,unsigned long number)
    					{
    					}
    					void mm_expunged (MAILSTREAM *stream,unsigned long number)
    					{
    					}
    					void mm_flags (MAILSTREAM *stream,unsigned long number)
    					{
    					}
    					void mm_notify (MAILSTREAM *stream,char *string,long errflg)
    					{
    					}
    					void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
    					{
    					}
    					void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
    					{
    					}
    					void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
    					{
    					}
    					void mm_log (char *string,long errflg)
    					{
    					}
    					void mm_dlog (char *string)
    					{
    					}
    					void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
    					{
    					}
    					void mm_critical (MAILSTREAM *stream)
    					{
    					}
    					void mm_nocritical (MAILSTREAM *stream)
    					{
    					}
    					long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
    					{
    					}
    					void mm_fatal (char *string)
    					{
    					}],
    					[
    					MAILSTREAM *foo = mail_open(NULL, "", 0);
    					]
    
    				[ac_cv_imap_tk="yes"],
    				[ac_cv_imap_tk="no"]
    	   		)
    			if test "${ac_cv_imap_tk}" = "yes"; then
    				AC_LINK_IFELSE(
    
    						[#include <stdio.h>
    						#include <c-client/c-client.h>
    						void mm_searched (MAILSTREAM *stream,unsigned long number)
    						{
    						}
    						void mm_exists (MAILSTREAM *stream,unsigned long number)
    						{
    						}
    						void mm_expunged (MAILSTREAM *stream,unsigned long number)
    						{
    						}
    						void mm_flags (MAILSTREAM *stream,unsigned long number)
    						{
    						}
    						void mm_notify (MAILSTREAM *stream,char *string,long errflg)
    						{
    						}
    						void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
    						{
    						}
    						void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
    						{
    						}
    						void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
    						{
    						}
    						void mm_log (char *string,long errflg)
    						{
    						}
    						void mm_dlog (char *string)
    						{
    						}
    						void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
    						{
    						}
    						void mm_critical (MAILSTREAM *stream)
    						{
    						}
    						void mm_nocritical (MAILSTREAM *stream)
    						{
    						}
    						long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
    						{
    						}
    						void mm_fatal (char *string)
    						{
    						}],
    						[
    						long check = mail_expunge_full(NULL, "", 0);
    						]
    
    	fi
    	if test "${ac_cv_imap_tk}" = "yes"; then
    		AC_MSG_RESULT(yes)
    		IMAP_TK_LIB="${imap_libs} "`echo ${imap_ldflags}`
    		IMAP_TK_INCLUDE="${imap_include}"
    		PBX_IMAP_TK=1
    		AC_DEFINE([HAVE_IMAP_TK], 1, [Define if your system has the UW IMAP Toolkit c-client library.])
    		if test "${ac_cv_imap_tk2006}" = "yes"; then
    			AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
    
    	CPPFLAGS="${saved_cppflags}"
    	LIBS="${saved_libs}"
    
    AST_EXT_LIB_CHECK([IODBC], [iodbc], [SQLConnect], [sql.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
    
    AST_EXT_LIB_CHECK([INOTIFY], [c], [inotify_init], [sys/inotify.h])
    
    
    AST_EXT_LIB_CHECK([JACK], [jack], [jack_activate], [jack/jack.h])
    
    
    # BSD (and OS X) equivalent of inotify
    AST_EXT_LIB_CHECK([KQUEUE], [c], [kqueue], [sys/event.h])
    
    # 64-bit version of kevent (from kqueue) on OS X
    AC_CHECK_FUNCS([kevent64])
    
    
    # Needed by unixodbc
    AST_EXT_LIB_CHECK([LTDL], [ltdl], [lt_dlinit], [ltdl.h], [])
    
    
    AST_EXT_LIB_CHECK([LDAP], [ldap], [ldap_initialize], [ldap.h])
    
    AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h])
    
    if test "${PBX_MISDN}" = 1; then
       AST_EXT_LIB_CHECK([ISDNNET], [isdnnet], [init_manager], [mISDNuser/isdn_net.h], [-lmISDN -lpthread])
       AST_EXT_LIB_CHECK([SUPPSERV], [suppserv], [encodeFac], [mISDNuser/suppserv.h])
    
       AST_C_DEFINE_CHECK([MISDN_FAC_RESULT], [Fac_RESULT], [mISDNuser/suppserv.h])
       AST_C_DEFINE_CHECK([MISDN_FAC_ERROR], [Fac_ERROR], [mISDNuser/suppserv.h])
    
       AC_CHECK_HEADER([linux/mISDNdsp.h], [AC_DEFINE_UNQUOTED([MISDN_1_2], 1, [Build chan_misdn for mISDN 1.2 or later.])])
    
       AC_CHECK_MEMBER([Q931_info_t.redirect_dn], [], [PBX_MISDN=0], [#include <mISDNuser/mISDNlib.h>])
    
    AST_EXT_TOOL_CHECK([MYSQLCLIENT], [mysql_config])
    
    
    AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
    
    AST_EXT_TOOL_CHECK([NEON], [neon-config])
    
    AST_EXT_TOOL_CHECK([NEON29], [neon-config], , [--libs],
    [#include <ne_auth.h>],
    [#ifndef NE_AUTH_NTLM
    #error Need libneon >= 0.29.0
    #endif])
    
    
    AST_EXT_TOOL_CHECK([NETSNMP], [net-snmp-config], , [--agent-libs],
    
    [#include <net-snmp/net-snmp-config.h>
    #include <net-snmp/net-snmp-includes.h>
    #include <net-snmp/agent/net-snmp-agent-includes.h>],
    [int callback = snmp_register_callback(0, 0, NULL, NULL)])
    
    AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
    
    
    # libunbound v1.5.0 added the ub_ctx_add_ta_autr() API call that we can
    # detect as a useable version so that is going to be the minimum version
    # that we will require.
    # Technically v1.4.21 and later could be used but v1.4.21 has a configure
    # script bug which does not find the ldns library.  The bug is fixed in
    # v1.4.22 but that version is not easily detectable.
    #
    
    AST_EXT_LIB_CHECK([UNBOUND], [unbound], [ub_ctx_delete], [unbound.h], [])
    AST_C_DECLARE_CHECK([UNBOUND_CONST_PARAMS], [UNBOUND_VERSION_MAJOR], [unbound.h])
    
    AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
    
    
    AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
    
    
    # Non-glibc platforms require libexecinfo for backtrace support
    
    AST_EXT_LIB_CHECK([BKTR], [execinfo], [backtrace], [execinfo.h])
    
    # Linux, however, has backtrace directly in glibc
    AST_EXT_LIB_CHECK([BKTR], [c], [backtrace], [execinfo.h])
    
    AST_EXT_LIB_CHECK([BLUETOOTH], [bluetooth], [ba2str], [bluetooth/bluetooth.h])
    
    
    AST_EXT_LIB_CHECK([BEANSTALK], [beanstalk], [bs_version], [beanstalk.h])
    
    
    # possible places for oss definitions
    AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [linux/soundcard.h])
    AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [sys/soundcard.h])
    AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
    
       if test "x${PGSQL_DIR}" != "x"; then
          AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
    
             AC_MSG_NOTICE([***])
             AC_MSG_NOTICE([*** pg_config was not found in the path you specified:])
             AC_MSG_NOTICE([*** ${PGSQL_DIR}/bin])
             AC_MSG_NOTICE([*** Either correct the installation, or run configure])
             AC_MSG_NOTICE([*** including --without-postgres])
    
       PGSQL_libdir=`${PG_CONFIG} --libdir`
       PGSQL_includedir=`${PG_CONFIG} --includedir`
    
       if test "x$?" != "x0" ; then
          if test -n "${PGSQL_MANDATORY}" ; then
             AC_MSG_NOTICE([***])
             AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
             AC_MSG_NOTICE([*** Either correct the installation, or run configure])
             AC_MSG_NOTICE([*** including --without-postgres])
             exit 1
    	  fi
    
          AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
    
          [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
    
    
          AC_MSG_CHECKING(for pg_encoding_to_char within Postgres headers)
          old_CFLAGS=${CFLAGS}
          CFLAGS="${CFLAGS} -I${PGSQL_includedir} -Werror"
          old_LDFLAGS=${LDFLAGS}
          LDFLAGS="${LDFLAGS} -L${PGSQL_libdir} -lpq -lz"
          AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <libpq-fe.h>],
              [const char *foo = pg_encoding_to_char(1)])],
            [AC_MSG_RESULT(yes)
             AC_DEFINE_UNQUOTED([HAVE_PGSQL_pg_encoding_to_char], 1, [Define to indicate presence of the pg_encoding_to_char API.])],
            [AC_MSG_RESULT(no)])
          CFLAGS=${old_CFLAGS}
          LDFLAGS=${old_LDFLAGS}
    
    
          if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
    
             PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
             PGSQL_INCLUDE="-I${PGSQL_includedir}"
             PBX_PGSQL=1
          elif test -n "${PGSQL_MANDATORY}";
          then
             AC_MSG_NOTICE([***])
             AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
             AC_MSG_NOTICE([*** Either correct the installation, or run configure])
             AC_MSG_NOTICE([*** including --without-postgres])
             exit 1
          fi
    
    if test "$USE_PJPROJECT" != "no" ; then
    
       if test "$PJPROJECT_BUNDLED" = "no" ; then
    
          AST_PKG_CONFIG_CHECK([PJPROJECT], [libpjproject])
    
          AST_EXT_LIB_CHECK([PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], [pjsip], [pjsip_dlg_create_uas_and_inc_lock], [pjsip.h], [$PJPROJECT_LIBS], [$PJPROJECT_CFLAGS])
          AST_EXT_LIB_CHECK([PJ_TRANSACTION_GRP_LOCK], [pjsip], [pjsip_tsx_create_uac2], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
    
          saved_cppflags="${CPPFLAGS}"
          saved_libs="${LIBS}"
          CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}"
          LIBS="${LIBS} ${PJPROJECT_LIB}"
          AST_C_COMPILE_CHECK([PJSIP_REPLACE_MEDIA_STREAM], [pjmedia_mod_offer_flag flag = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE], [pjmedia.h])
          LIBS="${saved_libs}"
          CPPFLAGS="${saved_cppflags}"
    
          AST_EXT_LIB_CHECK([PJSIP_GET_DEST_INFO], [pjsip], [pjsip_get_dest_info], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
    
          AST_EXT_LIB_CHECK([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj], [pj_ssl_cert_load_from_files2], [pjlib.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
    
          AST_EXT_LIB_CHECK([PJSIP_EXTERNAL_RESOLVER], [pjsip], [pjsip_endpt_set_ext_resolver], [pjsip.h], [$PJPROJECT_LIBS], [$PJPROJECT_CFLAGS])
    
    
          saved_cppflags="${CPPFLAGS}"
          saved_libs="${LIBS}"
          CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}"
          LIBS="${LIBS} ${PJPROJECT_LIB}"
          AST_C_COMPILE_CHECK([PJSIP_TLS_TRANSPORT_PROTO], [struct pjsip_tls_setting setting; int proto; proto = setting.proto;], [pjsip.h])
          LIBS="${saved_libs}"
          CPPFLAGS="${saved_cppflags}"
    
          AST_EXT_LIB_CHECK([PJSIP_EVSUB_GRP_LOCK], [pjsip], [pjsip_evsub_add_ref], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
    
          AST_EXT_LIB_CHECK([PJSIP_INV_SESSION_REF], [pjsip], [pjsip_inv_add_ref], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
    
          AST_EXT_LIB_CHECK([PJSIP_AUTH_CLT_DEINIT], [pjsip], [pjsip_auth_clt_deinit], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
    
          AST_EXT_LIB_CHECK([PJSIP_EVSUB_SET_UAS_TIMEOUT], [pjsip], [pjsip_evsub_set_uas_timeout], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
    
          AST_EXT_LIB_CHECK([PJSIP_TSX_LAYER_FIND_TSX2], [pjsip], [pjsip_tsx_layer_find_tsx2], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS])
    
    AC_SUBST([PYTHONDEV_LIB])
    AC_SUBST([PYTHONDEV_INCLUDE])
    AST_PKG_CONFIG_CHECK([PYTHONDEV], [python])
    
    
    AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
    
    AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
    
    
    AST_EXT_LIB_CHECK([PRI], [pri], [pri_connected_line_update], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_SETUP_ACK_INBAND], [pri], [pri_setup_ack], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_L2_PERSISTENCE], [pri], [pri_persistent_layer2_option], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_DATETIME_SEND], [pri], [pri_date_time_send_option], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_MWI_V2], [pri], [pri_mwi_indicate_v2], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_DISPLAY_TEXT], [pri], [pri_display_text], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_MWI], [pri], [pri_mwi_indicate], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_MCID], [pri], [pri_mcid_enable], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_CALL_WAITING], [pri], [pri_connect_ack_enable], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_AOC_EVENTS], [pri], [pri_aoc_events_enable], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_TRANSFER], [pri], [pri_transfer_enable], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_CCSS], [pri], [pri_cc_enable], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_HANGUP_FIX], [pri], [pri_hangup_fix_enable], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_SUBADDR], [pri], [pri_sr_set_called_subaddress], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_CALL_HOLD], [pri], [pri_hold_enable], [libpri.h])
    AST_EXT_LIB_CHECK([PRI_CALL_REROUTING], [pri], [pri_reroute_enable], [libpri.h])
    AST_EXT_LIB_CHECK([PRI_SETUP_KEYPAD], [pri], [pri_sr_set_keypad_digits], [libpri.h])
    
    # ------------------------------------v
    # TODO: The code can be changed to always include these features now.
    # These features will always be present if pri_connected_line_update is available.
    
    AST_EXT_LIB_CHECK([PRI_PROG_W_CAUSE], [pri], [pri_progress_with_cause], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_INBANDDISCONNECT], [pri], [pri_set_inbanddisconnect], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_SERVICE_MESSAGES], [pri], [pri_maintenance_service], [libpri.h])
    
    AST_EXT_LIB_CHECK([PRI_REVERSE_CHARGE], [pri], [pri_sr_set_reversecharge], [libpri.h])
    
    # ------------------------------------^
    
    AST_EXT_LIB_CHECK([RESAMPLE], [resample], [resample_open], [libresample.h], [-lm])
    
    AST_EXT_LIB_CHECK([FFTW3], [fftw3], [fftw_alloc_real], [fftw3.h])
    AST_EXT_LIB_CHECK([SNDFILE], [sndfile], [sf_open], [sndfile.h])
    
    AST_C_COMPILE_CHECK([SPANDSP], [
    		#if SPANDSP_RELEASE_DATE < 20080516
    		#error "spandsp 0.0.5 or greater is required"
    		#endif
    
    	], [spandsp/version.h], , [minimum version of SpanDSP])
    
    if test "x${PBX_SPANDSP}" = "x1" ; then
    	# We found the correct version in the header, now let's make sure it links
    	# properly, and that libtiff is available
    	PBX_SPANDSP=0
    	AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [span_set_message_handler], [spandsp.h], [-ltiff])
    fi
    
    
    if test "x${PBX_SPANDSP}" = "x1" ; then
    	# We also need t38_terminal_init()
    	PBX_SPANDSP=0
    	AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [t38_terminal_init], [spandsp.h], [-ltiff])
    fi
    
    
    # Check for libss7 v2.0 branch compatible version.
    AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_set_isup_timer], [libss7.h])
    
    AST_EXT_LIB_CHECK([OPENR2], [openr2], [openr2_chan_new], [openr2.h])
    
    
    AST_EXT_LIB_CHECK([OPUS], [opus], [opus_encoder_create], [opus/opus.h])
    
    # opusfile.h includes <opus_multistream.h> so we need to make sure that
    # either $OPUS_INCLUDE or /usr/include/opus is added to the search path.
    __opus_include=${OPUS_INCLUDE}
    if test -z "$__opus_include" -o x"$__opus_include" = x" " ; then
    	__opus_include=-I/usr/include/opus
    fi
    AST_EXT_LIB_CHECK([OPUSFILE], [opusfile], [op_open_callbacks], [opus/opusfile.h], [], [$__opus_include])
    
    	if test -n "${PWLIB_DIR}"; then
    
    		PWLIBDIR="${PWLIB_DIR}"
    	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()
    
    		PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
    
    		AST_CHECK_PWLIB_BUILD([PWLib], [PWLIB],
    			[Define if your system has the PWLib libraries.],
    			[#include "ptlib.h"],
    
    			[int q = (int) PTime::IsDaylightSavings();])
    
    	fi
    fi
    
    if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
    
    	if test -n "${OPENH323_DIR}"; then
    
    		OPENH323DIR="${OPENH323_DIR}"
    	fi
    	AST_CHECK_OPENH323()
    
    	AST_CHECK_PWLIB_VERSION([OpenH323], [OPENH323], [openh323buildopts.h], [1], [17], [3], [], [1], [19], [0])
    
    	AST_CHECK_OPENH323_BUILD()
    	PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
    	AST_CHECK_PWLIB_BUILD([OpenH323], [OPENH323],
    		[Define if your system has the OpenH323 libraries.],
    		[#include "ptlib.h"
    		#include "h323.h"
    		#include "h323ep.h"],
    		[H323EndPoint ep = H323EndPoint();],
    		[${PWLIB_INCLUDE}], [${PWLIB_LIB}])
    fi
    
    
    AST_EXT_LIB_CHECK([LUA], [lua5.2], [luaL_newstate], [lua5.2/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.2"
    	else
    		LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.2"
    	fi
    fi
    
    
    AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm])
    
    	if test x"${LUA_DIR}" = x; then
    		LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.1"
    	else
    		LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.1"
    	fi
    
    # Some distributions (like SuSE) remove the 5.1 suffix.
    
    AST_EXT_LIB_CHECK([LUA], [lua], [luaL_openlib], [lua.h], [-lm])
    
    # Accept either RADIUS client library, their APIs are fully compatible,
    # just different header filenames and different SONAMEs
    AST_EXT_LIB_CHECK([RADIUS], [freeradius-client], [rc_read_config], [freeradius-client.h])
    if test "x${PBX_RADIUS}" = "x1"; then
    
    	AC_DEFINE(RADIUS_HEADER_STR, [<freeradius-client.h>], [Name of RADIUS library include header])
    
    else
    	AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
    
    	if test "x${PBX_RADIUS}" = "x1"; then
    		AC_DEFINE(RADIUS_HEADER_STR, [<radiusclient-ng.h>], [Name of RADIUS library include header])
    	else
    		AST_EXT_LIB_CHECK([RADIUS], [radcli], [rc_read_config], [radcli/radcli.h])
    		if test "x${PBX_RADIUS}" = "x1"; then
    			AC_DEFINE(RADIUS_HEADER_STR, [<radcli/radcli.h>], [Name of RADIUS library include header])
    		fi
    	fi
    
    AST_EXT_LIB_CHECK([CODEC2], [codec2], [codec2_create], [codec2/codec2.h])
    
    
    AST_EXT_LIB_CHECK([COROSYNC], [cpg], [cpg_join], [corosync/cpg.h], [-lcpg -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])
    
    
    # See if the main speex library contains the preprocess functions
    
    AST_EXT_LIB_CHECK([SPEEX_PREPROCESS], [speex], [speex_preprocess_ctl], [speex/speex.h], [-lm])
    
    if test "${PBX_SPEEX_PREPROCESS}" = 1; then
       PBX_SPEEX_PREPROCESS=1
    fi
    
    
    AST_EXT_LIB_CHECK([SPEEXDSP], [speexdsp], [speex_preprocess_ctl], [speex/speex.h], [-lm])
    
    if test "${PBX_SPEEXDSP}" = 1; then
       PBX_SPEEX_PREPROCESS=1
    fi
    
    AC_SUBST(PBX_SPEEX_PREPROCESS)
    
    AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
    
    
    AST_EXT_LIB_CHECK([SQLITE3], [sqlite3], [sqlite3_open], [sqlite3.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
    
    if test "${PBX_SQLITE3}" != 1; then
    
    	AC_MSG_ERROR(*** Asterisk now uses SQLite3 for the internal Asterisk database.)
    	AC_MSG_ERROR(*** Please install the SQLite3 development package.)
    
    # Find crypt support
    # * -lcrypt on *NIX
    # * in libsystem on OS X
    AST_EXT_LIB_CHECK([LIBCRYPT], [crypt], [crypt], [crypt.h])
    AC_CHECK_FUNC([crypt], [SYSCRYPT=true], [SYSCRYPT=""])
    
    if test "x$LIBCRYPT_LIB" != "x" ; then
        CRYPT_LIB="$LIBCRYPT_LIB"
        CRYPT_INCLUDE="$LIBCRYPT_INCLUDE"
    
        AC_DEFINE([HAVE_CRYPT], [1], [Define to 1 if you have the 'crypt' function.])
    
    elif test "x$SYSCRYPT" != "x" ; then
        CRYPT_LIB=""
        CRYPT_INCLUDE=""
    
        AC_DEFINE([HAVE_CRYPT], [1], [Define to 1 if you have the 'crypt' function.])
    
    fi
    
    AC_SUBST(CRYPT_LIB)
    AC_SUBST(CRYPT_INCLUDE)
    
    # Find crypt_r support
    AC_CHECK_LIB([crypt], [crypt_r],
    
        [AC_DEFINE([HAVE_CRYPT_R], [1], [Define to 1 if you have the 'crypt_r' function.])])
    
    AST_EXT_LIB_CHECK([CRYPTO], [crypto], [AES_encrypt], [openssl/aes.h])
    
    
    Kevin P. Fleming's avatar
    Kevin P. Fleming committed
    if test "$PBX_CRYPTO" = "1";
    
    	AST_EXT_LIB_CHECK([OPENSSL], [ssl], [SSL_connect], [openssl/ssl.h], [-lcrypto])
    
    Kevin P. Fleming's avatar
    Kevin P. Fleming committed
    if test "$PBX_OPENSSL" = "1";
    then
    
            AST_CHECK_OSPTK([4], [0], [0])
            AST_EXT_LIB_CHECK([OPENSSL_SRTP], [ssl], [SSL_CTX_set_tlsext_use_srtp], [openssl/ssl.h], [-lcrypto])
    
    if test "$PBX_OPENSSL" = "1";
    then
    	AST_EXT_LIB_CHECK([OPENSSL_EC], [ssl], [EC_KEY_new_by_curve_name], [openssl/ec.h], [-lcrypto])
    fi
    
    
    if test "$PBX_OPENSSL" = "1";
    then
            AST_C_DEFINE_CHECK([SSL_OP_NO_TLSV1_1], [SSL_OP_NO_TLSv1_1], [openssl/ssl.h])
            AST_C_DEFINE_CHECK([SSL_OP_NO_TLSV1_2], [SSL_OP_NO_TLSv1_2], [openssl/ssl.h])
    fi
    
    
    AST_EXT_LIB_CHECK([SRTP], [srtp2], [srtp_init], [srtp2/srtp.h], [], [], [2])
    AST_EXT_LIB_CHECK_SHARED([SRTP], [srtp2], [srtp_init], [srtp2/srtp.h], [], [], [], [
        AC_MSG_WARN([***])
        AC_MSG_WARN([*** libsrtp2 could not be linked as a shared object.])
        AC_MSG_WARN([*** Try compiling libsrtp2 manually. Configure libsrtp2])
        AC_MSG_WARN([*** with ./configure --prefix=/usr replacing /usr with])
        AC_MSG_WARN([*** the prefix of your choice, and then make with])
        AC_MSG_WARN([*** 'make libsrtp2.so'])
        AC_MSG_WARN([***])
        AC_MSG_WARN([*** After re-installing libsrtp2, re-run the Asterisk])
        AC_MSG_WARN([*** configure script.])
        AC_MSG_WARN([***])
        AC_MSG_WARN([*** If you do not need SRTP support re-run configure])
        AC_MSG_WARN([*** with the --without-srtp option.])
        exit 1
    ])
    
    if test "x$PBX_SRTP" = x1;
    
        AST_EXT_LIB_CHECK([SRTP_256], [srtp2], [srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80])
    
        AST_EXT_LIB_CHECK([SRTP_192], [srtp2], [srtp_crypto_policy_set_aes_cm_192_hmac_sha1_80])
    
        AST_EXT_LIB_CHECK([SRTP_GCM], [srtp2], [srtp_crypto_policy_set_aes_gcm_128_8_auth])
        AST_EXT_LIB_CHECK([SRTP_SHUTDOWN], [srtp2], [srtp_shutdown], [srtp2/srtp.h])
    
        # libsrtp2 removed support for PRNG, so we require OpenSSL
        if test "x$PBX_OPENSSL" != x1;
        then
            AC_MSG_WARN([***])
            AC_MSG_WARN([*** OpenSSL required when using libsrtp2, checking for libsrtp instead.])
            AC_MSG_WARN([***])
    	PBX_SRTP=0
        fi
    
    if test "x$PBX_SRTP" != x1;
    
        AST_EXT_LIB_CHECK([SRTP], [srtp], [srtp_init], [srtp/srtp.h], [], [], [1])
        AST_EXT_LIB_CHECK_SHARED([SRTP], [srtp], [srtp_init], [srtp/srtp.h], [], [], [], [
            AC_MSG_WARN([***])
            AC_MSG_WARN([*** libsrtp could not be linked as a shared object.])
            AC_MSG_WARN([*** Try compiling libsrtp manually. Configure libsrtp])
            AC_MSG_WARN([*** with ./configure CFLAGS=-fPIC --prefix=/usr])
            AC_MSG_WARN([*** replacing /usr with the prefix of your choice.])
            AC_MSG_WARN([*** After re-installing libsrtp, re-run the Asterisk])
            AC_MSG_WARN([*** configure script.])
            AC_MSG_WARN([***])
            AC_MSG_WARN([*** If you do not need SRTP support re-run configure])
            AC_MSG_WARN([*** with the --without-srtp option.])
            exit 1
        ])
    
        if test "x$PBX_SRTP" = x1;
        then
            AST_EXT_LIB_CHECK([SRTP_256], [srtp], [crypto_policy_set_aes_cm_256_hmac_sha1_80])
            AST_EXT_LIB_CHECK([SRTP_192], [srtp], [crypto_policy_set_aes_cm_192_hmac_sha1_80])
            AST_EXT_LIB_CHECK([SRTP_GCM], [srtp], [crypto_policy_set_aes_gcm_128_8_auth])
            AST_EXT_LIB_CHECK([SRTP_SHUTDOWN], [srtp], [srtp_shutdown], [srtp/srtp.h])
        fi
    
    Tzafrir Cohen's avatar
    Tzafrir Cohen committed
    for ver in 2.0 2.2 2.4 2.6 3.0; do
    
    	AST_PKG_CONFIG_CHECK([GMIME], gmime-$ver)
    	if test "$PBX_GMIME" = 1; then
    
    AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
    
    
    AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
    
    AC_CHECK_LIB([tonezone], [tone_zone_find_by_num], tonezone_does_not_need_lm=yes, tonezone_does_not_need_lm=no)
    
    if test "${tonezone_does_not_need_lm}" = "no" ; then
    
    AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
    
    if test "${OSARCH}" = "OpenBSD";
    then
    
    	AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -lvorbisfile -logg])
    
    	AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -lvorbisfile])
    
    AST_C_DECLARE_CHECK([VORBIS_OPEN_CALLBACKS], [OV_CALLBACKS_NOCLOSE], [vorbis/vorbisfile.h])
    
    AC_LANG_PUSH(C++)
    
    if test "${USE_VPB}" != "no"; then
       AC_MSG_CHECKING(for vpb_open in -lvpb)
       saved_libs="${LIBS}"
       saved_cppflags="${CPPFLAGS}"
       if test "x${VPB_DIR}" != "x"; then
          if test -d ${VPB_DIR}/lib; then
             vpblibdir=${VPB_DIR}/lib
          else
             vpblibdir=${VPB_DIR}
          fi
          LIBS="${LIBS} -L${vpblibdir}"
          CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
       fi
    
       CPPFLAGS="${CPPFLAGS} ${PTHREAD_CFLAGS}"
    
       AC_LINK_IFELSE(
    	[
    	AC_LANG_PROGRAM(
    	[#include <vpbapi.h>],
    	[int q = vpb_open(0,0);])
    	],
    
    	[	AC_MSG_RESULT(yes)
    		ac_cv_lib_vpb_vpb_open="yes"
    
    	[	AC_MSG_RESULT(no)
    		ac_cv_lib_vpb_vpb_open="no"
    
    	]
    	)
       LIBS="${saved_libs}"
       CPPFLAGS="${saved_cppflags}"
       if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
    	VPB_LIB="-lvpb"
    	if test "${VPB_DIR}" != ""; then
    	   VPB_LIB="-L${vpblibdir}  ${VPB_LIB}"
    	   VPB_INCLUDE="-I${VPB_DIR}/include"
    	fi
    	PBX_VPB=1
    	AC_DEFINE([HAVE_VPB], 1, [Define if your system has the VoiceTronix API libraries.])
       fi
    fi
    
    AC_LANG_POP
    
    
    AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
    
    if test "x${PBX_UNIXODBC}" = "x1" -o "x${PBX_IODBC}" = "x1"; then
    	# Does ODBC support wide characters?
    	AC_MSG_CHECKING(whether ODBC has support for Unicode types)
    	AC_LINK_IFELSE(
    
    			[#include <sql.h>
    #include <sqlext.h>],
    
    		AC_MSG_RESULT(yes)
    			AC_DEFINE([HAVE_ODBC_WCHAR], [1], [Define to 1 if your ODBC library has wide (Unicode) types.]),
    		AC_MSG_RESULT(no)
    	)
    fi
    
    
    AC_CHECK_HEADER([linux/compiler.h],
                    [AC_DEFINE_UNQUOTED([HAVE_LINUX_COMPILER_H], 1, [Define to 1 if your system has linux/compiler.h.])])
    
    
    AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
    				   #include <linux/version.h>
    
    				   #ifdef HAVE_LINUX_COMPILER_H
    
    # Used in res/res_pktccops
    AST_C_DEFINE_CHECK([MSG_NOSIGNAL], [MSG_NOSIGNAL], [sys/socket.h])
    AST_C_DEFINE_CHECK([SO_NOSIGPIPE], [SO_NOSIGPIPE], [sys/socket.h])
    
    
    AST_EXT_TOOL_CHECK([SDL], [sdl-config])
    
    AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL_image.h], [${SDL_LIB}], [${SDL_INCLUDE}])
    
    AST_EXT_LIB_CHECK([FFMPEG], [avcodec], [sws_getContext], [ffmpeg/avcodec.h], [${PTHREAD_LIBS} -lz -lm], [${PTHREAD_CFLAGS}])
    
    Luigi Rizzo's avatar
    Luigi Rizzo committed
    # possible places for video4linux version 1
    AC_CHECK_HEADER([linux/videodev.h],
    	[AC_DEFINE_UNQUOTED([HAVE_VIDEODEV_H], 1, [Define to 1 if your system has linux/videodev.h.])])
    
    
    # possible places for X11
    AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],,, [standard_path])
    AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],, [-I/usr/X11R6/include], [X11R6])
    
    
    if test "${cross_compiling}" = "no";
    then
    
    David M. Lee's avatar
    David M. Lee committed
      AC_CHECK_FILE(/sbin/launchd,
        [PBX_LAUNCHD=1]
        AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
    
    AST_PKG_CONFIG_CHECK([GTK2], [gtk+-2.0])
    
    # build a GENERIC_ODBC result based on the presence of either UnixODBC (preferred)
    # or iODBC
    
    PBX_GENERIC_ODBC=0
    
    if test "${PBX_UNIXODBC}" = 1; then
       PBX_GENERIC_ODBC=1
       GENERIC_ODBC_LIB="${UNIXODBC_LIB}"
       GENERIC_ODBC_INCLUDE="${UNIXODBC_INCLUDE}"
    elif test "${PBX_IODBC}" = 1; then
       PBX_GENERIC_ODBC=1
       GENERIC_ODBC_LIB="${IODBC_LIB}"
       GENERIC_ODBC_INCLUDE="${IODBC_INCLUDE}"
    fi
    
    AC_SUBST([GENERIC_ODBC_LIB])
    AC_SUBST([GENERIC_ODBC_INCLUDE])
    AC_SUBST([PBX_GENERIC_ODBC])
    
    
    AC_SUBST([PBX_SYSTEMD])
    AC_SUBST([SYSTEMD_LIB])
    AC_SUBST([SYSTEMD_INCLUDE])
    AST_PKG_CONFIG_CHECK([SYSTEMD], [libsystemd])
    
    
    if test "${ac_cv_header_syslog_h}" = "yes"; then
       # syslog facilities
       AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_AUTH],     [LOG_AUTH],     [syslog.h])
       AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_AUTHPRIV], [LOG_AUTHPRIV], [syslog.h])
       AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_CRON],     [LOG_CRON],     [syslog.h])
       AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_DAEMON],   [LOG_DAEMON],   [syslog.h])
       AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_FTP],      [LOG_FTP],      [syslog.h])
       AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_KERN],     [LOG_KERN],     [syslog.h])
       AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LPR],      [LOG_LPR],      [syslog.h])
       AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_MAIL],     [LOG_MAIL],     [syslog.h])
       AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_NEWS],     [LOG_NEWS],     [syslog.h])
       AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_SYSLOG],   [LOG_SYSLOG],   [syslog.h])
       AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_UUCP],     [LOG_UUCP],     [syslog.h])
    
    if test -f makeopts; then
    
    	${ac_cv_path_EGREP} 'CURSES|GTK2|OSARCH|NEWT' makeopts > makeopts.acbak
    
    	touch makeopts.acbak
    
    # conf_bridge (binaural rendering): check if HRIRs are available
    AC_CHECK_FILES([bridges/bridge_softmix/include/hrirs.h])
    
    
    AC_CONFIG_FILES([build_tools/menuselect-deps makeopts])
    
    if test -f build_tools/menuselect-deps; then
        # extract old values of all PBX_ variables from menuselect-deps
        # and preserve them so that menuselect can determine whether
        # any previously-met dependencies are no longer met and warn
        # the user appropriately
        while IFS="=:" read var val old_val; do
            eval "PBX_${var}=\${PBX_${var}}:${val}"
        done < build_tools/menuselect-deps
    fi
    
    
    ${ac_cv_path_EGREP} 'CURSES|GTK2|OSARCH|NEWT' makeopts > makeopts.acbak2
    
    if test "x${ac_cv_path_CMP}" = "x:"; then
    
    	( cd `pwd`/menuselect && ./configure )
    else if ${ac_cv_path_CMP} -s makeopts.acbak makeopts.acbak2; then : ; else
    	( cd `pwd`/menuselect && ./configure )
    
    rm makeopts.acbak makeopts.acbak2
    
    if test "x${silent}" != "xyes" ; then
    
    echo
    echo "               .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=..      "
    echo "            .\$7\$7..          .7\$\$7:.    "
    echo "          .\$\$:.                 ,\$7.7   "
    echo "        .\$7.     7\$\$\$\$           .\$\$77  "
    echo "     ..\$\$.       \$\$\$\$\$            .\$\$\$7 "
    echo "    ..7\$   .?.   \$\$\$\$\$   .?.       7\$\$\$."
    echo "   \$.\$.   .\$\$\$7. \$\$\$\$7 .7\$\$\$.      .\$\$\$."
    echo " .777.   .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7.      \$\$\$,"
    echo " \$\$\$~      .7\$\$\$\$\$\$\$\$\$\$\$\$\$7.       .\$\$\$."
    echo ".\$\$7          .7\$\$\$\$\$\$\$7:          ?\$\$\$."
    echo "\$\$\$          ?7\$\$\$\$\$\$\$\$\$\$I        .\$\$\$7 "
    echo "\$\$\$       .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$      :\$\$\$. "
    echo "\$\$\$       \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$    .\$\$\$.  "
    echo "\$\$\$        \$\$\$   7\$\$\$7  .\$\$\$    .\$\$\$.   "
    echo "\$\$\$\$             \$\$\$\$7         .\$\$\$.    "
    echo "7\$\$\$7            7\$\$\$\$        7\$\$\$      "
    echo " \$\$\$\$\$                        \$\$\$       "
    echo "  \$\$\$\$7.                       \$\$  (TM)     "
    echo "   \$\$\$\$\$\$\$.           .7\$\$\$\$\$\$  \$\$      "
    echo "     \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$      "
    echo "       \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$.                "
    echo
    
    if test "x${AST_IODBC_FOUND}" = "xyes"; then
    	echo "WARNING: iodbc libs/headers found!"
    	echo
    	echo "  If you plan to use ODBC functionality, you should consider"
    	echo "  switching to unixodbc instead."
    	echo "  See: https://issues.asterisk.org/jira/browse/ASTERISK-22459"
    	echo
    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 :)
    
    if test "${cross_compiling}" = "yes"; then
    
       AC_MSG_NOTICE( Cross Compilation = YES)