configure.ac 5.96 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)
brendan's avatar
brendan committed
5
m4_define(libshout_minor, 2)
6
7
m4_define(libshout_micro, 0)
m4_define(libshout_version,
brendan's avatar
brendan committed
8
  m4_if(libshout_micro, 0, libshout_major.libshout_minor,
brendan's avatar
brendan committed
9
   libshout_major.libshout_minor.libshout_micro))
10

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

20
21
22
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
23

24
VERSION=libshout_version
25

26
AM_INIT_AUTOMAKE([libshout], libshout_version)
brendan's avatar
brendan committed
27
AM_MAINTAINER_MODE
Jack Moffitt's avatar
Jack Moffitt committed
28

29
30
31
32
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 */
33
#define _mangle(proc) _shout_ ## proc
34
35
])

Jack Moffitt's avatar
Jack Moffitt committed
36
37
38
39
40
AC_PROG_CC
AM_PROG_LIBTOOL

dnl Set some options based on environment

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

dnl Checks for programs.

dnl Checks for header files.
AC_HEADER_STDC
brendan's avatar
brendan committed
78
AC_CHECK_HEADERS([strings.h])
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.
brendan's avatar
brendan committed
86
87
88
AC_SEARCH_LIBS([nanosleep], [rt],
  [AC_DEFINE([HAVE_NANOSLEEP], [1],
    [Define if you have the nanosleep function])])
Jack Moffitt's avatar
Jack Moffitt committed
89

brendan's avatar
brendan committed
90
91
dnl Module checks
XIPH_NET
92

brendan's avatar
brendan committed
93
dnl Extra dependencies
94
95
AC_ARG_ENABLE([thread],
  AC_HELP_STRING([--disable-thread],[do not build with thread support even if it is available]))
96

brendan's avatar
brendan committed
97
SHOUT_THREADSAFE="0"
98
if test "$enable_thread" != "no"
99
100
101
then
  ACX_PTHREAD([
    LIBS="$LIBS $PTHREAD_LIBS"
brendan's avatar
brendan committed
102
    XIPH_CFLAGS="$XIPH_CFLAGS $PTHREAD_CFLAGS $PTHREAD_CPPFLAGS"
103
    CC="$PTHREAD_CC"
brendan's avatar
brendan committed
104
    SHOUT_THREADSAFE="1"
105
106
    ])
fi
brendan's avatar
brendan committed
107
108
109
AC_SUBST([SHOUT_THREADSAFE])
AM_CONDITIONAL([HAVE_THREAD], [test "$SHOUT_THREADSAFE" = "1"])
if test "$SHOUT_THREADSAFE" != "1"
110
111
112
then
  AC_DEFINE([NO_THREAD], 1, [Define if you don't want to use the thread library])
fi
113

114
115
116
117
118
119
120
121
SHOUT_REQUIRES="ogg"

PKG_CHECK_MODULES(VORBIS, vorbis, [
    HAVE_VORBIS="yes"
    SHOUT_REQUIRES="$SHOUT_REQUIRES, vorbis"
  ], [
    XIPH_PATH_VORBIS(, [AC_MSG_ERROR([requisite Ogg Vorbis library not found])])
  ])
122
123
VORBIS_LIBS="$VORBIS_LDFLAGS $VORBIS_LIBS"
XIPH_CFLAGS="$XIPH_CFLAGS $VORBIS_CFLAGS"
124

125
126
127
128
129
130
PKG_CHECK_MODULES(THEORA, theora, [
    HAVE_THEORA="yes"
    SHOUT_REQUIRES="$SHOUT_REQUIRES, theora"
  ], [
    XIPH_PATH_THEORA(, [AC_MSG_WARN([Theora library not found, disabling])])
  ])
131
132
XIPH_VAR_APPEND([XIPH_CPPFLAGS],[$THEORA_CFLAGS])
XIPH_VAR_PREPEND([XIPH_LIBS],[$THEORA LDFLAGS $THEORA_LIBS])
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
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

PKG_CHECK_MODULES(SPEEX, speex, [
    HAVE_SPEEX="yes"
    SHOUT_REQUIRES="$SHOUT_REQUIRES, speex"
  ], [
    XIPH_PATH_SPEEX(, [AC_MSG_WARN([Speex library not found, disabling])])
  ])
XIPH_VAR_APPEND([XIPH_CPPFLAGS],[$SPEEX_CFLAGS])
XIPH_VAR_PREPEND([XIPH_LIBS],[$SPEEX LDFLAGS $SPEEX_LIBS])
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
152

153
154
155
156
157
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],
158
  AC_HELP_STRING([--disable-pkgconfig],[disable pkgconfig data files (auto)]),
159
  [dopkgconfig="$enableval"], [dopkgconfig="maybe"])
brendan's avatar
Typo    
brendan committed
160
if test "$dopkgconfig" = "maybe"
161
162
163
164
165
166
167
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
168
169
AM_CONDITIONAL([HAVE_PKGCONFIG], [test "$PKGCONFIG" != "no"])

170
# Build shout-config, shout.pc
171
172
173
174
175
176
177
178
179
180

# 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"

181
SHOUT_VERSION="$VERSION"
182
183
SHOUT_CPPFLAGS="-I$shout_includedir $VORBIS_CFLAGS $PTHREAD_CPPFLAGS"
SHOUT_CFLAGS="$PTHREAD_CFLAGS"
184
SHOUT_LIBS="-lshout"
185

186
XIPH_CLEAN_CCFLAGS([$SHOUT_CPPFLAGS], [SHOUT_CPPFLAGS])
187
XIPH_CLEAN_CCFLAGS([$SHOUT_CFLAGS], [SHOUT_CFLAGS])
188
XIPH_CLEAN_CCFLAGS([$VORBIS_LIBS $THEORA_LIBS $SPEEX_LIBS $PTHREAD_LIBS $LIBS], [SHOUT_LIBDEPS])
189
AC_SUBST(PTHREAD_CPPFLAGS)
190
AC_SUBST(SHOUT_LIBDEPS)
191
AC_SUBST(SHOUT_REQUIRES)
192
AC_SUBST(SHOUT_CPPFLAGS)
193
AC_SUBST(SHOUT_CFLAGS)
194
195
AC_CONFIG_LIBCONFIG_IN_STATIC
AC_CONFIG_LIBCONFIG_IN([shout])
196

Jack Moffitt's avatar
Jack Moffitt committed
197
198
199
200
201
202
203
204
dnl Make substitutions

AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(OPT)
AC_SUBST(LIBS)
AC_SUBST(DEBUG)
AC_SUBST(CFLAGS)
AC_SUBST(PROFILE)
205
AC_SUBST(XIPH_CFLAGS)
Karl Heyes's avatar
Karl Heyes committed
206
AC_SUBST(XIPH_CPPFLAGS)
Jack Moffitt's avatar
Jack Moffitt committed
207

keegan's avatar
keegan committed
208
AC_OUTPUT([Makefile debian/Makefile include/Makefile include/shout/Makefile
brendan's avatar
brendan committed
209
210
  include/shout/shout.h src/Makefile src/net/Makefile src/timing/Makefile
  src/thread/Makefile src/avl/Makefile src/httpp/Makefile doc/Makefile
211
  examples/Makefile win32/Makefile shout-config shout.pc])