siproxd/configure.in
Thomas Ries 00dfe93a0d - Introduced the use of gethostbyname_r() if available. As siproxd
uses threads it probably is a very good idea (some funny things
  seen with Linux 2.4.18 kernel & RTP proxy - gethostbyname()
  did return a NULL result but has h_errno set to 0 "every fine, thanks")
  Future will show it this helps.
- Had overlooked one inet_aton in register.c - replaced to utils_inet_aton
- Fixed a compiler warning in log.c for Solaris. Siproxd now at least
  builds on Solaris (tested on: SunOS 5.9 sun4u sparc SUNW,Ultra-60)
2003-11-22 21:54:21 +00:00

352 lines
9.4 KiB
Plaintext

dnl
dnl History
dnl -------
dnl before time a lot happend before start of history
dnl 8-Sep-2002 tries included more tests for used functions
dnl 17-Sep-2002 tries fail configure if needed libs not there
dnl 14-Nov-2002 tries support for *BSD systems
dnl 22-Mar-2003 tries check for sockaddr_t, hstrerror()
dnl --enable-almost-static (for Fli4l use)
dnl --enable-uclibc (uClibc building support)
dnl 29-Mar-2003 tries added support for libosip2
dnl 6-Apr-2003 tries redone the fli4l specific build options
dnl now: --enable-fli4l-libc5, --enable-fli4l-uclibc
dnl 7-Apr-2003 tries added siproxd.spec to autoconf process
dnl 31-Jul-2003 tries changed to support OSIP2 only
dnl 1-Sep-2003 tries check for IPCHAINS
dnl 5-Sep-2003 tries test for pthreads before libosip stuff
dnl 19-Sep-2003 tries DMALLOC support
dnl 1-Nov-2003 tries check for NETFILTER (IPTABLES)
dnl 18-Nov-2003 tries include sysconfdir to search for config
dnl 19-Nov-2003 tries changes to support Solaris & BSD/OS
dnl 22-Nov-2003 tries test for gethostbyname_r() & # of args
dnl
dnl
dnl
dnl
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/siproxd.c)
dnl ******************************************************************
dnl
dnl Release Version
dnl
SPD_MAJOR_VERSION=0
SPD_MINOR_VERSION=5
SPD_MICRO_VERSION=0
SPD_VERSION=$SPD_MAJOR_VERSION.$SPD_MINOR_VERSION.$SPD_MICRO_VERSION
dnl *********************************************************************
dnl
dnl Initialize automake stuff
dnl
AC_CONFIG_AUX_DIR(scripts)
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(siproxd, $SPD_VERSION)
dnl
dnl Checks for needed programs.
dnl
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
dnl
dnl add
dnl --with-extra-includes
dnl --with-extra-libs
dnl
AC_ARG_WITH(extra-includes,
[ --with-extra-includes=DIR adds non standard include paths],
extra_includes="$withval" )
AC_SUBST(extra_includes)
AC_MSG_CHECKING("extra includes")
AC_MSG_RESULT($extra_includes)
AC_ARG_WITH(extra-libs,
[ --with-extra-libs=DIR adds non standard library paths],
extra_libs="$withval" )
AC_SUBST(extra_libs)
AC_MSG_CHECKING("extra libs")
AC_MSG_RESULT($extra_libs)
for each in $extra_includes; do
CPPFLAGS="$CPPFLAGS -I$each";
done
for each in $extra_libs; do
LIBS="$LIBS -L$each";
done
dnl
dnl add
dnl --enable-dmalloc
AC_MSG_CHECKING(building with DMALLOC support)
AC_ARG_ENABLE(dmalloc,
[ --enable-dmalloc build with DMALLOC support],
CFLAGS="$CFLAGS -DDMALLOC ";LIBS="-ldmallocth $LIBS";
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
dnl
dnl general stuff
dnl _POSIX_THREAD_SAFE_FUNCTIONS needed by some platforms to make
dnl reentrant functions available (gethostbyname_r)
CFLAGS="$CFLAGS -D_POSIX_THREAD_SAFE_FUNCTIONS"
dnl
dnl system specific stuff
dnl
AC_MSG_CHECKING(target platform)
case "$target" in
*-*-linux*)
AC_MSG_RESULT(Linux)
AC_DEFINE(_LINUX,,[building on Linux platform])
AC_CHECK_HEADERS(linux/ip_masq.h)
AC_CHECK_HEADERS(linux/netfilter.h)
;;
*-*-freebsd*)
AC_MSG_RESULT(FreeBSD)
AC_DEFINE(_BSD,,[building on BSD platform])
AC_DEFINE(_FREEBSD,,[building on FreeBSD platform])
CPPFLAGS="$CPPFLAGS -I/usr/local/include/"
LIBS="$LIBS -L/usr/local/lib/ -lgnugetopt"
;;
*-*-openbsd*)
AC_MSG_RESULT(OpenBSD)
AC_DEFINE(_BSD,,[building on BSD platform])
AC_DEFINE(_OPENBSD,,[building on OpenBSD platform])
CPPFLAGS="$CPPFLAGS -I/usr/local/include/"
LIBS="$LIBS -L/usr/local/lib/"
;;
*-*-netbsd*)
AC_MSG_RESULT(NetBSD)
AC_DEFINE(_BSD,,[building on BSD platform])
AC_DEFINE(_NETBSD,,[building on NetBSD platform])
CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
LIBS="$LIBS -L/usr/pkg/lib"
;;
*-*-bsdi* | *-*-bsdos*)
AC_MSG_RESULT(BSD/OS)
AC_DEFINE(_BSD,,[building on BSD platform])
AC_DEFINE(_BSDOS,,[building on BSD/OS platform])
;;
*-*-solaris2*)
# It's easier to do this here, rather than AC_CHECK_LIBS for all of the
# things that are/might be in libsocket or libnsl...
AC_MSG_RESULT(Solaris 2.x)
AC_DEFINE(_SOLARIS2,,[building on Solaris2 platform])
LIBS="$LIBS -lsocket -lnsl"
;;
*)
;;
esac
dnl
dnl Feature:
dnl Fli4l uClibc support (only available on Linux, yet)
dnl
build_fli4l_uclibc="no"
AC_MSG_CHECKING(whether build for FLI4L uClibc)
case "$target" in
*-*-linux*)
AC_ARG_ENABLE(fli4l-uclibc,
[ --enable-fli4l-uclibc FLI4L: build for uClibc],
build_fli4l_uclibc=$enableval,)
AC_MSG_RESULT($build_fli4l_uclibc)
;;
*)
AC_MSG_RESULT(fli4l-uclibc not available on this platform)
;;
esac
dnl
dnl Feature:
dnl Fli4l libc5 support (only available on Linux, yet)
dnl
build_fli4l_libc5="no"
AC_MSG_CHECKING(building for FLI4L libc5)
case "$target" in
*-*-linux*)
AC_ARG_ENABLE(fli4l-libc5,
[ --enable-fli4l-libc5 FLI4L: build for libc5],
build_fli4l_libc5=$enableval,)
AC_MSG_RESULT($build_fli4l_libc5)
;;
*)
AC_MSG_RESULT(fli4l-libc5 not available on this platform)
;;
esac
if test "x$build_fli4l_uclibc" = "xyes"; then
dnl FLI4l uClibc: make only libosip static
build_static_libosip="yes"
build_static_pthread="no"
elif test "x$build_fli4l_libc5" = "xyes"; then
dnl FLI4l libc5: make libosip and libpthread static
build_static_libosip="yes"
build_static_pthread="yes"
else
dnl build all dynamically linked
build_static_libosip="no"
build_static_pthread="no"
fi
dnl
dnl Check for pthreads
dnl
ACX_PTHREAD(,
echo "*** ERROR: pthreads is required!"; exit 1;)
if test "x$build_static_pthread" = "xno"; then
dnl link dynamically (default)
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
else
dnl link statically to this lib
dnl (this probably only will work on linux yet...)
AC_MSG_CHECKING("where I can find static threads library")
libpthreads_static=`find $extra_libs /lib /usr/lib /usr/local/lib \
-name 'lib*thread*.a' 2>/dev/null| \
egrep 'lib[p]?thread[s]?.a' |head -1`
if test "x$libpthreads_static" != "x"; then
LIBS="$libpthreads_static $LIBS"
AC_MSG_RESULT($libpthreads_static)
else
echo "*** ERROR: a static threads library is required!";exit 1;
fi
CC="$PTHREAD_CC"
fi
dnl
dnl add
dnl --with-libosip-prefix=DIR
dnl
libosip_prefix_dir=""
AC_ARG_WITH(libosip-prefix,
[ --with-libosip-prefix=DIR use libosip2 from DIR/include and DIR/lib],
if test x$withval != x ; then libosip_prefix_dir="$withval"; fi,
)
AC_SUBST(libosip_prefix_dir)
dnl
dnl Check for libosip
dnl
if test x$libosip_prefix_dir != x; then
LIBS="-L$libosip_prefix_dir/lib $LIBS"
CPPFLAGS="$CPPFLAGS -I$libosip_prefix_dir/include"
fi
if test "x$build_static_libosip" = "xno"; then
dnl link dynamically (default)
AC_CHECK_LIB(osip2, osip_init,,
echo "*** ERROR: libosip2 is required! "\
"Maybe you need to use --with-libosip-prefix ?"; exit 1;,
[-losipparser2])
AC_CHECK_LIB(osipparser2, parser_init,,
echo "*** ERROR: libosipparser2 is required!";exit 1;,)
else
dnl link statically to this lib
dnl (this probably only will work on linux yet...)
AC_MSG_CHECKING("where I can find libosip2.a")
libosip_static=`find $extra_libs /lib /usr/lib /usr/local/lib \
-name libosip2.a 2>/dev/null|head -1`
if test "x$libosip_static" != "x"; then
LIBS="$libosip_static $LIBS"
AC_MSG_RESULT($libosip_static)
else
echo "*** ERROR: a static libosip library is required!";exit 1;
fi
AC_MSG_CHECKING("where I can find libosipparser2.a")
libosip_static=`find $extra_libs /lib /usr/lib /usr/local/lib \
-name libosipparser2.a 2>/dev/null|head -1`
if test "x$libosip_static" != "x"; then
LIBS="$libosip_static $LIBS"
AC_MSG_RESULT($libosip_static)
else
echo "*** ERROR: a static libosip library is required!";exit 1;
fi
fi
dnl
dnl Checks for header files.
dnl
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/time.h unistd.h errno.h)
AC_CHECK_HEADERS(stdarg.h varargs.h)
AC_CHECK_HEADERS(pwd.h getopt.h)
dnl
dnl Checks for typedefs, structures, and compiler characteristics.
dnl
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
dnl check for typedef socklen (not available on SUSE 5.3 for example)
AC_MSG_CHECKING(typedef socklen_t)
AC_EGREP_HEADER([typedef.*socklen_t], sys/socket.h,
AC_MSG_RESULT(available),
AC_MSG_RESULT(not available - create DEFINE to uint)
AC_DEFINE(socklen_t, [unsigned int],[typedef socklen_t available])
)
dnl
dnl Checks for library functions.
dnl
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strerror)
AC_CHECK_FUNCS(gethostbyname gethostbyname_r)
ACX_WHICH_GETHOSTBYNAME_R()
AC_CHECK_FUNCS(getopt_long daemon syslog)
AC_CHECK_FUNCS(getuid setuid getgid setgid getpwnam chroot)
AC_CHECK_FUNCS(socket bind select read send sendto)
AC_CHECK_FUNCS(strncpy strchr strstr sprintf vfprintf vsnprintf)
AC_CHECK_FUNCS(fgets sscanf hstrerror)
AC_CHECK_FUNCS(inet_pton inet_ntop inet_aton inet_ntoa)
dnl
dnl sysconfdir
dnl
SIPROXDCONFPATH=""
tmpset="$sysconfdir"
while test "x$tmpset" != "x$SIPROXDCONFPATH"; do
SIPROXDCONFPATH="$tmpset"
eval tmpset="$tmpset"
done
AC_DEFINE_UNQUOTED(SIPROXDCONFPATH,"$SIPROXDCONFPATH",
[will search for config file here])
AC_SUBST(CPPFLAGS)
AC_SUBST(LIBS)
dnl
dnl Generate output files
dnl
AC_OUTPUT( \
siproxd.spec \
Makefile \
src/Makefile \
doc/Makefile \
scripts/Makefile \
)