add 2206 to copyright notice
[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.2)
23 AM_INIT_AUTOMAKE(flac, CVS)
24
25 # Don't automagically regenerate autoconf/automake generated files unless
26 # explicitly requested.  Eases autobuilding -mdz
27 AM_MAINTAINER_MODE
28
29 # We need two libtools, one that builds both shared and static, and
30 # one that builds only static.  This is because the resulting libtool
31 # does not allow us to choose which to build at runtime.
32 AM_PROG_LIBTOOL
33 sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
34 chmod +x libtool-disable-static
35
36 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
37
38 AM_PROG_AS
39 AC_PROG_CXX
40 AC_PROG_MAKE_SET
41
42 AC_CHECK_TYPES(socklen_t, [], [])
43
44 dnl check for getopt in standard library
45 dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
46 AC_CHECK_FUNCS(getopt_long, [], [])
47
48 case "$host_cpu" in
49         i*86)   cpu_ia32=true ; AC_DEFINE(FLAC__CPU_IA32) ;;
50         powerpc)        cpu_ppc=true ; AC_DEFINE(FLAC__CPU_PPC) ;;
51         sparc)  cpu_sparc=true ; AC_DEFINE(FLAC__CPU_SPARC) ;;
52 esac
53 AM_CONDITIONAL(FLaC__CPU_IA32, test x$cpu_ia32 = xtrue)
54 AM_CONDITIONAL(FLaC__CPU_PPC, test x$cpu_ppc = xtrue)
55 AM_CONDITIONAL(FLaC__CPU_SPARC, test x$cpu_sparc = xtrue)
56 case "$host" in
57         i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
58         *-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
59         *) OBJ_FORMAT=elf ;;
60 esac
61 AC_SUBST(OBJ_FORMAT)
62 case "$host" in
63         *-pc-linux-gnu) sys_linux=true ; AC_DEFINE(FLAC__SYS_LINUX) ;;
64         *-*-darwin*) sys_darwin=true ; AC_DEFINE(FLAC__SYS_DARWIN) ;;
65 esac
66 AM_CONDITIONAL(FLaC__SYS_DARWIN, test x$sys_darwin = xtrue)
67 AM_CONDITIONAL(FLaC__SYS_LINUX, test x$sys_linux = xtrue)
68
69 if test x$cpu_ia32 = xtrue ; then
70 AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
71 fi
72
73 AC_ARG_ENABLE(asm-optimizations, [  --disable-asm-optimizations    Don't use any assembly optimization routines], asm_opt=no, asm_opt=yes)
74 AM_CONDITIONAL(FLaC__NO_ASM, test x$asm_opt = xno)
75 if test x$asm_opt = xno ; then
76 AC_DEFINE(FLAC__NO_ASM)
77 fi
78
79 AC_ARG_ENABLE(debug,
80 [  --enable-debug                 Turn on debugging],
81 [case "${enableval}" in
82         yes) debug=true ;;
83         no)  debug=false ;;
84         *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
85 esac],[debug=false])
86 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
87
88 AC_ARG_ENABLE(sse,
89 [  --enable-sse                   Enable SSE support by asserting that the OS supports SSE instructions],
90 [case "${enableval}" in
91         yes) sse_os=true ;;
92         no)  sse_os=false ;;
93         *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
94 esac],[sse_os=false])
95 AM_CONDITIONAL(FLaC__SSE_OS, test x$sse_os = xtrue)
96 if test x$sse_os = xtrue ; then
97 AC_DEFINE(FLAC__SSE_OS)
98 fi
99
100 AC_ARG_ENABLE(3dnow,
101 [  --disable-3dnow                Disable 3DNOW! optimizations],
102 [case "${enableval}" in
103         yes) use_3dnow=true ;;
104         no)  use_3dnow=false ;;
105         *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
106 esac],[use_3dnow=true])
107 AM_CONDITIONAL(FLaC__USE_3DNOW, test x$use_3dnow = xtrue)
108 if test x$use_3dnow = xtrue ; then
109 AC_DEFINE(FLAC__USE_3DNOW)
110 fi
111
112 AC_ARG_ENABLE(altivec,
113 [  --disable-altivec              Disable Altivec optimizations],
114 [case "${enableval}" in
115         yes) use_altivec=true ;;
116         no)  use_altivec=false ;;
117         *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
118 esac],[use_altivec=true])
119 AM_CONDITIONAL(FLaC__USE_ALTIVEC, test x$use_altivec = xtrue)
120 if test x$use_altivec = xtrue ; then
121 AC_DEFINE(FLAC__USE_ALTIVEC)
122 fi
123
124 AC_ARG_ENABLE(local-xmms-plugin,
125 [  --enable-local-xmms-plugin     Install XMMS plugin to ~/.xmms/Plugins instead of system location],
126 [case "${enableval}" in
127         yes) install_xmms_plugin_locally=true ;;
128         no)  install_xmms_plugin_locally=false ;;
129         *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
130 esac],[install_xmms_plugin_locally=false])
131 AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test x$install_xmms_plugin_locally = xtrue)
132
133 AC_ARG_ENABLE(exhaustive-tests,
134 [  --enable-exhaustive-tests      Enable exhaustive testing],
135 [case "${enableval}" in
136         yes) exhaustive_tests=true ;;
137         no)  exhaustive_tests=false ;;
138         *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
139 esac],[exhaustive_tests=false])
140 AM_CONDITIONAL(FLaC__EXHAUSTIVE_TESTS, test x$exhaustive_tests = xtrue)
141 if test x$exhaustive_tests = xtrue ; then
142 AC_DEFINE(FLAC__EXHAUSTIVE_TESTS)
143 fi
144
145 AC_ARG_ENABLE(valgrind-testing,
146 [  --enable-valgrind-testing      Run all tests inside Valgrind],
147 [case "${enableval}" in
148         yes) valgrind_testing=true ;;
149         no)  valgrind_testing=false ;;
150         *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
151 esac],[valgrind_testing=false])
152 AM_CONDITIONAL(FLaC__VALGRIND_TESTING, test x$valgrind_testing = xtrue)
153 if test x$valgrind_testing = xtrue ; then
154 AC_DEFINE(FLAC__VALGRIND_TESTING)
155 fi
156
157 dnl check for ogg library
158 XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
159 AM_CONDITIONAL(FLaC__HAS_OGG, [test x$have_ogg = xyes])
160 if test x$have_ogg = xyes ; then
161 AC_DEFINE(FLAC__HAS_OGG)
162 fi
163
164 AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - xmms support will not be built]))
165 AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
166
167 dnl check for i18n(internationalization); these are from libiconv/gettext
168 AM_ICONV
169 AM_LANGINFO_CODESET
170
171 AC_CHECK_PROGS(DOXYGEN, doxygen)
172 AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
173 if test -n "$DOXYGEN" ; then
174 AC_DEFINE(FLAC__HAS_DOXYGEN)
175 fi
176
177 AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
178 AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
179 if test -n "$DOCBOOK_TO_MAN" ; then
180 AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
181 fi
182
183 # only matters for x86
184 AC_CHECK_PROGS(NASM, nasm)
185 AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
186 if test -n "$NASM" ; then
187 AC_DEFINE(FLAC__HAS_NASM)
188 fi
189
190 # only matters for PowerPC
191 AC_CHECK_PROGS(AS, as, as)
192 AC_CHECK_PROGS(GAS, gas, gas)
193
194 test "$AS" = "as" && as --version | grep GNU >/dev/null && AS=gas
195
196 AM_CONDITIONAL(FLaC__HAS_AS, test "$AS" = "as")
197 AM_CONDITIONAL(FLaC__HAS_GAS, test "$AS" = "gas")
198 if test "$AS" = "as" ; then
199 AC_DEFINE(FLAC__HAS_AS)
200 fi
201 if test "$AS" = "gas" ; then
202 # funniest. macro. ever.
203 AC_DEFINE(FLAC__HAS_GAS)
204 fi
205
206 OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
207 if test x$debug = xtrue; then
208         OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -g -O0 -DDEBUG"
209 else
210         OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -O2 -DNDEBUG"
211         if test x$GCC = xyes; then
212                 OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -O3 -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__"
213         fi
214 fi
215 CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS"
216 CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS"
217
218 #@@@@@@
219 AM_CONDITIONAL(FLaC__HAS_AS__TEMPORARILY_DISABLED, test "yes" = "no")
220 AM_CONDITIONAL(FLaC__HAS_GAS__TEMPORARILY_DISABLED, test "yes" = "no")
221
222 AM_CONFIG_HEADER(config.h)
223 AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA,  [define to align allocated memory on 32-byte boundaries])
224 AH_TEMPLATE(FLAC__CPU_IA32,  [define if building for ia32/i386])
225 AH_TEMPLATE(FLAC__CPU_PPC,  [define if building for PowerPC])
226 AH_TEMPLATE(FLAC__CPU_SPARC,  [define if building for SPARC])
227 AH_TEMPLATE(FLAC__SYS_DARWIN,  [define if building for Darwin / MacOS X])
228 AH_TEMPLATE(FLAC__SYS_LINUX,  [define if building for Linux])
229 AH_TEMPLATE(FLAC__EXHAUSTIVE_TESTS,  [define to run even more tests])
230 AH_TEMPLATE(FLAC__VALGRIND_TESTING,  [define to enable use of Valgrind in testers])
231 AH_TEMPLATE(FLAC__HAS_DOXYGEN,  [define if you have Doxygen])
232 AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN,  [define if you have docbook-to-man or docbook2man])
233 AH_TEMPLATE(FLAC__HAS_NASM,  [define if you are compiling for x86 and have the NASM assembler])
234 AH_TEMPLATE(FLAC__HAS_AS,  [define if you are compiling for PowerPC and have the 'as' assembler])
235 AH_TEMPLATE(FLAC__HAS_GAS,  [define if you are compiling for PowerPC and have the 'gas' assembler])
236 AH_TEMPLATE(FLAC__HAS_OGG,  [define if you have the ogg library])
237 AH_TEMPLATE(FLAC__NO_ASM,  [define to disable use of assembly code])
238 AH_TEMPLATE(FLAC__SSE_OS,  [define if your operating system supports SSE instructions])
239 AH_TEMPLATE(FLAC__USE_3DNOW,  [define to enable use of 3Dnow! instructions])
240 AH_TEMPLATE(FLAC__USE_ALTIVEC,  [define to enable use of Altivec instructions])
241
242 AC_OUTPUT( \
243         Makefile \
244         src/Makefile \
245         src/libFLAC/Makefile \
246         src/libFLAC/ia32/Makefile \
247         src/libFLAC/ppc/Makefile \
248         src/libFLAC/ppc/as/Makefile \
249         src/libFLAC/ppc/gas/Makefile \
250         src/libFLAC/include/Makefile \
251         src/libFLAC/include/private/Makefile \
252         src/libFLAC/include/protected/Makefile \
253         src/libFLAC++/Makefile \
254         src/libOggFLAC/Makefile \
255         src/libOggFLAC/include/Makefile \
256         src/libOggFLAC/include/private/Makefile \
257         src/libOggFLAC/include/protected/Makefile \
258         src/libOggFLAC++/Makefile \
259         src/flac/Makefile \
260         src/metaflac/Makefile \
261         src/monkeys_audio_utilities/Makefile \
262         src/monkeys_audio_utilities/flac_mac/Makefile \
263         src/monkeys_audio_utilities/flac_ren/Makefile \
264         src/plugin_common/Makefile \
265         src/plugin_winamp2/Makefile \
266         src/plugin_winamp2/include/Makefile \
267         src/plugin_winamp2/include/winamp2/Makefile \
268         src/plugin_xmms/Makefile \
269         src/share/Makefile \
270         src/share/getopt/Makefile \
271         src/share/grabbag/Makefile \
272         src/share/replaygain_analysis/Makefile \
273         src/share/replaygain_synthesis/Makefile \
274         src/share/replaygain_synthesis/include/Makefile \
275         src/share/replaygain_synthesis/include/private/Makefile \
276         src/share/utf8/Makefile \
277         src/test_grabbag/Makefile \
278         src/test_grabbag/cuesheet/Makefile \
279         src/test_libFLAC/Makefile \
280         src/test_libFLAC++/Makefile \
281         src/test_libOggFLAC/Makefile \
282         src/test_libOggFLAC++/Makefile \
283         src/test_seeking/Makefile \
284         src/test_streams/Makefile \
285         include/Makefile \
286         include/FLAC/Makefile \
287         include/FLAC++/Makefile \
288         include/OggFLAC/Makefile \
289         include/OggFLAC++/Makefile \
290         include/share/Makefile \
291         include/share/grabbag/Makefile \
292         doc/Makefile \
293         doc/html/Makefile \
294         doc/html/images/Makefile \
295         doc/html/ru/Makefile \
296         man/Makefile \
297         test/Makefile \
298         test/cuesheets/Makefile \
299         build/Makefile \
300         obj/Makefile \
301         obj/debug/Makefile \
302         obj/debug/bin/Makefile \
303         obj/debug/lib/Makefile \
304         obj/release/Makefile \
305         obj/release/bin/Makefile \
306         obj/release/lib/Makefile \
307         flac.pbproj/Makefile \
308 )