Commit eeaf86e1 authored by Benoit Grégoire's avatar Benoit Grégoire

Add detection of libspeex, libgsm and libboost. Add --without-speex and --without-gsm

parent 95a8c71f
......@@ -3,7 +3,7 @@ dnl
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([SFLPhone],[0.7],[sflphoneteam@savoirfairelinux.com],[sflphone])
AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004-2007]])
AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004-2008]])
AC_REVISION([$Revision$])
dnl Compute canonical system name
......@@ -192,27 +192,52 @@ PKG_CHECK_MODULES(libdbuscpp, dbus-c++-1 >= ${LIBDBUSCPP_MIN_VERSION})
SFLPHONE_CFLAGS="$SFLPHONE_CFLAGS $libdbuscpp_CFLAGS"
SFLPHONE_LIBS="$SFLPHONE_LIBS $libdbuscpp_LIBS"
dnl Check for speex
AC_ARG_ENABLE(speex,
AS_HELP_STRING(
[--enable-speex],
[compile with speex codec @<:@default=no@:>@]
),
[with_speex=$enableval],
[with_speex=no]
)
# check for libboost (doesn't use pkg-config)
AC_CHECK_HEADER(boost/tokenizer.hpp, , AC_MSG_ERROR("Unable to find the libboost tokenizer headers; you may need to install the libboost-dev package" ) )
# check for libgsm1 (doesn't use pkg-config)
dnl Check for libspeex
AC_ARG_WITH([gsm],
[AS_HELP_STRING([--without-gsm],
[disable support for gsm codec])],
[],
[with_gsm=yes])
LIBGSM=
AS_IF([test "x$with_gsm" != xno],
[AC_CHECK_HEADER([gsm.h], , AC_MSG_FAILURE([Unable to find the libgsm1 headers (you may need to install the dev package). You may use --without-gsm to compile without gsm codec support.]))]
[AC_CHECK_LIB([gsm], [gsm_decode],
[],
[AC_MSG_FAILURE(
[libgsm link test failed. You may use --without-gsm to compile without gsm codec support.])]
)
]
)
AC_DEFINE([HAVE_GSM], test "x$with_gsm" = "xyes", [Define if you have libgsm])
AM_CONDITIONAL(BUILD_GSM, test "x$with_gsm" = "xyes" )
dnl Check for libspeex
AC_ARG_WITH([speex],
[AS_HELP_STRING([--without-speex],
[disable support for speex codec])],
[],
[with_speex=yes])
LIBSPEEX=
AS_IF([test "x$with_speex" != xno],
[AC_CHECK_HEADER([speex/speex.h], , AC_MSG_FAILURE([Unable to find the libspeex headers (you may need to install the dev package). You may use --without-speex to compile without speex codec support.]))]
[AC_CHECK_LIB([speex], [speex_decode_int],
[],
[AC_MSG_FAILURE(
[libspeex link test failed. You may use --without-speex to compile without speex codec support.])]
)
]
)
AC_DEFINE([HAVE_SPEEX], test "x$with_speex" = "xyes", [Define if you have libspeex])
AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" )
if test "x$with_speex" = "xyes" ; then
AC_CHECK_HEADER([speex/speex.h], [
AC_CHECK_LIB(speex, speex_decode_int,
[
with_speex=yes
], [ with_speex=no ]
)
], [ with_speex=no ]
)
fi
AM_CONDITIONAL(USE_SPEEX, test "x$with_speex" = "xyes" )
dnl Check for IAX
AC_ARG_ENABLE(iax2,
......
AC_DEFUN([LP_CHECK_SPEEX],[
dnl only accept speex>=1.1.6 or 1.0.5 (the versions that have speex_encode_int )
AC_ARG_WITH( speex,
[ --with-speex Set prefix where speex lib can be found (ex:/usr, /usr/local) [default=/usr] ],
[ speex_prefix=${withval}],[ speex_prefix="/usr" ])
SPEEX_CFLAGS=" -I${speex_prefix}/include -I${speex_prefix}/include/speex"
SPEEX_LIBS="-L${speex_prefix}/lib -lspeex -lm"
CPPFLAGS_save=$CPPFLAGS
CPPFLAGS=$SPEEX_CFLAGS
LDFLAGS_save=$LDFLAGS
LDFLAGS=$SPEEX_LIBS
AC_CHECK_HEADERS(speex.h,[AC_CHECK_LIB(speex,speex_encode_int,speex_found=yes,speex_found=no)
],speex_found=no)
if test "$speex_found" = "no" ; then
AC_MSG_ERROR([Could not find a libspeex version that have the speex_encode_int() function. Please install libspeex=1.0.5 or libspeex>=1.1.6])
fi
AC_SUBST(SPEEX_CFLAGS)
AC_SUBST(SPEEX_LIBS)
CPPFLAGS=$CPPFLAGS_save
LDFLAGS=$LDFLAGS_save
])
sflcodecdir = $(libdir)/sflphone/codecs
noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so libcodec_gsm.so libcodec_speex.so libcodec_ilbc.so
if BUILD_GSM
GSM_LIB = libcodec_gsm.so
libcodec_gsm_so_SOURCES = gsmcodec.cpp
libcodec_gsm_so_CFLAGS = -fPIC -g -Wall
libcodec_gsm_so_LDFLAGS = -shared -lc -lgsm
endif
if BUILD_SPEEX
SPEEX_LIB = libcodec_speex.so
libcodec_speex_so_SOURCES = speexcodec.cpp
libcodec_speex_so_CFLAGS = -fPIC -g -Wall
libcodec_speex_so_LDFLAGS = -shared -lc -lspeex
endif
noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so $(GSM_LIB) $(SPEEX_LIB) libcodec_ilbc.so
noinst_HEADERS = audiocodec.h
......@@ -12,14 +25,6 @@ libcodec_alaw_so_SOURCES = alaw.cpp
libcodec_alaw_so_CFLAGS = -fPIC -g -Wall
libcodec_alaw_so_LDFLAGS = -shared -lc
libcodec_gsm_so_SOURCES = gsmcodec.cpp
libcodec_gsm_so_CFLAGS = -fPIC -g -Wall
libcodec_gsm_so_LDFLAGS = -shared -lc -lgsm
libcodec_speex_so_SOURCES = speexcodec.cpp
libcodec_speex_so_CFLAGS = -fPIC -g -Wall
libcodec_speex_so_LDFLAGS = -shared -lc -lspeex
libcodec_ilbc_so_SOURCES = ilbc.cpp
libcodec_ilbc_so_CFLAGS = -fPIC -g -Wall
libcodec_ilbc_so_LDFLAGS = -shared ilbc/*.o -lc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment