reintegrated exosip2

This commit is contained in:
jpbl
2005-11-10 21:40:30 +00:00
parent 1a4be2a365
commit 9329c4ede5
60 changed files with 18089 additions and 499 deletions

1
m4/Makefile.am Normal file
View File

@ -0,0 +1 @@
EXTRA_DIST=speex.m4 osip.m4 exosip.m4 ilbc.m4

224
m4/acx_pthread.m4 Normal file
View File

@ -0,0 +1,224 @@
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
dnl
dnl This macro figures out how to build C programs using POSIX
dnl threads. It sets the PTHREAD_LIBS output variable to the threads
dnl library and linker flags, and the PTHREAD_CFLAGS output variable
dnl to any special C compiler flags that are needed. (The user can also
dnl force certain compiler flags/libs to be tested by setting these
dnl environment variables.)
dnl
dnl Also sets PTHREAD_CC to any special C compiler that is needed for
dnl multi-threaded programs (defaults to the value of CC otherwise).
dnl (This is necessary on AIX to use the special cc_r compiler alias.)
dnl
dnl If you are only building threads programs, you may wish to
dnl use these variables in your default LIBS, CFLAGS, and CC:
dnl
dnl LIBS="$PTHREAD_LIBS $LIBS"
dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
dnl CC="$PTHREAD_CC"
dnl
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE
dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
dnl
dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands
dnl to run it if it is not found. If ACTION-IF-FOUND is not specified,
dnl the default action will define HAVE_PTHREAD.
dnl
dnl Please let the authors know if this macro fails on any platform,
dnl or if you have any other suggestions or comments. This macro was
dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org)
dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread
dnl macros posted by AFC to the autoconf macro repository. We are also
dnl grateful for the helpful feedback of numerous users.
dnl
dnl @version $Id$
dnl @author Steven G. Johnson <stevenj@alum.mit.edu> and Alejandro Forero Cuervo <bachue@bachue.com>
AC_DEFUN([ACX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
acx_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
AC_MSG_RESULT($acx_pthread_ok)
if test x"$acx_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all.
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# pthread: Linux, etcetera
# --thread-safe: KAI C++
case "${host_cpu}-${host_os}" in
*solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthread or
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
;;
esac
if test x"$acx_pthread_ok" = xno; then
for flag in $acx_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[acx_pthread_ok=yes])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($acx_pthread_ok)
if test "x$acx_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$acx_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: threads are created detached by default
# and the JOINABLE attribute has a nonstandard name (UNDETACHED).
AC_MSG_CHECKING([for joinable pthread attribute])
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_JOINABLE;],
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
if test x"$ok" = xunknown; then
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_UNDETACHED;],
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
fi
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
[Define to the necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_RESULT(${ok})
if test x"$ok" = xunknown; then
AC_MSG_WARN([we do not know how to create joinable pthreads])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
*solaris* | alpha*-osf*) flag="-D_REENTRANT";;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with cc_r
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
acx_pthread_ok=no
$2
fi
])dnl ACX_PTHREAD

88
m4/exosip.m4 Normal file
View File

