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

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

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

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

32
33
34
AC_PROG_LIBTOOL
AC_SUBST([LIBTOOL_DEPS])

35
36
37
38
39
EZ_CFLAGS=""
EZ_CPPFLAGS=""
EZ_LDFLAGS=""
EZ_LIBS=""

40
41
42
43
AC_SYS_LARGEFILE

PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])

44
45
46
47
48
49

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

if test -n "${GCC}"; then
Moritz Grimm's avatar
Moritz Grimm committed
50
51
	for _flag in Wall W Wshadow Wconversion Wmissing-declarations \
	    Wmissing-prototypes Wstrict-prototypes
52
53
	do
		AX_CHECK_CFLAG([${_flag}],
54
			[AX_UNIQVAR_APPEND([EZ_CFLAGS], [-${_flag}])], [])
55
56
	done
	AX_CHECK_CFLAG([Wformat=2],
57
		[AX_UNIQVAR_APPEND([EZ_CFLAGS], [-Wformat=2])],
58
59
		[
		  AX_CHECK_CFLAG([Wformat],
60
			[AX_UNIQVAR_APPEND([EZ_CFLAGS], [-Wformat])], [])
61
62
63
		])
else
	case "${host}" in
moritz's avatar
moritz committed
64
	*-irix*)
65
		EZ_CFLAGS="-fullwarn"
moritz's avatar
moritz committed
66
67
		;;
	*-solaris*)
68
		EZ_CFLAGS="-v"
moritz's avatar
moritz committed
69
70
71
72
		;;
	*)
		;;
	esac
oddsock's avatar
oddsock committed
73
74
fi

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
have_attributes=no
CFG_ATTRIBUTE_UNUSED=0
AX_FUNC_ATTRIBUTE_UNUSED([
	CFG_ATTRIBUTE_UNUSED=1
	have_attributes=yes
], [])
AC_SUBST([CFG_ATTRIBUTE_UNUSED])

CFG_HAVE_ATTRIBUTES=0
CFG_ATTRIBUTE_FORMAT=0
CFG_ATTRIBUTE_NONNULL=0
if test x"${have_attributes}" = "xyes"; then
	CFG_HAVE_ATTRIBUTES=1
	AX_FUNC_ATTRIBUTE([const char *a, ...],
		[format], [(printf, 1, 2)],
		[CFG_ATTRIBUTE_FORMAT=1], [])
	AX_FUNC_ATTRIBUTE([const char *a],
		[nonnull], [(1)],
		[CFG_ATTRIBUTE_NONNULL=1], [])
fi
AC_SUBST([CFG_HAVE_ATTRIBUTES])
AC_SUBST([CFG_ATTRIBUTE_FORMAT])
AC_SUBST([CFG_ATTRIBUTE_NONNULL])

99
100
AC_C_CONST
AC_C_VOLATILE
101

oddsock's avatar
oddsock committed
102

103
104
105
dnl #############
dnl ## HEADERS #########################################################
dnl #############
oddsock's avatar
oddsock committed
106

107
AC_CHECK_HEADERS([ \
108
	sys/random.h sys/time.h libgen.h paths.h \
109
110
111
112
113
114
], [], [],
[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
])
115

116
117
118
119

dnl ###########
dnl ## TYPES ###########################################################
dnl ###########
120
121
122

AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
123

124

125
126
127
128
129
130
131
132
dnl ###############
dnl ## LIBRARIES #######################################################
dnl ###############

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

AX_CHECK_LIBSHOUT([], [],
133
	[AC_MSG_ERROR([libshout is missing], [1])])
134
135
136
137
138
139
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([], [],
140
	[AC_MSG_ERROR([libxml is missing], [1])])
141
142
143
144
145
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}])

146
AX_CHECK_TAGLIB_C([], [],
147
	[AC_MSG_ERROR([libtag_c is missing], [1])])
148
149
150
151
AX_UNIQVAR_APPEND([EZ_CFLAGS], [${TAGLIB_CFLAGS}])
AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${TAGLIB_CPPFLAGS}])
AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${TAGLIB_LDFLAGS}])
AX_UNIQVAR_PREPEND([EZ_LIBS], [${TAGLIB_C_LIBS}])
152

153
EZ_LIBICONV=""
154
155
156
AM_ICONV
if test -n "${LTLIBICONV}"; then
	EZ_LIBICONV="${LTLIBICONV}"
157
else
158
159
160
161
162
163
164
	EZ_LIBICONV="${LIBICONV}"
fi
AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [$INCICONV])
AX_UNIQVAR_PREPEND([EZ_LIBS], [$EZ_LIBICONV])
use_iconv="No"
if test x"${am_cv_func_iconv}" = "xyes"; then
	use_iconv="Yes"
165
fi
166

oddsock's avatar
oddsock committed
167

168
169
170
dnl #######################
dnl ## FUNCTIONS / MACROS ##############################################
dnl #######################
oddsock's avatar
oddsock committed
171

172
173
AC_CHECK_FUNCS([ \
	arc4random \
174
	getrandom \
175
])
moritz's avatar
moritz committed
176

177
AC_REPLACE_FUNCS([ \
Moritz Grimm's avatar
Moritz Grimm committed
178
	getopt \
179
	reallocarray \
180
181
182
183
	strlcat \
	strlcpy \
	strtonum \
])
moritz's avatar
moritz committed
184

185
186
187
188
189
190
191
AC_CHECK_FUNC([clock_gettime], [], [
	AC_CHECK_LIB([rt], [clock_gettime], [
		AX_UNIQVAR_PREPEND([EZ_LIBS], [-lrt])
	])
])


moritz's avatar
moritz committed
192

193
194
195
dnl ##################
dnl ## MISCELLANEOUS ###################################################
dnl ##################
moritz's avatar
moritz committed
196

197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
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
	doc/Makefile
214
	doc/ezstream-cfgmigrate.1.in
215
216
	doc/ezstream-file.sh.1.in
	doc/ezstream.1.in
217
218
219
	examples/Makefile
	m4/Makefile
	src/Makefile
220
	src/attr_config.h
221
	src/ezstream-file.sh
222
	tests/Makefile
223
])
oddsock's avatar
oddsock committed
224

225
AC_OUTPUT
226
227
228
229
230
231

cat << __EOT

${PACKAGE_STRING} has been configured successfully.

Configuration:
232
233
    Charset conversion support .... : ${use_iconv}
    Prefix ........................ : ${prefix}
234
235

__EOT