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