Blame configure.ac

Packit Service 102f81
# Process this file with autoconf to produce a configure script.
Packit Service 102f81
# $Id: configure.ac 11154 2006-04-18 00:09:33Z brendan $
Packit Service 102f81
Packit Service 102f81
m4_define(libshout_major, 2)
Packit Service 102f81
m4_define(libshout_minor, 2)
Packit Service 102f81
m4_define(libshout_micro, 2)
Packit Service 102f81
m4_define(libshout_version,
Packit Service 102f81
  m4_if(libshout_micro, 0, libshout_major.libshout_minor,
Packit Service 102f81
   libshout_major.libshout_minor.libshout_micro))
Packit Service 102f81
Packit Service 102f81
AC_INIT([libshout], libshout_version, [icecast-dev@xiph.org])
Packit Service 102f81
AC_PREREQ([2.54])
Packit Service 102f81
AC_CONFIG_SRCDIR([src/shout.c])
Packit Service 102f81
AM_CONFIG_HEADER(config.h)
Packit Service 102f81
# config.h guard
Packit Service 102f81
AH_TOP([#ifndef __CONFIG_H__
Packit Service 102f81
#define __CONFIG_H__ 1])
Packit Service 102f81
AH_BOTTOM([#endif])
Packit Service 102f81
Packit Service 102f81
AC_DEFINE([LIBSHOUT_MAJOR], libshout_major, [Shout library major version])
Packit Service 102f81
AC_DEFINE([LIBSHOUT_MINOR], libshout_minor, [Shout library minor version])
Packit Service 102f81
AC_DEFINE([LIBSHOUT_MICRO], libshout_micro, [Shout library patch version])
Packit Service 102f81
Packit Service 102f81
VERSION=libshout_version
Packit Service 102f81
Packit Service 102f81
AM_INIT_AUTOMAKE([libshout], libshout_version)
Packit Service 102f81
AM_MAINTAINER_MODE
Packit Service 102f81
Packit Service 102f81
dnl create our name mangling macro
Packit Service 102f81
dnl the prefix must be hardwired because of AH limitations
Packit Service 102f81
AH_VERBATIM([_mangle], [
Packit Service 102f81
/* name mangling to protect code we share with other libraries */
Packit Service 102f81
#define _mangle(proc) _shout_ ## proc
Packit Service 102f81
])
Packit Service 102f81
Packit Service 102f81
AC_PROG_CC
Packit Service 102f81
AM_PROG_LIBTOOL
Packit Service 102f81
Packit Service 102f81
dnl Set some options based on environment
Packit Service 102f81
Packit Service 102f81
dnl openbsd headers break when _XOPEN_SOURCE is defined but without it seems
Packit Service 102f81
dnl to be fine
Packit Service 102f81
case "$ac_cv_host" in
Packit Service 102f81
   *openbsd* | *solaris* | *irix*)
Packit Service 102f81
   ;;
Packit Service 102f81
   *) AC_DEFINE(_XOPEN_SOURCE, 600, [Define if you have POSIX and XPG specifications])
Packit Service 102f81
   ;;
Packit Service 102f81
esac
Packit Service 102f81
if test -z "$GCC"; then
Packit Service 102f81
        case $host in 
Packit Service 102f81
        *-*-irix*)
Packit Service 102f81
                DEBUG="-g -signed" 
Packit Service 102f81
                CFLAGS="-O2 -w -signed"
Packit Service 102f81
                PROFILE="-p -g3 -O2 -signed"
Packit Service 102f81
		;;
Packit Service 102f81
        sparc-sun-solaris*)
Packit Service 102f81
                DEBUG="-v -g"
Packit Service 102f81
                CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
Packit Service 102f81
                PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc"
Packit Service 102f81
		;;
Packit Service 102f81
        *)
Packit Service 102f81
                DEBUG="-g"
Packit Service 102f81
                CFLAGS="-O"
Packit Service 102f81
                PROFILE="-g -p" 
Packit Service 102f81
		;;
Packit Service 102f81
        esac
Packit Service 102f81
else
Packit Service 102f81
        XIPH_CFLAGS="-Wall -ffast-math -fsigned-char"
Packit Service 102f81
        AC_DEFINE(_GNU_SOURCE, ,[Define if you have POSIX and GNU specifications])
Packit Service 102f81
        DEBUG="-g"
Packit Service 102f81
        PROFILE="-pg -g"
