1 dnl Process this file with autoconf to produce a configure script
3 dnl ------------------------------------------------
4 dnl Initialization and Versioning
5 dnl ------------------------------------------------
7 AC_INIT(libtheora,[1.0beta3svn])
12 AM_CONFIG_HEADER([config.h])
13 AC_CONFIG_SRCDIR([lib/enc/dct.c])
17 dnl Library versioning
18 dnl CURRENT, REVISION, AGE
19 dnl - library source changed -> increment REVISION
20 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
21 dnl - interfaces added -> increment AGE
22 dnl - interfaces removed -> AGE = 0
27 AC_SUBST(TH_LIB_CURRENT)
28 AC_SUBST(TH_LIB_REVISION)
34 AC_SUBST(THDEC_LIB_CURRENT)
35 AC_SUBST(THDEC_LIB_REVISION)
36 AC_SUBST(THDEC_LIB_AGE)
41 AC_SUBST(THENC_LIB_CURRENT)
42 AC_SUBST(THENC_LIB_REVISION)
43 AC_SUBST(THENC_LIB_AGE)
45 dnl Extra linker options (for version script)
48 dnl --------------------------------------------------
49 dnl Check for programs
50 dnl --------------------------------------------------
52 dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
53 dnl if $CFLAGS is blank
62 dnl Add parameters for aclocal
63 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
66 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
67 AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
68 if test $HAVE_DOXYGEN = "false"; then
69 AC_MSG_WARN([*** doxygen not found, API documentation will not be built])
72 dnl Check for tools used to build the format specification
73 AC_CHECK_PROG(HAVE_PDFLATEX, pdflatex, yes)
74 AC_CHECK_PROG(HAVE_BIBTEX, bibtex, yes)
75 AC_CHECK_PROG(HAVE_TRANSFIG, fig2dev, yes)
77 if test -r doc/spec/spec.tex; then
78 if test "x$HAVE_PDFLATEX" = "xyes"; then
79 if test "x$HAVE_BIBTEX" = "xyes"; then
80 if test "x$HAVE_TRANSFIG" = "xyes"; then
81 tex_pkg_list=`fgrep usepackage doc/spec/spec.tex | grep \{ | grep -v ltablex`
83 for pkg_line in $tex_pkg_list; do
84 pkg_name=`echo $pkg_line | sed -e 's/.*{\(.*\)}.*/\1/'`
85 AC_MSG_CHECKING([for Tex package $pkg_name])
86 cat >conftest.tex <<_ACEOF
93 if pdflatex -interaction batchmode -halt-on-error conftest < /dev/null > /dev/null 2>&1; then
100 if test -w conftest.tex; then rm conftest.tex; fi
101 if test -w conftest.tex; then rm conftest.aux; fi
102 if test -w conftest.pdf; then rm conftest.pdf; fi
103 if test "x$tex_pkg_ok" = "xyes"; then
110 AM_CONDITIONAL(BUILD_SPEC, $BUILD_SPEC)
111 if test $BUILD_SPEC = "false"; then
112 AC_MSG_WARN([*** Format Specification will not built.])
115 dnl Check for valgrind
116 VALGRIND_ENVIRONMENT=""
117 ac_enable_valgrind=no
118 AC_ARG_ENABLE(valgrind-testing,
119 [ --enable-valgrind-testing enable running of tests inside Valgrind ], [ ac_enable_valgrind=yes ], [ ac_enable_valgrind=no] )
121 if test "x${ac_enable_valgrind}" = xyes ; then
122 if test "x${enable_shared}" = xyes ; then
123 VALGRIND_ENVIRONMENT="libtool --mode=execute "
126 AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
127 if test "x$HAVE_VALGRIND" = xyes ; then
128 VALGRIND_ENVIRONMENT="$VALGRIND_ENVIRONMENT valgrind -q --leak-check=yes --show-reachable=yes --num-callers=100"
129 AC_SUBST(VALGRIND_ENVIRONMENT)
130 TESTS_INFO="Type 'make check' to run test suite. Tests will be run under:
131 ${VALGRIND_ENVIRONMENT}"
133 TESTS_INFO="Type 'make check' to run test suite (Valgrind not found)"
136 TESTS_INFO="Type 'make check' to run test suite (Valgrind testing not enabled)"
139 dnl --------------------------------------------------
140 dnl Set build flags based on environment
141 dnl --------------------------------------------------
143 dnl Set some target options
145 cflags_save="$CFLAGS"
146 if test -z "$GCC"; then
151 PROFILE="-g -p -DDEBUG" ;;
157 DEBUG="-g -Wall -Wno-parentheses -DDEBUG -D__NO_MATH_INLINES"
158 CFLAGS="-Wall -Wno-parentheses -O3 -fforce-addr -fomit-frame-pointer -finline-functions -funroll-loops"
159 PROFILE="-Wall -Wno-parentheses -pg -g -O3 -fno-inline-functions -DDEBUG";;
162 CFLAGS="$CFLAGS $cflags_save"
167 [ --disable-asm disable assembly optimizations ],
168 [ ac_enable_asm=$enableval ], [ ac_enable_asm=yes] )
170 if test "x${ac_enable_asm}" = xyes; then
171 cpu_optimization="no optimization for your platform, please send a patch"
175 cpu_optimization="32 bit x86"
176 AC_DEFINE([USE_ASM], [], [make use of asm optimization])
177 if test "x$target_vendor" = "xapple"; then
178 THEORA_LDFLAGS="$THEORA_LDFLAGS -Wl,-read_only_relocs,suppress"
181 AC_DEFINE([OC_X86ASM], [], [enable x86 assambler optimization])
185 cpu_optimization="64 bit x86"
186 AC_DEFINE([USE_ASM], [], [make use of asm optimization])
187 AC_DEFINE([OC_X86ASM], [], [enable x86 assambler optimization])
191 cpu_optimization="disabled"
193 AM_CONDITIONAL([CPU_x86_64], [test x$cpu_x86_64 = xyes])
194 AM_CONDITIONAL([CPU_x86_32], [test x$cpu_x86_32 = xyes])
195 AM_CONDITIONAL(OC_X86ASM,[test x$ac_enable_asm = xyes])
197 # Test whenever ld supports -version-script
200 AC_MSG_CHECKING([library versioning support])
205 if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
208 THDEC_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script-dec'
209 THENC_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script-enc'
210 TH_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script'
214 # build without versioning
220 THEORADEC_LDFLAGS="$THEORA_LDFLAGS $THDEC_VERSION_ARG"
221 THEORAENC_LDFLAGS="$THEORA_LDFLAGS $THENC_VERSION_ARG"
222 THEORA_LDFLAGS="$THEORA_LDFLAGS $TH_VERSION_ARG"
223 AC_SUBST(THEORADEC_LDFLAGS)
224 AC_SUBST(THEORAENC_LDFLAGS)
225 AC_SUBST(THEORA_LDFLAGS)
227 dnl --------------------------------------------------
228 dnl Checks for support libraries and headers
229 dnl --------------------------------------------------
234 dnl first check through pkg-config since it's more flexible
236 dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
237 AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
238 if test "x$HAVE_PKG_CONFIG" = "xyes"
240 PKG_CHECK_MODULES(OGG, ogg >= 1.1, HAVE_OGG=yes, HAVE_OGG=no)
242 if test "x$HAVE_OGG" = "xno"
244 dnl fall back to the old school test
245 XIPH_PATH_OGG(, AC_MSG_ERROR([
246 libogg is required to build this package!
247 please see http://www.xiph.org/ for how to
252 CFLAGS="$CFLAGS $OGG_CFLAGS"
253 LIBS="$LIBS $OGG_LIBS"
254 AC_CHECK_FUNC(oggpackB_read, , [
255 AC_MSG_ERROR([newer libogg version (1.1 or later) required])
265 dnl first check through pkg-config since it's more flexible
267 if test "x$HAVE_PKG_CONFIG" = "xyes"
269 PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0.1, HAVE_VORBIS=yes, HAVE_VORBIS=no)
270 dnl also set VORBISENC_LIBS since an examples needs it
271 dnl the old .m4 sets this to a value to use on top of VORBIS_LIBS,
272 dnl so we do the same here.
273 VORBISENC_LIBS="-lvorbisenc"
274 AC_SUBST(VORBISENC_LIBS)
276 if test "x$HAVE_VORBIS" = "xno"
278 dnl fall back to the old school test
279 XIPH_PATH_VORBIS(HAVE_VORBIS=yes, HAVE_VORBIS=no)
287 SDL_LIBS=`$SDL_CONFIG --libs`
288 ],AC_MSG_WARN([*** Unable to find SDL -- Not compiling example players ***]))
293 AC_CHECK_HEADERS([sys/soundcard.h soundcard.h machine/soundcard.h],[
297 if test x$HAVE_OSS != xyes; then
298 AC_MSG_WARN([OSS audio support not found -- not compiling player_example])
303 if test "x$HAVE_PKG_CONFIG" = "xyes"
305 PKG_CHECK_MODULES(PNG, libpng, HAVE_PNG=yes, HAVE_PNG=no)
310 dnl --------------------------------------------------
311 dnl Overall build configuration options
312 dnl --------------------------------------------------
314 dnl Configuration option for building of floating point code.
318 [ --disable-float disable use of floating point code ],
319 [ ac_enable_float=$enableval ], [ ac_enable_float=yes] )
321 if test "x${ac_enable_float}" != xyes ; then
322 AC_DEFINE([THEORA_DISABLE_FLOAT], [],
323 [Define to exclude floating point code from the build])
325 AM_CONDITIONAL(THEORA_DISABLE_FLOAT, [test "x${ac_enable_float}" != xyes])
327 dnl Configuration option for building of encoding support.
330 AC_ARG_ENABLE(encode,
331 [ --disable-encode disable encoding support ],
332 [ ac_enable_encode=$enableval ], [ ac_enable_encode=yes] )
334 if test "x${ac_enable_encode}" != xyes ; then
335 AC_DEFINE([THEORA_DISABLE_ENCODE], [],
336 [Define to exclude encode support from the build])
338 if test x$HAVE_VORBIS = xyes; then
339 BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES encoder_example\$(EXEEXT)"
341 AC_MSG_NOTICE([Vorbis missing, cannot build example encoder])
344 AM_CONDITIONAL(THEORA_DISABLE_ENCODE, [test "x${ac_enable_encode}" != xyes])
346 dnl Configuration option for examples
348 ac_enable_examples=yes
349 AC_ARG_ENABLE(examples,
350 [ --disable-examples disable examples ],
351 [ ac_enable_examples=$enableval ], [ ac_enable_examples=yes] )
352 AM_CONDITIONAL(THEORA_ENABLE_EXAMPLES, [test "x${ac_enable_examples}" != xno])
354 dnl --------------------------------------------------
355 dnl Check for headers
356 dnl --------------------------------------------------
360 dnl --------------------------------------------------
361 dnl Check for typedefs, structures, etc
362 dnl --------------------------------------------------
366 dnl --------------------------------------------------
367 dnl Check for library functions
368 dnl --------------------------------------------------
370 dnl substitute the included getopt if the system doesn't support long options
371 AC_CHECK_FUNC(getopt_long,
373 [GETOPT_OBJS='getopt.$(OBJEXT) getopt1.$(OBJEXT)'])
374 AC_SUBST(GETOPT_OBJS)
376 if test x$HAVE_SDL = xyes -a x$HAVE_OSS = xyes -a x$HAVE_VORBIS = xyes; then
377 BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES player_example"
379 if test x$HAVE_PNG = xyes; then
380 BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES png2theora"
382 AC_SUBST(BUILDABLE_EXAMPLES)
384 dnl --------------------------------------------------
386 dnl --------------------------------------------------
394 include/Makefile include/theora/Makefile
396 doc/Makefile doc/Doxyfile doc/spec/Makefile
401 theora-uninstalled.pc
404 AS_AC_EXPAND(LIBDIR, ${libdir})
405 AS_AC_EXPAND(INCLUDEDIR, ${includedir})
406 AS_AC_EXPAND(BINDIR, ${bindir})
407 AS_AC_EXPAND(DOCDIR, ${datadir}/doc)
409 if test $HAVE_DOXYGEN = "false"; then
414 if test $BUILD_SPEC = "false"; then
421 ------------------------------------------------------------------------
422 $PACKAGE $VERSION: Automatic configuration OK.
424 General configuration:
426 Encoding support: ........... ${ac_enable_encode}
427 Floating point support: ..... ${ac_enable_float}
428 Assembly optimization: ...... ${cpu_optimization}
429 Build example code: ......... ${ac_enable_examples}
430 API Documentation: .......... ${doc_build}
431 Format Documentation: ....... ${spec_build}
435 libtheora: ................... ${LIBDIR}
436 C header files: .............. ${INCLUDEDIR}/theora
437 Documentation: ............... ${DOCDIR}/$PACKAGE
441 Type 'make' to compile $PACKAGE.
443 Type 'make install' to install $PACKAGE.
447 Example programs will be built but not installed.
448 ------------------------------------------------------------------------