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