configure.ac 6.82 KB
Newer Older
1
# Process this file with autoconf to produce a configure script.
2
# $Id$
Jack Moffitt's avatar
Jack Moffitt committed
3

4
m4_define(libshout_major, 2)
5
m4_define(libshout_minor, 4)
6
m4_define(libshout_micro, 3)
7
m4_define(libshout_version, libshout_major.libshout_minor.libshout_micro)
8

9
AC_INIT([libshout], libshout_version, [icecast-dev@xiph.org])
10
AC_PREREQ([2.54])
11
AC_CONFIG_SRCDIR([src/shout.c])
12
AM_CONFIG_HEADER(config.h)
13 14 15 16
# config.h guard
AH_TOP([#ifndef __CONFIG_H__
#define __CONFIG_H__ 1])
AH_BOTTOM([#endif])
17

18 19 20
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])
brendan's avatar
brendan committed
21

22
VERSION=libshout_version
23

Marvin Scholz's avatar
Marvin Scholz committed
24
AM_INIT_AUTOMAKE
brendan's avatar
brendan committed
25
AM_MAINTAINER_MODE
Jack Moffitt's avatar
Jack Moffitt committed
26

27 28 29 30
dnl create our name mangling macro
dnl the prefix must be hardwired because of AH limitations
AH_VERBATIM([_mangle], [
/* name mangling to protect code we share with other libraries */
31
#define _mangle(proc) _shout_ ## proc
32 33
])

Jack Moffitt's avatar
Jack Moffitt committed
34 35 36 37 38
AC_PROG_CC
AM_PROG_LIBTOOL

dnl Set some options based on environment

39 40 41
dnl openbsd headers break when _XOPEN_SOURCE is defined but without it seems
dnl to be fine
case "$ac_cv_host" in
42
   *openbsd* | *solaris* | *irix*)
brendan's avatar
brendan committed
43
   ;;
44
   *) AC_DEFINE(_XOPEN_SOURCE, 600, [Define if you have POSIX and XPG specifications])
45 46
   ;;
esac
Jack Moffitt's avatar
Jack Moffitt committed
47 48 49 50 51 52 53
if test -z "$GCC"; then
        case $host in 
        *-*-irix*)
                DEBUG="-g -signed" 
                CFLAGS="-O2 -w -signed"
                PROFILE="-p -g3 -O2 -signed"
		;;
54
        sparc-sun-solaris*)
Jack Moffitt's avatar
Jack Moffitt committed
55 56 57 58 59 60 61 62 63 64 65
                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
66 67
        XIPH_CFLAGS="-Wall -ffast-math -fsigned-char"
        AC_DEFINE(_GNU_SOURCE, ,[Define if you have POSIX and GNU specifications])
68 69
        DEBUG="-g"
        PROFILE="-pg -g"
Jack Moffitt's avatar
Jack Moffitt committed
70 71 72 73 74 75
fi

dnl Checks for programs.

dnl Checks for header files.
AC_HEADER_STDC
76
AC_HEADER_TIME
77
AC_CHECK_HEADERS([strings.h sys/timeb.h arpa/inet.h])
78
AC_CHECK_HEADERS([stdarg.h], [SHOUT_STDARG=1], [AC_MSG_ERROR([required header <stdarg.h> not found])])
Jack Moffitt's avatar
Jack Moffitt committed
79 80 81

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
82
AC_C_INLINE
brendan's avatar
brendan committed
83
XIPH_C99_INTTYPES
84

Jack Moffitt's avatar
Jack Moffitt committed
85
dnl Checks for library functions.
86
AC_CHECK_FUNCS([gettimeofday ftime])
87
AC_CHECK_FUNCS([strcasestr])
brendan's avatar
brendan committed
88 89 90
AC_SEARCH_LIBS([nanosleep], [rt],
  [AC_DEFINE([HAVE_NANOSLEEP], [1],
    [Define if you have the nanosleep function])])
Jack Moffitt's avatar
Jack Moffitt committed
91

