VS2008 project files.
[xiph/unicode.git] / theora-old / configure.ac
blob4ac9447bd89f999160000e26724a68e7b2bbeb6a
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])
9 AC_CANONICAL_HOST
10 AC_CANONICAL_TARGET
12 AM_CONFIG_HEADER([config.h])
13 AC_CONFIG_SRCDIR([lib/dct.c])
14 AM_INIT_AUTOMAKE
15 AM_MAINTAINER_MODE
17 dnl Library versioning
19 V_LIB_CURRENT=2
20 V_LIB_REVISION=0
21 V_LIB_AGE=2
22 AC_SUBST(V_LIB_CURRENT)
23 AC_SUBST(V_LIB_REVISION)
24 AC_SUBST(V_LIB_AGE)
26 dnl Extra linker options (for version script)
27 THEORA_LDFLAGS=""
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
35 cflags_save="$CFLAGS"
36 AC_PROG_CC
37 AC_PROG_CPP
38 CFLAGS="$cflags_save"
40 AM_PROG_LIBTOOL
42 dnl Add parameters for aclocal
43 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
45 dnl Check for doxygen
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])
52 dnl Check for python
53 AC_CHECK_PROG(HAVE_PYTHON, python, true, false)
54 AM_CONDITIONAL(HAVE_PYTHON,$HAVE_PYTHON)
56 dnl Check for valgrind
57 VALGRIND_ENVIRONMENT=""
58 ac_enable_valgrind=no
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 "
65   fi
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}"
73   else
74     TESTS_INFO="Type 'make check' to run test suite (Valgrind not found)"
75   fi
76 else
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
86 cflags_save="$CFLAGS"
87 if test -z "$GCC"; then
88         case $host in 
89         *)
90                 DEBUG="-g -DDEBUG"
91                 CFLAGS="-O"
92                 PROFILE="-g -p -DDEBUG" ;;
93         esac
94 else
96         case $host in 
97         *)
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";;
101         esac
103 CFLAGS="$CFLAGS $cflags_save"
105 cpu_x86_64=no
106 cpu_x86_32=no
107 AC_ARG_ENABLE(asm,
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"
113   case $target_cpu in
114         i[[3456]]86)
115                 cpu_x86_32=yes 
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"
120                 fi
121                 ;;
122         x86_64)
123                 cpu_x86_64=yes
124                 cpu_optimization="64 bit x86"
125         AC_DEFINE([USE_ASM], [],  [make use of asm optimization])       
126     ;;
127   esac
128 else
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
136 AC_PROG_LD
137 AC_PROG_LD_GNU
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
142         case "$target_os" in
143         linux* | solaris* )
144                 SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
145                 ;;
146         *)
147                 ;;
148         esac
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 --------------------------------------------------
158 dnl check for Ogg
159 HAVE_OGG=no
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"
166 then
167   PKG_CHECK_MODULES(OGG, ogg >= 1.1, HAVE_OGG=yes, HAVE_OGG=no)
169 if test "x$HAVE_OGG" = "xno"
170 then
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
175     obtain a copy.
176   ]))
177   cflags_save=$CFLAGS
178   libs_save=$LIBS
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])
183   ])
184   CFLAGS=$cflags_save
185   LIBS=$libs_save
189 dnl check for Vorbis
190 HAVE_VORBIS=no
192 dnl first check through pkg-config since it's more flexible
194 if test "x$HAVE_PKG_CONFIG" = "xyes"
195 then
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"
204 then
205   dnl fall back to the old school test
206   XIPH_PATH_VORBIS(HAVE_VORBIS=yes, HAVE_VORBIS=no)
209 dnl check for SDL
210 HAVE_SDL=no
212 AM_PATH_SDL(,[
213         HAVE_SDL=yes
214         SDL_LIBS=`$SDL_CONFIG --libs`
215 ],AC_MSG_WARN([*** Unable to find SDL -- Not compiling example players ***]))
217 dnl check for OSS
218 HAVE_OSS=no
220 AC_CHECK_HEADERS([sys/soundcard.h soundcard.h machine/soundcard.h],[
221   HAVE_OSS=yes
222   break
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.
234 ac_enable_float=yes
235 AC_ARG_ENABLE(float,
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.
247 ac_enable_encode=yes
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])
255 else
256     if test x$HAVE_VORBIS = xyes; then
257       BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES encoder_example\$(EXEEXT)"
258     else
259       AC_MSG_NOTICE([Vorbis missing, cannot build example encoder])
260     fi
262 AM_CONDITIONAL(THEORA_DISABLE_ENCODE, [test "x${ac_enable_encode}" != xyes])
264 dnl --------------------------------------------------
265 dnl Check for headers
266 dnl --------------------------------------------------
268 dnl none here
270 dnl --------------------------------------------------
271 dnl Check for typedefs, structures, etc
272 dnl --------------------------------------------------
274 dnl none
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,
282               [GETOPT_OBJS=''],
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 --------------------------------------------------
292 dnl Do substitutions
293 dnl --------------------------------------------------
295 AC_SUBST(DEBUG)
296 AC_SUBST(PROFILE)
298 AC_OUTPUT([
299   Makefile lib/Makefile
300   include/Makefile include/theora/Makefile
301   examples/Makefile
302   doc/Makefile doc/Doxyfile
303   tests/Makefile
304   lib/Version_script
305   m4/Makefile
306   libtheora.spec
307   theora.pc
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
317   doc_build="no"
318 else
319   doc_build="yes"
321 dnl need to handle spec build?
323 AC_MSG_RESULT([
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}
334   Installation paths:
336     libtheora: ................... ${LIBDIR}
337     C header files: .............. ${INCLUDEDIR}/theora
338     Documentation: ............... ${DOCDIR}/$PACKAGE
340   Building:
342     Type 'make' to compile $PACKAGE.
344     Type 'make install' to install $PACKAGE.
346     ${TESTS_INFO}
348   Example programs will be built but not installed.
349 ------------------------------------------------------------------------