configure.ac 7.08 KB
Newer Older
1
2
3
4
dnl ###########
dnl ## SETUP ###########################################################
dnl ###########

5
AC_INIT([ezstream], [0.6.1], [https://gitlab.xiph.org/xiph/ezstream/issues])
6
AC_REVISION([$Id$])
7
8
9
AC_PREREQ([2.61])
AC_CONFIG_SRCDIR([src/ezstream.c])
AC_CONFIG_AUX_DIR([build-aux])
oddsock's avatar
oddsock committed
10
AM_INIT_AUTOMAKE
11
12
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_LIBOBJ_DIR([src])
oddsock's avatar
oddsock committed
13
AM_MAINTAINER_MODE
14
AC_USE_SYSTEM_EXTENSIONS
moritz's avatar
moritz committed
15
AC_PROG_CC_STDC
16
17
AC_PROG_FGREP
AC_CANONICAL_HOST
18

19
20
21
BUILD_DATE=$(date '+%B %d, %Y')
AC_SUBST([BUILD_DATE])

22
EXAMPLES_DIR="\$(datadir)/examples/${PACKAGE_TARNAME}"
23
24
25
AC_ARG_ENABLE([examplesdir],
	[AS_HELP_STRING([--enable-examplesdir=DIR],
		[examples installation directory (default: DATADIR/examples/ezstream)])],
26
27
[case "$enableval" in
	yes) ;;
28
	no) AC_MSG_ERROR([Must have an install directory for the examples.]) ;;
29
30
	*) EXAMPLES_DIR="$enableval" ;;
esac], [])
31
AC_SUBST([EXAMPLES_DIR])
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
ez_enable_debug=no
AC_ARG_ENABLE([debug],
	[AS_HELP_STRING([--enable-debug],
		[enable memory debugging (default: no)])],
[case "$enableval" in
	no) ;;
	*) ez_enable_debug=yes ;;
esac], [])
AC_MSG_CHECKING([whether to enable debugging])
if test x"${ez_enable_debug}" = "xyes"; then
	AC_DEFINE([XALLOC_DEBUG], [1],
		[Define whether to build with XALLOC debugging])
fi
AC_MSG_RESULT([$ez_enable_debug])
oddsock's avatar
oddsock committed
47

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
EZ_CFLAGS=""
EZ_CPPFLAGS=""
EZ_LDFLAGS=""
EZ_LIBS=""


dnl ##############
dnl ## COMPILER ########################################################
dnl ##############

if test -n "${GCC}"; then
	for _flag in fstack-protector fstrict-aliasing Wall W Wstrict-aliasing \
		Wwrite-strings Wpointer-arith Wshadow Wconversion Wcast-qual \
		Wcast-align Wbounded Wmissing-declarations Wmissing-prototypes \
		Wstrict-prototypes
	do
		AX_CHECK_CFLAG([${_flag}],
65
			[AX_UNIQVAR_APPEND([EZ_CFLAGS], [-${_flag}])], [])
66
67
	done
	AX_CHECK_CFLAG([Wformat=2],
68
		[AX_UNIQVAR_APPEND([EZ_CFLAGS], [-Wformat=2])],
69
70
		[
		  AX_CHECK_CFLAG([Wformat],
71
			[AX_UNIQVAR_APPEND([EZ_CFLAGS], [-Wformat])], [])
72
73
74
		])
else
	case "${host}" in
moritz's avatar
moritz committed
75
	*-irix*)
76
		EZ_CFLAGS="-fullwarn"
moritz's avatar
moritz committed
77
78
		;;
	*-solaris*)
79
		EZ_CFLAGS="-v"
moritz's avatar
moritz committed
80
81
82
83
		;;
	*)
		;;
	esac
oddsock's avatar
oddsock committed
84
85
fi

86
87
AC_C_CONST
AC_C_VOLATILE
88

oddsock's avatar
oddsock committed
89

90
91
92
dnl #############
dnl ## HEADERS #########################################################
dnl #############
oddsock's avatar
oddsock committed
93

