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