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