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