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.0alpha8-svn])
12 AM_CONFIG_HEADER([config.h])
13 AC_CONFIG_SRCDIR([lib/dct.c])
17 dnl Library versioning
22 AC_SUBST(V_LIB_CURRENT)
23 AC_SUBST(V_LIB_REVISION)
26 dnl Extra linker options (for version script)
29 dnl --------------------------------------------------
30 dnl Check for programs
31 dnl --------------------------------------------------
33 dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
34 dnl if $CFLAGS is blank
42 dnl Add parameters for aclocal
43 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
46 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
47 AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
48 if test $HAVE_DOXYGEN = "false"; then
49 AC_MSG_WARN([*** doxygen not found, API documentation will not be built])
53 AC_CHECK_PROG(HAVE_PYTHON, python, true, false)
54 AM_CONDITIONAL(HAVE_PYTHON,$HAVE_PYTHON)
56 dnl Check for valgrind
57 VALGRIND_ENVIRONMENT=""
59 AC_ARG_ENABLE(valgrind-testing,
60 [ --enable-valgrind-testing enable running of tests inside Valgrind ], [ ac_enable_valgrind=yes ], [ ac_enable_valgrind=no] )
62 if test "x${ac_enable_valgrind}" = xyes ; then
63 if test "x${enable_shared}" = xyes ; then
64 VALGRIND_ENVIRONMENT="libtool --mode=execute "
67 AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
68 if test "x$HAVE_VALGRIND" = xyes ; then
69 VALGRIND_ENVIRONMENT="$VALGRIND_ENVIRONMENT valgrind -q --leak-check=yes --show-reachable=yes --num-callers=100"
70 AC_SUBST(VALGRIND_ENVIRONMENT)
71 TESTS_INFO="Type 'make check' to run test suite. Tests will be run under:
72 ${VALGRIND_ENVIRONMENT}"
74 TESTS_INFO="Type 'make check' to run test suite (Valgrind not found)"
77 TESTS_INFO="Type 'make check' to run test suite (Valgrind testing not enabled)"
80 dnl --------------------------------------------------
81 dnl Set build flags based on environment
82 dnl --------------------------------------------------
84 dnl Set some target options
87 if test -z "$GCC"; then
92 PROFILE="-g -p -DDEBUG" ;;
98 DEBUG="-g -Wall -DDEBUG -D__NO_MATH_INLINES"
99 CFLAGS="-Wall -O3 -fforce-addr -fomit-frame-pointer -finline-functions -funroll-loops"
100 PROFILE="-Wall -pg -g -O3 -fno-inline-functions -DDEBUG";;
103 CFLAGS="$CFLAGS $cflags_save"
108 [ --disable-asm disable assembly optimizations ],
109 [ ac_enable_asm=$enableval ], [ ac_enable_asm=yes] )
111 if test "x${ac_enable_asm}" = xyes; then
112 cpu_optimization="no optimization for your platform, please send a patch"
116 cpu_optimization="32 bit x86"
117 AC_DEFINE([USE_ASM], [], [make use of asm optimization])
118 if test "x$target_vendor" = "xapple"; then
119 THEORA_LDFLAGS="$THEORA_LDFLAGS -Wl,-read_only_relocs,suppress"
124 cpu_optimization="64 bit x86"
125 AC_DEFINE([USE_ASM], [], [make use of asm optimization])
129 cpu_optimization="disabled"
132 AM_CONDITIONAL([CPU_x86_64], [test x$cpu_x86_64 = xyes])
133 AM_CONDITIONAL([CPU_x86_32], [test x$cpu_x86_32 = xyes])
135 # Test whenever ld supports -version-script
138 if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
139 SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
141 dnl Set extra linker options
144 SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
149 THEORA_LDFLAGS="$THEORA_LDFLAGS SHLIB_VERSION_ARG"
152 AC_SUBST(THEORA_LDFLAGS)
154 dnl --------------------------------------------------
155 dnl Checks for support libraries and headers
156 dnl --------------------------------------------------
161 dnl first check through pkg-config since it's more flexible
163 dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
164 AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
165 if test "x$HAVE_PKG_CONFIG" = "xyes"
167 PKG_CHECK_MODULES(OGG, ogg >= 1.1, HAVE_OGG=yes, HAVE_OGG=no)
169 if test "x$HAVE_OGG" = "xno"
171 dnl fall back to the old school test
172 XIPH_PATH_OGG(, AC_MSG_ERROR([
173 libogg is required to build this package!
174 please see http://www.xiph.org/ for how to
179 CFLAGS="$CFLAGS $OGG_CFLAGS"
180 LIBS="$LIBS $OGG_LIBS"
181 AC_CHECK_FUNC(oggpackB_read, , [
182 AC_MSG_ERROR([newer libogg version (1.1 or later) required])
192 dnl first check through pkg-config since it's more flexible
194 if test "x$HAVE_PKG_CONFIG" = "xyes"
196 PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0.1, HAVE_VORBIS=yes, HAVE_VORBIS=no)
197 dnl also set VORBISENC_LIBS since an examples needs it
198 dnl the old .m4 sets this to a value to use on top of VORBIS_LIBS,
199 dnl so we do the same here.
200 VORBISENC_LIBS="-lvorbisenc"
201 AC_SUBST(VORBISENC_LIBS)
203 if test "x$HAVE_VORBIS" = "xno"
205 dnl fall back to the old school test
206 XIPH_PATH_VORBIS(HAVE_VORBIS=yes, HAVE_VORBIS=no)
214 SDL_LIBS=`$SDL_CONFIG --libs`
215 ],AC_MSG_WARN([*** Unable to find SDL -- Not compiling example players ***]))
220 AC_CHECK_HEADERS([sys/soundcard.h soundcard.h machine/soundcard.h],[
224 if test x$HAVE_OSS != xyes; then
225 AC_MSG_WARN([OSS audio support not found -- not compiling player_example])
228 dnl --------------------------------------------------
229 dnl Overall build configuration options
230 dnl --------------------------------------------------
232 dnl Configuration option for building of floating point code.
236 [ --disable-float disable use of floating point code ],
237 [ ac_enable_float=$enableval ], [ ac_enable_float=yes] )
239 if test "x${ac_enable_float}" != xyes ; then
240 AC_DEFINE([THEORA_DISABLE_FLOAT], [],
241 [Define to exclude floating point code from the build])
243 AM_CONDITIONAL(THEORA_DISABLE_FLOAT, [test "x${ac_enable_float}" != xyes])
245 dnl Configuration option for building of encoding support.
248 AC_ARG_ENABLE(encode,
249 [ --disable-encode disable encoding support ],
250 [ ac_enable_encode=$enableval ], [ ac_enable_encode=yes] )
252 if test "x${ac_enable_encode}" != xyes ; then
253 AC_DEFINE([THEORA_DISABLE_ENCODE], [],
254 [Define to exclude encode support from the build])
256 if test x$HAVE_VORBIS = xyes; then
257 BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES encoder_example\$(EXEEXT)"
259 AC_MSG_NOTICE([Vorbis missing, cannot build example encoder])
262 AM_CONDITIONAL(THEORA_DISABLE_ENCODE, [test "x${ac_enable_encode}" != xyes])
264 dnl --------------------------------------------------
265 dnl Check for headers
266 dnl --------------------------------------------------
270 dnl --------------------------------------------------
271 dnl Check for typedefs, structures, etc
272 dnl --------------------------------------------------
276 dnl --------------------------------------------------
277 dnl Check for library functions
278 dnl --------------------------------------------------
280 dnl substitute the included getopt if the system doesn't support long options
281 AC_CHECK_FUNC(getopt_long,
283 [GETOPT_OBJS='getopt.$(OBJEXT) getopt1.$(OBJEXT)'])
284 AC_SUBST(GETOPT_OBJS)
286 if test x$HAVE_SDL = xyes -a x$HAVE_OSS = xyes -a x$HAVE_VORBIS = xyes; then
287 BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES player_example"
289 AC_SUBST(BUILDABLE_EXAMPLES)
291 dnl --------------------------------------------------
293 dnl --------------------------------------------------
299 Makefile lib/Makefile
300 include/Makefile include/theora/Makefile
302 doc/Makefile doc/Doxyfile
308 theora-uninstalled.pc
311 AS_AC_EXPAND(LIBDIR, ${libdir})
312 AS_AC_EXPAND(INCLUDEDIR, ${includedir})
313 AS_AC_EXPAND(BINDIR, ${bindir})
314 AS_AC_EXPAND(DOCDIR, ${datadir}/doc)
316 if test $HAVE_DOXYGEN = "false"; then
321 dnl need to handle spec build?
324 ------------------------------------------------------------------------
325 $PACKAGE $VERSION: Automatic configuration OK.
327 General configuration:
329 Encoding support: ........... ${ac_enable_encode}
330 Floating point support: ..... ${ac_enable_float}
331 Assembly optimization: ...... ${cpu_optimization}
332 API Documentation: .......... ${doc_build}
336 libtheora: ................... ${LIBDIR}
337 C header files: .............. ${INCLUDEDIR}/theora
338 Documentation: ............... ${DOCDIR}/$PACKAGE
342 Type 'make' to compile $PACKAGE.
344 Type 'make install' to install $PACKAGE.
348 Example programs will be built but not installed.
349 ------------------------------------------------------------------------