94
95
96
97
98
99
100
101
AC_CHECK_HEADERS([ \
	sys/time.h signal.h langinfo.h libgen.h locale.h paths.h \
], [], [],
[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
])
102

103
COMPAT_INCLUDES=""
104
if test x"${ez_enable_debug}" = "xyes"; then
105
	AX_HEADER_TREE([RB_FOREACH], [],
106
107
		[
		  COMPAT_INCLUDES="-I\$(top_srcdir)/compat"
108
		])
109
fi
110
111
112
113
114
115
AC_SUBST([COMPAT_INCLUDES])


dnl ###########
dnl ## TYPES ###########################################################
dnl ###########
116
117
118

AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
119

120

121
122
123
124
125
126
127
128
dnl ###############
dnl ## LIBRARIES #######################################################
dnl ###############

AC_CHECK_LIB([gen], [basename],
	[ AX_UNIQVAR_PREPEND([EZ_LIBS], [-lgen]) ])

AX_CHECK_LIBSHOUT([], [],
129
	[AC_MSG_ERROR([libshout 2.2.x is required.], [1])])
130
131
132
133
134
135
136
137
138
139
140
141
AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${LIBSHOUT_CPPFLAGS}])
AX_UNIQVAR_APPEND([EZ_CFLAGS], [${LIBSHOUT_CFLAGS}])
AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${LIBSHOUT_LDFLAGS}])
AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBSHOUT_LIBS}])

AX_CHECK_LIBXML2([], [],
	[AC_MSG_ERROR([libxml 2.x is required.], [1])])
AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${LIBXML2_CPPFLAGS}])
AX_UNIQVAR_APPEND([EZ_CFLAGS], [${LIBXML2_CFLAGS}])
AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${LIBXML2_LDFLAGS}])
AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBXML2_LIBS}])

142
use_metadata="No"
moritz's avatar
moritz committed
143
AX_CHECK_TAGLIB_C([], [
144
145
146
	AC_DEFINE([HAVE_TAGLIB], [1],
		[Define to 1 if you have the libtag_c library.]
	)
moritz's avatar
moritz committed
147
148
	AX_UNIQVAR_APPEND([EZ_CFLAGS], [${TAGLIB_CFLAGS}])
	AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${TAGLIB_CPPFLAGS}])
149
150
	AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${TAGLIB_LDFLAGS}])
	AX_UNIQVAR_PREPEND([EZ_LIBS], [${TAGLIB_C_LIBS}])
151
152
153
154
155
156
157
158
159
160
161
162
	use_metadata="TagLib"
], [
	AX_CHECK_LIBVORBISFILE([], [
		AC_DEFINE([HAVE_VORBISFILE], [1],
			[Define to 1 if you have the libvorbisfile library.])
		AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${VORBIS_CPPFLAGS}])
		AX_UNIQVAR_APPEND([EZ_CFLAGS], [${VORBIS_CFLAGS}])
		AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${VORBIS_LDFLAGS}])
		AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBVORBISFILE_LIBS}])
		use_metadata="libvorbis"
	], [])
])
163
164
165
166
167
168
169

# Not using AM_ICONV to check for iconv(), with or without libiconv(),
# is not a viable option. Something in the past went horribly wrong;
# the whole topic is extremely complex and not worth rewriting.
# Instead, work around the buggy no-op that is --with-libiconv-prefix,
# and at least try to find it in --prefix. Thankfully, it is and will
# remain optional in ezstream.
170

