7dce4e771165520a22b298726394ee66c87e5f1a
[platform/upstream/flac.git] / configure.in
1 #  FLAC - Free Lossless Audio Codec
2 #  Copyright (C) 2001,2002,2003,2004,2005,2006 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.1.3)
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 #@@@ new name is AC_CONFIG_HEADERS
45 AM_CONFIG_HEADER(config.h)
46
47 AC_CHECK_TYPES(socklen_t, [], [])
48
49 dnl check for getopt in standard library
50 dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
51 AC_CHECK_FUNCS(getopt_long, [], [])
52
53 case "$host_cpu" in
54         i*86)
55                 cpu_ia32=true
56                 AC_DEFINE(FLAC__CPU_IA32)
57                 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
58                 ;;
59         powerpc)
60                 cpu_ppc=true
61                 AC_DEFINE(FLAC__CPU_PPC)
62                 AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
63                 ;;
64         sparc)
65                 cpu_sparc=true
66                 AC_DEFINE(FLAC__CPU_SPARC)
67                 AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
68                 ;;
69 esac
70 AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
71 AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
72 AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
73 case "$host" in
74         i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
75         *-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
76         *) OBJ_FORMAT=elf ;;
77 esac
78 AC_SUBST(OBJ_FORMAT)
79 case "$host" in
80         *-pc-linux-gnu)
81                 sys_linux=true
82                 AC_DEFINE(FLAC__SYS_LINUX)
83                 AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
84                 ;;
85         *-*-darwin*)
86                 sys_darwin=true
87                 AC_DEFINE(FLAC__SYS_DARWIN)
88                 AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
89                 ;;
90 esac
91 AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
92 AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
93
94 if test "x$cpu_ia32" = xtrue ; then
95 AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
96 AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
97 fi
98
99 AC_ARG_ENABLE(asm-optimizations, AC_HELP_STRING([--disable-asm-optimizations], [Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
100 AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
101 if test "x$asm_opt" = xno ; then
102 AC_DEFINE(FLAC__NO_ASM)
103 AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
104 fi
105
106 AC_ARG_ENABLE(debug,
107 AC_HELP_STRING([--enable-debug], [Turn on debugging]),
108 [case "${enableval}" in
109         yes) debug=true ;;
110         no)  debug=false ;;
111         *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
112 esac],[debug=false])
113 AM_CONDITIONAL(DEBUG, test "x$debug" = xtrue)
114
115 AC_ARG_ENABLE(sse,
116 AC_HELP_STRING([--enable-sse], [Enable SSE support by asserting that the OS supports SSE instructions]),
117 [case "${enableval}" in
118         yes) sse_os=true ;;
119         no)  sse_os=false ;;
120         *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
121 esac],[sse_os=false])
122 AM_CONDITIONAL(FLaC__SSE_OS, test "x$sse_os" = xtrue)
123 if test "x$sse_os" = xtrue ; then
124 AC_DEFINE(FLAC__SSE_OS)
125 AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions])
126 fi
127
128 AC_ARG_ENABLE(3dnow,
129 AC_HELP_STRING([--disable-3dnow], [Disable 3DNOW! optimizations]),
130 [case "${enableval}" in
131         yes) use_3dnow=true ;;
132         no)  use_3dnow=false ;;
133         *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
134 esac],[use_3dnow=true])
135 AM_CONDITIONAL(FLaC__USE_3DNOW, test "x$use_3dnow" = xtrue)
136 if test "x$use_3dnow" = xtrue ; then
137 AC_DEFINE(FLAC__USE_3DNOW)
138 AH_TEMPLATE(FLAC__USE_3DNOW, [define to enable use of 3Dnow! instructions])
139 fi
140
141 AC_ARG_ENABLE(altivec,
142 AC_HELP_STRING([--disable-altivec], [Disable Altivec optimizations]),
143 [case "${enableval}" in
144         yes) use_altivec=true ;;
145         no)  use_altivec=false ;;
146         *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
147 esac],[use_altivec=true])
148 AM_CONDITIONAL(FLaC__USE_ALTIVEC, test "x$use_altivec" = xtrue)
149 if test "x$use_altivec" = xtrue ; then
150 AC_DEFINE(FLAC__USE_ALTIVEC)
151 AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions])
152 fi
153
154 AC_ARG_ENABLE(thorough-tests,
155 AC_HELP_STRING([--disable-thorough-tests], [Disable thorough (long) testing, do only basic tests]),
156 [case "${enableval}" in
157         yes) thorough_tests=true ;;
158         no)  thorough_tests=false ;;
159         *) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;;
160 esac],[thorough_tests=true])
161 AC_ARG_ENABLE(exhaustive-tests,
162 AC_HELP_STRING([--enable-exhaustive-tests], [Enable exhaustive testing (VERY long)]),
163 [case "${enableval}" in
164         yes) exhaustive_tests=true ;;
165         no)  exhaustive_tests=false ;;
166         *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
167 esac],[exhaustive_tests=false])
168 if test "x$thorough_tests" = xfalse ; then
169 FLAC__TEST_LEVEL=0
170 elif test "x$exhaustive_tests" = xfalse ; then
171 FLAC__TEST_LEVEL=1
172 else
173 FLAC__TEST_LEVEL=2
174 fi
175 AC_SUBST(FLAC__TEST_LEVEL)
176
177 AC_ARG_ENABLE(valgrind-testing,
178 AC_HELP_STRING([--enable-valgrind-testing], [Run all tests inside Valgrind]),
179 [case "${enableval}" in
180         yes) FLAC__TEST_WITH_VALGRIND=yes ;;
181         no)  FLAC__TEST_WITH_VALGRIND=no ;;
182         *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
183 esac],[FLAC__TEST_WITH_VALGRIND=no])
184 AC_SUBST(FLAC__TEST_WITH_VALGRIND)
185
186 AC_ARG_ENABLE(doxygen-docs,
187 AC_HELP_STRING([--disable-doxygen-docs], [Disable API documentation building via Doxygen]),
188 [case "${enableval}" in
189         yes) enable_doxygen_docs=true ;;
190         no)  enable_doxygen_docs=false ;;
191         *) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;;
192 esac],[enable_doxygen_docs=true])
193 if test "x$enable_doxygen_docs" != xfalse ; then
194         AC_CHECK_PROGS(DOXYGEN, doxygen)
195 fi
196 AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
197
198 AC_ARG_ENABLE(local-xmms-plugin,
199 AC_HELP_STRING([--enable-local-xmms-plugin], [Install XMMS plugin to ~/.xmms/Plugins instead of system location]),
200 [case "${enableval}" in
201         yes) install_xmms_plugin_locally=true ;;
202         no)  install_xmms_plugin_locally=false ;;
203         *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
204 esac],[install_xmms_plugin_locally=false])
205 AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test "x$install_xmms_plugin_locally" = xtrue)
206
207 AC_ARG_ENABLE(xmms-plugin,
208 AC_HELP_STRING([--disable-xmms-plugin], [Do not build XMMS plugin]),
209 [case "${enableval}" in
210         yes) enable_xmms_plugin=true ;;
211         no)  enable_xmms_plugin=false ;;
212         *) AC_MSG_ERROR(bad value ${enableval} for --enable-xmms-plugin) ;;
213 esac],[enable_xmms_plugin=true])
214 if test "x$enable_xmms_plugin" != xfalse ; then
215         AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - XMMS support will not be built]))
216 fi
217 AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "$XMMS_INPUT_PLUGIN_DIR")
218
219 dnl check for ogg library
220 XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
221 AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
222 if test "x$have_ogg" = xyes ; then
223 AC_DEFINE(FLAC__HAS_OGG)
224 AH_TEMPLATE(FLAC__HAS_OGG, [define if you have the ogg library])
225 fi
226
227 dnl check for i18n(internationalization); these are from libiconv/gettext
228 AM_ICONV
229 AM_LANGINFO_CODESET
230
231 AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
232 AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
233 if test -n "$DOCBOOK_TO_MAN" ; then
234 AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
235 AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
236 fi
237
238 # only matters for x86
239 AC_CHECK_PROGS(NASM, nasm)
240 AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
241 if test -n "$NASM" ; then
242 AC_DEFINE(FLAC__HAS_NASM)
243 AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
244 fi
245
246 # only matters for PowerPC
247 AC_CHECK_PROGS(AS, as, as)
248 AC_CHECK_PROGS(GAS, gas, gas)
249
250 test "$AS" = "as" && as --version | grep GNU >/dev/null && AS=gas
251
252 AM_CONDITIONAL(FLaC__HAS_AS, test "$AS" = "as")
253 AM_CONDITIONAL(FLaC__HAS_GAS, test "$AS" = "gas")
254 if test "$AS" = "as" ; then
255 AC_DEFINE(FLAC__HAS_AS)
256 AH_TEMPLATE(FLAC__HAS_AS, [define if you are compiling for PowerPC and have the 'as' assembler])
257 fi
258 if test "$AS" = "gas" ; then
259 # funniest. macro. ever.
260 AC_DEFINE(FLAC__HAS_GAS)
261 AH_TEMPLATE(FLAC__HAS_GAS, [define if you are compiling for PowerPC and have the 'gas' assembler])
262 fi
263
264 OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
265 if test "x$debug" = xtrue; then
266         OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -g -O0 -DDEBUG"
267 else
268         OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -O2 -DNDEBUG"
269         if test "x$GCC" = xyes; then
270                 OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -O3 -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__"
271         fi
272 fi
273 CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS"
274 CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS"
275
276 #@@@@@@
277 AM_CONDITIONAL(FLaC__HAS_AS__TEMPORARILY_DISABLED, test "yes" = "no")
278 AM_CONDITIONAL(FLaC__HAS_GAS__TEMPORARILY_DISABLED, test "yes" = "no")
279
280 AC_CONFIG_FILES([ \
281         Makefile \
282         src/Makefile \
283         src/libFLAC/Makefile \
284         src/libFLAC/ia32/Makefile \
285         src/libFLAC/ppc/Makefile \
286         src/libFLAC/ppc/as/Makefile \
287         src/libFLAC/ppc/gas/Makefile \
288         src/libFLAC/include/Makefile \
289         src/libFLAC/include/private/Makefile \
290         src/libFLAC/include/protected/Makefile \
291         src/libFLAC++/Makefile \
292         src/libOggFLAC/Makefile \
293         src/libOggFLAC/include/Makefile \
294         src/libOggFLAC/include/private/Makefile \
295         src/libOggFLAC/include/protected/Makefile \
296         src/libOggFLAC++/Makefile \
297         src/flac/Makefile \
298         src/metaflac/Makefile \
299         src/monkeys_audio_utilities/Makefile \
300         src/monkeys_audio_utilities/flac_mac/Makefile \
301         src/monkeys_audio_utilities/flac_ren/Makefile \
302         src/plugin_common/Makefile \
303         src/plugin_winamp2/Makefile \
304         src/plugin_winamp2/include/Makefile \
305         src/plugin_winamp2/include/winamp2/Makefile \
306         src/plugin_xmms/Makefile \
307         src/share/Makefile \
308         src/share/getopt/Makefile \
309         src/share/grabbag/Makefile \
310         src/share/replaygain_analysis/Makefile \
311         src/share/replaygain_synthesis/Makefile \
312         src/share/replaygain_synthesis/include/Makefile \
313         src/share/replaygain_synthesis/include/private/Makefile \
314         src/share/utf8/Makefile \
315         src/test_grabbag/Makefile \
316         src/test_grabbag/cuesheet/Makefile \
317         src/test_libFLAC/Makefile \
318         src/test_libFLAC++/Makefile \
319         src/test_libOggFLAC/Makefile \
320         src/test_libOggFLAC++/Makefile \
321         src/test_seeking/Makefile \
322         src/test_streams/Makefile \
323         include/Makefile \
324         include/FLAC/Makefile \
325         include/FLAC++/Makefile \
326         include/OggFLAC/Makefile \
327         include/OggFLAC++/Makefile \
328         include/share/Makefile \
329         include/share/grabbag/Makefile \
330         doc/Makefile \
331         doc/html/Makefile \
332         doc/html/images/Makefile \
333         doc/html/ru/Makefile \
334         man/Makefile \
335         test/Makefile \
336         test/cuesheets/Makefile \
337         build/Makefile \
338         obj/Makefile \
339         obj/debug/Makefile \
340         obj/debug/bin/Makefile \
341         obj/debug/lib/Makefile \
342         obj/release/Makefile \
343         obj/release/bin/Makefile \
344         obj/release/lib/Makefile \
345         flac.pbproj/Makefile \
346 ])
347 AC_OUTPUT