Skip to content
Snippets Groups Projects
configure.ac 44.5 KiB
Newer Older
  • Learn to ignore specific revisions
  • 						}
    						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);
    						]
    					),
    					[ac_cv_imap_tk2006="yes"],
    					[ac_cv_imap_tk2006="no"]
    				)
    			fi
    		fi
    
    	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([JACK], [jack], [jack_activate], [jack/jack.h])
    
    
    # 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.])])
    
    AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
    
    AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
    
    AST_EXT_TOOL_CHECK([NETSNMP], [net-snmp], , [--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])
    
    
    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])
    
    # 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 "${USE_PGSQL}" != "no"; then	
       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
       else 
    
          AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
    
          [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
    
    
          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
    
    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_new_bri], [libpri.h])
    
    AST_EXT_LIB_CHECK([SS7], [ss7], [isup_cqr], [libss7.h])
    
    	if test -n "${PWLIB_DIR}"; then
    
    		PWLIBDIR="${PWLIB_DIR}"
    	fi
    	AST_CHECK_PWLIB()
    	AST_CHECK_PWLIB_VERSION([PWLib], [PWLIB], [ptbuildopts.h], [1], [9], [2])
    		
    	if test "${HAS_PWLIB:-unset}" != "unset"; then
    		AST_CHECK_OPENH323_PLATFORM()
    
    		PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
    
    		AST_CHECK_PWLIB_BUILD([PWLib], [PWLIB],
    			[Define if your system has the PWLib libraries.],
    			[#include "ptlib.h"],
    			[BOOL q = 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])
    	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
    
    
    LUA_INCLUDE="-I/usr/include/lua5.1"
    LUA_LIB="-llua5.1"
    AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h]) 
    
    
    AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
    
    AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
    
    
    AST_EXT_LIB_CHECK([SPEEXDSP], [speexdsp], [speex_preprocess_ctl], [speex/speex.h], [-lm])
    
    
    AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
    
    
    AST_EXT_LIB_CHECK([SQLITE3], [sqlite3], [sqlite3_open], [sqlite3.h])
    
    
    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";
    
    then
        AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl2_connect], [openssl/ssl.h], [-lcrypto])
    fi
    
    Kevin P. Fleming's avatar
    Kevin P. Fleming committed
    if test "$PBX_OPENSSL" = "1";
    then
        AST_EXT_LIB_CHECK([OSPTK], [osptk], [OSPPCryptoDecrypt], [osp/osp.h], [-lcrypto -lssl])
    fi
    
    
    AST_EXT_LIB_CHECK([FREETDS], [tds], [tds_version], [tds.h])
    if test "${PBX_FREETDS}" != "0";
    
        case `grep TDS_VERSION_NO ${FREETDS_DIR:-/usr}/include/tdsver.h` in
    
    	*0.64*)
    		FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_64"
    	;;
    
        *0.63*)
            FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_63"
    	;;
        *0.62*)
            FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_62"
    	;;
        *)
            FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_PRE_0_62"
    	;;
        esac
    fi
    
    
    AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
    
    AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
    
    
    if test "${host_os}" != "linux-gnu" ; then
    
    AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/tonezone.h], [${tonezone_extra}], [], [140])
    
    # other case, old tonezone (0.80)
    
    AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/zaptel.h], [${tonezone_extra}], [], [80])
    
    AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
    
    
    AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
    
    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
       LIBS="${LIBS} -lvpb -lpthread"
       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])
    
    # Check for various zaptel features and locations.
    # The version number, which goes into HAVE_ZAPTEL_VERSION,
    # will be used in the system headers to determine the location
    # of the zaptel.h header.
    
    AST_C_DEFINE_CHECK([ZAPTEL], [ZT_TONE_DTMF_BASE], [zaptel/zaptel.h], [140])
    AST_C_DEFINE_CHECK([ZAPTEL], [ZT_DIAL_OP_CANCEL], [zaptel/zaptel.h], [90])
    
    # Check for VLDTMF support
    
    AST_C_DEFINE_CHECK([ZAPTEL_VLDTMF], [ZT_EVENT_REMOVED], [zaptel/zaptel.h])
    
    # Check for echo canceler parameters support
    AST_C_DEFINE_CHECK([ZAPTEL_ECHOCANPARAMS], [ZT_ECHOCANCEL_PARAMS], [zaptel/zaptel.h])
    
    # Check for transcoder support
    
    AST_C_DEFINE_CHECK([ZAPTEL_TRANSCODE], [ZT_TCOP_ALLOCATE], [zaptel/zaptel.h])
    
    Kevin P. Fleming's avatar
    Kevin P. Fleming committed
    # Check for hwgain support
    
    AST_C_DEFINE_CHECK([ZAPTEL_HWGAIN], [ZT_SET_HWGAIN], [zaptel/zaptel.h])
    
    
    Kevin P. Fleming's avatar
    Kevin P. Fleming committed
    # Check for channel alarm support
    AST_C_COMPILE_CHECK([ZAPTEL_CHANALARMS], [size_t foo = sizeof(struct zt_params_v1)], [zaptel/zaptel.h])
    
    
    # On FreeBSD, try old zaptel (0.80 or so) and pretend we have vldtmf
    case "${host_os}" in
        freebsd*)
    
    	AST_EXT_LIB_CHECK([ZAPTEL], [zaptel],, [zaptel.h],,, [80])
    	AST_EXT_LIB_CHECK([ZAPTEL_VLDTMF], [zaptel],, [zaptel/zaptel.h],,, [90])
    	AST_EXT_LIB_CHECK([ZAPTEL_VLDTMF], [zaptel],, [zaptel.h],,, [80])
    
    
    	# other case, old tonezone (0.80)
    
    	AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel.h], [${tonezone_extra}],, [80])
    
      EDITLINE_LIB="$TERMCAP_LIB"
    
      EDITLINE_LIB="$TINFO_LIB"
    
      EDITLINE_LIB="$CURSES_LIB"
    
      EDITLINE_LIB="$NCURSES_LIB"
    
      AC_MSG_ERROR(*** termcap support not found)
    
    AC_SUBST(EDITLINE_LIB)
    
    
    AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
    AC_SUBST(PBX_H323)
    
    
    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
    
    AST_EXT_TOOL_CHECK([SDL], [sdl])
    
    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], [-lpthread -lz -lm])
    
    
    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])
    
    
    AC_CHECK_FILE(/sbin/launchd, AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
    
    
    AST_EXT_TOOL_CHECK([GTK], [gtk], [--cflags gthread], [--libs gthread])
    
    PBX_GTK2=0
    AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
    if test ! "x${PKGCONFIG}" = xNo; 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)
    
    
    if test "${USE_CURL}" != "no"; then
    
       AC_PATH_TOOL([CURL_CONFIG], [curl-config], No)
       if test ! x"${CURL_CONFIG}" = xNo; then
    
          if test $(printf "%d" 0x$(${CURL_CONFIG} --vernum)) -ge $(printf "%d" 0x070907); then
             CURL_INCLUDE=$(${CURL_CONFIG} --cflags)
             CURL_LIB=$(${CURL_CONFIG} --libs)
    
    
             AC_MSG_CHECKING(for curl_version() in curl/curl.h)
             saved_cppflags="${CPPFLAGS}"
             CPPFLAGS="${CPPFLAGS} ${CURL_INCLUDE}"
             AC_COMPILE_IFELSE(
                [AC_LANG_PROGRAM(
                    [#include <curl/curl.h>],
                        [curl_version();])
                ],[
                    AC_MSG_RESULT(yes)
                    ac_cv_curl_h="yes"
                ],[
                    AC_MSG_RESULT(no)
                    ac_cv_curl_h="no"
                ]
    	 )
    	 CPPFLAGS="${saved_cppflags}"
             if test "${ac_cv_curl_h}" = "yes"; then
                 PBX_CURL=1
                 AC_DEFINE([HAVE_CURL], 1, [Define if your system has the curl libraries.])
             fi
    
    AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
    
    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
    
    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)