Copy Derf's experimental ptalarbvorm branch to trunk.
[theora.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script
2
3 dnl ------------------------------------------------
4 dnl Initialization and Versioning
5 dnl ------------------------------------------------
6
7 AC_INIT(libtheora,[1.1.1+svn])
8
9 AC_CANONICAL_HOST
10 AC_CANONICAL_TARGET
11
12 AM_CONFIG_HEADER([config.h])
13 AC_CONFIG_SRCDIR([lib/fdct.c])
14 AM_INIT_AUTOMAKE
15
16 dnl we use doc_DATA in doc/Makefile.am which requires autoconf >= 2.60
17 dnl to define docdir for us.
18 AC_PREREQ(2.60)
19
20 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
21
22 dnl Library versioning
23 dnl CURRENT, REVISION, AGE
24 dnl - library source changed -> increment REVISION
25 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
26 dnl - interfaces added -> increment AGE
27 dnl - interfaces removed -> AGE = 0
28
29 TH_LIB_CURRENT=3
30 TH_LIB_REVISION=10
31 TH_LIB_AGE=3
32 AC_SUBST(TH_LIB_CURRENT)
33 AC_SUBST(TH_LIB_REVISION)
34 AC_SUBST(TH_LIB_AGE)
35
36 THDEC_LIB_CURRENT=2
37 THDEC_LIB_REVISION=4
38 THDEC_LIB_AGE=1
39 AC_SUBST(THDEC_LIB_CURRENT)
40 AC_SUBST(THDEC_LIB_REVISION)
41 AC_SUBST(THDEC_LIB_AGE)
42
43 THENC_LIB_CURRENT=2
44 THENC_LIB_REVISION=2
45 THENC_LIB_AGE=1
46 AC_SUBST(THENC_LIB_CURRENT)
47 AC_SUBST(THENC_LIB_REVISION)
48 AC_SUBST(THENC_LIB_AGE)
49
50 dnl Extra linker options (for version script)
51 THEORA_LDFLAGS=""
52
53 dnl --------------------------------------------------  
54 dnl Check for programs
55 dnl --------------------------------------------------  
56
57 AM_PROG_AS
58
59 dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
60 dnl if $CFLAGS is blank
61 cflags_save="$CFLAGS"
62 AC_PROG_CC
63 AC_PROG_CPP
64 CFLAGS="$cflags_save"
65
66 AM_PROG_CC_C_O
67 AC_LIBTOOL_WIN32_DLL
68 AM_PROG_LIBTOOL
69
70 dnl Add parameters for aclocal
71 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
72
73 dnl Check for doxygen
74 AC_ARG_ENABLE([doc],
75         AS_HELP_STRING([--enable-doc], [Build API documentation]),
76         [ac_enable_doc=$enableval], [ac_enable_doc=auto])
77
78 if test "x$ac_enable_doc" != "xno"; then
79         AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
80
81         if test "x$HAVE_DOXYGEN" = "xfalse" -a "x$ac_enable_doc" = "xyes"; then
82                 AC_MSG_ERROR([*** API documentation explicitly requested but Doxygen not found])
83         fi
84 else
85         HAVE_DOXYGEN=false
86 fi
87 AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
88 if test $HAVE_DOXYGEN = "false"; then
89         AC_MSG_WARN([*** doxygen not found, API documentation will not be built])
90 fi
91
92 dnl Check for tools used to build the format specification
93 BUILD_SPEC="false"
94 ac_build_spec=yes
95 AC_ARG_ENABLE(spec,
96      AS_HELP_STRING([--disable-spec], [Do not build the specification]),
97      [
98        if test "x$enableval" = "xno"; then
99          ac_build_spec=$enableval
100        fi
101      ], [
102        ac_build_spec=yes
103      ] )
104 if test "x$ac_build_spec" = "xyes"; then
105   AC_CHECK_PROG(HAVE_PDFLATEX, pdflatex, yes)
106   AC_CHECK_PROG(HAVE_BIBTEX, bibtex, yes)
107   AC_CHECK_PROG(HAVE_TRANSFIG, fig2dev, yes)
108   if test -r doc/spec/spec.tex; then
109    if test "x$HAVE_PDFLATEX" = "xyes"; then
110     if test "x$HAVE_BIBTEX" = "xyes"; then
111       if test "x$HAVE_TRANSFIG" = "xyes"; then
112         tex_pkg_list=`fgrep usepackage doc/spec/spec.tex | grep \{ | grep -v ltablex`
113         tex_pkg_ok="yes"
114         for pkg_line in $tex_pkg_list; do
115           pkg_name=`echo $pkg_line | sed -e 's/.*{\(.*\)}.*/\1/'`
116           AC_MSG_CHECKING([for Tex package $pkg_name])
117           cat >conftest.tex <<_ACEOF
118 \\documentclass{book}
119 $pkg_line
120 \\begin{document}
121 Hello World.
122 \\end{document}
123 _ACEOF
124           if pdflatex -interaction batchmode -halt-on-error conftest < /dev/null > /dev/null 2>&1; then
125             AC_MSG_RESULT([ok])
126           else
127             tex_pkg_ok="no"
128             AC_MSG_RESULT([no])
129           fi
130         done
131         if test -w conftest.tex; then rm conftest.tex; fi
132         if test -w conftest.tex; then rm conftest.aux; fi
133         if test -w conftest.pdf; then rm conftest.pdf; fi
134         if test "x$tex_pkg_ok" = "xyes"; then
135           BUILD_SPEC="true"
136         fi
137       fi
138     fi
139    fi
140   fi
141 fi
142 AM_CONDITIONAL(BUILD_SPEC, $BUILD_SPEC)
143 if test $BUILD_SPEC = "false"; then
144         AC_MSG_WARN([*** Format Specification will not built.])
145 fi
146
147 dnl Check for valgrind
148 VALGRIND_ENVIRONMENT=""
149 ac_enable_valgrind=no
150 AC_ARG_ENABLE(valgrind-testing,
151      AS_HELP_STRING([--enable-valgrind-testing], [Enable running of tests inside Valgrind]),
152      [ ac_enable_valgrind=$enableval ], [ ac_enable_valgrind=no] )
153
154 if test "x${ac_enable_valgrind}" = xyes ; then
155   if test "x${enable_shared}" = xyes ; then
156     VALGRIND_ENVIRONMENT="libtool --mode=execute "
157   fi
158
159   AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
160   if test "x$HAVE_VALGRIND" = xyes ; then
161     VALGRIND_ENVIRONMENT="$VALGRIND_ENVIRONMENT valgrind -q --leak-check=yes --show-reachable=yes --num-callers=100"
162     AC_SUBST(VALGRIND_ENVIRONMENT)
163     TESTS_INFO="Type 'make check' to run test suite. Tests will be run under:
164   ${VALGRIND_ENVIRONMENT}"
165   else
166     TESTS_INFO="Type 'make check' to run test suite (Valgrind not found)"
167   fi
168 else
169   TESTS_INFO="Type 'make check' to run test suite (Valgrind testing not enabled)"
170 fi
171
172 dnl --------------------------------------------------
173 dnl Set build flags based on environment
174 dnl --------------------------------------------------
175
176 dnl Set some target options
177
178 cflags_save="$CFLAGS"
179 if test -z "$GCC"; then
180         case $host in 
181         *)
182                 DEBUG="-g -DDEBUG"
183                 CFLAGS="-O"
184                 PROFILE="-g -p -DDEBUG" ;;
185         esac
186 else
187
188         case $host in 
189         *)
190                 DEBUG="-g -Wall -Wno-parentheses -DDEBUG -D__NO_MATH_INLINES"
191                 CFLAGS="-Wall -Wno-parentheses -O3 -fforce-addr -fomit-frame-pointer -finline-functions -funroll-loops"
192                 PROFILE="-Wall -Wno-parentheses -pg -g -O3 -fno-inline-functions -DDEBUG";;
193         esac
194 fi
195 CFLAGS="$CFLAGS $cflags_save"
196
197 cpu_x86_64=no
198 cpu_x86_32=no
199 cpu_arm=no
200 cpu_c64x=no
201 AC_ARG_ENABLE(asm,
202     AS_HELP_STRING([--disable-asm], [Disable assembly optimizations]),
203     [ ac_enable_asm=$enableval ], [ ac_enable_asm=yes] )
204
205 if test "x${ac_enable_asm}" = xyes; then
206   cpu_optimization="no optimization for your platform, please send a patch"
207   case $target_cpu in
208   i[[3456]]86)
209     cpu_x86_32=yes
210     cpu_optimization="32 bit x86"
211     AC_DEFINE([OC_X86_ASM], [],  [make use of x86 asm optimization])
212     if test "x$target_vendor" = "xapple"; then
213       THEORA_LDFLAGS="$THEORA_LDFLAGS  -Wl,-read_only_relocs,suppress"
214     fi
215       ;;
216   x86_64)
217     cpu_x86_64=yes
218     cpu_optimization="64 bit x86"
219     AC_DEFINE([OC_X86_ASM], [],  [make use of x86 asm optimization])
220     AC_DEFINE([OC_X86_64_ASM], [],  [make use of x86_64 asm optimization])
221     ;;
222   arm*)
223     cpu_arm=yes
224     cpu_optimization="ARM"
225     AC_DEFINE([OC_ARM_ASM], [],  [make use of arm asm optimization])
226     AC_ARG_ENABLE(asflag-probe,
227         AS_HELP_STRING([--disable-asflag-probe], [Disable instructions not supported by the default ASFLAGS (ARM only).]),
228         [ ac_enable_asflag_probe=$enableval ], [ ac_enable_asflag_probe=yes] )
229
230     dnl our ARM assembly requires perl to run the arm2gnu reformatter
231     AC_CHECK_PROG([HAVE_PERL], perl, yes, no)
232     if test "x$HAVE_PERL" = "xno"; then
233       AC_MSG_WARN([*** ARM assembly requires perl -- disabling optimizations])
234       cpu_arm=no
235       cpu_optimization="(missing perl dependency for ARM)"
236     fi
237
238     dnl AC_TRY_ASSEMBLE uses CFLAGS instead of CCASFLAGS
239     save_CFLAGS="$CFLAGS"
240     ARM_CCASFLAGS=
241     dnl Test for instruction set support with the default CCASFLAGS.
242     AS_ASM_ARM_NEON([HAVE_ARM_ASM_NEON=1],[HAVE_ARM_ASM_NEON=0])
243     AS_ASM_ARM_MEDIA([HAVE_ARM_ASM_MEDIA=1],[HAVE_ARM_ASM_MEDIA=0])
244     AS_ASM_ARM_EDSP([HAVE_ARM_ASM_EDSP=1],[HAVE_ARM_ASM_EDSP=0])
245     dnl gas will not assemble instructions unless the architecture explicitly
246     dnl  supports it (unlike on x86).
247     dnl Try to speculatively add ASFLAGS to enable usage of these instructions
248     dnl  at assembly time (actual support is detected at runtime).
249     dnl If the user has already specified -march or -mcpu flags, this may give
250     dnl  some spurious warnings (use --disable-asflag-probe to avoid this if
251     dnl  you don't want run-time support for instructions not available on the
252     dnl  architecture you specified).
253     dnl Order here is important.
254     if test "x${ac_enable_asflag_probe}" = xyes; then
255       if test x$HAVE_ARM_ASM_NEON != x1 ; then
256         dnl Try to set some flags to enable NEON instructions.
257         AC_MSG_NOTICE([trying custom CCASFLAGS to enable NEON instructions...])
258         ARM_CCASFLAGS="-mfpu=neon -march=armv7-a"
259         CFLAGS="$save_CFLAGS $ARM_CCASFLAGS"
260         AS_ASM_ARM_NEON([HAVE_ARM_ASM_NEON=1],[HAVE_ARM_ASM_NEON=0])
261         if test x$HAVE_ARM_ASM_NEON != x1 ; then
262           ARM_CCASFLAGS=
263           CFLAGS="$save_CFLAGS"
264         fi
265       fi
266       if test x$HAVE_ARM_ASM_MEDIA != x1 ; then
267         dnl Try to set some flags to enable ARMv6 media instructions.
268         AC_MSG_NOTICE([trying custom CCASFLAGS to enable ARMv6 media instructions...])
269         ARM_CCASFLAGS="-march=armv6j"
270         CFLAGS="$save_CFLAGS $ARM_CCASFLAGS"
271         AS_ASM_ARM_MEDIA([HAVE_ARM_ASM_MEDIA=1],[HAVE_ARM_ASM_MEDIA=0])
272         if test x$HAVE_ARM_ASM_MEDIA != x1 ; then
273           ARM_CCASFLAGS=
274           CFLAGS="$save_CFLAGS"
275         fi
276       fi
277       if test x$HAVE_ARM_ASM_EDSP != x1 ; then
278         dnl Try to set some flags to enable EDSP instructions.
279         AC_MSG_NOTICE([trying custom CCASFLAGS to enable EDSP compilation...])
280         ARM_CCASFLAGS="-march=armv5e"
281         CFLAGS="$save_CFLAGS $ARM_CCASFLAGS"
282         AS_ASM_ARM_EDSP([HAVE_ARM_ASM_EDSP=1],[HAVE_ARM_ASM_EDSP=0])
283         if test x$HAVE_ARM_ASM_MEDIA != x1 ; then
284           ARM_CCASFLAGS=
285           CFLAGS="$save_CFLAGS"
286         fi
287       fi
288     fi
289
290     dnl Only enable if we passed the perl test above
291     if test x$cpu_arm = xyes; then
292       if test x$HAVE_ARM_ASM_EDSP = x1 ; then
293         AC_DEFINE(OC_ARM_ASM_EDSP, 1,
294           [Define if assembler supports EDSP instructions])
295         cpu_optimization="$cpu_optimization (EDSP)"
296       fi
297       AC_SUBST(HAVE_ARM_ASM_EDSP)
298       if test x$HAVE_ARM_ASM_MEDIA = x1 ; then
299         AC_DEFINE(OC_ARM_ASM_MEDIA, 1,
300           [Define if assembler supports ARMv6 media instructions])
301         cpu_optimization="$cpu_optimization (Media)"
302       fi
303       AC_SUBST(HAVE_ARM_ASM_MEDIA)
304       if test x$HAVE_ARM_ASM_NEON = x1 ; then
305         AC_DEFINE(OC_ARM_ASM_NEON, 1,
306           [Define if compiler supports NEON instructions])
307         cpu_optimization="$cpu_optimization (NEON)"
308       fi
309       AC_SUBST(HAVE_ARM_ASM_NEON)
310     fi
311
312     CFLAGS="$save_CFLAGS"
313     CCASFLAGS="$CCASFLAGS $ARM_CCASFLAGS"
314     ;;
315   tic6x)
316     cpu_c64x=yes
317     cpu_optimization="TI C64x+"
318     AC_DEFINE([OC_C64X_ASM], [],  [make use of c64x+ asm optimization])
319     ;;
320   esac
321 else
322   cpu_optimization="disabled"
323 fi
324 AM_CONDITIONAL([CPU_x86_64], [test x$cpu_x86_64 = xyes])
325 AM_CONDITIONAL([CPU_x86_32], [test x$cpu_x86_32 = xyes])
326 AM_CONDITIONAL([CPU_arm], [test x$cpu_arm = xyes])
327 AM_CONDITIONAL([CPU_c64x], [test x$cpu_c64x = xyes])
328
329 # Test whenever ld supports -version-script
330 AC_PROG_LD
331 AC_PROG_LD_GNU
332 AC_MSG_CHECKING([how to control symbol export])
333
334 THDEC_VERSION_ARG=""
335 THENC_VERSION_ARG=""
336 TH_VERSION_ARG=""
337 if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
338  case "$target_os" in
339   *mingw*)
340     THEORA_LDFLAGS="$THEORA_LDFLAGS -no-undefined"
341     THDEC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/xmingw32/libtheoradec-all.def"
342     THENC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/xmingw32/libtheoraenc-all.def"
343     THENC_VERSION_ARG="$THENC_VERSION_ARG -ltheoradec"
344     THC_VERSION_ARG="-export-symbols \$(top_srcdir)/win32/libtheora.def"
345     AC_MSG_RESULT([-export-symbols])
346     ;;
347   linux* | solaris* | gnu* | k*bsd*-gnu)
348     THDEC_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script-dec'
349     THENC_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script-enc'
350     TH_VERSION_ARG='-Wl,--version-script=$(srcdir)/Version_script'
351     AC_MSG_RESULT([--version-script])
352     ;;
353   *)
354     # build without versioning
355     AC_MSG_RESULT([no])
356     ;;
357  esac
358 else
359  case "$target_os" in
360   darwin*)
361     THDEC_VERSION_ARG='-Wl,-exported_symbols_list,$(srcdir)/theoradec.exp'
362     THENC_VERSION_ARG='-Wl,-exported_symbols_list,$(srcdir)/theoraenc.exp'
363     TH_VERSION_ARG='-Wl,-exported_symbols_list,$(srcdir)/theora.exp'
364     AC_MSG_RESULT([-exported_symbols_list])
365     ;;
366   *)
367     # build without versioning
368     AC_MSG_RESULT([no])
369     ;;
370  esac
371 fi
372  
373 THEORADEC_LDFLAGS="$THEORA_LDFLAGS $THDEC_VERSION_ARG"
374 THEORAENC_LDFLAGS="$THEORA_LDFLAGS $THENC_VERSION_ARG"
375 THEORA_LDFLAGS="$THEORA_LDFLAGS $TH_VERSION_ARG"
376 AC_SUBST(THEORADEC_LDFLAGS)
377 AC_SUBST(THEORAENC_LDFLAGS)
378 AC_SUBST(THEORA_LDFLAGS)
379
380 dnl --------------------------------------------------
381 dnl Checks for support libraries and headers
382 dnl --------------------------------------------------
383
384 dnl check for Ogg
385 HAVE_OGG=no
386
387 dnl first check through pkg-config since it's more flexible
388
389 dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
390 AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
391 if test "x$HAVE_PKG_CONFIG" = "xyes"
392 then
393   PKG_CHECK_MODULES(OGG, ogg >= 1.1, HAVE_OGG=yes, HAVE_OGG=no)
394 fi
395 if test "x$HAVE_OGG" = "xno"
396 then
397   dnl fall back to the old school test
398   XIPH_PATH_OGG(, AC_MSG_ERROR([
399     libogg is required to build this package!
400     please see http://www.xiph.org/ for how to
401     obtain a copy.
402   ]))
403   cflags_save=$CFLAGS
404   libs_save=$LIBS
405   CFLAGS="$CFLAGS $OGG_CFLAGS"
406   LIBS="$LIBS $OGG_LIBS"
407   AC_CHECK_FUNC(oggpackB_read, , [
408     AC_MSG_ERROR([newer libogg version (1.1 or later) required])
409   ])
410   CFLAGS=$cflags_save
411   LIBS=$libs_save
412 fi
413
414
415 dnl check for Vorbis
416 HAVE_VORBIS=no
417
418 dnl first check through pkg-config since it's more flexible
419
420 if test "x$HAVE_PKG_CONFIG" = "xyes"
421 then
422   PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0.1, HAVE_VORBIS=yes, HAVE_VORBIS=no)
423   dnl also set VORBISENC_LIBS since an examples needs it
424   dnl the old .m4 sets this to a value to use on top of VORBIS_LIBS,
425   dnl so we do the same here.
426   VORBISENC_LIBS="-lvorbisenc"
427   AC_SUBST(VORBISENC_LIBS)
428 fi
429 if test "x$HAVE_VORBIS" = "xno"
430 then
431   dnl fall back to the old school test
432   XIPH_PATH_VORBIS(HAVE_VORBIS=yes, HAVE_VORBIS=no)
433 fi
434
435 dnl check for SDL
436 HAVE_SDL=no
437 if test "x$HAVE_PKG_CONFIG" = "xyes"
438 then
439   PKG_CHECK_MODULES(SDL, sdl, HAVE_SDL=yes, [
440     HAVE_SDL=no
441     AC_MSG_WARN([*** Unable to find SDL -- Not compiling example players ***])])
442 fi
443
444 dnl check for OSS
445 HAVE_OSS=no
446 AC_CHECK_HEADERS([sys/soundcard.h soundcard.h machine/soundcard.h],[
447   HAVE_OSS=yes
448   break
449 ])
450 if test x$HAVE_OSS != xyes; then
451   AC_MSG_WARN([OSS audio support not found -- not compiling player_example])
452 fi
453
454 dnl OpenBSD needs -lossaudio to use the oss interface
455 OSS_LIBS=
456 case "$target_os" in
457   openbsd*)
458     OSS_LIBS='-lossaudio'
459     ;;
460 esac
461 AC_SUBST(OSS_LIBS)
462
463 dnl check for libpng
464 HAVE_PNG=no
465 if test "x$HAVE_PKG_CONFIG" = "xyes"
466 then
467   PKG_CHECK_MODULES(PNG, libpng, HAVE_PNG=yes, HAVE_PNG=no)
468 fi
469 AC_SUBST(PNG_CFLAGS)
470 AC_SUBST(PNG_LIBS)
471
472 dnl check for libcairo
473 HAVE_CAIRO=no
474 AC_ARG_ENABLE(telemetry,
475     AS_HELP_STRING([--enable-telemetry], [Enable debugging output controls]),
476     [ ac_enable_telemetry=$enableval ], [ ac_enable_telemetry=no] )
477
478 if test "x${ac_enable_telemetry}" = xyes; then
479    if test "x$HAVE_PKG_CONFIG" = "xyes"
480    then
481      PKG_CHECK_MODULES(CAIRO, cairo, HAVE_CAIRO=yes, HAVE_CAIRO=no)
482      AC_DEFINE([HAVE_CAIRO], [],  [libcairo is available for visual debugging output])  
483    fi
484    if test x$HAVE_CAIRO != xyes; then
485      AC_MSG_WARN([libcairo not found -- not compiling telemetry output support ])
486    fi
487    AC_SUBST(CAIRO_CFLAGS)
488    AC_SUBST(CAIRO_LIBS)
489 fi
490
491 dnl --------------------------------------------------
492 dnl Overall build configuration options
493 dnl --------------------------------------------------
494
495 dnl Configuration option for building of floating point code.
496
497 ac_enable_float=yes
498 AC_ARG_ENABLE(float,
499      AS_HELP_STRING([--disable-float], [Disable use of floating point code]),
500      [ ac_enable_float=$enableval ], [ ac_enable_float=yes] )
501
502 if test "x${ac_enable_float}" != xyes ; then
503     AC_DEFINE([THEORA_DISABLE_FLOAT], [], 
504   [Define to exclude floating point code from the build])
505 fi
506 AM_CONDITIONAL(THEORA_DISABLE_FLOAT, [test "x${ac_enable_float}" != xyes])
507
508 dnl Configuration option for building of encoding support.
509
510 ac_enable_encode=yes
511 AC_ARG_ENABLE(encode,
512      AS_HELP_STRING([--disable-encode], [Disable encoding support]),
513      [ ac_enable_encode=$enableval ], [ ac_enable_encode=yes] )
514
515 if test "x${ac_enable_encode}" != xyes ; then
516     AC_DEFINE([THEORA_DISABLE_ENCODE], [],
517   [Define to exclude encode support from the build])
518 else
519     if test x$HAVE_VORBIS = xyes; then
520       BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES encoder_example\$(EXEEXT)"
521     else
522       AC_MSG_NOTICE([Vorbis missing, cannot build example encoder])
523     fi
524 fi
525 AM_CONDITIONAL(THEORA_DISABLE_ENCODE, [test "x${ac_enable_encode}" != xyes])
526
527 dnl Configuration option for examples
528
529 ac_enable_examples=yes
530 AC_ARG_ENABLE(examples,
531      AS_HELP_STRING([--disable-examples], [Disable examples]),
532      [ ac_enable_examples=$enableval ], [ ac_enable_examples=yes] )
533 AM_CONDITIONAL(THEORA_ENABLE_EXAMPLES, [test "x${ac_enable_examples}" != xno])
534
535 dnl --------------------------------------------------
536 dnl Check for headers
537 dnl --------------------------------------------------
538
539 dnl none here
540
541 dnl --------------------------------------------------
542 dnl Check for typedefs, structures, etc
543 dnl --------------------------------------------------
544
545 dnl none
546
547 dnl --------------------------------------------------
548 dnl Check for library functions
549 dnl --------------------------------------------------
550
551 dnl OpenBSD needs -lcompat for ftime() used by dump_video.c
552 AC_SEARCH_LIBS([ftime], [compat])
553
554 dnl substitute the included getopt if the system doesn't support long options
555 AC_CHECK_FUNC(getopt_long,
556               [GETOPT_OBJS=''],
557               [GETOPT_OBJS='getopt.$(OBJEXT) getopt1.$(OBJEXT)'])
558 AC_SUBST(GETOPT_OBJS)
559
560 if test x$HAVE_SDL = xyes -a x$HAVE_OSS = xyes -a x$HAVE_VORBIS = xyes; then
561   BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES player_example\$(EXEEXT)"
562 fi
563 if test x$HAVE_PNG = xyes; then
564   BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES png2theora\$(EXEEXT)"
565 fi
566 AC_SUBST(BUILDABLE_EXAMPLES)
567
568 dnl --------------------------------------------------
569 dnl Do substitutions
570 dnl --------------------------------------------------
571
572 AC_SUBST(DEBUG)
573 AC_SUBST(PROFILE)
574
575 AC_OUTPUT([
576   Makefile 
577   lib/Makefile
578   lib/arm/armopts.s
579   include/Makefile include/theora/Makefile
580   examples/Makefile
581   doc/Makefile doc/Doxyfile doc/spec/Makefile
582   tests/Makefile
583   m4/Makefile
584   libtheora.spec
585   theora.pc
586   theora-uninstalled.pc
587   theoradec.pc
588   theoradec-uninstalled.pc
589   theoraenc.pc
590   theoraenc-uninstalled.pc
591 ])
592
593 AS_AC_EXPAND(LIBDIR, ${libdir})
594 AS_AC_EXPAND(INCLUDEDIR, ${includedir})
595 AS_AC_EXPAND(BINDIR, ${bindir})
596 AS_AC_EXPAND(DOCDIR, ${docdir})
597
598 if test $HAVE_DOXYGEN = "false"; then
599   doc_build="no"
600 else
601   doc_build="yes"
602 fi
603 if test $BUILD_SPEC = "false"; then
604   spec_build="no"
605 else
606   spec_build="yes"
607 fi
608
609 AC_MSG_RESULT([
610 ------------------------------------------------------------------------
611   $PACKAGE $VERSION:  Automatic configuration OK.
612
613   General configuration:
614
615     Encoding support: ........... ${ac_enable_encode}
616     Floating point support: ..... ${ac_enable_float}
617     Assembly optimization: ...... ${cpu_optimization}
618     Debugging telemetry: ........ ${ac_enable_telemetry}
619     Build example code: ......... ${ac_enable_examples}
620     API Documentation: .......... ${doc_build}
621     Format Documentation: ....... ${spec_build}
622
623   Installation paths:
624
625     libtheora: ................... ${LIBDIR}
626     C header files: .............. ${INCLUDEDIR}/theora
627     Documentation: ............... ${DOCDIR}
628
629   Building:
630
631     Type 'make' to compile $PACKAGE.
632
633     Type 'make install' to install $PACKAGE.
634
635     ${TESTS_INFO}
636
637   Example programs will be built but not installed.
638 ------------------------------------------------------------------------
639 ])
640