Don't check for ltablex when determining if we should build the format
[xiph/unicode.git] / theora / configure.ac
blob48fe552294f6a7627b664d36cded8af38d7c7d98
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])
9 AC_CANONICAL_HOST
10 AC_CANONICAL_TARGET
12 AM_CONFIG_HEADER([config.h])
13 AC_CONFIG_SRCDIR([lib/enc/dct.c])
14 AM_INIT_AUTOMAKE
15 AM_MAINTAINER_MODE
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
24 TH_LIB_CURRENT=3
25 TH_LIB_REVISION=2
26 TH_LIB_AGE=3
27 AC_SUBST(TH_LIB_CURRENT)
28 AC_SUBST(TH_LIB_REVISION)
29 AC_SUBST(TH_LIB_AGE)
31 THDEC_LIB_CURRENT=1
32 THDEC_LIB_REVISION=0
33 THDEC_LIB_AGE=0
34 AC_SUBST(THDEC_LIB_CURRENT)
35 AC_SUBST(THDEC_LIB_REVISION)
36 AC_SUBST(THDEC_LIB_AGE)
38 THENC_LIB_CURRENT=1
39 THENC_LIB_REVISION=0
40 THENC_LIB_AGE=0
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)
46 THEORA_LDFLAGS=""
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
54 cflags_save="$CFLAGS"
55 AC_PROG_CC
56 AC_PROG_CPP
57 CFLAGS="$cflags_save"
59 AM_PROG_CC_C_O
60 AM_PROG_LIBTOOL
62 dnl Add parameters for aclocal
63 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
65 dnl Check for doxygen
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)
76 BUILD_SPEC="false"
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`
82       tex_pkg_ok="yes"
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
87 \\documentclass{book}
88 $pkg_line
89 \\begin{document}
90 Hello World.
91 \\end{document}
92 _ACEOF
93         if pdflatex -interaction batchmode -halt-on-error conftest < /dev/null > /dev/null 2>&1; then
94           AC_MSG_RESULT([ok])
95         else
96           tex_pkg_ok="no"
97           AC_MSG_RESULT([no])
98         fi
99       done
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
104         BUILD_SPEC="true"
105       fi
106     fi
107   fi
108  fi
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 "
124   fi
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}"
132   else
133     TESTS_INFO="Type 'make check' to run test suite (Valgrind not found)"
134   fi
135 else
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
147         case $host in 
148         *)
149                 DEBUG="-g -DDEBUG"
150                 CFLAGS="-O"
151                 PROFILE="-g -p -DDEBUG" ;;
152         esac
153 else
155         case $host in 
156         *)
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";;
160         esac
162 CFLAGS="$CFLAGS $cflags_save"
164 cpu_x86_64=no
165 cpu_x86_32=no
166 AC_ARG_ENABLE(asm,
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"
172   case $target_cpu in
173   i[[3456]]86)
174     cpu_x86_32=yes 
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"
179     fi
180     
181     AC_DEFINE([OC_X86ASM], [], [enable x86 assambler optimization])
182       ;;
183   x86_64)
184     cpu_x86_64=yes
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])
188     ;;
189   esac
190 else
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
198 AC_PROG_LD
199 AC_PROG_LD_GNU
200 AC_MSG_CHECKING([library versioning support])
202 THDEC_VERSION_ARG=""
203 THENC_VERSION_ARG=""
204 TH_VERSION_ARG=""
205 if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
206  case "$target_os" in
207   linux* | solaris* )
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'
211     AC_MSG_RESULT([yes])
212     ;;
213   *)
214     # build without versioning
215     AC_MSG_RESULT([no])
216     ;;
217  esac
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 --------------------------------------------------
231 dnl check for Ogg
232 HAVE_OGG=no
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"
239 then
240   PKG_CHECK_MODULES(OGG, ogg >= 1.1, HAVE_OGG=yes, HAVE_OGG=no)
242 if test "x$HAVE_OGG" = "xno"
243 then
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
248     obtain a copy.
249   ]))
250   cflags_save=$CFLAGS
251   libs_save=$LIBS
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])
256   ])
257   CFLAGS=$cflags_save
258   LIBS=$libs_save
262 dnl check for Vorbis
263 HAVE_VORBIS=no
265 dnl first check through pkg-config since it's more flexible
267 if test "x$HAVE_PKG_CONFIG" = "xyes"
268 then
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"
277 then
278   dnl fall back to the old school test
279   XIPH_PATH_VORBIS(HAVE_VORBIS=yes, HAVE_VORBIS=no)
282 dnl check for SDL
283 HAVE_SDL=no
285 AM_PATH_SDL(,[
286   HAVE_SDL=yes
287   SDL_LIBS=`$SDL_CONFIG --libs`
288 ],AC_MSG_WARN([*** Unable to find SDL -- Not compiling example players ***]))
290 dnl check for OSS
291 HAVE_OSS=no
293 AC_CHECK_HEADERS([sys/soundcard.h soundcard.h machine/soundcard.h],[
294   HAVE_OSS=yes
295   break
297 if test x$HAVE_OSS != xyes; then
298   AC_MSG_WARN([OSS audio support not found -- not compiling player_example])
301 dnl check for libpng
302 HAVE_PNG=no
303 if test "x$HAVE_PKG_CONFIG" = "xyes"
304 then
305   PKG_CHECK_MODULES(PNG, libpng, HAVE_PNG=yes, HAVE_PNG=no)
307 AC_SUBST(PNG_CFLAGS)
308 AC_SUBST(PNG_LIBS)
310 dnl --------------------------------------------------
311 dnl Overall build configuration options
312 dnl --------------------------------------------------
314 dnl Configuration option for building of floating point code.
316 ac_enable_float=yes
317 AC_ARG_ENABLE(float,
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.
329 ac_enable_encode=yes
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])
337 else
338     if test x$HAVE_VORBIS = xyes; then
339       BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES encoder_example\$(EXEEXT)"
340     else
341       AC_MSG_NOTICE([Vorbis missing, cannot build example encoder])
342     fi
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 --------------------------------------------------
358 dnl none here
360 dnl --------------------------------------------------
361 dnl Check for typedefs, structures, etc
362 dnl --------------------------------------------------
364 dnl none
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,
372               [GETOPT_OBJS=''],
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 --------------------------------------------------
385 dnl Do substitutions
386 dnl --------------------------------------------------
388 AC_SUBST(DEBUG)
389 AC_SUBST(PROFILE)
391 AC_OUTPUT([
392   Makefile 
393   lib/Makefile
394   include/Makefile include/theora/Makefile
395   examples/Makefile
396   doc/Makefile doc/Doxyfile doc/spec/Makefile
397   tests/Makefile
398   m4/Makefile
399   libtheora.spec
400   theora.pc
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
410   doc_build="no"
411 else
412   doc_build="yes"
414 if test $BUILD_SPEC = "false"; then
415   spec_build="no"
416 else
417   spec_build="yes"
420 AC_MSG_RESULT([
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}
433   Installation paths:
435     libtheora: ................... ${LIBDIR}
436     C header files: .............. ${INCLUDEDIR}/theora
437     Documentation: ............... ${DOCDIR}/$PACKAGE
439   Building:
441     Type 'make' to compile $PACKAGE.
443     Type 'make install' to install $PACKAGE.
445     ${TESTS_INFO}
447   Example programs will be built but not installed.
448 ------------------------------------------------------------------------