1 dnl Process this file with autoconf to produce a configure script
3 dnl ------------------------------------------------
5 dnl ------------------------------------------------
7 AC_INIT(oggenc/encode.c)
14 AM_INIT_AUTOMAKE([vorbis-tools],[1.2.1])
17 AM_CONFIG_HEADER([config.h])
19 AC_USE_SYSTEM_EXTENSIONS
21 dnl --------------------------------------------------
22 dnl Check for programs
23 dnl --------------------------------------------------
25 dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
26 dnl if $CFLAGS is blank
33 ALL_LINGUAS="be cs da en_GB es fr hr hu nl ro ru sk sv uk vi"
36 dnl --------------------------------------------------
38 dnl --------------------------------------------------
43 dnl --------------------------------------------------
44 dnl Set build flags based on environment
45 dnl --------------------------------------------------
48 if test -z "$GCC"; then
52 CFLAGS="-O2 -w -signed"
53 PROFILE="-p -g3 -O2 -signed"
57 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
58 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc"
69 DEBUG="-g -Wall -fsigned-char"
70 CFLAGS="-O2 -Wall -ffast-math -fsigned-char"
71 PROFILE="-Wall -W -pg -g -O2 -ffast-math -fsigned-char"
74 DEBUG="-g -Wall -fsigned-char -mv8"
75 CFLAGS="-O20 -ffast-math -fsigned-char -mv8"
76 PROFILE="-pg -g -O20 -fsigned-char -mv8"
79 DEBUG="-fno-common -g -Wall -fsigned-char"
80 CFLAGS="-fno-common -O4 -Wall -fsigned-char -ffast-math"
81 PROFILE="-fno-common -O4 -Wall -pg -g -fsigned-char -ffast-math"
84 DEBUG="-g -Wall -fsigned-char"
85 CFLAGS="-O2 -fsigned-char"
86 PROFILE="-O2 -g -pg -fsigned-char"
90 CFLAGS="$CFLAGS $cflags_save"
91 DEBUG="$DEBUG $cflags_save"
92 PROFILE="$PROFILE $cflags_save"
94 dnl --------------------------------------------------
95 dnl Allow tools to be selectively built
96 dnl --------------------------------------------------
97 AC_ARG_ENABLE(ogg123, [ --disable-ogg123 Skip building ogg123], build_ogg123="$enableval", build_ogg123="yes")
98 AC_ARG_ENABLE(oggdec, [ --disable-oggdec Skip building oggdec], build_oggdec="$enableval", build_oggdec="yes")
99 AC_ARG_ENABLE(oggenc, [ --disable-oggenc Skip building oggenc], build_oggenc="$enableval", build_oggenc="yes")
100 AC_ARG_ENABLE(ogginfo,[ --disable-ogginfo Skip building ogginfo], build_ogginfo="$enableval", build_ogginfo="yes")
101 AC_ARG_ENABLE(vcut, [ --disable-vcut Skip building vcut], build_vcut="$enableval", build_vcut="no")
102 AC_ARG_ENABLE(vorbiscomment, [ --disable-vorbiscomment Skip building vorbiscomment], build_vorbiscomment="$enableval", build_vorbiscomment="yes")
103 AC_ARG_WITH(flac, [ --without-flac Do not compile FLAC support], build_flac="$withval", build_flac="yes")
104 AC_ARG_WITH(speex, [ --without-speex Do not compile Speex support], build_speex="$withval", build_speex="yes")
105 AC_ARG_WITH(kate, [ --without-kate Do not compile Kate support], build_kate="$withval", build_kate="yes")
107 dnl --------------------------------------------------
108 dnl Check for generally needed libraries
109 dnl --------------------------------------------------
112 dnl first check through pkg-config
113 dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
114 AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
115 if test "x$HAVE_PKG_CONFIG" = "xyes"
117 PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
119 if test "x$HAVE_OGG" = "xno"
121 dnl fall back to the old school test
122 XIPH_PATH_OGG(,AC_MSG_ERROR(Ogg needed!))
124 LIBS="$OGG_LIBS $VORBIS_LIBS"
125 AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !))
132 dnl first check through pkg-config since it's more flexible
134 if test "x$HAVE_PKG_CONFIG" = "xyes"
136 PKG_CHECK_MODULES(VORBIS, vorbis >= 1.1.1, HAVE_VORBIS=yes, HAVE_VORBIS=no)
137 dnl also set VORBISENC_LIBS since an examples needs it
138 dnl the old .m4 sets this to a value to use on top of VORBIS_LIBS,
139 dnl so we do the same here.
140 VORBISENC_LIBS="-lvorbisenc"
141 VORBISFILE_LIBS="-lvorbisfile"
142 AC_SUBST(VORBISENC_LIBS)
143 AC_SUBST(VORBISFILE_LIBS)
145 if test "x$HAVE_VORBIS" = "xno"
147 dnl fall back to the old school test
148 XIPH_PATH_VORBIS(,AC_MSG_ERROR(Vorbis needed!))
153 SHARE_LIBS='$(top_builddir)/share/libutf8.a $(top_builddir)/share/libgetopt.a'
154 SHARE_CFLAGS='-I$(top_srcdir)/include'
156 I18N_CFLAGS='-I$(top_srcdir)/intl'
160 AC_CHECK_LIB(socket, socket, SOCKET_LIBS="-lsocket")
161 AC_CHECK_LIB(nsl, gethostbyname, SOCKET_LIBS="-lnsl $SOCKET_LIBS")
164 dnl --------------------------------------------------
165 dnl Check for ogg123 critical libraries and other optional libraries
166 dnl --------------------------------------------------
168 dnl curl is an optional dependancy of ogg123
169 if test "x$HAVE_PKG_CONFIG" = "xyes"; then
170 PKG_CHECK_MODULES(CURL, libcurl, HAVE_CURL=yes, HAVE_CURL=no)
171 if test "x$HAVE_CURL" = "xno"; then
172 AM_PATH_CURL(HAVE_CURL=yes, HAVE_CURL=no; AC_MSG_WARN(libcurl missing))
175 AM_PATH_CURL(HAVE_CURL=yes, HAVE_CURL=no; AC_MSG_WARN(libcurl missing))
177 if test "x$HAVE_CURL" = "xyes"; then
178 AC_DEFINE(HAVE_CURL,1,[Defined if we have libcurl])
181 if test "x$build_ogg123" = xyes; then
182 AC_MSG_RESULT([checking for ogg123 requirements])
183 XIPH_PATH_AO(,build_ogg123=no; AC_MSG_WARN(libao missing))
185 ACX_PTHREAD(,build_ogg123=no; AC_MSG_WARN(POSIX threads missing))
188 dnl -------------------- FLAC ----------------------
191 if test "x$build_flac" = xyes; then
193 AC_CHECK_LIB(m,log,FLAC_LIBS="-lm")
195 dnl First check for libFLAC-1.1.3 or later. As of libFLAC 1.1.3,
196 dnl OggFLAC functionality has been rolled into libFLAC rather
197 dnl than being in a separate libOggFLAC library.
199 AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_init_ogg_stream],
200 have_libFLAC=yes, have_libFLAC=no, [$FLAC_LIBS $OGG_LIBS])
202 if test "x$have_libFLAC" = xyes; then
203 FLAC_LIBS="-lFLAC $FLAC_LIBS $OGG_LIBS"
205 dnl Check for libFLAC prior to 1.1.3
206 AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_process_single],
207 [have_libFLAC=yes; FLAC_LIBS="-lFLAC $FLAC_LIBS"],
208 AC_MSG_WARN([libFLAC missing])
209 have_libFLAC=no, [$FLAC_LIBS]
212 AC_CHECK_LIB(OggFLAC, [OggFLAC__stream_decoder_new],
213 [FLAC_LIBS="-lOggFLAC $FLAC_LIBS $OGG_LIBS"],
214 AC_MSG_WARN([libOggFLAC missing])
215 have_libFLAC=no, [$FLAC_LIBS $OGG_LIBS]
219 AC_CHECK_HEADER(FLAC/stream_decoder.h,,
220 AC_MSG_WARN(libFLAC headers missing)
223 if test "x$have_libFLAC" = xyes; then
224 AC_DEFINE(HAVE_LIBFLAC, 1, [Defined if we have libFLAC])
230 AM_CONDITIONAL(HAVE_LIBFLAC, test "x$have_libFLAC" = "xyes")
233 dnl ------------------- Speex ------------------------
236 if test "x$build_speex" = xyes; then
237 AC_CHECK_LIB(m,log,SPEEX_LIBS="-lm")
238 AC_CHECK_LIB(speex, [speex_decoder_init],
239 [have_libspeex=yes; SPEEX_LIBS="-lspeex $SPEEX_LIBS"],
240 AC_MSG_WARN(libspeex missing)
241 have_libspeex=no, [$SPEEX_LIBS]
243 AC_CHECK_HEADER(speex/speex.h,,
244 AC_MSG_WARN(libspeex headers missing)
245 have_libspeex=no,[ ])
247 if test "x$have_libspeex" = xyes; then
248 AC_DEFINE(HAVE_LIBSPEEX, 1, [Defined if we have libspeex])
254 AM_CONDITIONAL(HAVE_LIBSPEEX, test "x$have_libspeex" = "xyes")
257 dnl ------------------- Kate -------------------------
261 if test "x$build_kate" = xyes; then
262 AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
263 if test "x$HAVE_PKG_CONFIG" = "xyes"
265 PKG_CHECK_MODULES(KATE, oggkate, HAVE_KATE=yes, HAVE_KATE=no)
267 if test "x$HAVE_KATE" = "xno"
269 dnl fall back to the old school test
270 AC_CHECK_LIB(m,log,KATE_LIBS="-lm")
271 AC_CHECK_LIB(kate, [kate_decode_init],
272 [HAVE_KATE=yes; KATE_LIBS="-lkate $KATE_LIBS $OGG_LIBS"],
273 AC_MSG_WARN(libkate missing)
274 HAVE_KATE=no, [$KATE_LIBS $OGG_LIBS]
276 AC_CHECK_LIB(oggkate, [kate_ogg_decode_headerin],
277 [HAVE_KATE=yes; KATE_LIBS="-loggkate $KATE_LIBS $OGG_LIBS"],
278 AC_MSG_WARN(libkate missing)
279 HAVE_KATE=no, [$KATE_LIBS $OGG_LIBS]
281 AC_CHECK_HEADER(kate/kate.h,,
282 AC_MSG_WARN(libkate headers missing)
284 AC_CHECK_HEADER(kate/oggkate.h,,
285 AC_MSG_WARN(liboggkate headers missing)
289 if test "x$HAVE_KATE" = xyes; then
290 AC_DEFINE(HAVE_KATE, 1, [Defined if we have libkate])
297 AM_CONDITIONAL(HAVE_KATE, test "x$HAVE_KATE" = "xyes")
298 AC_SUBST(KATE_CFLAGS)
301 dnl --------------------------------------------------
302 dnl Check for headers
303 dnl --------------------------------------------------
305 AC_CHECK_HEADERS([fcntl.h unistd.h])
307 dnl --------------------------------------------------
308 dnl Check for library functions
309 dnl --------------------------------------------------
313 AC_CHECK_FUNCS(atexit on_exit fcntl select stat chmod)
316 dnl --------------------------------------------------
317 dnl Work around FHS stupidity
318 dnl --------------------------------------------------
320 if test -z "$mandir"; then
321 if test "$prefix" = "/usr"; then
322 MANDIR='$(datadir)/man'
324 MANDIR='$(prefix)/man'
332 dnl --------------------------------------------------
334 dnl --------------------------------------------------
336 # add optional subdirs to the build
338 if test "x$build_ogg123" = xyes; then
339 OPT_SUBDIRS="$OPT_SUBDIRS ogg123"
341 if test "x$build_oggenc" = xyes; then
342 OPT_SUBDIRS="$OPT_SUBDIRS oggenc"
344 if test "x$build_oggdec" = xyes; then
345 OPT_SUBDIRS="$OPT_SUBDIRS oggdec"
347 if test "x$build_ogginfo" = xyes; then
348 OPT_SUBDIRS="$OPT_SUBDIRS ogginfo"
350 if test "x$build_vcut" = xyes; then
351 OPT_SUBDIRS="$OPT_SUBDIRS vcut"
353 if test "x$build_vorbiscomment" = xyes; then
354 OPT_SUBDIRS="$OPT_SUBDIRS vorbiscomment"
356 AC_SUBST(OPT_SUBDIRS)
360 AC_SUBST(SOCKET_LIBS)
361 AC_SUBST(SHARE_CFLAGS)
363 AC_SUBST(CURL_CFLAGS)
365 AC_SUBST(I18N_CFLAGS)
380 vorbiscomment/Makefile
386 if test "x$build_oggenc" = xyes -a "x$have_libFLAC" != xyes; then
387 AC_MSG_WARN([FLAC and/or OggFLAC libraries or headers missing, oggenc
388 will NOT be built with FLAC read support.])
391 if test "x$build_ogg123" != xyes; then
392 AC_MSG_WARN([Prerequisites for ogg123 not met, ogg123 will be skipped.
393 Please ensure that you have POSIX threads, libao, and (optionally) libcurl
394 libraries and headers present if you would like to build ogg123.])
396 if test "x$have_libFLAC" != xyes; then
397 AC_MSG_WARN([FLAC and/or OggFLAC libraries or headers missing, ogg123
398 will NOT be built with FLAC read support.])
400 if test "x$have_libspeex" != xyes; then
401 AC_MSG_WARN([Speex libraries and/or headers missing, ogg123
402 will NOT be built with Speex read support.])
404 if test "x$HAVE_CURL" != xyes; then
405 AC_MSG_WARN([curl libraries and/or headers missing, ogg123
406 will NOT be built with http support.])
408 if test "x$HAVE_KATE" != xyes; then
409 AC_MSG_WARN([Kate libraries and/or headers missing, ogginfo
410 will be built with LIMITED Kate read support.])