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