1 # FLAC - Free Lossless Audio Codec
2 # Copyright (C) 2001,2002 Josh Coalson
4 # This program is part of FLAC; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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
21 AC_INIT(src/flac/main.c)
22 AM_INIT_AUTOMAKE(flac, 1.0.4_beta)
24 # Function to configure paths for id3lib; search for 'meat' to get to the end.
26 # This is here until id3lib comes with an equivalent.
27 # It is inline with configure.in instead of a separate file as a courtesy to users unaware of the -I flag to aclocal
28 dnl LOCAL__PATH_ID3LIB([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
29 dnl Test for libid3, and define ID3LIB_CFLAGS and ID3LIB_LIBS
31 AC_DEFUN(LOCAL__PATH_ID3LIB,
33 dnl Get the cflags and libraries
35 AC_ARG_WITH(id3lib,[ --with-id3lib=PFX Prefix where libid3 is installed (optional)], id3lib_prefix="$withval", id3lib_prefix="")
36 AC_ARG_WITH(id3lib-libraries,[ --with-id3lib-libraries=DIR Directory where libid3 library is installed (optional)], id3lib_libraries="$withval", id3lib_libraries="")
37 AC_ARG_WITH(id3lib-includes,[ --with-id3lib-includes=DIR Directory where libid3 header files are installed (optional)], id3lib_includes="$withval", id3lib_includes="")
38 AC_ARG_ENABLE(id3libtest, [ --disable-id3libtest Do not try to compile and run a test id3lib program],, enable_id3libtest=yes)
40 if test "x$id3lib_libraries" != "x" ; then
41 ID3LIB_LIBS="-L$id3lib_libraries"
42 elif test "x$id3lib_prefix" != "x" ; then
43 ID3LIB_LIBS="-L$id3lib_prefix/lib"
44 elif test "x$prefix" != "xNONE" ; then
45 ID3LIB_LIBS="-L$prefix/lib"
48 ID3LIB_LIBS="$ID3LIB_LIBS -lid3"
50 if test "x$id3lib_includes" != "x" ; then
51 ID3LIB_CFLAGS="-I$id3lib_includes"
52 elif test "x$id3lib_prefix" != "x" ; then
53 ID3LIB_CFLAGS="-I$id3lib_prefix/include"
54 elif test "$prefix" != "xNONE"; then
55 ID3LIB_CFLAGS="-I$prefix/include"
58 AC_MSG_CHECKING(for id3lib)
61 if test "x$enable_id3libtest" = "xyes" ; then
66 dnl There is some confusion over what libraries libid3 needs
67 dnl so we must be pessimistic and try all permutations:
68 dnl "-lid3" "-lid3 -lstdc++" "-lid3 -lz" "-lid3 -lz -lstdc++"
69 for xtra_stdcpp in "" " -lstdc++" ; do
70 for xtra_z in "" " -lz" ; do
71 if test "x$id3lib_found" = "x" ; then
72 ac_save_CFLAGS="$CFLAGS"
74 CFLAGS="$CFLAGS $ID3LIB_CFLAGS"
75 LIBS="$LIBS $ID3LIB_LIBS$xtra_stdcpp$xtra_z"
82 int main () { system("touch conf.id3libtest"); return 0; }
83 ], id3lib_found=yes,,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
84 CFLAGS="$ac_save_CFLAGS"
87 if test "x$id3lib_found" = "xyes" ; then
88 ID3LIB_LIBS="$ID3LIB_LIBS$xtra_stdcpp$xtra_z"
93 if test "x$id3lib_found" = "xyes" ; then
95 ifelse([$1], , :, [$1])
98 if test -f conf.id3libtest ; then
101 echo "*** Could not run id3lib test program, checking why..."
102 CFLAGS="$CFLAGS $ID3LIB_CFLAGS"
103 LIBS="$LIBS $ID3LIB_LIBS"
108 [ echo "*** The test program compiled, but did not run. This usually means"
109 echo "*** that the run-time linker is not finding id3lib or finding the wrong"
110 echo "*** version of id3lib. If it is not finding id3lib, you'll need to set your"
111 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
112 echo "*** to the installed location Also, make sure you have run ldconfig if that"
113 echo "*** is required on your system"
115 echo "*** If you have an old version installed, it is best to remove it, although"
116 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
117 [ echo "*** The test program failed to compile or link. See the file config.log for the"
118 echo "*** exact error that occured. This usually means id3lib was incorrectly installed"
119 echo "*** or that you have moved id3lib since it was installed." ])
120 CFLAGS="$ac_save_CFLAGS"
125 ifelse([$2], , :, [$2])
127 AC_SUBST(ID3LIB_CFLAGS)
128 AC_SUBST(ID3LIB_LIBS)
129 rm -f conf.id3libtest
133 dnl Now the meat of configure.in:
135 # We need two libtools, one that builds both shared and static, and
136 # one that builds only static. This is because the resulting libtool
137 # does not allow us to choose which to build at runtime.
139 sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
140 chmod +x libtool-disable-static
145 dnl check for getopt in standard library
146 dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
147 AC_CHECK_FUNCS(getopt_long, [], [])
151 i*86) cpu_ia32=true ; AC_DEFINE(FLAC__CPU_IA32) ;;
152 powerpc) cpu_ppc=true ; AC_DEFINE(FLAC__CPU_PPC) ;;
153 sparc) cpu_sparc=true ; AC_DEFINE(FLAC__CPU_SPARC) ;;
155 AM_CONDITIONAL(FLaC__CPU_IA32, test x$cpu_ia32 = xtrue)
156 AM_CONDITIONAL(FLaC__CPU_PPC, test x$cpu_ppc = xtrue)
157 AM_CONDITIONAL(FLaC__CPU_SPARC, test x$cpu_sparc = xtrue)
159 i[[3-6]]86-*-openbsd*) OBJ_FORMAT=aoutb ;;
164 if test x$cpu_ia32 = xtrue ; then
165 AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
168 AC_ARG_ENABLE(asm-optimizations, [ --disable-asm-optimizations Don't use any assembly optimization routines], asm_opt=no, asm_opt=yes)
169 AM_CONDITIONAL(FLaC__NO_ASM, test x$asm_opt = xno)
170 if test x$asm_opt = xno ; then
171 AC_DEFINE(FLAC__NO_ASM)
175 [ --enable-debug Turn on debugging],
176 [case "${enableval}" in
179 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
181 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
184 [ --enable-sse Enable SSE support by asserting that the OS supports SSE instructions],
185 [case "${enableval}" in
188 *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
189 esac],[sse_os=false])
190 AM_CONDITIONAL(FLaC__SSE_OS, test x$sse_os = xtrue)
191 if test x$sse_os = xtrue ; then
192 AC_DEFINE(FLAC__SSE_OS)
196 [ --enable-3dnow Enable 3DNOW! support],
197 [case "${enableval}" in
198 yes) use_3dnow=true ;;
199 no) use_3dnow=false ;;
200 *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
201 esac],[use_3dnow=false])
202 AM_CONDITIONAL(FLaC__USE_3DNOW, test x$use_3dnow = xtrue)
203 if test x$use_3dnow = xtrue ; then
204 AC_DEFINE(FLAC__USE_3DNOW)
207 AC_ARG_ENABLE(exhaustive-tests,
208 [ --enable-exhaustive-tests Enable exhaustive testing],
209 [case "${enableval}" in
210 yes) exhaustive_tests=true ;;
211 no) exhaustive_tests=false ;;
212 *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
213 esac],[exhaustive_tests=false])
214 AM_CONDITIONAL(FLaC__EXHAUSTIVE_TESTS, test x$exhaustive_tests = xtrue)
215 if test x$exhaustive_tests = xtrue ; then
216 AC_DEFINE(FLAC__EXHAUSTIVE_TESTS)
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)
226 AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - xmms support will not be built]))
227 AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
229 SHARE_LIBS='$(top_builddir)/src/share/libutf8.a $(top_builddir)/src/share/libgetopt.a'
231 dnl check for i18n(internationalization); these are from libiconv/gettext
235 dnl check for id3lib library
236 dnl LOCAL__PATH_ID3LIB is defined by us, and will be until such time as id3lib supplies one
237 LOCAL__PATH_ID3LIB(have_id3lib=yes, AC_MSG_WARN([*** id3lib not found - id3v2 support will not be built]))
238 AM_CONDITIONAL(FLaC__HAS_ID3LIB, [test x$have_id3lib = xyes])
239 if test x$have_id3lib = xyes ; then
240 AC_DEFINE(FLAC__HAS_ID3LIB)
242 dnl expected id3lib version for cross compiling
247 CFLAGS_save_blah_blah_blah=$CFLAGS
248 CFLAGS="$ID3LIB_CFLAGS $CFLAGS"
249 LIBS_save_blah_blah_blah=$LIBS
250 LIBS="$ID3LIB_LIBS $LIBS"
251 AC_MSG_CHECKING(for id3lib version)
259 output=fopen("conftest.id3","w");
260 fprintf(output,"ID3LIB_MAJOR=%d\nID3LIB_MINOR=%d\nID3LIB_PATCH=%d\n",ID3LIB_MAJOR_VERSION,ID3LIB_MINOR_VERSION,ID3LIB_PATCH_VERSION);
264 ], . conftest.id3; echo "${ID3LIB_MAJOR}.${ID3LIB_MINOR}.${ID3LIB_PATCH}", AC_MSG_WARN(could not determine id3lib version),[echo $ac_n "cross compiling; assuming ${ID3LIB_MAJOR}.${ID3LIB_MINOR}.${ID3LIB_PATCH} $ac_c"])
265 AC_DEFINE_UNQUOTED(ID3LIB_MAJOR, $ID3LIB_MAJOR)
266 AC_DEFINE_UNQUOTED(ID3LIB_MINOR, $ID3LIB_MINOR)
267 AC_DEFINE_UNQUOTED(ID3LIB_PATCH, $ID3LIB_PATCH)
268 CFLAGS=$CFLAGS_save_blah_blah_blah
269 LIBS=$LIBS_save_blah_blah_blah
272 AC_CHECK_PROGS(NASM, nasm)
273 AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
274 if test -n "$NASM" ; then
275 AC_DEFINE(FLAC__HAS_NASM)
278 dnl Check for type sizes
280 AC_CHECK_SIZEOF(short)
282 AC_CHECK_SIZEOF(long)
283 AC_CHECK_SIZEOF(long long)
286 $ac_cv_sizeof_short) FLaC__SIZE16="short" ; FLaC__USIZE16="unsigned short";;
287 $ac_cv_sizeof_int) FLaC__SIZE16="int" ; FLaC__USIZE16="unsigned int";;
291 $ac_cv_sizeof_short) FLaC__SIZE32="short" ; FLaC__USIZE32="unsigned short";;
292 $ac_cv_sizeof_int) FLaC__SIZE32="int" ; FLaC__USIZE32="unsigned int";;
293 $ac_cv_sizeof_long) FLaC__SIZE32="long" ; FLaC__USIZE32="unsigned long";;
297 $ac_cv_sizeof_int) FLaC__SIZE64="int" ; FLaC__USIZE64="unsigned int";;
298 $ac_cv_sizeof_long) FLaC__SIZE64="long" ; FLaC__USIZE64="unsigned long";;
299 $ac_cv_sizeof_long_long) FLaC__SIZE64="long long" ; FLaC__USIZE64="unsigned long long";;
302 if test -z "$FLaC__SIZE16"; then
303 AC_MSG_ERROR(No 16 bit type found on this platform!)
305 if test -z "$FLaC__USIZE16"; then
306 AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
308 if test -z "$FLaC__SIZE32"; then
309 AC_MSG_ERROR(No 32 bit type found on this platform!)
311 if test -z "$FLaC__USIZE32"; then
312 AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
314 if test -z "$FLaC__SIZE64"; then
315 AC_MSG_WARN(No 64 bit type found on this platform!)
317 if test -z "$FLaC__USIZE64"; then
318 AC_MSG_ERROR(No unsigned 64 bit type found on this platform!)
321 AC_SUBST(FLaC__SIZE16)
322 AC_SUBST(FLaC__USIZE16)
323 AC_SUBST(FLaC__SIZE32)
324 AC_SUBST(FLaC__USIZE32)
325 AC_SUBST(FLaC__SIZE64)
326 AC_SUBST(FLaC__USIZE64)
330 OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
331 if test x$debug = xtrue; then
332 OUR_CFLAGS_TAIL="-g -O0 -DDEBUG"
334 OUR_CFLAGS_TAIL="-O3 -DNDEBUG"
335 if test x$GCC = xyes; then
336 OUR_CFLAGS_TAIL="$OUR_CFLAGS_TAIL -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__"
339 CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS $OUR_CFLAGS_TAIL"
340 CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS $OUR_CFLAGS_TAIL"
345 src/libFLAC/Makefile \
346 src/libFLAC/ia32/Makefile \
347 src/libFLAC/include/Makefile \
348 src/libFLAC/include/private/Makefile \
349 src/libFLAC/include/protected/Makefile \
350 src/libFLAC++/Makefile \
351 src/libOggFLAC/Makefile \
352 src/libOggFLAC/include/Makefile \
353 src/libOggFLAC/include/protected/Makefile \
354 src/libOggFLAC++/Makefile \
356 src/metaflac/Makefile \
357 src/monkeys_audio_utilities/flac_mac/Makefile \
358 src/monkeys_audio_utilities/flac_ren/Makefile \
359 src/monkeys_audio_utilities/Makefile \
360 src/plugin_common/Makefile \
361 src/plugin_winamp2/Makefile \
362 src/plugin_winamp3/Makefile \
363 src/plugin_xmms/Makefile \
365 src/test_libFLAC/Makefile \
366 src/test_libFLAC++/Makefile \
367 src/test_libOggFLAC/Makefile \
368 src/test_libOggFLAC++/Makefile \
369 src/test_streams/Makefile \
371 include/FLAC/Makefile \
372 include/FLAC/ordinals.h \
373 include/FLAC++/Makefile \
374 include/OggFLAC/Makefile \
375 include/OggFLAC++/Makefile \
376 include/share/Makefile \
379 doc/html/images/Makefile \
380 doc/html/ru/Makefile \
387 flac.pbproj/Makefile \