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