unwind gettext usage; see tag COMMENT_LAST_WORKING_GETTEXT for the last working versi...
[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.3)
23
24 # We need two libtools, one that builds both shared and static, and
25 # one that builds only static.  This is because the resulting libtool
26 # does not allow us to choose which to build at runtime.
27 AM_PROG_LIBTOOL
28 sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
29 chmod +x libtool-disable-static
30
31 AC_PROG_CXX
32 AC_PROG_MAKE_SET
33
34 dnl check for getopt in standard library
35 dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
36 AC_CHECK_FUNCS(getopt_long, [], [])
37
38 AC_CANONICAL_HOST
39 case "$host_cpu" in
40         i*86)   cpu_ia32=true ; AC_DEFINE(FLAC__CPU_IA32) ;;
41         powerpc)        cpu_ppc=true ; AC_DEFINE(FLAC__CPU_PPC) ;;
42         sparc)  cpu_sparc=true ; AC_DEFINE(FLAC__CPU_SPARC) ;;
43 esac
44 AM_CONDITIONAL(FLaC__CPU_IA32, test x$cpu_ia32 = xtrue)
45 AM_CONDITIONAL(FLaC__CPU_PPC, test x$cpu_ppc = xtrue)
46 AM_CONDITIONAL(FLaC__CPU_SPARC, test x$cpu_sparc = xtrue)
47 case "$host" in
48         i[[3-6]]86-*-openbsd*) OBJ_FORMAT=aoutb ;;
49         *) OBJ_FORMAT=elf ;;
50 esac
51 AC_SUBST(OBJ_FORMAT)
52
53 if test x$cpu_ia32 = xtrue ; then
54 AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
55 fi
56
57 AC_ARG_ENABLE(asm-optimizations, [  --disable-asm-optimizations    Don't use any assembly optimization routines], asm_opt=no, asm_opt=yes)
58 AM_CONDITIONAL(FLaC__NO_ASM, test x$asm_opt = xno)
59 if test x$asm_opt = xno ; then
60 AC_DEFINE(FLAC__NO_ASM)
61 fi
62
63 AC_ARG_ENABLE(debug,
64 [  --enable-debug                 Turn on debugging],
65 [case "${enableval}" in
66         yes) debug=true ;;
67         no)  debug=false ;;
68         *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
69 esac],[debug=false])
70 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
71
72 AC_ARG_ENABLE(sse,
73 [  --enable-sse                   Enable SSE support by asserting that the OS supports SSE instructions],
74 [case "${enableval}" in
75         yes) sse_os=true ;;
76         no)  sse_os=false ;;
77         *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
78 esac],[sse_os=false])
79 AM_CONDITIONAL(FLaC__SSE_OS, test x$sse_os = xtrue)
80 if test x$sse_os = xtrue ; then
81 AC_DEFINE(FLAC__SSE_OS)
82 fi
83
84 AC_ARG_ENABLE(3dnow,
85 [  --enable-3dnow                 Enable 3DNOW! support],
86 [case "${enableval}" in
87         yes) use_3dnow=true ;;
88         no)  use_3dnow=false ;;
89         *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
90 esac],[use_3dnow=false])
91 AM_CONDITIONAL(FLaC__USE_3DNOW, test x$use_3dnow = xtrue)
92 if test x$use_3dnow = xtrue ; then
93 AC_DEFINE(FLAC__USE_3DNOW)
94 fi
95
96 AC_ARG_ENABLE(exhaustive-tests,
97 [  --enable-exhaustive-tests      Enable exhaustive testing ("make check" will take a LONG time!)],
98 [case "${enableval}" in
99         yes) exhaustive_tests=true ;;
100         no)  exhaustive_tests=false ;;
101         *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
102 esac],[exhaustive_tests=false])
103 AM_CONDITIONAL(FLaC__EXHAUSTIVE_TESTS, test x$exhaustive_tests = xtrue)
104 if test x$exhaustive_tests = xtrue ; then
105 AC_DEFINE(FLAC__EXHAUSTIVE_TESTS)
106 fi
107
108 XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
109 AM_CONDITIONAL(FLaC__HAS_OGG, [test x$have_ogg = xyes])
110 if test x$have_ogg = xyes ; then
111 AC_DEFINE(FLAC__HAS_OGG)
112 fi
113
114 AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - xmms support will not be built]))
115 AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
116
117 SHARE_LIBS='$(top_builddir)/src/share/libutf8.a $(top_builddir)/src/share/libgetopt.a'
118
119 dnl check for i18n(internationalization); these are from libiconv/gettext
120 AM_ICONV
121 AM_LANGINFO_CODESET
122
123 dnl check id3lib libraries
124 LIBS_save_blah_blah_blah=$LIBS
125 LIBS=""
126 AC_SEARCH_LIBS(ID3Tag_Link,"id3" "id3 -lstdc++" "id3 -lz" "id3 -lz -lstdc++",
127                [have_id3lib=yes],
128                [AC_MSG_WARN([id3lib not found - ID3v2 will not be supported, internal functions support only id3v1])])
129 AM_CONDITIONAL(FLaC__HAS_ID3LIB, [test x$have_id3lib = xyes])
130 if test x$have_id3lib = xyes ; then
131 AC_DEFINE(FLAC__HAS_ID3LIB)
132 ID3LIBS=$LIBS
133 fi
134 AC_SUBST(ID3LIBS)
135
136 dnl expected version for cross compiling
137 ID3LIB_MAJOR=3
138 ID3LIB_MINOR=8
139 ID3LIB_PATCH=0
140
141 AC_MSG_CHECKING(for id3lib version)
142       AC_TRY_RUN([
143 #include <id3.h>
144 #include <stdio.h>
145 int
146 main ()
147 {
148         FILE *output;
149         output=fopen("conftest.id3","w");
150         fprintf(output,"ID3LIB_MAJOR=%d\nID3LIB_MINOR=%d\nID3LIB_PATCH=%d\n",ID3LIB_MAJOR_VERSION,ID3LIB_MINOR_VERSION,ID3LIB_PATCH_VERSION);
151         fclose(output);
152         exit(0);
153 }
154 ], . 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"])
155 AC_DEFINE_UNQUOTED(ID3LIB_MAJOR, $ID3LIB_MAJOR)
156 AC_DEFINE_UNQUOTED(ID3LIB_MINOR, $ID3LIB_MINOR)
157 AC_DEFINE_UNQUOTED(ID3LIB_PATCH, $ID3LIB_PATCH)
158
159 LIBS=$LIBS_save_blah_blah_blah
160
161 AC_CHECK_PROGS(NASM, nasm)
162 AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
163 if test -n "$NASM" ; then
164 AC_DEFINE(FLAC__HAS_NASM)
165 fi
166
167 dnl Check for type sizes
168
169 AC_CHECK_SIZEOF(short)
170 AC_CHECK_SIZEOF(int)
171 AC_CHECK_SIZEOF(long)
172 AC_CHECK_SIZEOF(long long)
173
174 case 2 in
175         $ac_cv_sizeof_short) FLaC__SIZE16="short" ; FLaC__USIZE16="unsigned short";;
176         $ac_cv_sizeof_int) FLaC__SIZE16="int" ; FLaC__USIZE16="unsigned int";;
177 esac
178
179 case 4 in
180         $ac_cv_sizeof_short) FLaC__SIZE32="short" ; FLaC__USIZE32="unsigned short";;
181         $ac_cv_sizeof_int) FLaC__SIZE32="int" ; FLaC__USIZE32="unsigned int";;
182         $ac_cv_sizeof_long) FLaC__SIZE32="long" ; FLaC__USIZE32="unsigned long";;
183 esac
184
185 case 8 in
186         $ac_cv_sizeof_int) FLaC__SIZE64="int" ; FLaC__USIZE64="unsigned int";;
187         $ac_cv_sizeof_long) FLaC__SIZE64="long" ; FLaC__USIZE64="unsigned long";;
188         $ac_cv_sizeof_long_long) FLaC__SIZE64="long long" ; FLaC__USIZE64="unsigned long long";;
189 esac
190
191 if test -z "$FLaC__SIZE16"; then
192         AC_MSG_ERROR(No 16 bit type found on this platform!)
193 fi
194 if test -z "$FLaC__USIZE16"; then
195         AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
196 fi
197 if test -z "$FLaC__SIZE32"; then
198         AC_MSG_ERROR(No 32 bit type found on this platform!)
199 fi
200 if test -z "$FLaC__USIZE32"; then
201         AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
202 fi
203 if test -z "$FLaC__SIZE64"; then
204         AC_MSG_WARN(No 64 bit type found on this platform!)
205 fi
206 if test -z "$FLaC__USIZE64"; then
207         AC_MSG_ERROR(No unsigned 64 bit type found on this platform!)
208 fi
209
210 AC_SUBST(FLaC__SIZE16)
211 AC_SUBST(FLaC__USIZE16)
212 AC_SUBST(FLaC__SIZE32)
213 AC_SUBST(FLaC__USIZE32)
214 AC_SUBST(FLaC__SIZE64)
215 AC_SUBST(FLaC__USIZE64)
216
217 AC_SUBST(SHARE_LIBS)
218
219 OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
220 if test x$debug = xtrue; then
221         OUR_CFLAGS_TAIL="-g -O0 -DDEBUG"
222 else
223         OUR_CFLAGS_TAIL="-O3 -DNDEBUG"
224         if test x$GCC = xyes; then
225                 OUR_CFLAGS_TAIL="$OUR_CFLAGS_TAIL -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__"
226         fi
227 fi
228 CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS $OUR_CFLAGS_TAIL"
229 CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS $OUR_CFLAGS_TAIL"
230
231 AC_OUTPUT( \
232         Makefile \
233         src/Makefile \
234         src/libFLAC/Makefile \
235         src/libFLAC/ia32/Makefile \
236         src/libFLAC/include/Makefile \
237         src/libFLAC/include/private/Makefile \
238         src/libFLAC/include/protected/Makefile \
239         src/libFLAC++/Makefile \
240         src/libOggFLAC/Makefile \
241         src/libOggFLAC/include/Makefile \
242         src/libOggFLAC/include/protected/Makefile \
243         src/libOggFLAC++/Makefile \
244         src/flac/Makefile \
245         src/metaflac/Makefile \
246         src/monkeys_audio_utilities/flac_mac/Makefile \
247         src/monkeys_audio_utilities/flac_ren/Makefile \
248         src/monkeys_audio_utilities/Makefile \
249         src/plugin_common/Makefile \
250         src/plugin_winamp2/Makefile \
251         src/plugin_winamp3/Makefile \
252         src/plugin_xmms/Makefile \
253         src/share/Makefile \
254         src/test_libFLAC/Makefile \
255         src/test_libFLAC++/Makefile \
256         src/test_libOggFLAC/Makefile \
257         src/test_libOggFLAC++/Makefile \
258         src/test_streams/Makefile \
259         include/Makefile \
260         include/FLAC/Makefile \
261         include/FLAC/ordinals.h \
262         include/FLAC++/Makefile \
263         include/OggFLAC/Makefile \
264         include/OggFLAC++/Makefile \
265         include/share/Makefile \
266         doc/Makefile \
267         doc/html/Makefile \
268         doc/html/images/Makefile \
269         doc/html/ru/Makefile \
270         man/Makefile \
271         test/Makefile \
272         build/Makefile \
273         obj/bin/Makefile \
274         obj/lib/Makefile \
275         obj/Makefile \
276         flac.pbproj/Makefile \
277 )