2005-11-12 16:27:19 -05:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
2006-07-21 21:02:36 -04:00
2005-11-12 16:27:19 -05:00
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
2006-03-30 09:43:39 -05:00
AC_CONFIG_AUX_DIR(build/config)
2005-11-12 16:27:19 -05:00
AM_INIT_AUTOMAKE(libfreeswitch,0.1)
AC_CONFIG_SRCDIR([src/switch.c])
2007-03-09 15:44:13 -05:00
AC_CONFIG_HEADER([src/include/switch_private.h])
2006-01-02 13:31:50 -05:00
AC_PREFIX_DEFAULT(/usr/local/freeswitch)
2007-03-11 00:15:34 -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
prefix='/usr/local/freeswitch'
fi
2007-03-10 23:02:10 -05:00
2007-03-20 16:44:09 -04:00
AC_CANONICAL_HOST
2007-03-10 23:02:10 -05:00
# Absolute source/build directory
switch_srcdir=`(cd $srcdir && pwd)`
switch_builddir=`pwd`
AC_SUBST(switch_srcdir)
AC_SUBST(switch_builddir)
2007-03-12 22:26:00 -04:00
moddir=$prefix/mod
AC_SUBST(moddir)
2006-12-16 18:22:45 -05:00
#Set default language
AC_LANG_C
2005-11-12 16:27:19 -05:00
# Checks for programs.
AC_PROG_CC
2006-03-29 21:12:50 -05:00
AC_PROG_AWK
2005-11-12 16:27:19 -05:00
AC_PROG_MAKE_SET
AC_PROG_INSTALL
2006-03-29 21:12:50 -05:00
AC_PROG_LIBTOOL
2005-11-12 16:27:19 -05:00
2006-12-16 18:22:45 -05:00
#Check for compiler vendor
AX_COMPILER_VENDOR
# Optimize
AC_ARG_ENABLE(optimization,
[AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
if test "${enable_optimizer}" = "yes" ; then
AC_DEFINE([OPTIMZER],[],[Enable Optimization.])
AX_CC_MAXOPT
fi
# Enable debugging
AC_ARG_ENABLE(debug,
[AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enable_debug"],[enable_debug="yes"])
if test "${enable_debug}" = "yes"; then
AC_DEFINE([DEBUG],[],[Enable extra debugging.])
AX_CFLAGS_WARN_ALL_ANSI
fi
AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
2007-03-28 14:46:07 -04:00
# Optional Features
AC_ARG_ENABLE(resample,
[AC_HELP_STRING([--enable-resample],[build with embedded resamper])],[enable_resample="$enable_resample"],[enable_resample="yes"])
# We should add checking for out of tree libresample here
RESAMPLE_LIB=
RESAMPLE_CFLAGS=
if test "${enable_resample}" = "yes"; then
RESAMPLE_LIB="libs/libresample/libresample.la"
RESAMPLE_CFLAGS="-I${switch_srcdir}/libs/libresample/include"
else
AC_DEFINE([DISABLE_RESAMPLE],[],[Disable the embedded resampler])
fi
AC_SUBST(RESAMPLE_LIB)
AC_SUBST(RESAMPLE_CFLAGS)
AM_CONDITIONAL([USE_INTREE_RESAMPLE],[test "${enable_resample}" = "yes"])
2007-03-10 23:02:10 -05:00
# set defaults for use on all platforms
2007-03-28 17:48:06 -04:00
SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include"
SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include"
2007-03-20 16:44:09 -04:00
SWITCH_AM_LDFLAGS="-lm -L/usr/local/lib"
2007-03-10 23:02:10 -05: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
2007-03-12 13:46:24 -04:00
*darwin*)
2007-03-10 23:02:10 -05:00
SOLINK="-dynamic -bundle -force-flat-namespace"
;;
*)
SOLINK="-shared -Xlinker -x"
;;
esac
else
AC_ERROR([Please update configure.in with SOLINK values for your compiler])
fi
2006-12-16 18:22:45 -05:00
2007-03-10 23:02:10 -05:00
# set DYNAMIC_LIB_EXTEN
# we should really be using libtool so we don't need to do this
2006-12-16 18:22:45 -05:00
case "$host" in
2007-03-12 13:46:24 -04:00
*darwin*)
2007-03-10 23:02:10 -05:00
DYNAMIC_LIB_EXTEN="dylib"
;;
*cygwin* | *mingw*)
DYNAMIC_LIB_EXTEN="dll"
;;
*)
DYNAMIC_LIB_EXTEN="so"
;;
2006-12-16 18:22:45 -05:00
esac
2007-03-10 23:02:10 -05:00
# tweak compiler specific flags
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
APR_ADDTO(SWITCH_AM_CFLAGS, -KPIC)
APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC)
2007-03-12 00:21:54 -04:00
APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC)
2007-03-10 23:02:10 -05:00
APR_ADDTO(SWITCH_AM_LDFLAGS, -R${prefix}/lib)
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
2007-03-12 00:21:54 -04:00
APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
2007-03-18 13:38:48 -04:00
APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
2007-03-10 23:02:10 -05:00
fi
# tweak platform specific flags
case "$host" in
2007-03-12 13:46:24 -04:00
*darwin*)
2007-03-10 23:02:10 -05:00
APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
;;
*-solaris2*)
APR_ADDTO(SWITCH_AM_CFLAGS, -DPATH_MAX=2048)
;;
esac
2007-03-12 00:21:54 -04:00
APR_REMOVEFROM(SWITCH_AM_CXXFLAGS, -std=c99)
2007-03-10 23:02:10 -05:00
AC_SUBST(SWITCH_AM_CFLAGS)
2007-03-12 00:21:54 -04:00
AC_SUBST(SWITCH_AM_CXXFLAGS)
2007-03-10 23:02:10 -05:00
AC_SUBST(SWITCH_AM_LDFLAGS)
2006-12-16 18:22:45 -05:00
AC_SUBST(SOLINK)
AC_SUBST(DYNAMIC_LIB_EXTEN)
2005-11-12 16:27:19 -05:00
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
2005-11-18 19:10:16 -05:00
AC_CHECK_HEADERS([sys/types.h])
2005-11-12 16:27:19 -05:00
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
2006-09-17 14:44:53 -04:00
AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep])
2005-11-12 16:27:19 -05:00
2006-12-16 20:01:09 -05:00
AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
2006-01-05 18:13:00 -05:00
2007-03-09 15:44:13 -05:00
# Checks for integer size
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(long long, 8)
2007-03-29 00:08:18 -04:00
AC_CHECK_SIZEOF(time_t, 4)
2007-03-09 15:44:13 -05:00
AC_TYPE_SIZE_T
AC_CHECK_TYPE(ssize_t, int)
# Checks for pointer size
AC_CHECK_SIZEOF(void*, 4)
if test "x$ac_cv_sizeof_voidp" != "x"; then
voidp_size=$ac_cv_sizeof_voidp
else
AC_ERROR([Cannot determine size of void*])
fi
if test "$ac_cv_sizeof_short" = "2"; then
short_value=short
fi
if test "$ac_cv_sizeof_int" = "4"; then
int_value=int
fi
if test "$ac_cv_sizeof_int" = "8"; then
int64_t_fmt='#define SWITCH_INT64_T_FMT "d"'
uint64_t_fmt='#define SWITCH_UINT64_T_FMT "u"'
int64_value="int"
long_value=int
elif test "$ac_cv_sizeof_long" = "8"; then
int64_t_fmt='#define SWITCH_INT64_T_FMT "ld"'
uint64_t_fmt='#define SWITCH_UINT64_T_FMT "lu"'
int64_value="long"
long_value=long
elif test "$ac_cv_sizeof_long_long" = "8"; then
int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"'
uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"'
int64_value="long long"
long_value="long long"
elif test "$ac_cv_sizeof_longlong" = "8"; then
int64_t_fmt='#define SWITCH_INT64_T_FMT "qd"'
uint64_t_fmt='#define SWITCH_UINT64_T_FMT "qu"'
int64_value="__int64"
long_value="__int64"
else
AC_ERROR([could not detect a 64-bit integer type])
fi
if test "$ac_cv_type_size_t" = "yes"; then
size_t_value="size_t"
else
size_t_value="switch_int32_t"
fi
if test "$ac_cv_type_ssize_t" = "yes"; then
ssize_t_value="ssize_t"
else
ssize_t_value="switch_int32_t"
fi
APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
if test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then
ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"'
elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then
ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
else
ssize_t_fmt='#error Can not determine the proper size for ssize_t'
fi
APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
if test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then
size_t_fmt='#define SWITCH_SIZE_T_FMT "d"'
elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then
size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
else
size_t_fmt='#error Can not determine the proper size for size_t'
fi
2007-03-29 00:08:18 -04:00
if test "$ac_cv_sizeof_time_t" = "$ac_cv_sizeof_int"; then
time_t_fmt='#define TIME_T_FMT "d"'
elif test "$ac_cv_sizeof_time_t" = "$ac_cv_sizeof_long"; then
time_t_fmt='#define TIME_T_FMT "ld"'
elif test "$ac_cv_sizeof_time_t" = "$ac_cv_sizeof_long_long"; then
time_t_fmt='#define TIME_T_FMT "lld"'
else
time_t_fmt='#error Can not determine the proper format specifier for time_t of size $ac_cv_sizeof_time_t'
fi
2007-03-09 15:44:13 -05:00
# Basically, we have tried to figure out the correct format strings
# for SWITCH types which vary between platforms, but we don't always get
# it right. If you find that we don't get it right for your platform,
# you can override our decision below.
# NOTE: borrowed much of this logic from apr.
case $host in
s390*linux*)
# uniquely, the 31-bit Linux/s390 uses "unsigned long int"
# for size_t rather than "unsigned int":
size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
;;
*-os2*)
size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
;;
*aix4*|*aix5*)
ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
;;
*beos*)
ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
;;
*apple-darwin*)
osver=`uname -r`
case $osver in
[0-7].*)
ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"'
;;
*)
ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
;;
esac
size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
;;
esac
AC_SUBST(voidp_size)
AC_SUBST(short_value)
AC_SUBST(int_value)
AC_SUBST(long_value)
AC_SUBST(int64_value)
AC_SUBST(size_t_value)
AC_SUBST(ssize_t_value)
AC_SUBST(int64_t_fmt)
AC_SUBST(uint64_t_fmt)
AC_SUBST(ssize_t_fmt)
AC_SUBST(size_t_fmt)
2007-03-29 00:08:18 -04:00
AC_SUBST(time_t_fmt)
2007-03-09 15:44:13 -05:00
2007-03-13 23:02:46 -04:00
AC_PATH_PROGS(ZCAT, gunzip gzcat gzip zcat)
AC_PATH_PROGS(TAR, gtar tar)
AC_PATH_PROGS(WGET, wget)
AC_PATH_PROGS(CURL, curl)
2007-03-14 10:35:11 -04:00
GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_srcdir/build/getlib.sh"
AC_SUBST(GETLIB)
2007-03-13 23:02:46 -04:00
2007-03-14 14:59:25 -04:00
LIBCURL_CHECK_CONFIG([yes], [7.13.0], [LIBCURL_DEPS=''], [LIBCURL_DEPS='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include'])
AC_SUBST(LIBCURL_DEPS)
2006-05-05 09:35:33 -04:00
AC_ARG_ENABLE(crash-protection,
[ --enable-crash-protection Compile with CRASH Protection],,[enable_crash_prot="no"])
2006-01-05 18:13:00 -05:00
2007-03-23 02:08:17 -04:00
#AX_LIB_MYSQL([MINIMUM-VERSION])
AX_LIB_MYSQL
2006-05-05 09:35:33 -04:00
AM_CONDITIONAL([CRASHPROT],[test "x$enable_crash_prot" != "xno"])
2007-03-23 02:08:17 -04:00
AM_CONDITIONAL([HAVE_MYSQL],[test "$have_mysql" = "yes"])
2006-01-05 18:13:00 -05:00
2007-03-09 15:44:13 -05:00
AC_CONFIG_FILES([Makefile
2007-03-16 15:20:24 -04:00
src/Makefile
2007-03-12 22:26:00 -04:00
src/mod/Makefile
2007-03-23 02:08:17 -04:00
src/mod/event_handlers/mod_cdr/Makefile
2007-03-12 00:21:54 -04:00
src/include/switch_am_config.h
2007-03-13 23:02:46 -04:00
build/getlib.sh
2007-03-12 00:21:54 -04:00
build/modmake.rules])
2005-11-12 16:27:19 -05:00
2005-11-18 19:10:16 -05:00
AM_CONDITIONAL(ISLINUX, [test `uname -s` = Linux])
2005-12-13 16:26:03 -05:00
AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin])
2006-01-25 18:59:02 -05:00
AM_CONDITIONAL(IS64BITLINUX, [test `uname -m` = x86_64])
2005-11-18 19:10:16 -05:00
2007-03-11 03:36:49 -04:00
# Run configure in all the subdirs
AC_CONFIG_SUBDIRS(libs/srtp)
AC_CONFIG_SUBDIRS(libs/sqlite)
AC_CONFIG_SUBDIRS(libs/libresample)
AC_CONFIG_SUBDIRS(libs/pcre)
AC_CONFIG_SUBDIRS(libs/apr)
AC_CONFIG_SUBDIRS(libs/apr-util)
2007-03-11 10:03:58 -04:00
AC_CONFIG_SUBDIRS(libs/codec/g7xx)
AC_CONFIG_SUBDIRS(libs/codec/g726)
AC_CONFIG_SUBDIRS(libs/codec/gsm)
AC_CONFIG_SUBDIRS(libs/codec/ilbc)
AC_CONFIG_SUBDIRS(libs/codec/lpc10)
AC_CONFIG_SUBDIRS(libs/curl)
AC_CONFIG_SUBDIRS(libs/iax)
AC_CONFIG_SUBDIRS(libs/iksemel)
AC_CONFIG_SUBDIRS(libs/js/nsprpub)
AC_CONFIG_SUBDIRS(libs/js)
AC_CONFIG_SUBDIRS(libs/libdingaling)
AC_CONFIG_SUBDIRS(libs/libetpan)
AC_CONFIG_SUBDIRS(libs/libsndfile)
AC_CONFIG_SUBDIRS(libs/sofia-sip)
AC_CONFIG_SUBDIRS(libs/speex)
AC_CONFIG_SUBDIRS(libs/xmlrpc-c)
AC_CONFIG_SUBDIRS(libs/portaudio)
2007-03-13 02:17:58 -04:00
AC_OUTPUT