2008-02-17 16:52:17 -05:00
|
|
|
# -*- Autoconf -*-
|
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
AC_PREREQ([2.59])
|
|
|
|
AC_INIT([freetdm], [pre-alpha], [bugs@freeswitch.org])
|
2010-01-15 14:22:49 -05:00
|
|
|
AC_CONFIG_SRCDIR([src/ftdm_io.c])
|
2008-02-17 16:52:17 -05:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
AC_CONFIG_AUX_DIR([build])
|
|
|
|
AC_CONFIG_MACRO_DIR([build])
|
|
|
|
AM_INIT_AUTOMAKE([libfreetdm], [0.1])
|
|
|
|
|
|
|
|
# >=automake-1.11
|
|
|
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|
|
|
|
|
|
|
# override some default libtool behavior and invoke AC_PROG_LIBTOOL
|
|
|
|
# (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html)
|
|
|
|
m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
|
|
|
|
m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
|
|
|
|
m4_defun([_LT_AC_LANG_RC_CONFIG], [:])
|
2008-09-06 01:46:14 -04:00
|
|
|
|
2008-02-17 16:52:17 -05:00
|
|
|
# Checks for programs.
|
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_MAKE_SET
|
2009-02-05 13:21:51 -05:00
|
|
|
AM_PROG_CC_C_O
|
2010-10-31 21:13:27 -04:00
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
AC_PROG_INSTALL
|
2010-10-31 19:47:43 -04:00
|
|
|
PKG_PROG_PKG_CONFIG
|
2008-08-29 11:58:59 -04:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
AX_COMPILER_VENDOR
|
|
|
|
|
|
|
|
# AC_PREFIX_DEFAULT does not get expanded until too late so we need
|
|
|
|
# to do this to use prefix in this script
|
|
|
|
AC_PREFIX_DEFAULT([/usr/local/freetdm])
|
|
|
|
if test "x${prefix}" = "xNONE" ; then
|
|
|
|
prefix='/usr/local/freetdm'
|
2009-02-05 13:21:51 -05:00
|
|
|
fi
|
2008-09-06 20:08:01 -04:00
|
|
|
|
|
|
|
# Absolute source/build directory
|
2010-01-15 14:22:49 -05:00
|
|
|
FT_SRCDIR=`(cd $srcdir && pwd)`
|
|
|
|
ft_builddir=`pwd`
|
2010-10-31 21:13:27 -04:00
|
|
|
AC_SUBST([FT_SRCDIR])
|
|
|
|
AC_SUBST([ft_builddir])
|
2008-09-06 20:08:01 -04:00
|
|
|
|
2009-06-09 11:23:51 -04:00
|
|
|
if test "$sysconfdir" = "\${prefix}/etc" ; then
|
2010-10-31 21:13:27 -04:00
|
|
|
confdir="$prefix/conf"
|
2009-06-09 11:23:51 -04:00
|
|
|
else
|
2010-10-31 21:13:27 -04:00
|
|
|
confdir="$sysconfdir"
|
2009-06-09 11:23:51 -04:00
|
|
|
fi
|
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
AC_SUBST([confdir])
|
2008-09-06 01:46:14 -04:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
# Where to install the modules
|
|
|
|
AC_ARG_WITH([modinstdir],
|
|
|
|
[AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: ${prefix}/mod)])],
|
|
|
|
[case "${withval}" in
|
|
|
|
no|yes) AC_MSG_ERROR([Invalid value \"${withval}\", option requires a valid path]) ;;
|
|
|
|
*) modinstdir="${withval}" ;;
|
|
|
|
esac],
|
|
|
|
[modinstdir="${prefix}/mod"]
|
|
|
|
)
|
|
|
|
AC_SUBST([modinstdir])
|
2008-02-17 16:52:17 -05:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
AC_ARG_ENABLE([enable_64],
|
|
|
|
[AS_HELP_STRING([--enable-64], [Enable 64bit compilation])],
|
|
|
|
[enable_64="${enableval}"],
|
|
|
|
[enable_64="no"]
|
|
|
|
)
|
2008-02-17 16:52:17 -05:00
|
|
|
|
|
|
|
case "${ax_cv_c_compiler_vendor}" in
|
|
|
|
gnu)
|
2010-10-31 21:13:27 -04:00
|
|
|
COMP_VENDOR_CFLAGS="-ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0"
|
|
|
|
;;
|
2008-02-17 16:52:17 -05:00
|
|
|
sun)
|
2010-10-31 21:13:27 -04:00
|
|
|
COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -D__FUNCTION__=__func__ -xvpara"
|
|
|
|
if test "$enable_64" != "no" ; then
|
|
|
|
COMP_VENDOR_CFLAGS="-m64 $COMP_VENDOR_CFLAGS"
|
|
|
|
fi
|
|
|
|
;;
|
2008-02-17 16:52:17 -05:00
|
|
|
*)
|
2010-10-31 21:13:27 -04:00
|
|
|
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
|
|
|
|
;;
|
2008-02-17 16:52:17 -05:00
|
|
|
esac
|
2010-10-31 21:13:27 -04:00
|
|
|
AC_SUBST([COMP_VENDOR_CFLAGS])
|
2008-02-28 19:21:04 -05:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
# Enable debugging
|
|
|
|
AC_ARG_ENABLE([debug],
|
|
|
|
[AC_HELP_STRING([--enable-debug], [build with debug information])],
|
|
|
|
[enable_debug="${enableval}"],
|
|
|
|
[enable_debug="yes"]
|
|
|
|
)
|
|
|
|
if test "${enable_debug}" != "no"; then
|
|
|
|
AC_DEFINE([DEBUG], [], [Enable extra debugging.])
|
2008-09-06 01:46:14 -04:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
|
|
|
|
COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS -g -ggdb"
|
|
|
|
fi
|
2008-09-06 01:46:14 -04:00
|
|
|
fi
|
2010-10-31 21:13:27 -04:00
|
|
|
AC_SUBST([COMP_VENDOR_CFLAGS])
|
2008-09-06 01:46:14 -04:00
|
|
|
|
|
|
|
# set DYNAMIC_LIB_EXTEN
|
|
|
|
# we should really be using libtool so we don't need to do this
|
|
|
|
case "$host" in
|
2010-10-31 21:13:27 -04:00
|
|
|
*cygwin* | *mingw*)
|
|
|
|
DYNAMIC_LIB_EXTEN="dll"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
DYNAMIC_LIB_EXTEN="so"
|
|
|
|
;;
|
2008-09-06 01:46:14 -04:00
|
|
|
esac
|
2010-10-31 21:13:27 -04:00
|
|
|
AC_SUBST([DYNAMIC_LIB_EXTEN])
|
2008-09-06 01:46:14 -04:00
|
|
|
|
2008-09-05 16:27:55 -04:00
|
|
|
AC_CHECK_LIB([dl], [dlopen])
|
|
|
|
AC_CHECK_LIB([pthread], [pthread_create])
|
|
|
|
AC_CHECK_LIB([m], [cos])
|
|
|
|
|
2008-07-07 22:22:48 -04:00
|
|
|
AC_CHECK_HEADERS([netinet/sctp.h netdb.h sys/select.h])
|
2009-11-10 18:28:49 -05:00
|
|
|
AM_CONDITIONAL([HAVE_SCTP],[test "${ac_cv_header_netinet_sctp_h}" = "yes"])
|
|
|
|
|
2008-05-26 19:53:19 -04:00
|
|
|
AC_CHECK_FUNC([gethostbyname_r],
|
|
|
|
[], [AC_CHECK_LIB([nsl], [gethostbyname_r])]
|
|
|
|
)
|
2010-10-31 21:13:27 -04:00
|
|
|
if test "$ac_cv_func_gethostbyname_r" = "yes" -o "$ac_cv_lib_nsl_gethostbyname_r" = "yes"
|
|
|
|
then
|
|
|
|
AC_MSG_CHECKING([whether gethostbyname_r requires five arguments])
|
|
|
|
|
|
|
|
ac_cv_func_gethostbyname_r_five_args="no"
|
|
|
|
|
|
|
|
AC_TRY_COMPILE([#include <netdb.h>],
|
|
|
|
[char *name;
|
|
|
|
struct hostent *he, *res;
|
|
|
|
char buffer[2048];
|
|
|
|
int buflen = 2048;
|
|
|
|
(void)gethostbyname_r(name, he, buffer, buflen, &res)],
|
|
|
|
[ac_cv_func_gethostbyname_r_five_args="yes"
|
|
|
|
AC_DEFINE([HAVE_GETHOSTBYNAME_R_FIVE], [1], [gethostbyname_r has five arguments])]
|
|
|
|
)
|
2008-02-28 10:58:22 -05:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
AC_MSG_RESULT([$ac_cv_func_gethostbyname_r_five_args])
|
|
|
|
AC_DEFINE([HAVE_GETHOSTBYNAME_R], [1], [threadsafe gethostbyname])
|
2008-02-28 10:58:22 -05:00
|
|
|
fi
|
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
##
|
|
|
|
## Modules and optional features
|
|
|
|
##
|
|
|
|
AC_MSG_RESULT([${as_nl}<<>> Modules and optional features])
|
2009-02-05 15:44:13 -05:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
##
|
|
|
|
# libpri (TODO: add checks)
|
|
|
|
#
|
|
|
|
HAVE_LIBPRI="no"
|
2009-02-05 15:44:13 -05:00
|
|
|
AC_ARG_WITH([libpri],
|
2010-10-31 21:13:27 -04:00
|
|
|
[AS_HELP_STRING([--with-libpri], [Install ftmod_libpri])],
|
|
|
|
[case "${withval}" in
|
|
|
|
no) enable_libpri="no" ;;
|
|
|
|
*) enable_libpri="yes" ;;
|
|
|
|
esac],
|
|
|
|
[enable_libpri="no"]
|
|
|
|
)
|
|
|
|
HAVE_LIBPRI="${enable_libpri}"
|
|
|
|
AM_CONDITIONAL([HAVE_LIBPRI],[test "${enable_libpri}" = "yes"])
|
2009-02-05 15:44:13 -05:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
##
|
|
|
|
# pritap (TODO: add checks)
|
|
|
|
#
|
|
|
|
HAVE_PRITAP="no"
|
2010-07-30 19:46:05 -04:00
|
|
|
AC_ARG_WITH([pritap],
|
2010-10-31 21:13:27 -04:00
|
|
|
[AS_HELP_STRING([--with-pritap], [Install ftmod_pritap])],
|
|
|
|
[case "${withval}" in
|
|
|
|
no) enable_pritap="no" ;;
|
|
|
|
*) enable_pritab="yes" ;;
|
|
|
|
esac],
|
|
|
|
[enable_pritap="no"]
|
|
|
|
)
|
|
|
|
HAVE_PRITAP="${enable_pritap}"
|
|
|
|
AM_CONDITIONAL([HAVE_PRITAP],[test "${enable_pritap}" = "yes"])
|
2010-07-30 19:46:05 -04:00
|
|
|
|
2010-07-29 17:26:03 -04:00
|
|
|
# debug dtmf?
|
|
|
|
AC_ARG_WITH([debugdtmf],
|
2010-10-31 21:13:27 -04:00
|
|
|
[AS_HELP_STRING([--with-debugdtmf], [Debug DTMF])],
|
|
|
|
[case "${withval}" in
|
|
|
|
no) enable_debugdtmf="no" ;;
|
|
|
|
*) enable_debugdtmf="yes" ;;
|
|
|
|
esac],
|
|
|
|
[enable_debugdtmf="no"]
|
|
|
|
)
|
|
|
|
AM_CONDITIONAL([WANT_DEBUGDTMF], [test "${enable_debugdtmf}" = "yes"])
|
2010-07-29 17:26:03 -04:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
##
|
|
|
|
# OpenR2 stack
|
|
|
|
#
|
|
|
|
HAVE_OPENR2="no"
|
|
|
|
AC_CHECK_LIB([openr2], [openr2_context_set_io_type], [HAVE_OPENR2="yes"])
|
|
|
|
AC_MSG_RESULT([checking whether to build ftmod_r2... ${HAVE_OPENR2}])
|
|
|
|
AM_CONDITIONAL([HAVE_OPENR2], [test "${HAVE_OPENR2}" = "yes"])
|
2010-06-05 18:23:39 -04:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
##
|
|
|
|
# Sangoma Wanpipe
|
|
|
|
#
|
|
|
|
HAVE_LIBSANGOMA="no"
|
|
|
|
AC_MSG_RESULT([${as_nl}<<>> Sangoma Wanpipe])
|
|
|
|
AC_CHECK_LIB([sangoma], [sangoma_span_chan_toif], [HAVE_LIBSANGOMA="yes"])
|
|
|
|
AC_MSG_RESULT([checking whether to build ftmod_wanpipe... ${HAVE_LIBSANGOMA}])
|
|
|
|
AM_CONDITIONAL([HAVE_LIBSANGOMA], [test "${HAVE_LIBSANGOMA}" = "yes"])
|
2010-06-30 12:42:11 -04:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
##
|
|
|
|
# Sangoma ISDN stack
|
|
|
|
#
|
|
|
|
HAVE_SNG_ISDN="no"
|
|
|
|
AC_MSG_RESULT([${as_nl}<<>> Sangoma ISDN stack])
|
|
|
|
AC_CHECK_LIB([sng_isdn], [sng_isdn_init], [HAVE_SNG_ISDN="yes"])
|
|
|
|
AC_MSG_RESULT([checking whether to build ftmod_sangoma_isdn... ${HAVE_SNG_ISDN}])
|
|
|
|
AM_CONDITIONAL([HAVE_SNG_ISDN], [test "${HAVE_SNG_ISDN}" = "yes"])
|
2009-08-19 17:47:56 -04:00
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
if test "${HAVE_SNG_ISDN}" = "yes"; then
|
2010-08-31 13:29:31 -04:00
|
|
|
if test "${build}" == "${host}"
|
|
|
|
then
|
|
|
|
case "${host}" in
|
|
|
|
x86_64-*)
|
2010-10-31 21:13:27 -04:00
|
|
|
# X86_64 machines need additional flags when compiling against libsng_isdn
|
|
|
|
CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT"
|
|
|
|
;;
|
2010-08-31 13:29:31 -04:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-10-31 21:13:27 -04:00
|
|
|
##
|
|
|
|
# Sangoma SS7 stack
|
|
|
|
#
|
|
|
|
HAVE_SNG_SS7="no"
|
|
|
|
AC_MSG_RESULT([${as_nl}<<>> Sangoma SS7 stack])
|
|
|
|
AC_CHECK_LIB([sng_ss7], [sng_isup_init], [HAVE_SNG_SS7="yes"])
|
|
|
|
AC_MSG_RESULT([checking whether to build ftmod_sangoma_ss7... ${HAVE_SNG_SS7}])
|
|
|
|
AM_CONDITIONAL([HAVE_SNG_SS7], [test "${HAVE_SNG_SS7}" = "yes"])
|
|
|
|
|
|
|
|
if test "${HAVE_SNG_SS7}" = "yes"; then
|
2010-10-19 10:18:27 -04:00
|
|
|
if test "${build}" == "${host}"
|
|
|
|
then
|
|
|
|
case "${host}" in
|
|
|
|
x86_64-*)
|
2010-10-31 21:13:27 -04:00
|
|
|
# X86_64 machines need additional flags when compiling against libsng_isdn
|
|
|
|
CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT"
|
|
|
|
;;
|
2010-10-19 10:18:27 -04:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-10-31 19:47:43 -04:00
|
|
|
##
|
|
|
|
# libisdn
|
|
|
|
#
|
|
|
|
HAVE_LIBISDN="no"
|
|
|
|
AC_ARG_WITH([libisdn],
|
|
|
|
[AS_HELP_STRING([--with-libisdn], [Install ftmod_isdn (libisdn stack)])],
|
|
|
|
[case "${withval}" in
|
|
|
|
no) with_libisdn="no" ;;
|
|
|
|
*) with_libisdn="yes" ;;
|
|
|
|
esac
|
|
|
|
],
|
|
|
|
[with_libisdn="no"]
|
|
|
|
)
|
|
|
|
if test "${with_libisdn}" != "no"
|
|
|
|
then
|
|
|
|
AC_MSG_RESULT([${as_nl}<<>> ftmod_isdn (libisdn stack)])
|
|
|
|
PKG_CHECK_MODULES([libisdn],
|
|
|
|
[libisdn >= 0.0.1],
|
|
|
|
[AC_MSG_CHECKING([libisdn version])
|
|
|
|
LIBISDN_VERSION="`${PKG_CONFIG} --modversion libisdn`"
|
|
|
|
if test -z "${LIBISDN_VERSION}"; then
|
|
|
|
AC_MSG_ERROR([Failed to retrieve libisdn version])
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT([${LIBISDN_VERSION}])
|
|
|
|
|
|
|
|
# check features
|
|
|
|
AC_MSG_CHECKING([for new experimental API])
|
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM(
|
|
|
|
[#include <libisdn/version.h>
|
|
|
|
#if !LIBISDN_FEATURE(API2)
|
|
|
|
#error "libisdn API v2 not available"
|
|
|
|
#endif
|
|
|
|
],
|
|
|
|
[;]
|
|
|
|
)],
|
|
|
|
[AC_MSG_RESULT([yes])],
|
|
|
|
[AC_MSG_RESULT([no])]
|
|
|
|
)
|
|
|
|
|
|
|
|
HAVE_LIBISDN="yes"
|
|
|
|
AC_DEFINE([HAVE_LIBISDN], [1], [libisdn support])
|
|
|
|
AC_SUBST([LIBISDN_CFLAGS], [${libisdn_CFLAGS}])
|
|
|
|
AC_SUBST([LIBISDN_CPPFLAGS],[${libisdn_CPPFLAGS}])
|
|
|
|
AC_SUBST([LIBISDN_LDFLAGS], [${libisdn_LDFLAGS}])
|
|
|
|
AC_SUBST([LIBISDN_LIBS], [${libisdn_LIBS}])
|
|
|
|
AC_SUBST([LIBISDN_VERSION])
|
|
|
|
],
|
|
|
|
[AC_MSG_ERROR([Need libisdn-0.0.1 or higher])]
|
|
|
|
)
|
2010-10-31 21:13:27 -04:00
|
|
|
AX_LIB_PCAP
|
2010-10-31 19:47:43 -04:00
|
|
|
fi
|
|
|
|
AM_CONDITIONAL([HAVE_LIBISDN], [test "${HAVE_LIBISDN}" = "yes"])
|
|
|
|
|
|
|
|
AC_MSG_RESULT([${as_nl}<<>> Creating output files])
|
2010-10-31 21:13:27 -04:00
|
|
|
AC_CONFIG_FILES([
|
|
|
|
Makefile
|
|
|
|
freetdm.pc
|
|
|
|
mod_freetdm/Makefile
|
|
|
|
])
|
2008-02-17 16:52:17 -05:00
|
|
|
AC_OUTPUT
|
2010-10-31 21:13:27 -04:00
|
|
|
|
|
|
|
#
|
|
|
|
# summary screen
|
|
|
|
#
|
|
|
|
AC_MSG_RESULT([
|
|
|
|
============================ FreeTDM configuration ============================
|
|
|
|
|
|
|
|
+ Modules
|
|
|
|
|
|
|
|
Signalling:
|
|
|
|
ftmod_isdn......................... ${HAVE_LIBISDN}
|
|
|
|
ftmod_libpri....................... ${HAVE_LIBPRI}
|
|
|
|
ftmod_sangoma_isdn................. ${HAVE_SNG_ISDN}
|
|
|
|
ftmod_sangoma_ss7.................. ${HAVE_SNG_SS7}
|
|
|
|
ftmod_r2........................... ${HAVE_OPENR2}
|
|
|
|
ftmod_pritap....................... ${HAVE_PRITAP}
|
|
|
|
I/O:
|
|
|
|
ftmod_wanpipe...................... ${HAVE_LIBSANGOMA}
|
|
|
|
|
|
|
|
===============================================================================
|
|
|
|
])
|