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.0beta4svn])
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
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
74 AC_CHECK_PROG(HAVE_PDFLATEX, pdflatex, yes)
75 AC_CHECK_PROG(HAVE_BIBTEX, bibtex, yes)
76 AC_CHECK_PROG(HAVE_TRANSFIG, fig2dev, yes)
78 if test -r doc/spec/spec.tex; then
79 if test "x$HAVE_PDFLATEX" = "xyes"; then
80 if test "x$HAVE_BIBTEX" = "xyes"; then
81 if test "x$HAVE_TRANSFIG" = "xyes"; then
82 tex_pkg_list=`fgrep usepackage doc/spec/spec.tex | grep \{ | grep -v ltablex`
84 for pkg_line in $tex_pkg_list; do
85 pkg_name=`echo $pkg_line | sed -e 's/.*{\(.*\)}.*/\1/'`
86 AC_MSG_CHECKING([for Tex package $pkg_name])
87 cat >conftest.tex <<_ACEOF
94 if pdflatex -interaction batchmode -halt-on-error conftest < /dev/null > /dev/null 2>&1; then
101 if test -w conftest.tex; then rm conftest.tex; fi
102 if test -w conftest.tex; then rm conftest.aux; fi
103 if test -w conftest.pdf; then rm conftest.pdf; fi
104 if test "x$tex_pkg_ok" = "xyes"; then
111 AM_CONDITIONAL(BUILD_SPEC, $BUILD_SPEC)
112 if test $BUILD_SPEC = "false"; then
113 AC_MSG_WARN([*** Format Specification will not built.])
116 dnl Check for valgrind
117 VALGRIND_ENVIRONMENT=""
118 ac_enable_valgrind=no
119 AC_ARG_ENABLE(valgrind-testing,
120 [ --enable-valgrind-testing enable running of tests inside Valgrind ], [ ac_enable_valgrind=yes ], [ ac_enable_valgrind=no] )
122 if test "x${ac_enable_valgrind}" = xyes ; then
123 if test "x${enable_shared}" = xyes ; then
124 VALGRIND_ENVIRONMENT="libtool --mode=execute "
127 AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
128 if test "x$HAVE_VALGRIND" = xyes ; then
129 VALGRIND_ENVIRONMENT="$VALGRIND_ENVIRONMENT valgrind -q --leak-check=yes --show-reachable=yes --num-callers=100"
130 AC_SUBST(VALGRIND_ENVIRONMENT)
131 TESTS_INFO="Type 'make check' to run test suite. Tests will be run under:
132 ${VALGRIND_ENVIRONMENT}"
134 TESTS_INFO="Type 'make check' to run test suite (Valgrind not found)"
137 TESTS_INFO="Type 'make check' to run test suite (Valgrind testing not enabled)"
140 dnl --------------------------------------------------
141 dnl Set build flags based on environment
142 dnl --------------------------------------------------
144 dnl Set some target options
146 cflags_save="$CFLAGS"
147 if test -z "$GCC"; then
152 PROFILE="-g -p -DDEBUG" ;;
158 DEBUG="-g -Wall -Wno-parentheses -DDEBUG -D__NO_MATH_INLINES"
159 CFLAGS="-Wall -Wno-parentheses -O3 -fforce-addr -fomit-frame-pointer -finline-functions -funroll-loops"
160 PROFILE="-Wall -Wno-parentheses -pg -g -O3 -fno-inline-functions -DDEBUG";;
163 CFLAGS="$CFLAGS $cflags_save"
168 [ --disable-asm disable assembly optimizations ],
169 [ ac_enable_asm=$enableval ], [ ac_enable_asm=yes] )
171 if test "x${ac_enable_asm}" = xyes; then
172 cpu_optimization="no optimization for your platform, please send a patch"
176 cpu_optimization="32 bit x86"
177 AC_DEFINE([USE_ASM], [], [make use of asm optimization])
178 if test "x$target_vendor" = "xapple"; then
179 THEORA_LDFLAGS="$THEORA_LDFLAGS -Wl,-read_only_relocs,suppress"
182 AC_DEFINE([OC_X86ASM], [], [enable x86 assambler optimization])
186 cpu_optimization="64 bit x86"
187 AC_DEFINE([USE_ASM], [], [make use of asm optimization])
188 AC_DEFINE([OC_X86ASM], [], [enable x86 assambler optimization])
192 cpu_optimization="disabled"
194 AM_CONDITIONAL([CPU_x86_64], [test x$cpu_x86_64 = xyes])
195 AM_CONDITIONAL([CPU_x86_32], [test x$cpu_x86_32 = xyes])
196 AM_CONDITIONAL(OC_X86ASM,[test x$ac_enable_asm = xyes])
198 # Test whenever ld supports -version-script
201 AC_MSG_CHECKING([library versioning support])
206 if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
209 THEORA_LDFLAGS="$THEORA_LDFLAGS -no-undefined"
210 THDEC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/xmingw32/libtheoradec-all.def"
211 THENC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/xmingw32/libtheoraenc-all.def"
212 THENC_VERSION_ARG="$THENC_VERSION_ARG -ltheoradec"
213 THC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/libtheora.def"
217 THDEC_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script-dec'
218 THENC_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script-enc'
219 TH_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script'
223 # build without versioning
229 THEORADEC_LDFLAGS="$THEORA_LDFLAGS $THDEC_VERSION_ARG"
230 THEORAENC_LDFLAGS="$THEORA_LDFLAGS $THENC_VERSION_ARG"
231 THEORA_LDFLAGS="$THEORA_LDFLAGS $TH_VERSION_ARG"
232 AC_SUBST(THEORADEC_LDFLAGS)
233 AC_SUBST(THEORAENC_LDFLAGS)
234 AC_SUBST(THEORA_LDFLAGS)
236 dnl --------------------------------------------------
237 dnl Checks for support libraries and headers
238 dnl --------------------------------------------------
243 dnl first check through pkg-config since it's more flexible
245 dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
246 AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
247 if test "x$HAVE_PKG_CONFIG" = "xyes"
249 PKG_CHECK_MODULES(OGG, ogg >= 1.1, HAVE_OGG=yes, HAVE_OGG=no)
251 if test "x$HAVE_OGG" = "xno"
253 dnl fall back to the old school test
254 XIPH_PATH_OGG(, AC_MSG_ERROR([
255 libogg is required to build this package!
256 please see http://www.xiph.org/ for how to
261 CFLAGS="$CFLAGS $OGG_CFLAGS"
262 LIBS="$LIBS $OGG_LIBS"
263 AC_CHECK_FUNC(oggpackB_read, , [
264 AC_MSG_ERROR([newer libogg version (1.1 or later) required])
274 dnl first check through pkg-config since it's more flexible
276 if test "x$HAVE_PKG_CONFIG" = "xyes"
278 PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0.1, HAVE_VORBIS=yes, HAVE_VORBIS=no)
279 dnl also set VORBISENC_LIBS since an examples needs it
280 dnl the old .m4 sets this to a value to use on top of VORBIS_LIBS,
281 dnl so we do the same here.
282 VORBISENC_LIBS="-lvorbisenc"
283 AC_SUBST(VORBISENC_LIBS)
285 if test "x$HAVE_VORBIS" = "xno"
287 dnl fall back to the old school test
288 XIPH_PATH_VORBIS(HAVE_VORBIS=yes, HAVE_VORBIS=no)
296 SDL_LIBS=`$SDL_CONFIG --libs`
297 ],AC_MSG_WARN([*** Unable to find SDL -- Not compiling example players ***]))
302 AC_CHECK_HEADERS([sys/soundcard.h soundcard.h machine/soundcard.h],[
306 if test x$HAVE_OSS != xyes; then
307 AC_MSG_WARN([OSS audio support not found -- not compiling player_example])
312 if test "x$HAVE_PKG_CONFIG" = "xyes"
314 PKG_CHECK_MODULES(PNG, libpng, HAVE_PNG=yes, HAVE_PNG=no)
319 dnl --------------------------------------------------
320 dnl Overall build configuration options
321 dnl --------------------------------------------------
323 dnl Configuration option for building of floating point code.
327 [ --disable-float disable use of floating point code ],
328 [ ac_enable_float=$enableval ], [ ac_enable_float=yes] )
330 if test "x${ac_enable_float}" != xyes ; then
331 AC_DEFINE([THEORA_DISABLE_FLOAT], [],
332 [Define to exclude floating point code from the build])
334 AM_CONDITIONAL(THEORA_DISABLE_FLOAT, [test "x${ac_enable_float}" != xyes])
336 dnl Configuration option for building of encoding support.
339 AC_ARG_ENABLE(encode,
340 [ --disable-encode disable encoding support ],
341 [ ac_enable_encode=$enableval ], [ ac_enable_encode=yes] )
343 if test "x${ac_enable_encode}" != xyes ; then
344 AC_DEFINE([THEORA_DISABLE_ENCODE], [],
345 [Define to exclude encode support from the build])
347 if test x$HAVE_VORBIS = xyes; then
348 BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES encoder_example\$(EXEEXT)"
350 AC_MSG_NOTICE([Vorbis missing, cannot build example encoder])
353 AM_CONDITIONAL(THEORA_DISABLE_ENCODE, [test "x${ac_enable_encode}" != xyes])
355 dnl Configuration option for examples
357 ac_enable_examples=yes
358 AC_ARG_ENABLE(examples,
359 [ --disable-examples disable examples ],
360 [ ac_enable_examples=$enableval ], [ ac_enable_examples=yes] )
361 AM_CONDITIONAL(THEORA_ENABLE_EXAMPLES, [test "x${ac_enable_examples}" != xno])
363 dnl --------------------------------------------------
364 dnl Check for headers
365 dnl --------------------------------------------------
369 dnl --------------------------------------------------
370 dnl Check for typedefs, structures, etc
371 dnl --------------------------------------------------
375 dnl --------------------------------------------------
376 dnl Check for library functions
377 dnl --------------------------------------------------
379 dnl substitute the included getopt if the system doesn't support long options
380 AC_CHECK_FUNC(getopt_long,
382 [GETOPT_OBJS='getopt.$(OBJEXT) getopt1.$(OBJEXT)'])
383 AC_SUBST(GETOPT_OBJS)
385 if test x$HAVE_SDL = xyes -a x$HAVE_OSS = xyes -a x$HAVE_VORBIS = xyes; then
386 BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES player_example"
388 if test x$HAVE_PNG = xyes; then
389 BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES png2theora"
391 AC_SUBST(BUILDABLE_EXAMPLES)
393 dnl --------------------------------------------------
395 dnl --------------------------------------------------
403 include/Makefile include/theora/Makefile
405 doc/Makefile doc/Doxyfile doc/spec/Makefile
410 theora-uninstalled.pc
412 theoradec-uninstalled.pc
414 theoraenc-uninstalled.pc
417 AS_AC_EXPAND(LIBDIR, ${libdir})
418 AS_AC_EXPAND(INCLUDEDIR, ${includedir})
419 AS_AC_EXPAND(BINDIR, ${bindir})
420 AS_AC_EXPAND(DOCDIR, ${datadir}/doc)
422 if test $HAVE_DOXYGEN = "false"; then
427 if test $BUILD_SPEC = "false"; then
434 ------------------------------------------------------------------------
435 $PACKAGE $VERSION: Automatic configuration OK.
437 General configuration:
439 Encoding support: ........... ${ac_enable_encode}
440 Floating point support: ..... ${ac_enable_float}
441 Assembly optimization: ...... ${cpu_optimization}
442 Build example code: ......... ${ac_enable_examples}
443 API Documentation: .......... ${doc_build}
444 Format Documentation: ....... ${spec_build}
448 libtheora: ................... ${LIBDIR}
449 C header files: .............. ${INCLUDEDIR}/theora
450 Documentation: ............... ${DOCDIR}/$PACKAGE
454 Type 'make' to compile $PACKAGE.
456 Type 'make install' to install $PACKAGE.
460 Example programs will be built but not installed.
461 ------------------------------------------------------------------------