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.1.1])
12 AM_CONFIG_HEADER([config.h])
13 AC_CONFIG_SRCDIR([lib/fdct.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
63 dnl Add parameters for aclocal
64 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
67 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
68 AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
69 if test $HAVE_DOXYGEN = "false"; then
70 AC_MSG_WARN([*** doxygen not found, API documentation will not be built])
73 dnl Check for tools used to build the format specification
77 [ --disable-spec do not build spec ],
79 if test "x$enableval" = "xno"; then
80 ac_build_spec=$enableval
85 if test "x$ac_build_spec" = "xyes"; then
86 AC_CHECK_PROG(HAVE_PDFLATEX, pdflatex, yes)
87 AC_CHECK_PROG(HAVE_BIBTEX, bibtex, yes)
88 AC_CHECK_PROG(HAVE_TRANSFIG, fig2dev, yes)
89 if test -r doc/spec/spec.tex; then
90 if test "x$HAVE_PDFLATEX" = "xyes"; then
91 if test "x$HAVE_BIBTEX" = "xyes"; then
92 if test "x$HAVE_TRANSFIG" = "xyes"; then
93 tex_pkg_list=`fgrep usepackage doc/spec/spec.tex | grep \{ | grep -v ltablex`
95 for pkg_line in $tex_pkg_list; do
96 pkg_name=`echo $pkg_line | sed -e 's/.*{\(.*\)}.*/\1/'`
97 AC_MSG_CHECKING([for Tex package $pkg_name])
98 cat >conftest.tex <<_ACEOF
105 if pdflatex -interaction batchmode -halt-on-error conftest < /dev/null > /dev/null 2>&1; then
112 if test -w conftest.tex; then rm conftest.tex; fi
113 if test -w conftest.tex; then rm conftest.aux; fi
114 if test -w conftest.pdf; then rm conftest.pdf; fi
115 if test "x$tex_pkg_ok" = "xyes"; then
123 AM_CONDITIONAL(BUILD_SPEC, $BUILD_SPEC)
124 if test $BUILD_SPEC = "false"; then
125 AC_MSG_WARN([*** Format Specification will not built.])
128 dnl Check for valgrind
129 VALGRIND_ENVIRONMENT=""
130 ac_enable_valgrind=no
131 AC_ARG_ENABLE(valgrind-testing,
132 [ --enable-valgrind-testing enable running of tests inside Valgrind ], [ ac_enable_valgrind=yes ], [ ac_enable_valgrind=no] )
134 if test "x${ac_enable_valgrind}" = xyes ; then
135 if test "x${enable_shared}" = xyes ; then
136 VALGRIND_ENVIRONMENT="libtool --mode=execute "
139 AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
140 if test "x$HAVE_VALGRIND" = xyes ; then
141 VALGRIND_ENVIRONMENT="$VALGRIND_ENVIRONMENT valgrind -q --leak-check=yes --show-reachable=yes --num-callers=100"
142 AC_SUBST(VALGRIND_ENVIRONMENT)
143 TESTS_INFO="Type 'make check' to run test suite. Tests will be run under:
144 ${VALGRIND_ENVIRONMENT}"
146 TESTS_INFO="Type 'make check' to run test suite (Valgrind not found)"
149 TESTS_INFO="Type 'make check' to run test suite (Valgrind testing not enabled)"
152 dnl --------------------------------------------------
153 dnl Set build flags based on environment
154 dnl --------------------------------------------------
156 dnl Set some target options
158 cflags_save="$CFLAGS"
159 if test -z "$GCC"; then
164 PROFILE="-g -p -DDEBUG" ;;
170 DEBUG="-g -Wall -Wno-parentheses -DDEBUG -D__NO_MATH_INLINES"
171 CFLAGS="-Wall -Wno-parentheses -O3 -fforce-addr -fomit-frame-pointer -finline-functions -funroll-loops"
172 PROFILE="-Wall -Wno-parentheses -pg -g -O3 -fno-inline-functions -DDEBUG";;
175 CFLAGS="$CFLAGS $cflags_save"
180 [ --disable-asm disable assembly optimizations ],
181 [ ac_enable_asm=$enableval ], [ ac_enable_asm=yes] )
183 if test "x${ac_enable_asm}" = xyes; then
184 cpu_optimization="no optimization for your platform, please send a patch"
188 cpu_optimization="32 bit x86"
189 AC_DEFINE([OC_X86_ASM], [], [make use of x86 asm optimization])
190 if test "x$target_vendor" = "xapple"; then
191 THEORA_LDFLAGS="$THEORA_LDFLAGS -Wl,-read_only_relocs,suppress"
196 cpu_optimization="64 bit x86"
197 AC_DEFINE([OC_X86_ASM], [], [make use of x86 asm optimization])
198 AC_DEFINE([OC_X86_64_ASM], [], [make use of x86_64 asm optimization])
202 cpu_optimization="disabled"
204 AM_CONDITIONAL([CPU_x86_64], [test x$cpu_x86_64 = xyes])
205 AM_CONDITIONAL([CPU_x86_32], [test x$cpu_x86_32 = xyes])
207 # Test whenever ld supports -version-script
210 AC_MSG_CHECKING([how to control symbol export])
215 if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
218 THEORA_LDFLAGS="$THEORA_LDFLAGS -no-undefined"
219 THDEC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/xmingw32/libtheoradec-all.def"
220 THENC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/xmingw32/libtheoraenc-all.def"
221 THENC_VERSION_ARG="$THENC_VERSION_ARG -ltheoradec"
222 THC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/libtheora.def"
223 AC_MSG_RESULT([-export-symbols])
226 THDEC_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script-dec'
227 THENC_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script-enc'
228 TH_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script'
229 AC_MSG_RESULT([--version-script])
232 # build without versioning
239 THDEC_VERSION_ARG='-Wl,-exported_symbols_list,$(srcdir)/theoradec.exp'
240 THENC_VERSION_ARG='-Wl,-exported_symbols_list,$(srcdir)/theoraenc.exp'
241 TH_VERSION_ARG='-Wl,-exported_symbols_list,$(srcdir)/theora.exp'
242 AC_MSG_RESULT([-exported_symbols_list])
245 # build without versioning
251 THEORADEC_LDFLAGS="$THEORA_LDFLAGS $THDEC_VERSION_ARG"
252 THEORAENC_LDFLAGS="$THEORA_LDFLAGS $THENC_VERSION_ARG"
253 THEORA_LDFLAGS="$THEORA_LDFLAGS $TH_VERSION_ARG"
254 AC_SUBST(THEORADEC_LDFLAGS)
255 AC_SUBST(THEORAENC_LDFLAGS)
256 AC_SUBST(THEORA_LDFLAGS)
258 dnl --------------------------------------------------
259 dnl Checks for support libraries and headers
260 dnl --------------------------------------------------
265 dnl first check through pkg-config since it's more flexible
267 dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
268 AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
269 if test "x$HAVE_PKG_CONFIG" = "xyes"
271 PKG_CHECK_MODULES(OGG, ogg >= 1.1, HAVE_OGG=yes, HAVE_OGG=no)
273 if test "x$HAVE_OGG" = "xno"
275 dnl fall back to the old school test
276 XIPH_PATH_OGG(, AC_MSG_ERROR([
277 libogg is required to build this package!
278 please see http://www.xiph.org/ for how to
283 CFLAGS="$CFLAGS $OGG_CFLAGS"
284 LIBS="$LIBS $OGG_LIBS"
285 AC_CHECK_FUNC(oggpackB_read, , [
286 AC_MSG_ERROR([newer libogg version (1.1 or later) required])
296 dnl first check through pkg-config since it's more flexible
298 if test "x$HAVE_PKG_CONFIG" = "xyes"
300 PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0.1, HAVE_VORBIS=yes, HAVE_VORBIS=no)
301 dnl also set VORBISENC_LIBS since an examples needs it
302 dnl the old .m4 sets this to a value to use on top of VORBIS_LIBS,
303 dnl so we do the same here.
304 VORBISENC_LIBS="-lvorbisenc"
305 AC_SUBST(VORBISENC_LIBS)
307 if test "x$HAVE_VORBIS" = "xno"
309 dnl fall back to the old school test
310 XIPH_PATH_VORBIS(HAVE_VORBIS=yes, HAVE_VORBIS=no)
318 SDL_LIBS=`$SDL_CONFIG --libs`
319 ],AC_MSG_WARN([*** Unable to find SDL -- Not compiling example players ***]))
323 AC_CHECK_HEADERS([sys/soundcard.h soundcard.h machine/soundcard.h],[
327 if test x$HAVE_OSS != xyes; then
328 AC_MSG_WARN([OSS audio support not found -- not compiling player_example])
331 dnl OpenBSD needs -lossaudio to use the oss interface
335 OSS_LIBS='-lossaudio'
342 if test "x$HAVE_PKG_CONFIG" = "xyes"
344 PKG_CHECK_MODULES(PNG, libpng, HAVE_PNG=yes, HAVE_PNG=no)
349 dnl check for libcairo
351 AC_ARG_ENABLE(telemetry,
352 [ --enable-telemetry enable debugging output controls ],
353 [ ac_enable_telemetry=$enableval ], [ ac_enable_telemetry=no] )
355 if test "x${ac_enable_telemetry}" = xyes; then
356 if test "x$HAVE_PKG_CONFIG" = "xyes"
358 PKG_CHECK_MODULES(CAIRO, cairo, HAVE_CAIRO=yes, HAVE_CAIRO=no)
359 AC_DEFINE([HAVE_CAIRO], [], [libcairo is available for visual debugging output])
361 if test x$HAVE_CAIRO != xyes; then
362 AC_MSG_WARN([libcairo not found -- not compiling telemetry output support ])
364 AC_SUBST(CAIRO_CFLAGS)
368 dnl --------------------------------------------------
369 dnl Overall build configuration options
370 dnl --------------------------------------------------
372 dnl Configuration option for building of floating point code.
376 [ --disable-float disable use of floating point code ],
377 [ ac_enable_float=$enableval ], [ ac_enable_float=yes] )
379 if test "x${ac_enable_float}" != xyes ; then
380 AC_DEFINE([THEORA_DISABLE_FLOAT], [],
381 [Define to exclude floating point code from the build])
383 AM_CONDITIONAL(THEORA_DISABLE_FLOAT, [test "x${ac_enable_float}" != xyes])
385 dnl Configuration option for building of encoding support.
388 AC_ARG_ENABLE(encode,
389 [ --disable-encode disable encoding support ],
390 [ ac_enable_encode=$enableval ], [ ac_enable_encode=yes] )
392 if test "x${ac_enable_encode}" != xyes ; then
393 AC_DEFINE([THEORA_DISABLE_ENCODE], [],
394 [Define to exclude encode support from the build])
396 if test x$HAVE_VORBIS = xyes; then
397 BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES encoder_example\$(EXEEXT)"
399 AC_MSG_NOTICE([Vorbis missing, cannot build example encoder])
402 AM_CONDITIONAL(THEORA_DISABLE_ENCODE, [test "x${ac_enable_encode}" != xyes])
404 dnl Configuration option for examples
406 ac_enable_examples=yes
407 AC_ARG_ENABLE(examples,
408 [ --disable-examples disable examples ],
409 [ ac_enable_examples=$enableval ], [ ac_enable_examples=yes] )
410 AM_CONDITIONAL(THEORA_ENABLE_EXAMPLES, [test "x${ac_enable_examples}" != xno])
412 dnl --------------------------------------------------
413 dnl Check for headers
414 dnl --------------------------------------------------
418 dnl --------------------------------------------------
419 dnl Check for typedefs, structures, etc
420 dnl --------------------------------------------------
424 dnl --------------------------------------------------
425 dnl Check for library functions
426 dnl --------------------------------------------------
428 dnl OpenBSD needs -lcompat for ftime() used by dump_video.c
429 AC_SEARCH_LIBS([ftime], [compat])
431 dnl substitute the included getopt if the system doesn't support long options
432 AC_CHECK_FUNC(getopt_long,
434 [GETOPT_OBJS='getopt.$(OBJEXT) getopt1.$(OBJEXT)'])
435 AC_SUBST(GETOPT_OBJS)
437 if test x$HAVE_SDL = xyes -a x$HAVE_OSS = xyes -a x$HAVE_VORBIS = xyes; then
438 BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES player_example\$(EXEEXT)"
440 if test x$HAVE_PNG = xyes; then
441 BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES png2theora\$(EXEEXT)"
443 AC_SUBST(BUILDABLE_EXAMPLES)
445 dnl --------------------------------------------------
447 dnl --------------------------------------------------
455 include/Makefile include/theora/Makefile
457 doc/Makefile doc/Doxyfile doc/spec/Makefile
462 theora-uninstalled.pc
464 theoradec-uninstalled.pc
466 theoraenc-uninstalled.pc
469 AS_AC_EXPAND(LIBDIR, ${libdir})
470 AS_AC_EXPAND(INCLUDEDIR, ${includedir})
471 AS_AC_EXPAND(BINDIR, ${bindir})
472 AS_AC_EXPAND(DOCDIR, ${datadir}/doc)
474 if test $HAVE_DOXYGEN = "false"; then
479 if test $BUILD_SPEC = "false"; then
486 ------------------------------------------------------------------------
487 $PACKAGE $VERSION: Automatic configuration OK.
489 General configuration:
491 Encoding support: ........... ${ac_enable_encode}
492 Floating point support: ..... ${ac_enable_float}
493 Assembly optimization: ...... ${cpu_optimization}
494 Debugging telemetry: ........ ${ac_enable_telemetry}
495 Build example code: ......... ${ac_enable_examples}
496 API Documentation: .......... ${doc_build}
497 Format Documentation: ....... ${spec_build}
501 libtheora: ................... ${LIBDIR}
502 C header files: .............. ${INCLUDEDIR}/theora
503 Documentation: ............... ${DOCDIR}/$PACKAGE
507 Type 'make' to compile $PACKAGE.
509 Type 'make install' to install $PACKAGE.
513 Example programs will be built but not installed.
514 ------------------------------------------------------------------------