171
172
INCICONV=""
LDICONV=""
173
174
175
LIBICONV=""
LTLIBICONV=""
EZ_LIBICONV=""
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
AM_ICONV
if test x"${am_cv_func_iconv}" != "xyes"; then
	unset am_cv_func_iconv
	unset am_cv_lib_iconv
	if test x"${prefix}" = "xNONE"; then
		libiconv_prefix="/usr/local"
	else
		libiconv_prefix="${prefix}"
	fi
	AC_MSG_NOTICE([Looking for libiconv in ${libiconv_prefix} ...])
	libiconv_save_CPPFLAGS="${CPPFLAGS}"
	libiconv_save_LDFLAGS="${LDFLAGS}"
	libiconv_save_LIBS="${LIBS}"
	CPPFLAGS="${CPPFLAGS} -I${libiconv_prefix}/include"
	LDFLAGS="${LDFLAGS} -L${libiconv_prefix}/lib"
	LIBS="-liconv"
	AM_ICONV
	if test x"${am_cv_func_iconv}" = "xyes"; then
		INCICONV="-I${libiconv_prefix}/include"
		LDICONV="-L${libiconv_prefix}/lib"
		LIBICONV="-liconv"
	fi
	CPPFLAGS="${libiconv_save_CPPFLAGS}"
	LDFLAGS="${libiconv_save_LDFLAGS}"
	LIBS="${libiconv_save_LIBS}"
fi
if test -n "${LTLIBICONV}"; then
	EZ_LIBICONV="${LTLIBICONV}"
204
else
205
206
207
208
209
210
211
212
	EZ_LIBICONV="${LIBICONV}"
fi
AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [$INCICONV])
AX_UNIQVAR_APPEND([EZ_LDFLAGS], [$LDICONV])
AX_UNIQVAR_PREPEND([EZ_LIBS], [$EZ_LIBICONV])
use_iconv="No"
if test x"${am_cv_func_iconv}" = "xyes"; then
	use_iconv="Yes"
213
fi
214

oddsock's avatar
oddsock committed
215

216
217
218
dnl #######################
dnl ## FUNCTIONS / MACROS ##############################################
dnl #######################
oddsock's avatar
oddsock committed
219

220
221
AC_CHECK_FUNCS([ \
	arc4random \
222
	basename \
223
	getopt \
224
	gettimeofday \
225
	nl_langinfo \
226
227
228
229
	pclose \
	_pclose \
	popen \
	_popen \
230
231
	random \
	setlocale \
232
233
	snprintf \
	_snprintf \
234
235
	srandomdev \
	stat \
236
237
238
239
240
	_stat \
	strncasecmp \
	strnicmp \
	strtoll \
	_strtoi64 \
241
])
moritz's avatar
moritz committed
242

243
244
245
246
247
AC_REPLACE_FUNCS([ \
	strlcat \
	strlcpy \
	strtonum \
])
moritz's avatar
moritz committed
248

249
AX_FUNC_VA_COPY
moritz's avatar
moritz committed
250

251
252
253
254
255
256
257
258
AC_CHECK_FUNCS([sigaction], [
	AC_DEFINE([HAVE_SIGNALS], [1],
		[Define to 1 if we have BSD signals.])
	], [], [
	  #ifdef HAVE_SIGNAL_H
	  # include <signal.h>
	  #endif
	])
moritz's avatar
moritz committed
259

moritz's avatar
moritz committed
260

261
262
263
dnl ##################
dnl ## MISCELLANEOUS ###################################################
dnl ##################
moritz's avatar
moritz committed
264

265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
AX_CHECK___PROGNAME


dnl ############
dnl ## OUTPUT ##########################################################
dnl ############

AC_SUBST([EZ_CPPFLAGS])
AC_SUBST([EZ_CFLAGS])
AC_SUBST([EZ_LDFLAGS])
AC_SUBST([EZ_LIBS])

AC_CONFIG_FILES([
	Makefile
	build-aux/Makefile
	compat/Makefile
	compat/sys/Makefile
	doc/Makefile
283
284
	doc/ezstream-file.sh.1.in
	doc/ezstream.1.in
285
286
287
	examples/Makefile
	m4/Makefile
	src/Makefile
288
	src/ezstream-file.sh
289
	win32/Makefile
290
	win32/shout/Makefile
291
])
oddsock's avatar
oddsock committed
292

293
AC_OUTPUT
294
295
296
297
298
299

cat << __EOT

${PACKAGE_STRING} has been configured successfully.

Configuration:
300
301
302
    Ogg Vorbis metadata support ... : ${use_metadata}
    Charset conversion support .... : ${use_iconv}
    Prefix ........................ : ${prefix}
303
304

__EOT