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