bump the version number from 1.0.4_beta to 1.0.4
[platform/upstream/flac.git] / configure.in
1 #  FLAC - Free Lossless Audio Codec
2 #  Copyright (C) 2001,2002  Josh Coalson
3 #
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.
8 #
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.
13 #
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.
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.0.4)
23
24 # Function to configure paths for id3lib; search for 'meat' to get to the end.
25 # adapted from ogg.m4
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
30 dnl
31 AC_DEFUN(LOCAL__PATH_ID3LIB,
32 [dnl
33 dnl Get the cflags and libraries
34 dnl
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)
39
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"
46         fi
47
48         ID3LIB_LIBS="$ID3LIB_LIBS -lid3"
49
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"
56         fi
57
58         AC_MSG_CHECKING(for id3lib)
59
60
61         if test "x$enable_id3libtest" = "xyes" ; then
62                 id3lib_found=""
63         else
64                 id3lib_found="yes"
65         fi
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"
73                                 ac_save_LIBS="$LIBS"
74                                 CFLAGS="$CFLAGS $ID3LIB_CFLAGS"
75                                 LIBS="$LIBS $ID3LIB_LIBS$xtra_stdcpp$xtra_z"
76                                 rm -f conf.id3libtest
77                                 AC_TRY_RUN([
78 #include <stdio.h>
79 #include <stdlib.h>
80 #include <string.h>
81 #include <id3.h>
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"
85                                 LIBS="$ac_save_LIBS"
86                         fi
87                         if test "x$id3lib_found" = "xyes" ; then
88                                 ID3LIB_LIBS="$ID3LIB_LIBS$xtra_stdcpp$xtra_z"
89                         fi
90                 done
91         done
92
93         if test "x$id3lib_found" = "xyes" ; then
94                 AC_MSG_RESULT(yes)
95                 ifelse([$1], , :, [$1])
96         else
97                 AC_MSG_RESULT(no)
98                 if test -f conf.id3libtest ; then
99                         :
100                 else
101                         echo "*** Could not run id3lib test program, checking why..."
102                         CFLAGS="$CFLAGS $ID3LIB_CFLAGS"
103                         LIBS="$LIBS $ID3LIB_LIBS"
104                         AC_TRY_LINK([
105 #include <stdio.h>
106 #include <id3.h>
107 ],     [ return 0; ],
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"
114                         echo "***"
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"
121                         LIBS="$ac_save_LIBS"
122                 fi
123                 ID3LIB_CFLAGS=""
124                 ID3LIB_LIBS=""
125                 ifelse([$2], , :, [$2])
126         fi
127         AC_SUBST(ID3LIB_CFLAGS)
128         AC_SUBST(ID3LIB_LIBS)
129         rm -f conf.id3libtest
130 ])
131
132
133 dnl Now the meat of configure.in:
134
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.
138 AM_PROG_LIBTOOL
139 sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
140 chmod +x libtool-disable-static
141
142 AC_PROG_CXX
143 AC_PROG_MAKE_SET
144
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, [], [])
148
149 AC_CANONICAL_HOST
150 case "$host_cpu" in
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) ;;
154 esac
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)
158 case "$host" in
159         i[[3-6]]86-*-openbsd*) OBJ_FORMAT=aoutb ;;
160         *) OBJ_FORMAT=elf ;;
161 esac
162 AC_SUBST(OBJ_FORMAT)
163
164 if test x$cpu_ia32 = xtrue ; then
165 AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
166 fi
167
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)
172 fi
173
174 AC_ARG_ENABLE(debug,
175 [  --enable-debug                 Turn on debugging],
176 [case "${enableval}" in
177         yes) debug=true ;;
178         no)  debug=false ;;
179         *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
180 esac],[debug=false])
181 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
182
183 AC_ARG_ENABLE(sse,
184 [  --enable-sse                   Enable SSE support by asserting that the OS supports SSE instructions],
185 [case "${enableval}" in
186         yes) sse_os=true ;;
187         no)  sse_os=false ;;
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)
193 fi
194
195 AC_ARG_ENABLE(3dnow,
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)
205 fi
206
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)
217 fi
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 fi
225
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)
228
229 SHARE_LIBS='$(top_builddir)/src/share/libutf8.a $(top_builddir)/src/share/libgetopt.a'
230
231 dnl check for i18n(internationalization); these are from libiconv/gettext
232 AM_ICONV
233 AM_LANGINFO_CODESET
234
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)
241
242 dnl expected id3lib version for cross compiling
243 ID3LIB_MAJOR=3
244 ID3LIB_MINOR=8
245 ID3LIB_PATCH=0
246
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)
252       AC_TRY_RUN([
253 #include <id3.h>
254 #include <stdio.h>
255 int
256 main ()
257 {
258         FILE *output;
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);
261         fclose(output);
262         exit(0);
263 }
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
270 fi
271
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)
276 fi
277
278 dnl Check for type sizes
279
280 AC_CHECK_SIZEOF(short)
281 AC_CHECK_SIZEOF(int)
282 AC_CHECK_SIZEOF(long)
283 AC_CHECK_SIZEOF(long long)
284
285 case 2 in
286         $ac_cv_sizeof_short) FLaC__SIZE16="short" ; FLaC__USIZE16="unsigned short";;
287         $ac_cv_sizeof_int) FLaC__SIZE16="int" ; FLaC__USIZE16="unsigned int";;
288 esac
289
290 case 4 in
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";;
294 esac
295
296 case 8 in
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";;
300 esac
301
302 if test -z "$FLaC__SIZE16"; then
303         AC_MSG_ERROR(No 16 bit type found on this platform!)
304 fi
305 if test -z "$FLaC__USIZE16"; then
306         AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
307 fi
308 if test -z "$FLaC__SIZE32"; then
309         AC_MSG_ERROR(No 32 bit type found on this platform!)
310 fi
311 if test -z "$FLaC__USIZE32"; then
312         AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
313 fi
314 if test -z "$FLaC__SIZE64"; then
315         AC_MSG_WARN(No 64 bit type found on this platform!)
316 fi
317 if test -z "$FLaC__USIZE64"; then
318         AC_MSG_ERROR(No unsigned 64 bit type found on this platform!)
319 fi
320
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)
327
328 AC_SUBST(SHARE_LIBS)
329
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"
333 else
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__"
337         fi
338 fi
339 CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS $OUR_CFLAGS_TAIL"
340 CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS $OUR_CFLAGS_TAIL"
341
342 AC_OUTPUT( \
343         Makefile \
344         src/Makefile \
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 \
355         src/flac/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 \
364         src/share/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 \
370         include/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 \
377         doc/Makefile \
378         doc/html/Makefile \
379         doc/html/images/Makefile \
380         doc/html/ru/Makefile \
381         man/Makefile \
382         test/Makefile \
383         build/Makefile \
384         obj/bin/Makefile \
385         obj/lib/Makefile \
386         obj/Makefile \
387         flac.pbproj/Makefile \
388 )