@ -0,0 +1,88 @@
AC_DEFUN([LP_SETUP_EXOSIP],[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([LP_CHECK_OSIP2])
dnl *********************************************************************
dnl Source packaging numbers
EXOSIP_MAJOR_VERSION=1
EXOSIP_MINOR_VERSION=9
EXOSIP_MICRO_VERSION=1
SONAME_MAJOR_VERSION=5
SONAME_MINOR_VERSION=0
SONAME_MICRO_VERSION=0
dnl program extension
EXOSIP_VERSION=$EXOSIP_MAJOR_VERSION.$EXOSIP_MINOR_VERSION.$EXOSIP_MICRO_VERSION
LIBEXOSIP_SO_VERSION=$SONAME_MAJOR_VERSION:$SONAME_MINOR_VERSION:$SONAME_MICRO_VERSION
AC_SUBST(LIBEXOSIP_SO_VERSION, $LIBEXOSIP_SO_VERSION)
AC_SUBST(EXOSIP_VERSION)
dnl support for linux-thread or posix thread (pthread.h)
AC_ARG_ENABLE(pthread,
[ --enable-pthread enable support for POSIX threads. (autodetect)],
enable_pthread=$enableval,enable_pthread="no")
dnl compile with mt support
if test "x$enable_pthread" = "xyes"; then
EXOSIP_CFLAGS="-DHAVE_PTHREAD"
EXOSIP_LIBS="-lpthread"
else
ACX_PTHREAD()
fi
dnl eXosip embeded stuff
EXOSIP_CFLAGS="$OSIP_CFLAGS -DOSIP_MT -DENABLE_TRACE -DNEW_TIMER -DSM -DMSN_SUPPORT -DUSE_TMP_BUFFER"
EXOSIP_LIBS="$OSIP_LIBS"
AC_CHECK_HEADERS(semaphore.h)
AC_CHECK_HEADERS(sys/sem.h)
case $target in
linux*)
EXOSIP_CFLAGS="$EXOSIP_CFLAGS -pedantic"
;;
irix*)
;;
hpux* | hp-ux*)
;;
aix*)
;;
osf*)
AC_CHECK_LIB(rt,sem_open,[EXOSIP_LIBS="$EXOSIP_LIBS -lrt"])
;;
sunos*)
;;
darwin*)
EXOSIP_CFLAGS="$EXOSIP_CFLAGS -pedantic"
;;
*)
;;
esac
AC_CHECK_LIB(posix4,sem_open,[EXOSIP_LIBS="$EXOSIP_LIBS -lposix4 -mt"])
AC_CHECK_LIB(nsl,nis_add,[EXOSIP_LIBS="$EXOSIP_LIBS -lnsl"])
AC_CHECK_LIB(socket,sendto,[EXOSIP_LIBS="$EXOSIP_LIBS -lsocket"])
AC_CHECK_LIB(rt,clock_gettime,[EXOSIP_LIBS="$EXOSIP_LIBS -lrt"])
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(strings.h)
AC_CHECK_HEADERS(stdio.h)
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(stdarg.h)
AC_CHECK_HEADERS(varargs.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(assert.h)
AC_CHECK_HEADERS(signal.h)
AC_CHECK_HEADERS(sys/signal.h)
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(fcntl.h)
AC_SUBST(EXOSIP_CFLAGS)
AC_SUBST(EXOSIP_LIBS)
])

33
m4/ilbc.m4 Normal file
View File

