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