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.0])
17 AM_CONFIG_HEADER([config.h])
19 dnl --------------------------------------------------
20 dnl Check for programs
21 dnl --------------------------------------------------
23 dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
24 dnl if $CFLAGS is blank
31 ALL_LINGUAS="be cs da es fr hr hu nl ro ru sv uk"
34 dnl --------------------------------------------------
36 dnl --------------------------------------------------
41 dnl --------------------------------------------------
42 dnl Set build flags based on environment
43 dnl --------------------------------------------------
46 if test -z "$GCC"; then
50 CFLAGS="-O2 -w -signed"
51 PROFILE="-p -g3 -O2 -signed"
55 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
56 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc"
67 DEBUG="-g -Wall -fsigned-char"
68 CFLAGS="-O2 -Wall -ffast-math -fsigned-char"
69 PROFILE="-Wall -W -pg -g -O2 -ffast-math -fsigned-char"
72 DEBUG="-g -Wall -fsigned-char -mv8"
73 CFLAGS="-O20 -ffast-math -fsigned-char -mv8"
74 PROFILE="-pg -g -O20 -fsigned-char -mv8"
77 DEBUG="-fno-common -g -Wall -fsigned-char"
78 CFLAGS="-fno-common -O4 -Wall -fsigned-char -ffast-math"
79 PROFILE="-fno-common -O4 -Wall -pg -g -fsigned-char -ffast-math"
82 DEBUG="-g -Wall -fsigned-char"
83 CFLAGS="-O2 -fsigned-char"
84 PROFILE="-O2 -g -pg -fsigned-char"
88 CFLAGS="$CFLAGS $cflags_save"
89 DEBUG="$DEBUG $cflags_save"
90 PROFILE="$PROFILE $cflags_save"
92 dnl --------------------------------------------------
93 dnl Allow tools to be selectively built
94 dnl --------------------------------------------------
95 AC_ARG_ENABLE(ogg123, [ --disable-ogg123 Skip building ogg123], build_ogg123="$enableval", build_ogg123="yes")
96 AC_ARG_ENABLE(oggdec, [ --disable-oggdec Skip building oggdec], build_oggdec="$enableval", build_oggdec="yes")
97 AC_ARG_ENABLE(oggenc, [ --disable-oggenc Skip building oggenc], build_oggenc="$enableval", build_oggenc="yes")
98 AC_ARG_ENABLE(ogginfo,[ --disable-ogginfo Skip building ogginfo], build_ogginfo="$enableval", build_ogginfo="yes")
99 AC_ARG_ENABLE(vcut, [ --disable-vcut Skip building vcut], build_vcut="$enableval", build_vcut="no")
100 AC_ARG_ENABLE(vorbiscomment, [ --disable-vorbiscomment Skip building vorbiscomment], build_vorbiscomment="$enableval", build_vorbiscomment="yes")
101 AC_ARG_WITH(flac, [ --without-flac Do not compile FLAC support], build_flac=no, build_flac="yes")
102 AC_ARG_WITH(speex, [ --without-speex Do not compile Speex support], build_speex=no, build_speex="yes")
104 dnl --------------------------------------------------
105 dnl Check for generally needed libraries
106 dnl --------------------------------------------------
109 dnl first check through pkg-config
110 dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
111 AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
112 if test "x$HAVE_PKG_CONFIG" = "xyes"
114 PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
116 if test "x$HAVE_OGG" = "xno"
118 dnl fall back to the old school test
119 XIPH_PATH_OGG(,AC_MSG_ERROR(Ogg needed!))
121 LIBS="$OGG_LIBS $VORBIS_LIBS"
122 AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !))
129 dnl first check through pkg-config since it's more flexible
131 if test "x$HAVE_PKG_CONFIG" = "xyes"
133 PKG_CHECK_MODULES(VORBIS, vorbis >= 1.1.1, HAVE_VORBIS=yes, HAVE_VORBIS=no)
134 dnl also set VORBISENC_LIBS since an examples needs it
135 dnl the old .m4 sets this to a value to use on top of VORBIS_LIBS,
136 dnl so we do the same here.
137 VORBISENC_LIBS="-lvorbisenc"
138 VORBISFILE_LIBS="-lvorbisfile"
139 AC_SUBST(VORBISENC_LIBS)
140 AC_SUBST(VORBISFILE_LIBS)
142 if test "x$HAVE_VORBIS" = "xno"
144 dnl fall back to the old school test
145 XIPH_PATH_VORBIS(,AC_MSG_ERROR(Vorbis needed!))
150 SHARE_LIBS='$(top_builddir)/share/libutf8.a $(top_builddir)/share/libgetopt.a'
151 SHARE_CFLAGS='-I$(top_srcdir)/include'
153 I18N_CFLAGS='-I$(top_srcdir)/intl'
157 AC_CHECK_LIB(socket, socket, SOCKET_LIBS="-lsocket")
158 AC_CHECK_LIB(nsl, gethostbyname, SOCKET_LIBS="-lnsl $SOCKET_LIBS")
161 dnl --------------------------------------------------
162 dnl Check for ogg123 critical libraries and other optional libraries
163 dnl --------------------------------------------------
165 dnl curl is an optional dependancy of ogg123
166 if test "x$HAVE_PKG_CONFIG" = "xyes"; then
167 PKG_CHECK_MODULES(CURL, libcurl, HAVE_CURL=yes, HAVE_CURL=no)
168 if test "x$HAVE_CURL" = "xno"; then
169 AM_PATH_CURL(HAVE_CURL=yes, HAVE_CURL=no; AC_MSG_WARN(libcurl missing))
172 AM_PATH_CURL(HAVE_CURL=yes, HAVE_CURL=no; AC_MSG_WARN(libcurl missing))
174 if test "x$HAVE_CURL" = "xyes"; then
175 AC_DEFINE(HAVE_CURL,1,[Defined if we have libcurl])
178 if test "x$build_ogg123" = xyes; then
179 AC_MSG_RESULT([checking for ogg123 requirements])
180 XIPH_PATH_AO(,build_ogg123=no; AC_MSG_WARN(libao missing))
182 ACX_PTHREAD(,build_ogg123=no; AC_MSG_WARN(POSIX threads missing))
185 dnl -------------------- FLAC ----------------------
188 if test "x$build_flac" = xyes; then
190 AC_CHECK_LIB(m,log,FLAC_LIBS="-lm")
192 dnl First check for libFLAC-1.1.3 or later. As of libFLAC 1.1.3,
193 dnl OggFLAC functionality has been rolled into libFLAC rather
194 dnl than being in a separate libOggFLAC library.
196 AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_init_ogg_stream],
197 have_libFLAC=yes, have_libFLAC=no, [$FLAC_LIBS $OGG_LIBS])
199 if test "x$have_libFLAC" = xyes; then
200 FLAC_LIBS="-lFLAC $FLAC_LIBS $OGG_LIBS"
202 dnl Check for libFLAC prior to 1.1.3
203 AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_process_single],
204 [have_libFLAC=yes; FLAC_LIBS="-lFLAC $FLAC_LIBS"],
205 AC_MSG_WARN([libFLAC missing])
206 have_libFLAC=no, [$FLAC_LIBS]
209 AC_CHECK_LIB(OggFLAC, [OggFLAC__stream_decoder_new],
210 [FLAC_LIBS="-lOggFLAC $FLAC_LIBS $OGG_LIBS"],
211 AC_MSG_WARN([libOggFLAC missing])
212 have_libFLAC=no, [$FLAC_LIBS $OGG_LIBS]
216 AC_CHECK_HEADER(FLAC/stream_decoder.h,,
217 AC_MSG_WARN(libFLAC headers missing)
220 if test "x$have_libFLAC" = xyes; then
221 AC_DEFINE(HAVE_LIBFLAC, 1, [Defined if we have libFLAC])
227 AM_CONDITIONAL(HAVE_LIBFLAC, test "x$have_libFLAC" = "xyes")
230 dnl ------------------- Speex ------------------------
233 if test "x$build_speex" = xyes; then
234 AC_CHECK_LIB(m,log,SPEEX_LIBS="-lm")
235 AC_CHECK_LIB(speex, [speex_decoder_init],
236 [have_libspeex=yes; SPEEX_LIBS="-lspeex $SPEEX_LIBS"],
237 AC_MSG_WARN(libspeex missing)
238 have_libspeex=no, [$SPEEX_LIBS]
240 AC_CHECK_HEADER(speex/speex.h,,
241 AC_MSG_WARN(libspeex headers missing)
242 have_libspeex=no,[ ])
244 if test "x$have_libspeex" = xyes; then
245 AC_DEFINE(HAVE_LIBSPEEX, 1, [Defined if we have libspeex])
251 AM_CONDITIONAL(HAVE_LIBSPEEX, test "x$have_libspeex" = "xyes")
254 dnl --------------------------------------------------
255 dnl Check for headers
256 dnl --------------------------------------------------
258 AC_CHECK_HEADERS([fcntl.h unistd.h])
260 dnl --------------------------------------------------
261 dnl Check for library functions
262 dnl --------------------------------------------------
266 AC_CHECK_FUNCS(atexit on_exit fcntl select stat chmod)
269 dnl --------------------------------------------------
270 dnl Work around FHS stupidity
271 dnl --------------------------------------------------
273 if test -z "$mandir"; then
274 if test "$prefix" = "/usr"; then
275 MANDIR='$(datadir)/man'
277 MANDIR='$(prefix)/man'
285 dnl --------------------------------------------------
287 dnl --------------------------------------------------
289 # add optional subdirs to the build
291 if test "x$build_ogg123" = xyes; then
292 OPT_SUBDIRS="$OPT_SUBDIRS ogg123"
294 if test "x$build_oggenc" = xyes; then
295 OPT_SUBDIRS="$OPT_SUBDIRS oggenc"
297 if test "x$build_oggdec" = xyes; then
298 OPT_SUBDIRS="$OPT_SUBDIRS oggdec"
300 if test "x$build_ogginfo" = xyes; then
301 OPT_SUBDIRS="$OPT_SUBDIRS ogginfo"
303 if test "x$build_vcut" = xyes; then
304 OPT_SUBDIRS="$OPT_SUBDIRS vcut"
306 if test "x$build_vorbiscomment" = xyes; then
307 OPT_SUBDIRS="$OPT_SUBDIRS vorbiscomment"
309 AC_SUBST(OPT_SUBDIRS)
313 AC_SUBST(SOCKET_LIBS)
314 AC_SUBST(SHARE_CFLAGS)
316 AC_SUBST(CURL_CFLAGS)
318 AC_SUBST(I18N_CFLAGS)
333 vorbiscomment/Makefile
339 if test "x$build_oggenc" = xyes -a "x$have_libFLAC" != xyes; then
340 AC_MSG_WARN([FLAC and/or OggFLAC libraries or headers missing, oggenc
341 will NOT be built with FLAC read support.])
344 if test "x$build_ogg123" != xyes; then
345 AC_MSG_WARN([Prerequisites for ogg123 not met, ogg123 will be skipped.
346 Please ensure that you have POSIX threads, libao, and (optionally) libcurl
347 libraries and headers present if you would like to build ogg123.])
349 if test "x$have_libFLAC" != xyes; then
350 AC_MSG_WARN([FLAC and/or OggFLAC libraries or headers missing, ogg123
351 will NOT be built with FLAC read support.])
353 if test "x$have_libspeex" != xyes; then
354 AC_MSG_WARN([Speex libraries and/or headers missing, ogg123
355 will NOT be built with Speex read support.])
357 if test "x$HAVE_CURL" != xyes; then
358 AC_MSG_WARN([curl libraries and/or headers missing, ogg123
359 will NOT be built with http support.])