@ -0,0 +1,33 @@
AC_DEFUN([LP_CHECK_ILBC],[
AC_ARG_WITH( ilbc,
[ --with-ilbc Set prefix where ilbc headers and libs can be found (ex:/usr, /usr/local, none to disable ilbc support) [default=/usr] ],
[ ilbc_prefix=${withval}],[ ilbc_prefix="/usr" ])
if test "$ilbc_prefix" = "none" ; then
AC_MSG_NOTICE([iLBC codec support disabled. ])
else
ILBC_CFLAGS=" -I${ilbc_prefix}/include/ilbc"
ILBC_LIBS="-L${ilbc_prefix}/lib -lilbc -lm"
CPPFLAGS_save=$CPPFLAGS
CPPFLAGS=$ILBC_CFLAGS
LDFLAGS_save=$LDFLAGS
LDFLAGS=$ILBC_LIBS
AC_CHECK_HEADERS(iLBC_decode.h,[AC_CHECK_LIB(ilbc,iLBC_decode,ilbc_found=yes,ilbc_found=no)
],ilbc_found=no)
CPPFLAGS=$CPPFLAGS_save
LDFLAGS=$LDFLAGS_save
if test "$ilbc_found" = "no" ; then
AC_MSG_WARN([Could not find ilbc headers or libs. Please install ilbc package from http://www.linphone.org if you want iLBC codec support in linphone.])
ILBC_CFLAGS=
ILBC_LIBS=
else
AC_DEFINE(HAVE_ILBC,1,[Defined when we have ilbc codec lib])
AC_SUBST(ILBC_CFLAGS)
AC_SUBST(ILBC_LIBS)
fi
fi
])

32
m4/osip.m4 Normal file
View File

@ -0,0 +1,32 @@
AC_DEFUN([LP_CHECK_OSIP2],[
AC_ARG_WITH( osip,
[ --with-osip Set prefix where osip can be found (ex:/usr or /usr/local)[default=/usr/local] ],
[ osip_prefix=${withval}],[ osip_prefix=/usr ])
AC_SUBST(osip_prefix)
OSIP_CFLAGS="-I$osip_prefix/include"
OSIP_LIBS="-L$osip_prefix/lib"
dnl check osip2 headers
CPPFLAGS_save=$CPPFLAGS
CPPFLAGS=$OSIP_CFLAGS
AC_CHECK_HEADER([osip2/osip.h], ,AC_MSG_ERROR([Could not find osip2 headers !]))
CPPFLAGS=$CPPFLAGS_save
dnl check for osip2 libs
LDFLAGS_save=$LDFLAGS
LDFLAGS=$OSIP_LIBS
dnl AC_CHECK_LIB adds osipparser2 to LIBS, I don't want that !
LIBS_save=$LIBS
AC_CHECK_LIB(osipparser2,osip_message_init, , AC_MSG_ERROR([Could not find osip2 libraries !]))
LDFLAGS=$LDFLAGS_save
LIBS=$LIBS_save
OSIP_LIBS="$OSIP_LIBS -losipparser2 -losip2"
AC_SUBST(OSIP_CFLAGS)
AC_SUBST(OSIP_LIBS)
])

24
m4/speex.m4 Normal file
View File

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

85
m4/video.m4 Normal file
View File

@ -0,0 +1,85 @@
AC_DEFUN([LP_CHECK_DEP],[
dnl $1=dependency description
dnl $2=dependency short name, will be suffixed with _CFLAGS and _LIBS
dnl $3=headers's place
dnl $4=lib's place
dnl $5=header to check
dnl $6=lib to check
dnl $7=function to check in library
NAME=$2
dep_headersdir=$3
dep_libsdir=$4
dep_header=$5
dep_lib=$6
dep_funclib=$7
eval ${NAME}_CFLAGS=\"-I $dep_headersdir \"
eval ${NAME}_LIBS=\"-L $dep_libsdir -l$dep_lib\"
CPPFLAGS_save=$CPPFLAGS
LDFLAGS_save=$LDFLAGS
CPPFLAGS="-I $dep_headersdir "
LDFLAGS="-L $dep_libsdir "
AC_CHECK_HEADERS([$dep_header],[AC_CHECK_LIB([$dep_lib],[$dep_funclib],found=yes,found=no)
],found=no)
if test "$found" = "yes" ; then
eval ${NAME}_found=yes
AC_DEFINE([HAVE_${NAME}],1,[Defined when we have found $1])
AC_SUBST(${NAME}_CFLAGS)
AC_SUBST(${NAME}_LIBS)
else
eval ${NAME}_found=no
eval ${NAME}_CFLAGS=
eval ${NAME}_LIBS=
fi
CPPFLAGS=$CPPFLAGS_save
LDFLAGS=$LDFLAGS_save
])
AC_DEFUN([LP_CHECK_VIDEO],[
dnl conditionnal build of video support
AC_ARG_ENABLE(video,
[ --enable-video Turn on video support compiling: not functionnal for the moment],
[case "${enableval}" in
yes) video=true ;;
no) video=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-video) ;;
esac],[video=false])
AC_ARG_WITH( ffmpeg,
[ --with-ffmpeg Sets the installation prefix of ffmpeg, needed for video support. [default=/usr] ],
[ ffmpegdir=${withval}],[ ffmpegdir=/usr ])
AC_ARG_WITH( sdl,
[ --with-sdl Sets the installation prefix of libSDL, needed for video support. [default=/usr] ],
[ libsdldir=${withval}],[ libsdldir=/usr ])
if test "$video" = "true"; then
dnl test for ffmpeg presence
LP_CHECK_DEP([ffmpeg],[FFMPEG],[${ffmpegdir}/include/ffmpeg],[${ffmpegdir}/lib],[avcodec.h],[avcodec],[avcodec_init])
if test "$FFMPEG_found" = "no" ; then
AC_MSG_ERROR([Could not find ffmpeg headers and library. This is mandatory for video support])
fi
LP_CHECK_DEP([SDL],[SDL],[${libsdldir}/include],[${libsdldir}/lib],[SDL/SDL.h],[SDL],[SDL_Init])
if test "$SDL_found" = "no" ; then
AC_MSG_ERROR([Could not find libsdl headers and library. This is mandatory for video support])
fi
VIDEO_CFLAGS=" $FFMPEG_CFLAGS $SDL_CFLAGS"
VIDEO_LIBS=" $FFMPEG_LIBS $SDL_LIBS"
AC_DEFINE(VIDEO_ENABLED,1,[Set when video support is enabled])
fi
AC_SUBST(VIDEO_CFLAGS)
AC_SUBST(VIDEO_LIBS)
])