Add Russian translation provided by Валерий Крувялис <valkru@mail.ru>
[xiph-mirror.git] / vorbis / configure.ac
blobeddd02d7b177b0ea1085096baf1cd71b133fdf7a
1 dnl Process this file with autoconf to produce a configure script
3 dnl ------------------------------------------------
4 dnl Initialization and Versioning
5 dnl ------------------------------------------------
8 AC_INIT([libvorbis],[1.3.5],[vorbis-dev@xiph.org])
10 AC_CONFIG_SRCDIR([lib/mdct.c])
12 AC_CANONICAL_TARGET([])
14 AM_INIT_AUTOMAKE
15 AM_MAINTAINER_MODE
17 dnl Add parameters for aclocal
18 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
20 dnl Library versioning
21 dnl - library source changed -> increment REVISION
22 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
23 dnl - interfaces added -> increment AGE
24 dnl - interfaces removed -> AGE = 0
26 V_LIB_CURRENT=4
27 V_LIB_REVISION=8
28 V_LIB_AGE=4
30 VF_LIB_CURRENT=6
31 VF_LIB_REVISION=7
32 VF_LIB_AGE=3
34 VE_LIB_CURRENT=2
35 VE_LIB_REVISION=11
36 VE_LIB_AGE=0
38 AC_SUBST(V_LIB_CURRENT)
39 AC_SUBST(V_LIB_REVISION)
40 AC_SUBST(V_LIB_AGE)
41 AC_SUBST(VF_LIB_CURRENT)
42 AC_SUBST(VF_LIB_REVISION)
43 AC_SUBST(VF_LIB_AGE)
44 AC_SUBST(VE_LIB_CURRENT)
45 AC_SUBST(VE_LIB_REVISION)
46 AC_SUBST(VE_LIB_AGE)
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 AC_C_INLINE
61 AC_LIBTOOL_WIN32_DLL
62 AC_PROG_LIBTOOL
63 AM_PROG_CC_C_O
65 dnl Check for doxygen
66 if test "x$enable_docs" = xyes; then
67   AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
68   if test $HAVE_DOXYGEN = "false"; then
69     AC_MSG_WARN([*** doxygen not found, API documentation will not be built])
70   fi
71 else
72   HAVE_DOXYGEN=false
74 AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
76 dnl latex tools for the specification document
77 AC_ARG_ENABLE(docs,
78         AC_HELP_STRING([--enable-docs], [build the documentation]))
80 if test "x$enable_docs" = xyes; then
81   AC_CHECK_PROGS([PDFLATEX], pdflatex, [/bin/false])
82   AC_CHECK_PROGS([HTLATEX], htlatex, [/bin/false])
83   if test "x$PDFLATEX" = x/bin/false || test "x$HTLATEX" = x/bin/false; then
84     enable_docs=no
85     AC_MSG_WARN([Documentation will not be built!])
86   fi
89 AM_CONDITIONAL(BUILD_DOCS, [test "x$enable_docs" = xyes])
91 AC_ARG_ENABLE(examples, 
92   AS_HELP_STRING([--enable-examples], [build the examples])) 
93         
94 AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = xyes]) 
96 dnl --------------------------------------------------
97 dnl Set build flags based on environment
98 dnl --------------------------------------------------
100 dnl Set some target options
102 cflags_save="$CFLAGS"
103 if test -z "$GCC"; then
104         case $host in 
105         *-*-irix*)
106                 dnl If we're on IRIX, we wanna use cc even if gcc 
107                 dnl is there (unless the user has overriden us)...
108                 if test -z "$CC"; then
109                         CC=cc
110                 fi
111                 DEBUG="-g -signed" 
112                 CFLAGS="-O2 -w -signed"
113                 PROFILE="-p -g3 -O2 -signed" ;;
114         sparc-sun-solaris*)
115                 DEBUG="-v -g"
116                 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
117                 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
118         *)
119                 DEBUG="-g"
120                 CFLAGS="-O"
121                 PROFILE="-g -p" ;;
122         esac
123 else
125         AC_MSG_CHECKING([GCC version])
126         GCC_VERSION=`$CC -dumpversion`
127         AC_MSG_RESULT([$GCC_VERSION])
128         case $host in 
129         *86-*-linux*)
130                 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
131                 CFLAGS="-O3 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
132 #               PROFILE="-Wall -Wextra -pg -g -O3 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
133                 PROFILE="-Wall -Wextra -pg -g -O3 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"
135                 # glibc < 2.1.3 has a serious FP bug in the math inline header
136                 # that will cripple Vorbis.  Look to see if the magic FP stack
137                 # clobber is missing in the mathinline header, thus indicating
138                 # the buggy version
140                 AC_EGREP_CPP(log10.*fldlg2.*fxch,[
141                                 #define __LIBC_INTERNAL_MATH_INLINES 1
142                                 #define __OPTIMIZE__
143                                 #include <math.h>
144                                 ],bad=maybe,bad=no)
145                 if test ${bad} = "maybe" ;then
146                       AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
147                                         [
148                                         #define __LIBC_INTERNAL_MATH_INLINES 1
149                                         #define __OPTIMIZE__
150                                         #include <math.h>
151                                         ],bad=no,bad=yes)
152                 fi
153                 if test ${bad} = "yes" ;then
154  AC_MSG_WARN([                                                        ])
155  AC_MSG_WARN([********************************************************])
156  AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
157  AC_MSG_WARN([* in /usr/include/bits/mathinline.h  This bug affects  *])
158  AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
159  AC_MSG_WARN([* machine.  Upgrading to glibc 2.1.3 is strongly urged *])
160  AC_MSG_WARN([* to correct the problem.  Note that upgrading glibc   *])
161  AC_MSG_WARN([* will not fix any previously built programs; this is  *])
162  AC_MSG_WARN([* a compile-time bug.                                  *])
163  AC_MSG_WARN([* To work around the problem for this build of Ogg,    *])
164  AC_MSG_WARN([* autoconf is disabling all math inlining.  This will  *])
165  AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
166  AC_MSG_WARN([* will actually work.  Once glibc is upgraded, rerun   *])
167  AC_MSG_WARN([* configure and make to build with inlining.           *])
168  AC_MSG_WARN([********************************************************])
169  AC_MSG_WARN([                                                        ])
171                 CFLAGS=${OPT}" -D__NO_MATH_INLINES"
172                 PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
173                 fi;;
174         powerpc-*-linux*spe) 
175                 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES" 
176                 CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -D_REENTRANT" 
177                 PROFILE="-pg -g -O3 -ffast-math -mfused-madd -D_REENTRANT";; 
178         powerpc-*-linux*)
179                 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES"
180                 CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT"
181                 PROFILE="-pg -g -O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT";;
182         *-*-linux*)
183                 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
184                 CFLAGS="-O3 -Wall -Wextra -ffast-math -D_REENTRANT -fsigned-char"
185                 PROFILE="-pg -g -O3 -ffast-math -D_REENTRANT -fsigned-char";;
186         sparc-sun-*)
187                 sparc_cpu=""
188                 AC_MSG_CHECKING([if gcc supports -mv8])
189                 old_cflags="$CFLAGS"
190                 CFLAGS="$CFLAGS -mv8"
191                 AC_TRY_COMPILE(, [return 0;], [
192                         AC_MSG_RESULT([yes])
193                         sparc_cpu="-mv8"
194                 ])
195                 CFLAGS="$old_cflags"
196                 DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char $sparc_cpu"
197                 CFLAGS="-O3 -Wall -Wextra -ffast-math -D__NO_MATH_INLINES -fsigned-char $sparc_cpu"
198                 PROFILE="-pg -g -O3 -D__NO_MATH_INLINES -fsigned-char $sparc_cpu" ;;
199         *-*-darwin*)
200                 DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
201                 CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O3 -ffast-math -fsigned-char"
202                 PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O3 -ffast-math -fsigned-char";;
203         *-*-os2*)
204                 # Use -W instead of -Wextra because gcc on OS/2 is an old version.
205                 DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
206                 CFLAGS="-O3 -Wall -W -ffast-math -D_REENTRANT -fsigned-char"
207                 PROFILE="-pg -g -O3 -ffast-math -D_REENTRANT -fsigned-char";;
208         *)
209                 DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
210                 CFLAGS="-O3 -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
211                 PROFILE="-O3 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
212         esac
214         AC_ADD_CFLAGS([-Wdeclaration-after-statement])
216 CFLAGS="$CFLAGS $cflags_save"
218 dnl --------------------------------------------------
219 dnl Check for headers
220 dnl --------------------------------------------------
222 AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
224 dnl --------------------------------------------------
225 dnl Check for typedefs, structures, etc
226 dnl --------------------------------------------------
228 dnl none
230 dnl --------------------------------------------------
231 dnl Check for libraries
232 dnl --------------------------------------------------
234 AC_CHECK_LIB(m, cos, VORBIS_LIBS="-lm", VORBIS_LIBS="")
235 AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
237 PKG_PROG_PKG_CONFIG
239 HAVE_OGG=no
240 if test "x$PKG_CONFIG" != "x"
241 then
242   PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
244 if test "x$HAVE_OGG" = "xno"
245 then
246   dnl fall back to the old school test
247   XIPH_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!))
248   libs_save=$LIBS
249   LIBS="$OGG_LIBS $VORBIS_LIBS"
250   AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !))
251   LIBS=$libs_save
254 dnl --------------------------------------------------
255 dnl Check for library functions
256 dnl --------------------------------------------------
258 AC_FUNC_ALLOCA
259 AC_FUNC_MEMCMP
261 dnl --------------------------------------------------
262 dnl Do substitutions
263 dnl --------------------------------------------------
265 AC_SUBST(VORBIS_LIBS)
266 AC_SUBST(DEBUG)
267 AC_SUBST(PROFILE)
268 AC_SUBST(pthread_lib)
270 dnl The following line causes the libtool distributed with the source
271 dnl to be replaced if the build system has a more recent version.
272 AC_SUBST(LIBTOOL_DEPS)
274 AC_CONFIG_FILES([
275 Makefile
276 m4/Makefile
277 lib/Makefile
278 lib/modes/Makefile
279 lib/books/Makefile
280 lib/books/coupled/Makefile
281 lib/books/uncoupled/Makefile
282 lib/books/floor/Makefile
283 doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile doc/libvorbis/Makefile
284 doc/Doxyfile
285 include/Makefile include/vorbis/Makefile
286 examples/Makefile
287 test/Makefile
288 vq/Makefile
289 libvorbis.spec
290 vorbis.pc
291 vorbisenc.pc
292 vorbisfile.pc
293 vorbis-uninstalled.pc
294 vorbisenc-uninstalled.pc
295 vorbisfile-uninstalled.pc
297 AC_CONFIG_HEADERS([config.h])
299 AC_OUTPUT