Link against external GSM library.

This commit is contained in:
Jeffrey C. Ollie 2007-05-15 20:43:30 +00:00
parent b6b616362c
commit 24028d944d
2 changed files with 208 additions and 9 deletions

199
linphone-1.7.1-extgsm.patch Normal file
View File

@ -0,0 +1,199 @@
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])
+])

View File

@ -1,6 +1,6 @@
Name: linphone
Version: 1.7.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Phone anywhere in the whole world by using the Internet
Group: Applications/Communications
@ -10,6 +10,7 @@ Source0: http://download.savannah.nongnu.org/releases/linphone/1.7.x/sour
Patch0: linphone-1.7.1-ortpm4.patch
Patch1: linphone-1.7.1-imagedir.patch
Patch2: linphone-1.7.1-gtkosip.patch
Patch3: linphone-1.7.1-extgsm.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: compat-libosip2-devel
@ -22,6 +23,7 @@ BuildRequires: gtk2-devel
BuildRequires: alsa-lib-devel
BuildRequires: speex-devel >= 1.2
BuildRequires: gsm-devel
BuildRequires: desktop-file-utils
@ -64,12 +66,7 @@ Libraries and headers required to develop software with linphone.
%patch0 -p1 -b .ortpm4
%patch1 -p1 -b .imagedir
%patch2 -p1 -b .gtkosip
#patch0 -p1 -b .old
#patch1 -p1 -b .libs
#patch2 -p0 -b .osip
#rm -r oRTP
%patch3 -p1 -b .extgsm
pushd share/cs
for f in *.1
@ -89,13 +86,13 @@ rm -rf config.cache
pushd mediastreamer2
libtoolize --copy --force
aclocal
aclocal -I m4
autoheader
automake --force-missing --add-missing --copy
autoconf
popd
%configure --disable-static --disable-rpath --disable-video --enable-alsa --enable-strict --enable-external-ortp --with-osip-version=2.2.2
%configure --disable-static --disable-rpath --disable-video --enable-alsa --enable-strict --enable-external-ortp --with-osip-version=2.2.2 --enable-external-gsm
make %{?_smp_mflags}
%install
@ -147,6 +144,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/pkgconfig/*
%changelog
* Mon May 14 2007 Jeffrey C. Ollie <jeff@ocjtech.us> - 1.7.1-2
- Add patch for compiling against external GSM library.
* Tue Apr 17 2007 Jeffrey C. Ollie <jeff@ocjtech.us> - 1.7.1-1
- Update to 1.7.1
- Drop linphone-1.0.1-desktop.patch, linphone-1.4.1-libs.patch and