Remove winamp2 plugin
[platform/upstream/flac.git] / configure.ac
1 #  FLAC - Free Lossless Audio Codec
2 #  Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009  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(src/flac/main.c)
22 AM_INIT_AUTOMAKE(flac, 1.2.1)
23 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
24
25 # Enable the generation of shared libraries under Win32
26 AC_LIBTOOL_WIN32_DLL
27
28 # We need two libtools, one that builds both shared and static, and
29 # one that builds only static.  This is because the resulting libtool
30 # does not allow us to choose which to build at runtime.
31 AM_PROG_LIBTOOL
32 sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
33 chmod +x libtool-disable-static
34
35 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
36 AC_CONFIG_MACRO_DIR([m4])
37
38 AM_PROG_AS
39 AC_PROG_CXX
40 AC_PROG_MAKE_SET
41
42 AC_SYS_LARGEFILE
43 AC_FUNC_FSEEKO
44
45 AC_CHECK_SIZEOF(void*,0)
46
47 #@@@ new name is AC_CONFIG_HEADERS
48 AM_CONFIG_HEADER(config.h)
49
50 AC_LANG_PUSH(C++)
51 # c++ flavor first
52 AC_C_VARARRAYS
53 if test $ac_cv_c_vararrays = yes; then
54         AC_DEFINE([HAVE_CXX_VARARRAYS], 1, [Define to 1 if C++ supports variable-length arrays.])
55 fi
56 AC_LANG_POP(C++)
57
58 # c flavor
59 AC_HEADER_STDC
60 AC_C_INLINE
61 AC_C_VARARRAYS
62
63 AC_CHECK_HEADERS(stdint.h)
64 AC_SUBST(HAVE_STDINT_H)
65 AC_CHECK_HEADERS(inttypes.h)
66 AC_SUBST(HAVE_INTTYPES_H)
67 AC_CHECK_HEADERS(byteswap.h)
68 AC_SUBST(HAVE_BYTESWAP_H)
69
70 XIPH_C_BSWAP32
71
72 XIPH_C_FIND_ENDIAN
73 AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
74                                         [Target processor is big endian.])
75 AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
76                                         [Target processor is little endian.])
77 AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
78                                         [Target processor is big endian.])
79
80 # For the XMMS plugin.
81 AC_CHECK_TYPES(socklen_t, [], [])
82
83 dnl check for getopt in standard library
84 dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
85 AC_CHECK_FUNCS(getopt_long, [], [])
86
87 case "$host_cpu" in
88         i*86)
89                 cpu_ia32=true
90                 AC_DEFINE(FLAC__CPU_IA32)
91                 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
92                 ;;
93         powerpc)
94                 cpu_ppc=true
95                 AC_DEFINE(FLAC__CPU_PPC)
96                 AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
97                 ;;
98         sparc)
99                 cpu_sparc=true
100                 AC_DEFINE(FLAC__CPU_SPARC)
101                 AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
102                 ;;
103 esac
104 AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
105 AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
106 AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
107
108 case "$host" in
109         i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
110         *-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
111         *-*-darwin*) OBJ_FORMAT=macho ;;
112         *emx*) OBJ_FORMAT=aout ;;
113         *) OBJ_FORMAT=elf ;;
114 esac
115 AC_SUBST(OBJ_FORMAT)
116 case "$host" in
117         *-gnuspe)
118                 abi_spe=true
119                 AC_DEFINE(FLAC__CPU_PPC_SPE)
120                 AH_TEMPLATE(FLAC__CPU_PPC_SPE, [define if building for PowerPC with SPE ABI])
121                 ;;
122 esac
123 AM_CONDITIONAL(FLaC__CPU_PPC_SPE, test "x$abi_spe" = xtrue)
124
125 case "$host" in
126         *-*-cygwin|*mingw*|*emx*)
127                 # define this variable for enabling strict exports with libtool; for now, it's supported by Win32 and OS/2
128                 LT_NO_UNDEFINED="-no-undefined"
129                 ;;
130         *)
131                 LT_NO_UNDEFINED=
132                 ;;
133 esac
134 AC_SUBST(LT_NO_UNDEFINED)
135
136 case "$host" in
137         *-pc-linux-gnu)
138                 sys_linux=true
139                 AC_DEFINE(FLAC__SYS_LINUX)
140                 AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
141                 ;;
142         *-*-darwin*)
143                 sys_darwin=true
144                 AC_DEFINE(FLAC__SYS_DARWIN)
145                 AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
146                 ;;
147 esac
148 AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
149 AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
150
151 if test "x$cpu_ia32" = xtrue ; then
152 AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
153 AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
154 fi
155
156 AC_ARG_ENABLE(asm-optimizations, AC_HELP_STRING([--disable-asm-optimizations], [Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
157 dnl ' Terminate the damn single quote
158 AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
159 if test "x$asm_opt" = xno ; then
160 AC_DEFINE(FLAC__NO_ASM)
161 AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
162 fi
163
164 AC_ARG_ENABLE(debug,
165 AC_HELP_STRING([--enable-debug], [Turn on debugging]),
166 [case "${enableval}" in
167         yes) debug=true ;;
168         no)  debug=false ;;
169         *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
170 esac],[debug=false])
171 AM_CONDITIONAL(DEBUG, test "x$debug" = xtrue)
172
173 AC_ARG_ENABLE(sse,
174 AC_HELP_STRING([--enable-sse], [Enable SSE support by asserting that the OS supports SSE instructions]),
175 [case "${enableval}" in
176         yes) sse_os=true ;;
177         no)  sse_os=false ;;
178         *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
179 esac],[sse_os=false])
180 AM_CONDITIONAL(FLaC__SSE_OS, test "x$sse_os" = xtrue)
181 if test "x$sse_os" = xtrue ; then
182 AC_DEFINE(FLAC__SSE_OS)
183 AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions])
184 fi
185
186 AC_ARG_ENABLE(3dnow,
187 AC_HELP_STRING([--disable-3dnow], [Disable 3DNOW! optimizations]),
188 [case "${enableval}" in
189         yes) use_3dnow=true ;;
190         no)  use_3dnow=false ;;
191         *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
192 esac],[use_3dnow=true])
193 AM_CONDITIONAL(FLaC__USE_3DNOW, test "x$use_3dnow" = xtrue)
194 if test "x$use_3dnow" = xtrue ; then
195 AC_DEFINE(FLAC__USE_3DNOW)
196 AH_TEMPLATE(FLAC__USE_3DNOW, [define to enable use of 3Dnow! instructions])
197 fi
198
199 AC_ARG_ENABLE(altivec,
200 AC_HELP_STRING([--disable-altivec], [Disable Altivec optimizations]),
201 [case "${enableval}" in
202         yes) use_altivec=true ;;
203         no)  use_altivec=false ;;
204         *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
205 esac],[use_altivec=true])
206 AM_CONDITIONAL(FLaC__USE_ALTIVEC, test "x$use_altivec" = xtrue)
207 if test "x$use_altivec" = xtrue ; then
208 AC_DEFINE(FLAC__USE_ALTIVEC)
209 AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions])
210 fi
211
212 AC_ARG_ENABLE(thorough-tests,
213 AC_HELP_STRING([--disable-thorough-tests], [Disable thorough (long) testing, do only basic tests]),
214 [case "${enableval}" in
215         yes) thorough_tests=true ;;
216         no)  thorough_tests=false ;;
217         *) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;;
218 esac],[thorough_tests=true])
219 AC_ARG_ENABLE(exhaustive-tests,
220 AC_HELP_STRING([--enable-exhaustive-tests], [Enable exhaustive testing (VERY long)]),
221 [case "${enableval}" in
222         yes) exhaustive_tests=true ;;
223         no)  exhaustive_tests=false ;;
224         *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
225 esac],[exhaustive_tests=false])
226 if test "x$thorough_tests" = xfalse ; then
227 FLAC__TEST_LEVEL=0
228 elif test "x$exhaustive_tests" = xfalse ; then
229 FLAC__TEST_LEVEL=1
230 else
231 FLAC__TEST_LEVEL=2
232 fi
233 AC_SUBST(FLAC__TEST_LEVEL)
234
235 AC_ARG_ENABLE(gcc-werror,
236         AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]))
237
238 AC_ARG_ENABLE(valgrind-testing,
239 AC_HELP_STRING([--enable-valgrind-testing], [Run all tests inside Valgrind]),
240 [case "${enableval}" in
241         yes) FLAC__TEST_WITH_VALGRIND=yes ;;
242         no)  FLAC__TEST_WITH_VALGRIND=no ;;
243         *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
244 esac],[FLAC__TEST_WITH_VALGRIND=no])
245 AC_SUBST(FLAC__TEST_WITH_VALGRIND)
246
247 AC_ARG_ENABLE(doxygen-docs,
248 AC_HELP_STRING([--disable-doxygen-docs], [Disable API documentation building via Doxygen]),
249 [case "${enableval}" in
250         yes) enable_doxygen_docs=true ;;
251         no)  enable_doxygen_docs=false ;;
252         *) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;;
253 esac],[enable_doxygen_docs=true])
254 if test "x$enable_doxygen_docs" != xfalse ; then
255         AC_CHECK_PROGS(DOXYGEN, doxygen)
256 fi
257 AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
258
259 AC_ARG_ENABLE(local-xmms-plugin,
260 AC_HELP_STRING([--enable-local-xmms-plugin], [Install XMMS plugin to ~/.xmms/Plugins instead of system location]),
261 [case "${enableval}" in
262         yes) install_xmms_plugin_locally=true ;;
263         no)  install_xmms_plugin_locally=false ;;
264         *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
265 esac],[install_xmms_plugin_locally=false])
266 AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test "x$install_xmms_plugin_locally" = xtrue)
267
268 AC_ARG_ENABLE(xmms-plugin,
269 AC_HELP_STRING([--disable-xmms-plugin], [Do not build XMMS plugin]),
270 [case "${enableval}" in
271         yes) enable_xmms_plugin=true ;;
272         no)  enable_xmms_plugin=false ;;
273         *) AC_MSG_ERROR(bad value ${enableval} for --enable-xmms-plugin) ;;
274 esac],[enable_xmms_plugin=true])
275 if test "x$enable_xmms_plugin" != xfalse ; then
276         AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - XMMS support will not be built]))
277 fi
278 AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "$XMMS_INPUT_PLUGIN_DIR")
279
280 dnl build FLAC++ or not
281 AC_ARG_ENABLE([cpplibs],
282 AC_HELP_STRING([--disable-cpplibs], [Do not build libFLAC++]),
283 [case "${enableval}" in
284         yes) disable_cpplibs=false ;;
285         no)  disable_cpplibs=true ;;
286         *)   AC_MSG_ERROR(bad value ${enableval} for --enable-cpplibs) ;;
287 esac], [disable_cpplibs=false])
288 AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test "x$disable_cpplibs" != xtrue])
289
290 dnl check for ogg library
291 AC_ARG_ENABLE([ogg],
292         AC_HELP_STRING([--disable-ogg], [Disable ogg support (default: test for libogg)]),
293         [ want_ogg=$enableval ], [ want_ogg=yes ] )
294
295 if test "x$want_ogg" != "xno"; then
296         XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
297 fi
298
299 AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
300 if test "x$have_ogg" = xyes ; then
301 AC_DEFINE(FLAC__HAS_OGG)
302 AH_TEMPLATE(FLAC__HAS_OGG, [define if you have the ogg library])
303 fi
304
305 dnl check for i18n(internationalization); these are from libiconv/gettext
306 AM_ICONV
307 AM_LANGINFO_CODESET
308
309 AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
310 AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
311 if test -n "$DOCBOOK_TO_MAN" ; then
312 AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
313 AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
314 fi
315
316 # only matters for x86
317 AC_CHECK_PROGS(NASM, nasm)
318 AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
319 if test -n "$NASM" ; then
320 AC_DEFINE(FLAC__HAS_NASM)
321 AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
322 fi
323
324 # only matters for PowerPC
325 AC_CHECK_PROGS(AS, as, as)
326 AC_CHECK_PROGS(GAS, gas, gas)
327
328 # try -v (apple as) and --version (gas) at the same time
329 test "$AS" = "as" && as --version -v < /dev/null 2>&1 | grep Apple >/dev/null || AS=gas
330
331 AM_CONDITIONAL(FLaC__HAS_AS, test "$AS" = "as")
332 AM_CONDITIONAL(FLaC__HAS_GAS, test "$AS" = "gas")
333 if test "$AS" = "as" ; then
334 AC_DEFINE(FLAC__HAS_AS)
335 AH_TEMPLATE(FLAC__HAS_AS, [define if you are compiling for PowerPC and have the 'as' assembler])
336 fi
337 if test "$AS" = "gas" ; then
338 # funniest. macro. ever.
339 AC_DEFINE(FLAC__HAS_GAS)
340 AH_TEMPLATE(FLAC__HAS_GAS, [define if you are compiling for PowerPC and have the 'gas' assembler])
341 fi
342
343 CPPFLAGS='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'" $CPPFLAGS"
344 if test "x$debug" = xtrue; then
345         CPPFLAGS="-DDEBUG -DFLaC__INLINE= $CPPFLAGS"
346         CFLAGS="-g $CFLAGS"
347 else
348         CPPFLAGS="-DNDEBUG $CPPFLAGS"
349         # $ac_cv_c_inline from AC_C_INLINE
350         if test "x$ac_cv_c_inline" != xno ; then
351                 CPPFLAGS="-DFLaC__INLINE=$ac_cv_c_inline $CPPFLAGS"
352         fi
353         if test "x$GCC" = xyes; then
354                 CFLAGS="-O3 -funroll-loops -finline-functions -Wall -W -Winline $CFLAGS"
355         fi
356 fi
357
358 XIPH_GCC_VERSION
359
360 if test x$ac_cv_c_compiler_gnu = xyes ; then
361         if test x$enable_gcc_werror = "xyes" ; then
362                 CFLAGS="-Werror $CFLAGS"
363                 CXXFLAGS="-Werror $CXXFLAGS"
364                 fi
365         fi
366
367
368 #@@@
369 AM_CONDITIONAL(FLaC__HAS_AS__TEMPORARILY_DISABLED, test "yes" = "no")
370 AM_CONDITIONAL(FLaC__HAS_GAS__TEMPORARILY_DISABLED, test "yes" = "no")
371
372 AC_CONFIG_FILES([ \
373         Makefile \
374         src/Makefile \
375         src/libFLAC/Makefile \
376         src/libFLAC/flac.pc \
377         src/libFLAC/ia32/Makefile \
378         src/libFLAC/ppc/Makefile \
379         src/libFLAC/ppc/as/Makefile \
380         src/libFLAC/ppc/gas/Makefile \
381         src/libFLAC/include/Makefile \
382         src/libFLAC/include/private/Makefile \
383         src/libFLAC/include/protected/Makefile \
384         src/libFLAC++/Makefile \
385         src/libFLAC++/flac++.pc \
386         src/flac/Makefile \
387         src/metaflac/Makefile \
388         src/monkeys_audio_utilities/Makefile \
389         src/monkeys_audio_utilities/flac_mac/Makefile \
390         src/monkeys_audio_utilities/flac_ren/Makefile \
391         src/plugin_common/Makefile \
392         src/plugin_xmms/Makefile \
393         src/share/Makefile \
394         src/share/getopt/Makefile \
395         src/share/grabbag/Makefile \
396         src/share/replaygain_analysis/Makefile \
397         src/share/replaygain_synthesis/Makefile \
398         src/share/replaygain_synthesis/include/Makefile \
399         src/share/replaygain_synthesis/include/private/Makefile \
400         src/share/utf8/Makefile \
401         src/test_grabbag/Makefile \
402         src/test_grabbag/cuesheet/Makefile \
403         src/test_grabbag/picture/Makefile \
404         src/test_libs_common/Makefile \
405         src/test_libFLAC/Makefile \
406         src/test_libFLAC++/Makefile \
407         src/test_seeking/Makefile \
408         src/test_streams/Makefile \
409         src/utils/Makefile \
410         src/utils/flacdiff/Makefile \
411         src/utils/flactimer/Makefile \
412         examples/Makefile \
413         examples/c/Makefile \
414         examples/c/decode/Makefile \
415         examples/c/decode/file/Makefile \
416         examples/c/encode/Makefile \
417         examples/c/encode/file/Makefile \
418         examples/cpp/Makefile \
419         examples/cpp/decode/Makefile \
420         examples/cpp/decode/file/Makefile \
421         examples/cpp/encode/Makefile \
422         examples/cpp/encode/file/Makefile \
423         include/Makefile \
424         include/FLAC/Makefile \
425         include/FLAC++/Makefile \
426         include/share/Makefile \
427         include/share/grabbag/Makefile \
428         include/test_libs_common/Makefile \
429         doc/Makefile \
430         doc/html/Makefile \
431         doc/html/images/Makefile \
432         doc/html/images/hw/Makefile \
433         doc/html/ru/Makefile \
434         m4/Makefile \
435         man/Makefile \
436         test/Makefile \
437         test/cuesheets/Makefile \
438         test/flac-to-flac-metadata-test-files/Makefile \
439         test/metaflac-test-files/Makefile \
440         test/pictures/Makefile \
441         build/Makefile \
442         obj/Makefile \
443         obj/debug/Makefile \
444         obj/debug/bin/Makefile \
445         obj/debug/lib/Makefile \
446         obj/release/Makefile \
447         obj/release/bin/Makefile \
448         obj/release/lib/Makefile \
449 ])
450 AC_OUTPUT
451
452 AC_MSG_RESULT([
453 -=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
454
455   Configuration summary :
456
457     FLAC version : ........................ ${VERSION}
458
459     Host CPU : ............................ ${host_cpu}
460     Host Vendor : ......................... ${host_vendor}
461     Host OS : ............................. ${host_os}
462 ])
463
464 if test x$ac_cv_c_compiler_gnu = xyes ; then
465         echo "    Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
466         echo "    GCC version : ......................... ${GCC_VERSION}"
467         fi