[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Linphone-developers] [PATCH] Make it easier to link against an exte
From: |
Simon Morlat |
Subject: |
Re: [Linphone-developers] [PATCH] Make it easier to link against an external GSM library. |
Date: |
Wed, 23 May 2007 11:21:43 +0200 |
User-agent: |
KMail/1.9.5 |
Hello,
Would you please send me the patch as an attachement, to avoid again non-ascii
characters ?
Simon
Le mardi 15 mai 2007 08:10, Jeffrey C. Ollie a écrit :
> Make it easier to link against an external GSM library by creating an
> autoconf macro to detect an external GSM library and using it in
> mediastreamer2 and the main source. Also, if linking against an external
> GSM library, don't build the internal library.
>
> Signed-off-by: Jeffrey C. Ollie <address@hidden>
> ---
> Makefile.am | 8 ++++-
> configure.in | 24 ++++++++++++++++
> m4/gsm.m4 | 29 +++++++++++++++++++
> mediastreamer2/autogen.sh | 2 +-
> mediastreamer2/configure.ac | 45
> ++++++++++++++++++------------ mediastreamer2/m4/gsm.m4 |
> 29 +++++++++++++++++++ mediastreamer2/mediastreamer-config.h.in | 3 ++
> 7 files changed, 120 insertions(+), 20 deletions(-)
> create mode 100644 m4/gsm.m4
> create mode 100644 mediastreamer2/m4/gsm.m4
>
> diff --git a/Makefile.am b/Makefile.am
> index 90a6343..872ca5e 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -9,7 +9,13 @@ else
> ORTP_DIR = oRTP
> endif
>
> -SUBDIRS = m4 pixmaps po ipkg $(ORTP_DIR) gsmlib mediastreamer2\
> +if EXTERNAL_GSM
> +GSM_DIR =
> +else
> +GSM_DIR = gsmlib
> +endif
> +
> +SUBDIRS = m4 pixmaps po ipkg $(ORTP_DIR) $(GSM_DIR) mediastreamer2\
> media_api exosip coreapi console gtk share
>
>
> diff --git a/configure.in b/configure.in
> index 5c55410..81e917c 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -320,6 +320,30 @@ AC_SUBST(ORTP_LIBS)
>
> AM_CONDITIONAL(EXTERNAL_ORTP, [test "$external_ortp" = 'true'])
>
> +AC_ARG_WITH(gsm,
> + AS_HELP_STRING([--with-gsm],[Sets the installation prefix of GSM
> codec library (default=/usr)]), + [ gsmdir=${withval}],[ gsmdir=/usr ])
> +
> +AC_ARG_ENABLE(external-gsm,
> + AS_HELP_STRING([--enable-external-gsm],[Use external GSM library
> (default=false)]), + [case "${enableval}" in
> + yes) external_gsm=true ;;
> + no) external_gsm=false ;;
> + *) AC_MSG_ERROR(bad value ${enableval} for --enable-external-gsm)
> ;; + esac],[external_gsm=false])
> +
> +if test "$external_gsm" = 'true'; then
> + LP_CHECK_GSM
> +else
> + AC_CONFIG_SUBDIRS(gsmlib)
> + GSM_CFLAGS="-I\$(top_srcdir)/gsmlib"
> + GSM_LIBS="\$(top_builddir)/gsmlib/libgsm.la"
> + AC_SUBST(GSM_CFLAGS)
> + AC_SUBST(GSM_LIBS)
> +fi
> +
> +AM_CONDITIONAL(EXTERNAL_GSM, [test "$external_gsm" = 'true'])
> +
> dnl Packaging: Pick oRTP version from ${top_srcdir}/oRTP/configure.ac
> dnl Feel free to propose an alternative & cleaner version...
> top_srcdir=`dirname $0`
> diff --git a/m4/gsm.m4 b/m4/gsm.m4
> new file mode 100644
> index 0000000..b75a747
> --- /dev/null
> +++ b/m4/gsm.m4
> @@ -0,0 +1,29 @@
> +AC_DEFUN([LP_CHECK_GSM],[
> +
> +gsm_pkgconfig=true
> +
> +PKG_CHECK_MODULES([GSM], [gsm], , [gsm_pkgconfig=false])
> +
> +if test $gsm_pkgconfig = false; then
> + if test "${gsmdir}" != "/usr"; then
> + CFLAGS_save="$CFLAGS"
> + CFLAGS="$CFLAGS -I${gsmdir}/include"
> + fi
> + AC_CHECK_HEADER([gsm/gsm.h], , AC_MSG_ERROR([Could not find GSM headers
> !])) + if test "${gsmdir}" != "/usr"; then
> + GSM_CFLAGS="-I${gsmdir}/include"
> + CFLAGS="$CFLAGS_save"
> + LIBS_save="$LIBS"
> + LIBS="$LIBS -L${gsmdir}/lib"
> + fi
> + AC_CHECK_LIB([gsm], [gsm_create], , AC_MSG_ERROR([Could not find GSM
> library])) + if test "${gsmdir}" != "/usr"; then
> + GSM_LIBS="-L${gsmdir}/lib -lgsm"
> + LIBS="$LIBS_save"
> + else
> + GSM_LIBS="-lgsm"
> + fi
> +fi
> +AC_SUBST([GSM_LIBS])
> +AC_SUBST([GSM_CFLAGS])
> +])
> diff --git a/mediastreamer2/autogen.sh b/mediastreamer2/autogen.sh
> index 64516e8..fb71734 100755
> --- a/mediastreamer2/autogen.sh
> +++ b/mediastreamer2/autogen.sh
> @@ -14,6 +14,6 @@ echo "Generating build scripts in mediastreamer..."
> set -x
> libtoolize --copy --force
> autoheader
> -$ACLOCAL
> +$ACLOCAL -I m4
> $AUTOMAKE --force-missing --add-missing --copy
> autoconf
> diff --git a/mediastreamer2/configure.ac b/mediastreamer2/configure.ac
> index 89d66fa..9621a5e 100644
> --- a/mediastreamer2/configure.ac
> +++ b/mediastreamer2/configure.ac
> @@ -263,31 +263,40 @@ AC_SUBST(SPEEX_LIBS)
> AM_CONDITIONAL(BUILD_SPEEX, test x$build_speex = xyes )
>
> dnl check for gsm
> -AC_ARG_WITH( gsm,
> - [ --with-gsm Sets the installation prefix of gsm
> codec library
> [default=/usr] ], - [ gsmdir=${withval}],[ gsmdir=/usr ])
> -if test -e ../gsmlib/gsm.h ; then
> - echo "building from linphone source tree, using ../gsmlib/gsm.h"
> - GSM_CFLAGS="-I\$(top_srcdir)/../gsmlib"
> - GSM_LIBS="\$(top_builddir)/../gsmlib/libgsm.la"
> - build_gsm=yes
> - AC_SUBST(GSM_CFLAGS)
> - AC_SUBST(GSM_LIBS)
> -else
> - MS_CHECK_DEP([gsm codec],[GSM],[${gsmdir}/include],
> - [${gsmdir}/lib],[gsm.h],[gsm],[gsm_create])
> -
> - if test "$GSM_found" = "yes" ; then
> - build_gsm=yes
> +AC_ARG_WITH(gsm,
> + AS_HELP_STRING([--with-gsm],[Sets the installation prefix of gsm codec
> library (default=/usr)]), + [ gsmdir=${withval}],[ gsmdir=/usr ])
> +AC_ARG_ENABLE(external-gsm,
> + AS_HELP_STRING([--enable-external-gsm],[Use external GSM library]),
> + [case "${enableval}" in
> + yes) external_gsm=true ;;
> + no) external_gsm=false ;;
> + *) AC_MSG_ERROR(bad value ${enableval} for --enable-external-gsm)
> ;; + esac],[external_gsm=false])
> +
> +if test "$external_gsm" = 'false'; then
> + if test -e $srcdir/../gsmlib/gsm.h ; then
> + echo "building from linphone source tree, using ../gsmlib/gsm.h"
> + GSM_CFLAGS="-I\$(top_srcdir)/../gsmlib"
> + GSM_LIBS="\$(top_builddir)/../gsmlib/libgsm.la"
> + AC_SUBST(GSM_CFLAGS)
> + AC_SUBST(GSM_LIBS)
> + build_gsm=yes
> + else
> + external_gsm=true
> fi
> fi
> +if test "$external_gsm" = 'true'; then
> + MS_CHECK_GSM
> + build_gsm=yes
> +fi
> +
> +AM_CONDITIONAL(BUILD_GSM, test x$build_gsm = xyes )
>
> build_resample=false
> AC_CHECK_LIB(resample,resample_open,[LIBS="$LIBS -lresample";
> build_resample=yes]) AM_CONDITIONAL(BUILD_RESAMPLE, test x$build_resample =
> xyes )
>
> -AM_CONDITIONAL(BUILD_GSM, test x$build_gsm = xyes )
> -
> MS_CHECK_VIDEO
> AM_CONDITIONAL(BUILD_VIDEO, test "$video" = "true")
> AM_CONDITIONAL(BUILD_THEORA, test "$have_theora" = "yes")
> diff --git a/mediastreamer2/m4/gsm.m4 b/mediastreamer2/m4/gsm.m4
> new file mode 100644
> index 0000000..2208955
> --- /dev/null
> +++ b/mediastreamer2/m4/gsm.m4
> @@ -0,0 +1,29 @@
> +AC_DEFUN([MS_CHECK_GSM],[
> +
> +gsm_pkgconfig=true
> +
> +PKG_CHECK_MODULES([GSM], [gsm], , [gsm_pkgconfig=false])
> +
> +if test $gsm_pkgconfig = false; then
> + if test "${gsmdir}" != "/usr"; then
> + CFLAGS_save="$CFLAGS"
> + CFLAGS="$CFLAGS -I${gsmdir}/include"
> + fi
> + AC_CHECK_HEADER([gsm/gsm.h], , AC_MSG_ERROR([Could not find GSM headers
> !])) + if test "${gsmdir}" != "/usr"; then
> + GSM_CFLAGS="-I${gsmdir}/include"
> + CFLAGS="$CFLAGS_save"
> + LIBS_save="$LIBS"
> + LIBS="$LIBS -L${gsmdir}/lib"
> + fi
> + AC_CHECK_LIB([gsm], [gsm_create], , AC_MSG_ERROR([Could not find GSM
> library])) + if test "${gsmdir}" != "/usr"; then
> + GSM_LIBS="-L${gsmdir}/lib -lgsm"
> + LIBS="$LIBS_save"
> + else
> + GSM_LIBS="-lgsm"
> + fi
> +fi
> +AC_SUBST([GSM_LIBS])
> +AC_SUBST([GSM_CFLAGS])
> +])
> diff --git a/mediastreamer2/mediastreamer-config.h.in
> b/mediastreamer2/mediastreamer-config.h.in index 3054af5..fb22c79 100644
> --- a/mediastreamer2/mediastreamer-config.h.in
> +++ b/mediastreamer2/mediastreamer-config.h.in
> @@ -18,6 +18,9 @@
> /* Define to 1 if you have the `avcodec' library (-lavcodec). */
> #undef HAVE_LIBAVCODEC
>
> +/* Define to 1 if you have the `gsm' library (-lgsm). */
> +#undef HAVE_LIBGSM
> +
> /* Define to 1 if you have the <linux/videodev2.h> header file. */
> #undef HAVE_LINUX_VIDEODEV2_H