2008-02-17 16:52:17 -05:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
2008-02-18 11:12:26 -05:00
AC_PREREQ(2.59)
2010-01-15 14:22:49 -05:00
AC_INIT([freetdm],[pre-alpha],[bugs@freeswitch.org])
AC_CONFIG_SRCDIR([src/ftdm_io.c])
2008-02-17 16:52:17 -05:00
2008-09-06 01:46:14 -04:00
AC_CONFIG_AUX_DIR(build)
2010-01-15 14:22:49 -05:00
AM_INIT_AUTOMAKE(libfreetdm,0.1)
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
2008-08-29 11:58:59 -04:00
2010-01-15 14:22:49 -05:00
AC_PREFIX_DEFAULT(/usr/local/freetdm)
2009-02-05 13:21:51 -05:00
# AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script
if test "x$prefix" = "xNONE" ; then
2010-01-15 14:22:49 -05:00
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`
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
confdir="$prefix/conf"
else
confdir="$sysconfdir"
fi
AC_SUBST(confdir)
2008-09-06 01:46:14 -04:00
#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], [:])
#AM_PROG_CC_C_O
AC_PROG_LIBTOOL
AC_PROG_INSTALL
2008-02-17 16:52:17 -05:00
# Check for com;iler type
AC_DEFUN([AX_COMPILER_VENDOR],
[
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
# note: don't check for GCC first, since some other compilers define __GNUC__
for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
#if !($vencpp)
thisisanerror;
#endif
])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
done
])
])
2008-05-26 19:53:19 -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
AX_COMPILER_VENDOR
case "${ax_cv_c_compiler_vendor}" in
gnu)
2009-01-29 13:56:16 -05: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)
COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -D__FUNCTION__=__func__ -xvpara"
if test "$enable_64" = "yes" ; then
COMP_VENDOR_CFLAGS="-m64 $COMP_VENDOR_CFLAGS"
fi
;;
*)
2008-02-18 12:17:38 -05:00
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
2008-02-17 16:52:17 -05:00
;;
esac
2008-02-28 19:21:04 -05:00
2008-09-06 01:46:14 -04:00
#set SOLINK variable based on compiler and host
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
SOLINK="-Bdynamic -dy -G"
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
case "$host" in
*darwin*)
SOLINK="-dynamic -bundle -force-flat-namespace"
;;
*-solaris2*)
SOLINK="-shared -Xlinker"
;;
*)
SOLINK="-shared -Xlinker -x"
;;
esac
else
AC_ERROR([Please update configure.in with SOLINK values for your compiler])
fi
# set DYNAMIC_LIB_EXTEN
# we should really be using libtool so we don't need to do this
case "$host" in
*cygwin* | *mingw*)
DYNAMIC_LIB_EXTEN="dll"
;;
*)
DYNAMIC_LIB_EXTEN="so"
;;
esac
AC_SUBST(SOLINK)
AC_SUBST(DYNAMIC_LIB_EXTEN)
2008-09-05 16:27:55 -04:00
AC_CHECK_LIB([dl], [dlopen])
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([m], [cos])
2009-02-03 11:41:48 -05:00
AX_LIB_PCAP
2008-09-05 16:27:55 -04:00
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])]
)
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])]
)
AC_MSG_RESULT([$ac_cv_func_gethostbyname_r_five_args])
AC_DEFINE([HAVE_GETHOSTBYNAME_R],[1],[threadsafe gethostbyname])
fi
2008-02-28 19:21:04 -05:00
2008-02-28 10:58:22 -05:00
# Enable debugging
AC_ARG_ENABLE(debug,
2008-05-26 19:53:19 -04:00
[AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enableval"],[enable_debug="yes"])
2008-02-28 10:58:22 -05:00
if test "${enable_debug}" = "yes"; then
AC_DEFINE([DEBUG],[],[Enable extra debugging.])
if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS -g -ggdb"
fi
fi
2009-02-05 13:21:51 -05:00
# Where to install the modules
AC_ARG_WITH([modinstdir],
[AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modinstdir="$withval"], [modinstdir="${prefix}/mod"])
2008-02-28 10:58:22 -05:00
2009-02-05 13:21:51 -05:00
AC_SUBST(modinstdir)
2008-02-17 16:52:17 -05:00
2009-02-05 15:44:13 -05:00
# libpri?
AC_ARG_WITH([libpri],
2010-01-15 14:22:49 -05:00
[AS_HELP_STRING([--with-libpri], [Install ftmod_libpri])], [enable_libpri="yes"], [enable_libpri="no"])
2009-02-05 15:44:13 -05:00
AC_SUBST(enable_libpri)
2010-07-30 19:46:05 -04:00
# pritap?
AC_ARG_WITH([pritap],
[AS_HELP_STRING([--with-pritap], [Install ftmod_pritap])], [enable_pritap="yes"], [enable_pritap="no"])
AC_SUBST(enable_pritap)
2010-07-29 17:26:03 -04:00
# debug dtmf?
AC_ARG_WITH([debugdtmf],
[AS_HELP_STRING([--with-debugdtmf], [Debug DTMF])], [enable_debugdtmf="yes"], [enable_debugdtmf="no"])
AC_SUBST(enable_debugdtmf)
2009-04-22 17:22:42 -04:00
AC_CHECK_LIB([sangoma], [sangoma_span_chan_toif], [have_libsangoma="yes"])
AM_CONDITIONAL([LIBSANGOMA],[test "${have_libsangoma}" = "yes"])
2009-02-05 15:44:13 -05:00
AM_CONDITIONAL([LIBPRI],[test "${enable_libpri}" = "yes"])
2010-07-30 19:46:05 -04:00
AM_CONDITIONAL([PRITAP],[test "${enable_pritap}" = "yes"])
2010-07-29 17:26:03 -04:00
AM_CONDITIONAL([DEBUGDTMF],[test "${enable_debugdtmf}" = "yes"])
2010-06-05 18:23:39 -04:00
AC_CHECK_LIB([sng_ss7], [sng_isup_init], [have_sng_ss7="yes"])
AM_CONDITIONAL([SNGSS7],[test "${have_sng_ss7}" = "yes"])
2010-06-30 12:42:11 -04:00
AC_CHECK_LIB([sng_isdn], [sng_isdn_init], [have_sng_isdn="yes"])
AM_CONDITIONAL([SNGISDN],[test "${have_sng_isdn}" = "yes"])
2009-08-19 17:47:56 -04:00
AC_CHECK_LIB([openr2], [openr2_context_set_io_type], [have_openr2="yes"])
AM_CONDITIONAL([OPENR2],[test "${have_openr2}" = "yes"])
2008-02-17 16:52:17 -05:00
COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS"
AC_SUBST(COMP_VENDOR_CFLAGS)
2009-01-13 17:45:09 -05:00
AC_CONFIG_FILES([Makefile
2010-01-15 14:22:49 -05:00
freetdm.pc
mod_freetdm/Makefile])
2008-02-17 16:52:17 -05:00
AC_OUTPUT