92 93 94 95 96
dnl Allow examples not to be build
AC_ARG_ENABLE([examples],
  AC_HELP_STRING([--disable-examples],[Do not build example code]))
AM_CONDITIONAL([HAVE_EXAMPLES],[test "${enable_examples}" != "no"])

brendan's avatar
brendan committed
97 98
dnl Module checks
XIPH_NET
99

brendan's avatar
brendan committed
100
dnl Extra dependencies
101 102
AC_ARG_ENABLE([thread],
  AC_HELP_STRING([--disable-thread],[do not build with thread support even if it is available]))
103

104
SHOUT_THREADSAFE="0"
105
if test "$enable_thread" != "no"
106 107 108
then
  ACX_PTHREAD([
    LIBS="$LIBS $PTHREAD_LIBS"
109
    XIPH_CFLAGS="$XIPH_CFLAGS $PTHREAD_CFLAGS $PTHREAD_CPPFLAGS"
110
    CC="$PTHREAD_CC"
111
    SHOUT_THREADSAFE="1"
112 113
    ])
fi
114 115 116
AC_SUBST([SHOUT_THREADSAFE])
AM_CONDITIONAL([HAVE_THREAD], [test "$SHOUT_THREADSAFE" = "1"])
if test "$SHOUT_THREADSAFE" != "1"
117 118 119
then
  AC_DEFINE([NO_THREAD], 1, [Define if you don't want to use the thread library])
fi
120

121 122 123 124 125 126
SHOUT_REQUIRES="ogg"

PKG_CHECK_MODULES(VORBIS, vorbis, [
    HAVE_VORBIS="yes"
    SHOUT_REQUIRES="$SHOUT_REQUIRES, vorbis"
  ], [
127
    XIPH_PATH_VORBIS(, [AC_MSG_ERROR([required Ogg Vorbis library not found])])
128
  ])
129 130
VORBIS_LIBS="$VORBIS_LDFLAGS $VORBIS_LIBS"
XIPH_CFLAGS="$XIPH_CFLAGS $VORBIS_CFLAGS"
131

132 133 134 135
AC_ARG_ENABLE([theora],
  AC_HELP_STRING([--disable-theora],[do not build with Theora support]))

if test "x$enable_theora" != "xno"; then
136 137 138 139 140 141
PKG_CHECK_MODULES(THEORA, theora, [
    HAVE_THEORA="yes"
    SHOUT_REQUIRES="$SHOUT_REQUIRES, theora"
  ], [
    XIPH_PATH_THEORA(, [AC_MSG_WARN([Theora library not found, disabling])])
  ])
142
fi
143
XIPH_VAR_APPEND([XIPH_CPPFLAGS],[$THEORA_CFLAGS])
144
XIPH_VAR_PREPEND([XIPH_LIBS],[$THEORA_LDFLAGS $THEORA_LIBS])
145 146 147 148 149 150
AM_CONDITIONAL([HAVE_THEORA], [test -n "$THEORA_LIBS"])
if test -n "$THEORA_LIBS"
then
  AC_DEFINE([HAVE_THEORA], 1, [Define if you want theora streams supported])
fi

151 152 153 154
AC_ARG_ENABLE([speex],
  AC_HELP_STRING([--disable-speex],[do not build with Speex support]))

if test "x$enable_speex" != "xno"; then
155 156 157 158 159 160
PKG_CHECK_MODULES(SPEEX, speex, [
    HAVE_SPEEX="yes"
    SHOUT_REQUIRES="$SHOUT_REQUIRES, speex"
  ], [
    XIPH_PATH_SPEEX(, [AC_MSG_WARN([Speex library not found, disabling])])
  ])
161
fi
162
XIPH_VAR_APPEND([XIPH_CPPFLAGS],[$SPEEX_CFLAGS])
163
XIPH_VAR_PREPEND([XIPH_LIBS],[$SPEEX_LDFLAGS $SPEEX_LIBS])
164 165 166 167 168
AM_CONDITIONAL([HAVE_SPEEX], [test -n "$SPEEX_LIBS"])
if test -n "$SPEEX_LIBS"
then
  AC_DEFINE([HAVE_SPEEX], 1, [Define if you want speex streams supported])
fi
169

170
dnl If pkgconfig is found, install a shout.pc file.
171 172

AC_ARG_ENABLE([pkgconfig],
173
  AC_HELP_STRING([--disable-pkgconfig],[disable pkgconfig data files (auto)]),
174
  [dopkgconfig="$enableval"], [dopkgconfig="maybe"])
brendan's avatar
brendan committed
175
if test "$dopkgconfig" = "maybe"
176 177 178 179 180 181 182
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
183 184
AM_CONDITIONAL([HAVE_PKGCONFIG], [test "$PKGCONFIG" != "no"])

185
# Collect flags for shout.pc
186 187 188 189 190 191 192 193 194 195

# I hate myself for doing this.
save_prefix="$prefix"
if test "$prefix" = "NONE"
then
  prefix="$ac_default_prefix"
fi
eval shout_includedir="$includedir"
prefix="$save_prefix"

196 197 198 199
XIPH_PATH_OPENSSL([
    XIPH_VAR_APPEND([XIPH_CPPFLAGS],[$OPENSSL_CFLAGS])
    XIPH_VAR_APPEND([XIPH_LDFLAGS],[$OPENSSL_LDFLAGS])
    XIPH_VAR_PREPEND([XIPH_LIBS],[$OPENSSL_LIBS])
200
    SHOUT_REQUIRES="$SHOUT_REQUIRES, libssl"
201 202 203 204 205 206 207 208
    SHOUT_TLS="1"
    ],
    [ AC_MSG_NOTICE([SSL disabled!])
      SHOUT_TLS="0"
    ])
AC_SUBST([SHOUT_TLS])
AM_CONDITIONAL([HAVE_TLS], [test -n "$OPENSSL_LIBS"])

209
SHOUT_VERSION="$VERSION"
210 211
SHOUT_CPPFLAGS="-I$shout_includedir $VORBIS_CFLAGS $PTHREAD_CPPFLAGS"
SHOUT_CFLAGS="$PTHREAD_CFLAGS"
212
SHOUT_LIBS="-lshout"
213

214
XIPH_CLEAN_CCFLAGS([$SHOUT_CPPFLAGS], [SHOUT_CPPFLAGS])
215
XIPH_CLEAN_CCFLAGS([$SHOUT_CFLAGS], [SHOUT_CFLAGS])
Philipp Schafft's avatar
Philipp Schafft committed
216
XIPH_CLEAN_CCFLAGS([$VORBIS_LIBS $THEORA_LIBS $SPEEX_LIBS $PTHREAD_LIBS $OPENSSL_LIBS $OPENSSL_LIBS $LIBS], [SHOUT_LIBDEPS])
217
AC_SUBST(PTHREAD_CPPFLAGS)
218
AC_SUBST(SHOUT_LIBDEPS)
219
AC_SUBST(SHOUT_REQUIRES)
220
AC_SUBST(SHOUT_CPPFLAGS)
221
AC_SUBST(SHOUT_CFLAGS)
222

Jack Moffitt's avatar
Jack Moffitt committed
223 224 225 226 227 228 229 230
dnl Make substitutions

AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(OPT)
AC_SUBST(LIBS)
AC_SUBST(DEBUG)
AC_SUBST(CFLAGS)
AC_SUBST(PROFILE)
231
AC_SUBST(XIPH_CFLAGS)
Karl Heyes's avatar
Karl Heyes committed
232
AC_SUBST(XIPH_CPPFLAGS)
Philipp Schafft's avatar
Philipp Schafft committed
233
AC_SUBST(XIPH_LIBS)
Jack Moffitt's avatar
Jack Moffitt committed
234

235
AC_OUTPUT([Makefile include/Makefile include/shout/Makefile
236 237
  include/shout/shout.h src/Makefile src/common/net/Makefile src/common/timing/Makefile
  src/common/thread/Makefile src/common/avl/Makefile src/common/httpp/Makefile doc/Makefile
238
  examples/Makefile win32/Makefile shout.pc])