-
Notifications
You must be signed in to change notification settings - Fork 28
/
configure.ac
238 lines (205 loc) · 6.82 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# Process this file with autoconf to produce a configure script.
# $Id$
m4_define(libshout_major, 2)
m4_define(libshout_minor, 4)
m4_define(libshout_micro, 3)
m4_define(libshout_version, libshout_major.libshout_minor.libshout_micro)
AC_INIT([libshout], libshout_version, [[email protected]])
AC_PREREQ([2.54])
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
AM_MAINTAINER_MODE
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 */
#define _mangle(proc) _shout_ ## proc
])
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* | *irix*)
;;
*) 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_HEADER_TIME
AC_CHECK_HEADERS([strings.h sys/timeb.h arpa/inet.h])
AC_CHECK_HEADERS([stdarg.h], [SHOUT_STDARG=1], [AC_MSG_ERROR([required header <stdarg.h> not found])])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
XIPH_C99_INTTYPES
dnl Checks for library functions.
AC_CHECK_FUNCS([gettimeofday ftime])
AC_CHECK_FUNCS([strcasestr])
AC_SEARCH_LIBS([nanosleep], [rt],
[AC_DEFINE([HAVE_NANOSLEEP], [1],
[Define if you have the nanosleep function])])
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"])
dnl Module checks
XIPH_NET
dnl Extra dependencies
AC_ARG_ENABLE([thread],
AC_HELP_STRING([--disable-thread],[do not build with thread support even if it is available]))
SHOUT_THREADSAFE="0"
if test "$enable_thread" != "no"
then
ACX_PTHREAD([
LIBS="$LIBS $PTHREAD_LIBS"
XIPH_CFLAGS="$XIPH_CFLAGS $PTHREAD_CFLAGS $PTHREAD_CPPFLAGS"
CC="$PTHREAD_CC"
SHOUT_THREADSAFE="1"
])
fi
AC_SUBST([SHOUT_THREADSAFE])
AM_CONDITIONAL([HAVE_THREAD], [test "$SHOUT_THREADSAFE" = "1"])
if test "$SHOUT_THREADSAFE" != "1"
then
AC_DEFINE([NO_THREAD], 1, [Define if you don't want to use the thread library])
fi
SHOUT_REQUIRES="ogg"
PKG_CHECK_MODULES(VORBIS, vorbis, [
HAVE_VORBIS="yes"
SHOUT_REQUIRES="$SHOUT_REQUIRES, vorbis"
], [
XIPH_PATH_VORBIS(, [AC_MSG_ERROR([required Ogg Vorbis library not found])])
])
VORBIS_LIBS="$VORBIS_LDFLAGS $VORBIS_LIBS"
XIPH_CFLAGS="$XIPH_CFLAGS $VORBIS_CFLAGS"
AC_ARG_ENABLE([theora],
AC_HELP_STRING([--disable-theora],[do not build with Theora support]))
if test "x$enable_theora" != "xno"; then
PKG_CHECK_MODULES(THEORA, theora, [
HAVE_THEORA="yes"
SHOUT_REQUIRES="$SHOUT_REQUIRES, theora"
], [
XIPH_PATH_THEORA(, [AC_MSG_WARN([Theora library not found, disabling])])
])
fi
XIPH_VAR_APPEND([XIPH_CPPFLAGS],[$THEORA_CFLAGS])
XIPH_VAR_PREPEND([XIPH_LIBS],[$THEORA_LDFLAGS $THEORA_LIBS])
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
AC_ARG_ENABLE([speex],
AC_HELP_STRING([--disable-speex],[do not build with Speex support]))
if test "x$enable_speex" != "xno"; then
PKG_CHECK_MODULES(SPEEX, speex, [
HAVE_SPEEX="yes"
SHOUT_REQUIRES="$SHOUT_REQUIRES, speex"
], [
XIPH_PATH_SPEEX(, [AC_MSG_WARN([Speex library not found, disabling])])
])
fi
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
dnl If pkgconfig is found, install a shout.pc file.
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"])
# Collect flags for shout.pc
# 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"
XIPH_PATH_OPENSSL([
XIPH_VAR_APPEND([XIPH_CPPFLAGS],[$OPENSSL_CFLAGS])
XIPH_VAR_APPEND([XIPH_LDFLAGS],[$OPENSSL_LDFLAGS])
XIPH_VAR_PREPEND([XIPH_LIBS],[$OPENSSL_LIBS])
SHOUT_REQUIRES="$SHOUT_REQUIRES, libssl"
SHOUT_TLS="1"
],
[ AC_MSG_NOTICE([SSL disabled!])
SHOUT_TLS="0"
])
AC_SUBST([SHOUT_TLS])
AM_CONDITIONAL([HAVE_TLS], [test -n "$OPENSSL_LIBS"])
SHOUT_VERSION="$VERSION"
SHOUT_CPPFLAGS="-I$shout_includedir $VORBIS_CFLAGS $PTHREAD_CPPFLAGS"
SHOUT_CFLAGS="$PTHREAD_CFLAGS"
SHOUT_LIBS="-lshout"
XIPH_CLEAN_CCFLAGS([$SHOUT_CPPFLAGS], [SHOUT_CPPFLAGS])
XIPH_CLEAN_CCFLAGS([$SHOUT_CFLAGS], [SHOUT_CFLAGS])
XIPH_CLEAN_CCFLAGS([$VORBIS_LIBS $THEORA_LIBS $SPEEX_LIBS $PTHREAD_LIBS $OPENSSL_LIBS $OPENSSL_LIBS $LIBS], [SHOUT_LIBDEPS])
AC_SUBST(PTHREAD_CPPFLAGS)
AC_SUBST(SHOUT_LIBDEPS)
AC_SUBST(SHOUT_REQUIRES)
AC_SUBST(SHOUT_CPPFLAGS)
AC_SUBST(SHOUT_CFLAGS)
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_SUBST(XIPH_CPPFLAGS)
AC_SUBST(XIPH_LIBS)
AC_OUTPUT([Makefile include/Makefile include/shout/Makefile
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
examples/Makefile win32/Makefile shout.pc])