linphone/linphone-1.7.1-extgsm.patch
2007-05-15 20:43:30 +00:00

200 lines
5.7 KiB
Diff

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..7471c75
--- /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 ${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 ${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 ${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..73d0568
--- /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 ${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 ${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 ${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])
+])