# Process this file with autoconf to produce a configure script. # $Id: configure.in,v 1.50 2003/06/18 22:55:56 brendan Exp $ m4_define(libshout_major, 2) m4_define(libshout_minor, 0) m4_define(libshout_micro, 0) m4_define(libshout_version, m4_if(libshout_micro, 0, libshout_major.libshout_minor[b1], libshout_major.libshout_minor.libshout_micro[b1])) AC_INIT([libshout], libshout_version, [icecast@xiph.org]) AC_PREREQ(2.52) AC_CONFIG_SRCDIR([src/shout.c]) AM_CONFIG_HEADER(config.h) # config.h guard AH_TOP([#ifndef __CONFIG_H__ #define __CONFIG_H__ 1]) AH_BOTTOM([#endif]) AC_DEFINE([LIBSHOUT_MAJOR], libshout_major, [Shout library major version]) AC_DEFINE([LIBSHOUT_MINOR], libshout_minor, [Shout library minor version]) AC_DEFINE([LIBSHOUT_MICRO], libshout_micro, [Shout library patch version]) VERSION=libshout_version AM_INIT_AUTOMAKE([libshout], libshout_version) AM_MAINTAINER_MODE AC_PROG_CC AM_PROG_LIBTOOL dnl Set some options based on environment dnl openbsd headers break when _XOPEN_SOURCE is defined but without it seems dnl to be fine case "$ac_cv_host" in *openbsd*) ;; *solaris*) ;; *) AC_DEFINE(_XOPEN_SOURCE, 600, [Define if you have POSIX and XPG specifications]) ;; esac if test -z "$GCC"; then case $host in *-*-irix*) DEBUG="-g -signed" CFLAGS="-O2 -w -signed" PROFILE="-p -g3 -O2 -signed" ;; sparc-sun-solaris*) DEBUG="-v -g" CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;; *) DEBUG="-g" CFLAGS="-O" PROFILE="-g -p" ;; esac else XIPH_CFLAGS="-Wall -ffast-math -fsigned-char" AC_DEFINE(_GNU_SOURCE, ,[Define if you have POSIX and GNU specifications]) DEBUG="-g" PROFILE="-pg -g" fi 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]) 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 #endif #if HAVE_SYS_SOCKET_H # include #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 ], [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 ], [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])] ) ]) 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) dnl Extra dependencies AC_ARG_ENABLE([pthread], AC_HELP_STRING([--disable-pthread],[do not link with pthread even if it is available])) have_thread="no" if test "$enable_pthread" != "no" then ACX_PTHREAD([ LIBS="$LIBS $PTHREAD_LIBS" XIPH_CFLAGS="$XIPH_CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" have_thread="yes" ]) fi AM_CONDITIONAL([HAVE_THREAD], [test "$have_thread" = "yes"]) if test "$have_thread" != "yes" then AC_DEFINE([NO_THREAD], 1, [Define if you don't want to use the thread library]) fi XIPH_PATH_VORBIS VORBIS_LIBS="$VORBIS_LDFLAGS $VORBIS_LIBS" XIPH_CFLAGS="$XIPH_CFLAGS $VORBIS_CFLAGS" dnl pkgconfig/shout-config. dnl If pkgconfig is found, use it and disable shout-config, otherwise do the dnl opposite, unless the user overrides. AC_ARG_ENABLE([pkgconfig], AC_HELP_STRING([--disable-pkgconfig],[disable pkgconfig data files (auto)]), [dopkgconfig="$enableval"], [dopkgconfig="maybe"]) if test "$dopkgconfig" = "maybe" then AC_CHECK_PROG([PKGCONFIG], [pkg-config], [yes], [no]) else AC_MSG_CHECKING([whether pkgconfig should be used]) PKGCONFIG="$dopkgconfig" AC_MSG_RESULT([$PKGCONFIG]) fi 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], [SHOUT_CFLAGS]) AC_SUBST(SHOUT_LIBDEPS) AC_SUBST(SHOUT_CFLAGS) AC_CONFIG_LIBCONFIG_IN_STATIC AC_CONFIG_LIBCONFIG_IN([shout]) dnl Make substitutions AC_SUBST(LIBTOOL_DEPS) AC_SUBST(OPT) AC_SUBST(LIBS) AC_SUBST(DEBUG) AC_SUBST(CFLAGS) AC_SUBST(PROFILE) AC_SUBST(XIPH_CFLAGS) AC_OUTPUT([Makefile include/Makefile include/shout/Makefile src/Makefile src/net/Makefile src/timing/Makefile src/thread/Makefile src/avl/Makefile src/httpp/Makefile examples/Makefile shout-config shout.pc])