flac-leaks
[platform/upstream/flac.git] / configure.in
1 #  FLAC - Free Lossless Audio Codec
2 #  Copyright (C) 2001,2002,2003,2004,2005,2006,2007  Josh Coalson
3 #
4 #  This file is part the FLAC project.  FLAC is comprised of several
5 #  components distributed under difference licenses.  The codec libraries
6 #  are distributed under Xiph.Org's BSD-like license (see the file
7 #  COPYING.Xiph in this distribution).  All other programs, libraries, and
8 #  plugins are distributed under the GPL (see COPYING.GPL).  The documentation
9 #  is distributed under the Gnu FDL (see COPYING.FDL).  Each file in the
10 #  FLAC distribution contains at the top the terms under which it may be
11 #  distributed.
12 #
13 #  Since this particular file is relevant to all components of FLAC,
14 #  it may be distributed under the Xiph.Org license, which is the least
15 #  restrictive of those mentioned above.  See the file COPYING.Xiph in this
16 #  distribution.
17
18 # NOTE that for many of the AM_CONDITIONALs we use the prefix FLaC__
19 # instead of FLAC__ since autoconf triggers off 'AC_' in strings
20
21 AC_INIT
22 AC_CONFIG_SRCDIR([src/flac/main.c])
23 AM_INIT_AUTOMAKE(flac, 1.2.1)
24
25 # Don't automagically regenerate autoconf/automake generated files unless
26 # explicitly requested.  Eases autobuilding -mdz
27 AM_MAINTAINER_MODE
28
29 # We need two libtools, one that builds both shared and static, and
30 # one that builds only static.  This is because the resulting libtool
31 # does not allow us to choose which to build at runtime.
32 #AM_PROG_LIBTOOL
33 #sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
34 #chmod +x libtool-disable-static
35
36 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
37
38 AM_PROG_AS
39 AC_PROG_CC_STDC
40 AC_PROG_CXX
41 AC_PROG_MAKE_SET
42 AC_USE_SYSTEM_EXTENSIONS
43 AC_SYS_LARGEFILE
44 AC_FUNC_FSEEKO
45 LT_INIT([pic-only disable-static])
46 AC_CHECK_SIZEOF(void*,0)
47
48 #@@@ new name is AC_CONFIG_HEADERS
49 AC_CONFIG_HEADERS([config.h])
50
51 AC_C_BIGENDIAN
52
53 AC_CHECK_TYPES(socklen_t, [], [])
54
55 dnl check for getopt in standard library
56 dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
57 AC_CHECK_FUNCS(getopt_long, [], [])
58
59 case "$host_cpu" in
60         i*86)
61                 cpu_ia32=true
62                 AC_DEFINE(FLAC__CPU_IA32)
63                 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
64                 ;;
65         powerpc)
66                 cpu_ppc=true
67                 AC_DEFINE(FLAC__CPU_PPC)
68                 AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
69                 ;;
70         sparc)
71                 cpu_sparc=true
72                 AC_DEFINE(FLAC__CPU_SPARC)
73                 AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
74                 ;;
75 esac
76 AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
77 AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
78 AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
79
80 case "$host" in
81         i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
82         *-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
83         *-*-darwin*) OBJ_FORMAT=macho ;;
84         *) OBJ_FORMAT=elf ;;
85 esac
86 AC_SUBST(OBJ_FORMAT)
87
88 # only needed because of ntohl() usage, can get rid of after that's gone:
89 case "$host" in
90         *-*-cygwin|*mingw*) MINGW_WINSOCK_LIBS=-lwsock32 ;;
91         *) MINGW_WINSOCK_LIBS= ;;
92 esac
93 AC_SUBST(MINGW_WINSOCK_LIBS)
94
95 case "$host" in
96         *-pc-linux-gnu)
97                 sys_linux=true
98                 AC_DEFINE(FLAC__SYS_LINUX)
99                 AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
100                 ;;
101         *-*-darwin*)
102                 sys_darwin=true
103                 AC_DEFINE(FLAC__SYS_DARWIN)
104                 AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
105                 ;;
106 esac
107 AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
108 AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
109
110 if test "x$cpu_ia32" = xtrue ; then
111 AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
112 AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
113 fi
114
115 AC_ARG_ENABLE(asm-optimizations, AS_HELP_STRING([--disable-asm-optimizations],[Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
116 AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
117 if test "x$asm_opt" = xno ; then
118 AC_DEFINE(FLAC__NO_ASM)
119 AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
120 fi
121
122 AC_ARG_ENABLE(debug,
123 AS_HELP_STRING([--enable-debug],[Turn on debugging]),
124 [case "${enableval}" in
125         yes) debug=true ;;
126         no)  debug=false ;;
127         *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
128 esac],[debug=false])
129 AM_CONDITIONAL(DEBUG, test "x$debug" = xtrue)
130
131 AC_ARG_ENABLE(sse,
132 AS_HELP_STRING([--enable-sse],[Enable SSE support by asserting that the OS supports SSE instructions]),
133 [case "${enableval}" in
134         yes) sse_os=true ;;
135         no)  sse_os=false ;;
136         *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
137 esac],[sse_os=false])
138 AM_CONDITIONAL(FLaC__SSE_OS, test "x$sse_os" = xtrue)
139 if test "x$sse_os" = xtrue ; then
140 AC_DEFINE(FLAC__SSE_OS)
141 AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions])
142 fi
143
144 AC_ARG_ENABLE(3dnow,
145 AS_HELP_STRING([--disable-3dnow],[Disable 3DNOW! optimizations]),
146 [case "${enableval}" in
147         yes) use_3dnow=true ;;
148         no)  use_3dnow=false ;;
149         *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
150 esac],[use_3dnow=true])
151 AM_CONDITIONAL(FLaC__USE_3DNOW, test "x$use_3dnow" = xtrue)
152 if test "x$use_3dnow" = xtrue ; then
153 AC_DEFINE(FLAC__USE_3DNOW)
154 AH_TEMPLATE(FLAC__USE_3DNOW, [define to enable use of 3Dnow! instructions])
155 fi
156
157 AC_ARG_ENABLE(altivec,
158 AS_HELP_STRING([--disable-altivec],[Disable Altivec optimizations]),
159 [case "${enableval}" in
160         yes) use_altivec=true ;;
161         no)  use_altivec=false ;;
162         *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
163 esac],[use_altivec=true])
164 AM_CONDITIONAL(FLaC__USE_ALTIVEC, test "x$use_altivec" = xtrue)
165 if test "x$use_altivec" = xtrue ; then
166 AC_DEFINE(FLAC__USE_ALTIVEC)
167 AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions])
168 fi
169
170 AC_ARG_ENABLE(thorough-tests,
171 AS_HELP_STRING([--disable-thorough-tests],[Disable thorough (long) testing, do only basic tests]),
172 [case "${enableval}" in
173         yes) thorough_tests=true ;;
174         no)  thorough_tests=false ;;
175         *) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;;
176 esac],[thorough_tests=true])
177 AC_ARG_ENABLE(exhaustive-tests,
178 AS_HELP_STRING([--enable-exhaustive-tests],[Enable exhaustive testing (VERY long)]),
179 [case "${enableval}" in
180         yes) exhaustive_tests=true ;;
181         no)  exhaustive_tests=false ;;
182         *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
183 esac],[exhaustive_tests=false])
184 if test "x$thorough_tests" = xfalse ; then
185 FLAC__TEST_LEVEL=0
186 elif test "x$exhaustive_tests" = xfalse ; then
187 FLAC__TEST_LEVEL=1
188 else
189 FLAC__TEST_LEVEL=2
190 fi
191 AC_SUBST(FLAC__TEST_LEVEL)
192
193 AC_ARG_ENABLE(valgrind-testing,
194 AS_HELP_STRING([--enable-valgrind-testing],[Run all tests inside Valgrind]),
195 [case "${enableval}" in
196         yes) FLAC__TEST_WITH_VALGRIND=yes ;;
197         no)  FLAC__TEST_WITH_VALGRIND=no ;;
198         *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
199 esac],[FLAC__TEST_WITH_VALGRIND=no])
200 AC_SUBST(FLAC__TEST_WITH_VALGRIND)
201
202 AC_ARG_ENABLE(doxygen-docs,
203 AS_HELP_STRING([--disable-doxygen-docs],[Disable API documentation building via Doxygen]),
204 [case "${enableval}" in
205         yes) enable_doxygen_docs=true ;;
206         no)  enable_doxygen_docs=false ;;
207         *) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;;
208 esac],[enable_doxygen_docs=true])
209 if test "x$enable_doxygen_docs" != xfalse ; then
210         AC_CHECK_PROGS(DOXYGEN, doxygen)
211 fi
212 AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
213
214 AC_ARG_ENABLE(local-xmms-plugin,
215 AS_HELP_STRING([--enable-local-xmms-plugin],[Install XMMS plugin to ~/.xmms/Plugins instead of system location]),
216 [case "${enableval}" in
217         yes) install_xmms_plugin_locally=true ;;
218         no)  install_xmms_plugin_locally=false ;;
219         *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
220 esac],[install_xmms_plugin_locally=false])
221 AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test "x$install_xmms_plugin_locally" = xtrue)
222
223 AC_ARG_ENABLE(xmms-plugin,
224 AS_HELP_STRING([--disable-xmms-plugin],[Do not build XMMS plugin]),
225 [case "${enableval}" in
226         yes) enable_xmms_plugin=true ;;
227         no)  enable_xmms_plugin=false ;;
228         *) AC_MSG_ERROR(bad value ${enableval} for --enable-xmms-plugin) ;;
229 esac],[enable_xmms_plugin=true])
230 dnl if test "x$enable_xmms_plugin" != xfalse ; then
231 dnl     AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - XMMS support will not be built]))
232 dnl fi
233 AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "$XMMS_INPUT_PLUGIN_DIR")
234
235 dnl build FLAC++ or not
236 AC_ARG_ENABLE([cpplibs],
237 AS_HELP_STRING([--disable-cpplibs],[Do not build libFLAC++]),
238 [case "${enableval}" in
239         yes) disable_cpplibs=false ;;
240         no)  disable_cpplibs=true ;;
241         *)   AC_MSG_ERROR(bad value ${enableval} for --enable-cpplibs) ;;
242 esac], [disable_cpplibs=false])
243 AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test "x$disable_cpplibs" != xtrue])
244
245 dnl check for ogg library
246 AC_ARG_ENABLE([ogg],
247         AS_HELP_STRING([--disable-ogg],[Disable ogg support (default: test for libogg)]),
248         [ want_ogg=$enableval ], [ want_ogg=yes ] )
249
250 if test "x$want_ogg" != "xno"; then
251         XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
252 fi
253  
254 AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
255 if test "x$have_ogg" = xyes ; then
256 AC_DEFINE(FLAC__HAS_OGG)
257 AH_TEMPLATE(FLAC__HAS_OGG, [define if you have the ogg library])
258 fi
259
260 dnl check for i18n(internationalization); these are from libiconv/gettext
261 AM_ICONV
262 AM_LANGINFO_CODESET
263
264 AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
265 AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
266 if test -n "$DOCBOOK_TO_MAN" ; then
267 AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
268 AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
269 fi
270
271 # only matters for x86
272 AC_CHECK_PROGS(NASM, nasm)
273 AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
274 if test -n "$NASM" ; then
275 AC_DEFINE(FLAC__HAS_NASM)
276 AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
277 fi
278
279 # only matters for PowerPC
280 AC_CHECK_PROGS(AS, as, as)
281 AC_CHECK_PROGS(GAS, gas, gas)
282
283 # try -v (apple as) and --version (gas) at the same time
284 test "$AS" = "as" && as --version -v < /dev/null 2>&1 | grep Apple >/dev/null || AS=gas
285
286 AM_CONDITIONAL(FLaC__HAS_AS, test "$AS" = "as")
287 AM_CONDITIONAL(FLaC__HAS_GAS, test "$AS" = "gas")
288 if test "$AS" = "as" ; then
289 AC_DEFINE(FLAC__HAS_AS)
290 AH_TEMPLATE(FLAC__HAS_AS, [define if you are compiling for PowerPC and have the 'as' assembler])
291 fi
292 if test "$AS" = "gas" ; then
293 # funniest. macro. ever.
294 AC_DEFINE(FLAC__HAS_GAS)
295 AH_TEMPLATE(FLAC__HAS_GAS, [define if you are compiling for PowerPC and have the 'gas' assembler])
296 fi
297
298 CPPFLAGS='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'" $CPPFLAGS"
299 if test "x$debug" = xtrue; then
300         CPPFLAGS="-DDEBUG $CPPFLAGS"
301         CFLAGS="-g $CFLAGS"
302 else
303         CPPFLAGS="-DNDEBUG $CPPFLAGS"
304         if test "x$GCC" = xyes; then
305                 CPPFLAGS="-DFLaC__INLINE=__always_inline $CPPFLAGS"
306     CFLAGS="$CFLAGS"
307         fi
308 fi
309
310 #@@@
311 AM_CONDITIONAL(FLaC__HAS_AS__TEMPORARILY_DISABLED, test "yes" = "no")
312 AM_CONDITIONAL(FLaC__HAS_GAS__TEMPORARILY_DISABLED, test "yes" = "no")
313
314 AC_CONFIG_FILES([ \
315         Makefile \
316         src/Makefile \
317         src/libFLAC/Makefile \
318         src/libFLAC/flac.pc \
319         src/libFLAC/ia32/Makefile \
320         src/libFLAC/ppc/Makefile \
321         src/libFLAC/ppc/as/Makefile \
322         src/libFLAC/ppc/gas/Makefile \
323         src/libFLAC/include/Makefile \
324         src/libFLAC/include/private/Makefile \
325         src/libFLAC/include/protected/Makefile \
326         src/libFLAC++/Makefile \
327         src/libFLAC++/flac++.pc \
328         src/flac/Makefile \
329         src/metaflac/Makefile \
330         src/monkeys_audio_utilities/Makefile \
331         src/monkeys_audio_utilities/flac_mac/Makefile \
332         src/monkeys_audio_utilities/flac_ren/Makefile \
333         src/plugin_common/Makefile \
334         src/plugin_winamp2/Makefile \
335         src/plugin_winamp2/include/Makefile \
336         src/plugin_winamp2/include/winamp2/Makefile \
337         src/plugin_xmms/Makefile \
338         src/share/Makefile \
339         src/share/getopt/Makefile \
340         src/share/grabbag/Makefile \
341         src/share/replaygain_analysis/Makefile \
342         src/share/replaygain_synthesis/Makefile \
343         src/share/replaygain_synthesis/include/Makefile \
344         src/share/replaygain_synthesis/include/private/Makefile \
345         src/share/utf8/Makefile \
346         src/test_grabbag/Makefile \
347         src/test_grabbag/cuesheet/Makefile \
348         src/test_grabbag/picture/Makefile \
349         src/test_libs_common/Makefile \
350         src/test_libFLAC/Makefile \
351         src/test_libFLAC++/Makefile \
352         src/test_seeking/Makefile \
353         src/test_streams/Makefile \
354         examples/Makefile \
355         examples/c/Makefile \
356         examples/c/decode/Makefile \
357         examples/c/decode/file/Makefile \
358         examples/c/encode/Makefile \
359         examples/c/encode/file/Makefile \
360         examples/cpp/Makefile \
361         examples/cpp/decode/Makefile \
362         examples/cpp/decode/file/Makefile \
363         examples/cpp/encode/Makefile \
364         examples/cpp/encode/file/Makefile \
365         include/Makefile \
366         include/FLAC/Makefile \
367         include/FLAC++/Makefile \
368         include/share/Makefile \
369         include/share/grabbag/Makefile \
370         include/test_libs_common/Makefile \
371         doc/Makefile \
372         doc/html/Makefile \
373         doc/html/images/Makefile \
374         doc/html/images/hw/Makefile \
375         doc/html/ru/Makefile \
376         m4/Makefile \
377         man/Makefile \
378         test/Makefile \
379         test/cuesheets/Makefile \
380         test/flac-to-flac-metadata-test-files/Makefile \
381         test/metaflac-test-files/Makefile \
382         test/pictures/Makefile \
383         build/Makefile \
384         obj/Makefile \
385         obj/debug/Makefile \
386         obj/debug/bin/Makefile \
387         obj/debug/lib/Makefile \
388         obj/release/Makefile \
389         obj/release/bin/Makefile \
390         obj/release/lib/Makefile \
391 ])
392 AC_OUTPUT