Packit Service 102f81
fi
Packit Service 102f81
Packit Service 102f81
dnl Checks for programs.
Packit Service 102f81
Packit Service 102f81
dnl Checks for header files.
Packit Service 102f81
AC_HEADER_STDC
Packit Service 102f81
AC_CHECK_HEADERS([strings.h])
Packit Service 102f81
Packit Service 102f81
dnl Checks for typedefs, structures, and compiler characteristics.
Packit Service 102f81
AC_C_CONST
Packit Service 102f81
AC_C_INLINE
Packit Service 102f81
XIPH_C99_INTTYPES
Packit Service 102f81
Packit Service 102f81
dnl Checks for library functions.
Packit Service 102f81
AC_SEARCH_LIBS([nanosleep], [rt],
Packit Service 102f81
  [AC_DEFINE([HAVE_NANOSLEEP], [1],
Packit Service 102f81
    [Define if you have the nanosleep function])])
Packit Service 102f81
Packit Service 102f81
dnl Module checks
Packit Service 102f81
XIPH_NET
Packit Service 102f81
Packit Service 102f81
dnl Extra dependencies
Packit Service 102f81
AC_ARG_ENABLE([thread],
Packit Service 102f81
  AC_HELP_STRING([--disable-thread],[do not build with thread support even if it is available]))
Packit Service 102f81
Packit Service 102f81
SHOUT_THREADSAFE="0"
Packit Service 102f81
if test "$enable_thread" != "no"
Packit Service 102f81
then
Packit Service 102f81
  ACX_PTHREAD([
Packit Service 102f81
    LIBS="$LIBS $PTHREAD_LIBS"
Packit Service 102f81
    XIPH_CFLAGS="$XIPH_CFLAGS $PTHREAD_CFLAGS $PTHREAD_CPPFLAGS"
Packit Service 102f81
    CC="$PTHREAD_CC"
Packit Service 102f81
    SHOUT_THREADSAFE="1"
Packit Service 102f81
    ])
Packit Service 102f81
fi
Packit Service 102f81
AC_SUBST([SHOUT_THREADSAFE])
Packit Service 102f81
AM_CONDITIONAL([HAVE_THREAD], [test "$SHOUT_THREADSAFE" = "1"])
Packit Service 102f81
if test "$SHOUT_THREADSAFE" != "1"
Packit Service 102f81
then
Packit Service 102f81
  AC_DEFINE([NO_THREAD], 1, [Define if you don't want to use the thread library])
Packit Service 102f81
fi
Packit Service 102f81
Packit Service 102f81
SHOUT_REQUIRES="ogg"
Packit Service 102f81
Packit Service 102f81
PKG_CHECK_MODULES(VORBIS, vorbis, [
Packit Service 102f81
    HAVE_VORBIS="yes"
Packit Service 102f81
    SHOUT_REQUIRES="$SHOUT_REQUIRES, vorbis"
Packit Service 102f81
  ], [
Packit Service 102f81
    XIPH_PATH_VORBIS(, [AC_MSG_ERROR([requisite Ogg Vorbis library not found])])
Packit Service 102f81
  ])
Packit Service 102f81
VORBIS_LIBS="$VORBIS_LDFLAGS $VORBIS_LIBS"
Packit Service 102f81
XIPH_CFLAGS="$XIPH_CFLAGS $VORBIS_CFLAGS"
Packit Service 102f81
Packit Service 102f81
PKG_CHECK_MODULES(THEORA, theora, [
Packit Service 102f81
    HAVE_THEORA="yes"
Packit Service 102f81
    SHOUT_REQUIRES="$SHOUT_REQUIRES, theora"
Packit Service 102f81
  ], [
Packit Service 102f81
    XIPH_PATH_THEORA(, [AC_MSG_WARN([Theora library not found, disabling])])
Packit Service 102f81
  ])
Packit Service 102f81
XIPH_VAR_APPEND([XIPH_CPPFLAGS],[$THEORA_CFLAGS])
Packit Service 102f81
XIPH_VAR_PREPEND([XIPH_LIBS],[$THEORA LDFLAGS $THEORA_LIBS])
Packit Service 102f81
AM_CONDITIONAL([HAVE_THEORA], [test -n "$THEORA_LIBS"])
Packit Service 102f81
if test -n "$THEORA_LIBS"
Packit Service 102f81
then
Packit Service 102f81
  AC_DEFINE([HAVE_THEORA], 1, [Define if you want theora streams supported])
Packit Service 102f81
fi
Packit Service 102f81
Packit Service 102f81
PKG_CHECK_MODULES(SPEEX, speex, [
Packit Service 102f81
    HAVE_SPEEX="yes"
Packit Service 102f81
    SHOUT_REQUIRES="$SHOUT_REQUIRES, speex"
Packit Service 102f81
  ], [
Packit Service 102f81
    XIPH_PATH_SPEEX(, [AC_MSG_WARN([Speex library not found, disabling])])
Packit Service 102f81
  ])
Packit Service 102f81
XIPH_VAR_APPEND([XIPH_CPPFLAGS],[$SPEEX_CFLAGS])
Packit Service 102f81
XIPH_VAR_PREPEND([XIPH_LIBS],[$SPEEX LDFLAGS $SPEEX_LIBS])
Packit Service 102f81
AM_CONDITIONAL([HAVE_SPEEX], [test -n "$SPEEX_LIBS"])
Packit Service 102f81
if test -n "$SPEEX_LIBS"
Packit Service 102f81
then
Packit Service 102f81
  AC_DEFINE([HAVE_SPEEX], 1, [Define if you want speex streams supported])
Packit Service 102f81
fi
Packit Service 102f81
Packit Service 102f81
dnl pkgconfig/shout-config.
Packit Service 102f81
dnl If pkgconfig is found, use it and disable shout-config, otherwise do the
Packit Service 102f81
dnl opposite, unless the user overrides.
Packit Service 102f81
Packit Service 102f81
AC_ARG_ENABLE([pkgconfig],
Packit Service 102f81
  AC_HELP_STRING([--disable-pkgconfig],[disable pkgconfig data files (auto)]),
Packit Service 102f81
  [dopkgconfig="$enableval"], [dopkgconfig="maybe"])
Packit Service 102f81
if test "$dopkgconfig" = "maybe"
Packit Service 102f81
then
Packit Service 102f81
  AC_CHECK_PROG([PKGCONFIG], [pkg-config], [yes], [no])
Packit Service 102f81
else
Packit Service 102f81
  AC_MSG_CHECKING([whether pkgconfig should be used])
Packit Service 102f81
  PKGCONFIG="$dopkgconfig"
Packit Service 102f81
  AC_MSG_RESULT([$PKGCONFIG])
Packit Service 102f81
fi
Packit Service 102f81
AM_CONDITIONAL([HAVE_PKGCONFIG], [test "$PKGCONFIG" != "no"])
Packit Service 102f81
Packit Service 102f81
# Build shout-config, shout.pc
Packit Service 102f81
Packit Service 102f81
# I hate myself for doing this.
Packit Service 102f81
save_prefix="$prefix"
Packit Service 102f81
if test "$prefix" = "NONE"
Packit Service 102f81
then
Packit Service 102f81
  prefix="$ac_default_prefix"
Packit Service 102f81
fi
Packit Service 102f81
eval shout_includedir="$includedir"
Packit Service 102f81
prefix="$save_prefix"
Packit Service 102f81
Packit Service 102f81
SHOUT_VERSION="$VERSION"
Packit Service 102f81
SHOUT_CPPFLAGS="-I$shout_includedir $VORBIS_CFLAGS $PTHREAD_CPPFLAGS"
Packit Service 102f81
SHOUT_CFLAGS="$PTHREAD_CFLAGS"
Packit Service 102f81
SHOUT_LIBS="-lshout"
Packit Service 102f81
Packit Service 102f81
XIPH_CLEAN_CCFLAGS([$SHOUT_CPPFLAGS], [SHOUT_CPPFLAGS])
Packit Service 102f81
XIPH_CLEAN_CCFLAGS([$SHOUT_CFLAGS], [SHOUT_CFLAGS])
Packit Service 102f81
XIPH_CLEAN_CCFLAGS([$VORBIS_LIBS $THEORA_LIBS $SPEEX_LIBS $PTHREAD_LIBS $LIBS], [SHOUT_LIBDEPS])
Packit Service 102f81
AC_SUBST(PTHREAD_CPPFLAGS)
Packit Service 102f81
AC_SUBST(SHOUT_LIBDEPS)
Packit Service 102f81
AC_SUBST(SHOUT_REQUIRES)
Packit Service 102f81
AC_SUBST(SHOUT_CPPFLAGS)
Packit Service 102f81
AC_SUBST(SHOUT_CFLAGS)
Packit Service 102f81
AC_CONFIG_LIBCONFIG_IN_STATIC
Packit Service 102f81
AC_CONFIG_LIBCONFIG_IN([shout])
Packit Service 102f81
Packit Service 102f81
dnl Make substitutions
Packit Service 102f81
Packit Service 102f81
AC_SUBST(LIBTOOL_DEPS)
Packit Service 102f81
AC_SUBST(OPT)
Packit Service 102f81
AC_SUBST(LIBS)
Packit Service 102f81
AC_SUBST(DEBUG)
Packit Service 102f81
AC_SUBST(CFLAGS)
Packit Service 102f81
AC_SUBST(PROFILE)
Packit Service 102f81
AC_SUBST(XIPH_CFLAGS)
Packit Service 102f81
AC_SUBST(XIPH_CPPFLAGS)
Packit Service 102f81
Packit Service 102f81
AC_OUTPUT([Makefile debian/Makefile include/Makefile include/shout/Makefile
Packit Service 102f81
  include/shout/shout.h src/Makefile src/net/Makefile src/timing/Makefile
Packit Service 102f81
  src/thread/Makefile src/avl/Makefile src/httpp/Makefile doc/Makefile
Packit Service 102f81
  examples/Makefile win32/Makefile shout-config shout.pc])