Commit eec99a6b authored by brendan's avatar brendan
Browse files

Lots more autoconf stuff

1. src/net tests abstracted into XIPH_NET macro. We should do the same for
   src/thread, but it's a little more complicated - it will have to
   interact with the caller (eg some apps may want --disable-threads)
2. uintxx_t, socklen_t tests encapsulated, moved to xiph_types.m4
3. solaris fixes for socket func, nanosleep detection
4. added $LIBS to SHOUT_LIBS for *-config scripts. Good or bad idea?

We'll definitely need a libshout beta 2.

svn path=/trunk/libshout/; revision=5005
parent db55422b
......@@ -6,7 +6,8 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = include src examples
EXTRA_DIST = INSTALL shout.m4 m4/ac_config_libconfig_in.m4 m4/acx_pthread.m4 \
m4/ogg.m4 m4/vorbis.m4 m4/xiph_compiler.m4
m4/ogg.m4 m4/vorbis.m4 m4/xiph_compiler.m4 m4/xiph_net.m4 \
m4/xiph_types.m4
docdir = $(datadir)/doc/$(PACKAGE)
doc_DATA = COPYING README examples/example.c
......
# Process this file with autoconf to produce a configure script.
# $Id: configure.in,v 1.51 2003/06/24 01:09:58 brendan Exp $
# $Id: configure.in,v 1.52 2003/06/24 21:35:44 brendan Exp $
m4_define(libshout_major, 2)
m4_define(libshout_minor, 0)
......@@ -70,70 +70,21 @@ dnl Checks for programs.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([inttypes.h strings.h sys/select.h sys/socket.h sys/uio.h])
AC_CHECK_HEADERS([strings.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
dnl Check for types
AC_CHECK_TYPE([uint32_t],
[AC_DEFINE(HAVE_C99_INTTYPES, 1, [Define if you have the C99 integer types])],
[AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)])
AH_VERBATIM([X_HAVE_C99_INTTYPES],
[#ifndef HAVE_C99_INTTYPES
# if SIZEOF_SHORT == 4
typedef unsigned short uint32_t;
# elif SIZEOF_INT == 4
typedef unsigned int uint32_t;
# elif SIZEOF_LONG == 4
typedef unsigned long uint32_t;
# endif
# if SIZEOF_INT == 8
typedef unsigned int uint64_t;
# elif SIZEOF_LONG == 8
typedef unsigned long uint64_t;
# elif SIZEOF_LONG_LONG == 8
typedef unsigned long long uint64_t;
# endif
#endif])
AC_CHECK_TYPES([socklen_t],,,
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif])
AH_VERBATIM([X_HAVE_SOCKLEN_T],
[#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif])
AC_MSG_CHECKING([how to copy va_list])
AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
AC_MSG_RESULT([va_copy]),
[ AH_TEMPLATE([va_copy], [define if va_copy is not available])
AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
[ AC_DEFINE([va_copy], [__va_copy])
AC_MSG_RESULT([__va_copy])],
[ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
AC_MSG_RESULT([memcpy])]
)
])
XIPH_C99_INTTYPES
dnl Checks for library functions.
AC_CHECK_FUNCS(nanosleep)
AC_CHECK_FUNCS(sethostent endhostent)
AC_SEARCH_LIBS([inet_pton], [socket],
[AC_DEFINE([HAVE_INET_PTON], [1], [Define if you have the inet_pton function])],
[], [-lnsl])
AC_CHECK_FUNCS(getnameinfo getaddrinfo inet_aton)
AC_SEARCH_LIBS([nanosleep], [rt],
[AC_DEFINE([HAVE_NANOSLEEP], [1],
[Define if you have the nanosleep function])])
dnl Extra dependencies
dnl Module checks
XIPH_NET
dnl Extra dependencies
AC_ARG_ENABLE([pthread],
AC_HELP_STRING([--disable-pthread],[do not link with pthread even if it is available]))
......@@ -177,8 +128,9 @@ AM_CONDITIONAL([HAVE_PKGCONFIG], [test "$PKGCONFIG" != "no"])
# Build shout-config, shout.pc
SHOUT_VERSION="$VERSION"
SHOUT_LIBS="-lshout"
XIPH_CLEAN_CCFLAGS([$VORBIS_LIBS $PTHREAD_LIBS], [SHOUT_LIBDEPS])
XIPH_CLEAN_CCFLAGS([$VORBIS_CFLAGS $PTHREAD_CFLAGS $PTHREAD_CPPFLAGS], [SHOUT_CFLAGS])
XIPH_CLEAN_CCFLAGS([$VORBIS_LIBS $PTHREAD_LIBS $LIBS], [SHOUT_LIBDEPS])
XIPH_CLEAN_CCFLAGS([$VORBIS_CFLAGS $PTHREAD_CFLAGS $PTHREAD_CPPFLAGS],
[SHOUT_CFLAGS])
AC_SUBST(SHOUT_LIBDEPS)
AC_SUBST(SHOUT_CFLAGS)
AC_CONFIG_LIBCONFIG_IN_STATIC
......
# XIPH_NET
# Perform tests required by the net module
AC_DEFUN([XIPH_NET],
[dnl
AC_REQUIRE([XIPH_TYPE_SOCKLEN_T])
AC_REQUIRE([XIPH_FUNC_VA_COPY])
AC_CHECK_HEADERS([sys/select.h sys/uio.h])
# These tests are ordered based on solaris 8 tests
AC_SEARCH_LIBS([sethostent], [nsl],
[AC_DEFINE([HAVE_SETHOSTENT], [1],
[Define if you have the sethostent function])])
AC_SEARCH_LIBS([getnameinfo], [socket],
[AC_DEFINE([HAVE_GETNAMEINFO], [1],
[Define if you have the inet_pton function])])
AC_CHECK_FUNCS([endhostent getaddrinfo inet_aton inet_pton])
])
dnl xiph_types.m4
dnl macros for type checks not covered by autoconf
dnl XIPH_C99_INTTYPES
dnl Brendan Cully
dnl
# XIPH_C99_INTTYPES
# Check for C99 integer type definitions, or define if missing
AC_DEFUN([XIPH_C99_INTTYPES],
[dnl
AC_CHECK_HEADERS([inttypes.h])
AC_CHECK_TYPE([uint32_t],
[AC_DEFINE(HAVE_C99_INTTYPES, 1, [Define if you have the C99 integer types])],
[AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)])
AH_VERBATIM([X_HAVE_C99_INTTYPES],
[#ifndef HAVE_C99_INTTYPES
# if SIZEOF_SHORT == 4
typedef unsigned short uint32_t;
# elif SIZEOF_INT == 4
typedef unsigned int uint32_t;
# elif SIZEOF_LONG == 4
typedef unsigned long uint32_t;
# endif
# if SIZEOF_INT == 8
typedef unsigned int uint64_t;
# elif SIZEOF_LONG == 8
typedef unsigned long uint64_t;
# elif SIZEOF_LONG_LONG == 8
typedef unsigned long long uint64_t;
# endif
#endif
])
])
dnl XIPH_TYPE_SOCKLEN_T
dnl Brendan Cully
dnl
# XIPH_TYPE_SOCKLEN_T
# Check for socklen_t, or define as int if missing
AC_DEFUN([XIPH_TYPE_SOCKLEN_T],
[dnl
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_TYPES([socklen_t],,,
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
AH_VERBATIM([X_HAVE_SOCKLEN_T],
[#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
])
])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment