blob: 38bb196a42d708d2279d0bd18cab97f3b13d5931 [file] [log] [blame]
Josh Coalson6b05bc52001-06-08 00:13:21 +00001# FLAC - Free Lossless Audio Codec
Josh Coalson1152f9f2002-01-26 18:05:12 +00002# Copyright (C) 2001,2002 Josh Coalson
Josh Coalson6b05bc52001-06-08 00:13:21 +00003#
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
Josh Coalson0e3576e2001-05-25 00:07:51 +000018# NOTE that for many of the AM_CONDITIONALs we use the prefix FLaC__
Josh Coalsoncf030c82001-05-23 20:59:48 +000019# instead of FLAC__ since autoconf triggers off 'AC_' in strings
20
Josh Coalson9f429ba2001-01-19 22:39:39 +000021AC_INIT(src/flac/main.c)
Josh Coalson0d0d7732002-07-02 22:23:55 +000022AM_INIT_AUTOMAKE(flac, 1.0.3)
Josh Coalson9f429ba2001-01-19 22:39:39 +000023
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.
27AM_PROG_LIBTOOL
28sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
29chmod +x libtool-disable-static
30
Josh Coalson57ba6f42002-06-07 05:27:37 +000031AC_PROG_CXX
Josh Coalson9f429ba2001-01-19 22:39:39 +000032AC_PROG_MAKE_SET
33
Josh Coalson5a804ca2002-05-17 06:08:13 +000034dnl check for getopt in standard library
35dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
36AC_CHECK_FUNCS(getopt_long, [], [])
37
Josh Coalsondef8eb82001-05-23 22:08:27 +000038AC_CANONICAL_HOST
Josh Coalson5a804ca2002-05-17 06:08:13 +000039case "$host_cpu" in
Josh Coalson0e3576e2001-05-25 00:07:51 +000040 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) ;;
Josh Coalsoncf030c82001-05-23 20:59:48 +000043esac
44AM_CONDITIONAL(FLaC__CPU_IA32, test x$cpu_ia32 = xtrue)
45AM_CONDITIONAL(FLaC__CPU_PPC, test x$cpu_ppc = xtrue)
46AM_CONDITIONAL(FLaC__CPU_SPARC, test x$cpu_sparc = xtrue)
Josh Coalsonda0adb22001-06-18 23:07:19 +000047case "$host" in
Josh Coalson4ca5ec92001-08-13 21:58:49 +000048 i[[3-6]]86-*-openbsd*) OBJ_FORMAT=aoutb ;;
Josh Coalsonda0adb22001-06-18 23:07:19 +000049 *) OBJ_FORMAT=elf ;;
50esac
51AC_SUBST(OBJ_FORMAT)
Josh Coalsoncf030c82001-05-23 20:59:48 +000052
Josh Coalson0e3576e2001-05-25 00:07:51 +000053if test x$cpu_ia32 = xtrue ; then
54AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
55fi
Josh Coalsoncf030c82001-05-23 20:59:48 +000056
57AC_ARG_ENABLE(asm-optimizations, [ --disable-asm-optimizations Don't use any assembly optimization routines], asm_opt=no, asm_opt=yes)
58AM_CONDITIONAL(FLaC__NO_ASM, test x$asm_opt = xno)
Josh Coalson0e3576e2001-05-25 00:07:51 +000059if test x$asm_opt = xno ; then
60AC_DEFINE(FLAC__NO_ASM)
61fi
Josh Coalsoncf030c82001-05-23 20:59:48 +000062
Josh Coalson9f429ba2001-01-19 22:39:39 +000063AC_ARG_ENABLE(debug,
Josh Coalsonda0adb22001-06-18 23:07:19 +000064[ --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) ;;
69esac],[debug=false])
Josh Coalson9f429ba2001-01-19 22:39:39 +000070AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
71
Josh Coalsonbb14ae82001-12-04 06:46:35 +000072AC_ARG_ENABLE(sse,
73[ --enable-sse Enable SSE support by asserting that the OS supports SSE instructions],
Josh Coalsond01b13a2001-07-18 00:27:06 +000074[case "${enableval}" in
75 yes) sse_os=true ;;
76 no) sse_os=false ;;
Josh Coalsonbb14ae82001-12-04 06:46:35 +000077 *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
Josh Coalsond01b13a2001-07-18 00:27:06 +000078esac],[sse_os=false])
79AM_CONDITIONAL(FLaC__SSE_OS, test x$sse_os = xtrue)
80if test x$sse_os = xtrue ; then
81AC_DEFINE(FLAC__SSE_OS)
82fi
83
Josh Coalsonbb14ae82001-12-04 06:46:35 +000084AC_ARG_ENABLE(3dnow,
85[ --enable-3dnow Enable 3DNOW! support],
Josh Coalsonc69f8782001-11-13 23:08:22 +000086[case "${enableval}" in
87 yes) use_3dnow=true ;;
88 no) use_3dnow=false ;;
Josh Coalsonbb14ae82001-12-04 06:46:35 +000089 *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
Josh Coalsonc69f8782001-11-13 23:08:22 +000090esac],[use_3dnow=false])
91AM_CONDITIONAL(FLaC__USE_3DNOW, test x$use_3dnow = xtrue)
92if test x$use_3dnow = xtrue ; then
93AC_DEFINE(FLAC__USE_3DNOW)
94fi
95
Josh Coalson9b145182002-08-30 05:39:36 +000096AC_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) ;;
102esac],[exhaustive_tests=false])
103AM_CONDITIONAL(FLaC__EXHAUSTIVE_TESTS, test x$exhaustive_tests = xtrue)
104if test x$exhaustive_tests = xtrue ; then
105AC_DEFINE(FLAC__EXHAUSTIVE_TESTS)
106fi
107
Josh Coalson3f6c9982002-09-05 05:40:58 +0000108XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
Josh Coalsonc8a7d352001-11-11 03:59:46 +0000109AM_CONDITIONAL(FLaC__HAS_OGG, [test x$have_ogg = xyes])
110if test x$have_ogg = xyes ; then
111AC_DEFINE(FLAC__HAS_OGG)
112fi
Josh Coalsonf7fc5c82001-10-31 18:31:36 +0000113
Josh Coalson9f429ba2001-01-19 22:39:39 +0000114AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - xmms support will not be built]))
Josh Coalsoncf030c82001-05-23 20:59:48 +0000115AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
116
Josh Coalson5a804ca2002-05-17 06:08:13 +0000117SHARE_LIBS='$(top_builddir)/src/share/libutf8.a $(top_builddir)/src/share/libgetopt.a'
118
Josh Coalson130cbb52002-07-16 16:12:27 +0000119dnl check for i18n(internationalization); these are from libiconv/gettext
Josh Coalson412fa3b2002-07-11 06:15:30 +0000120AM_ICONV
121AM_LANGINFO_CODESET
122
Josh Coalson130cbb52002-07-16 16:12:27 +0000123dnl check id3lib libraries
Josh Coalson412fa3b2002-07-11 06:15:30 +0000124LIBS_save_blah_blah_blah=$LIBS
125LIBS=""
126AC_SEARCH_LIBS(ID3Tag_Link,"id3" "id3 -lstdc++" "id3 -lz" "id3 -lz -lstdc++",
127 [have_id3lib=yes],
Josh Coalson818de252002-09-06 06:07:40 +0000128 [AC_MSG_WARN([id3lib not found - ID3v2 will not be supported, internal functions support only id3v1])])
Josh Coalson412fa3b2002-07-11 06:15:30 +0000129AM_CONDITIONAL(FLaC__HAS_ID3LIB, [test x$have_id3lib = xyes])
130if test x$have_id3lib = xyes ; then
131AC_DEFINE(FLAC__HAS_ID3LIB)
132ID3LIBS=$LIBS
133fi
134AC_SUBST(ID3LIBS)
135
136dnl expected version for cross compiling
137ID3LIB_MAJOR=3
138ID3LIB_MINOR=8
139ID3LIB_PATCH=0
140
141AC_MSG_CHECKING(for id3lib version)
142 AC_TRY_RUN([
143#include <id3.h>
144#include <stdio.h>
Josh Coalson3d8a96e2002-08-27 05:51:19 +0000145int
Josh Coalson412fa3b2002-07-11 06:15:30 +0000146main ()
147{
Josh Coalson3d8a96e2002-08-27 05:51:19 +0000148 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);
Josh Coalson412fa3b2002-07-11 06:15:30 +0000153}
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"])
155AC_DEFINE_UNQUOTED(ID3LIB_MAJOR, $ID3LIB_MAJOR)
156AC_DEFINE_UNQUOTED(ID3LIB_MINOR, $ID3LIB_MINOR)
157AC_DEFINE_UNQUOTED(ID3LIB_PATCH, $ID3LIB_PATCH)
158
159LIBS=$LIBS_save_blah_blah_blah
160
Josh Coalsoncf030c82001-05-23 20:59:48 +0000161AC_CHECK_PROGS(NASM, nasm)
162AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
Josh Coalson0e3576e2001-05-25 00:07:51 +0000163if test -n "$NASM" ; then
164AC_DEFINE(FLAC__HAS_NASM)
165fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000166
Josh Coalson6ca4b1b2001-06-29 02:54:59 +0000167dnl Check for type sizes
168
169AC_CHECK_SIZEOF(short)
170AC_CHECK_SIZEOF(int)
171AC_CHECK_SIZEOF(long)
172AC_CHECK_SIZEOF(long long)
173
174case 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";;
177esac
178
179case 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";;
183esac
184
185case 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";;
189esac
190
191if test -z "$FLaC__SIZE16"; then
192 AC_MSG_ERROR(No 16 bit type found on this platform!)
193fi
194if test -z "$FLaC__USIZE16"; then
195 AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
196fi
197if test -z "$FLaC__SIZE32"; then
198 AC_MSG_ERROR(No 32 bit type found on this platform!)
199fi
200if test -z "$FLaC__USIZE32"; then
201 AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
202fi
203if test -z "$FLaC__SIZE64"; then
204 AC_MSG_WARN(No 64 bit type found on this platform!)
205fi
206if test -z "$FLaC__USIZE64"; then
207 AC_MSG_ERROR(No unsigned 64 bit type found on this platform!)
208fi
209
210AC_SUBST(FLaC__SIZE16)
211AC_SUBST(FLaC__USIZE16)
212AC_SUBST(FLaC__SIZE32)
213AC_SUBST(FLaC__USIZE32)
214AC_SUBST(FLaC__SIZE64)
215AC_SUBST(FLaC__USIZE64)
216
Josh Coalson5a804ca2002-05-17 06:08:13 +0000217AC_SUBST(SHARE_LIBS)
218
Josh Coalson57ba6f42002-06-07 05:27:37 +0000219OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
Josh Coalson9f429ba2001-01-19 22:39:39 +0000220if test x$debug = xtrue; then
Josh Coalson57ba6f42002-06-07 05:27:37 +0000221 OUR_CFLAGS_TAIL="-g -O0 -DDEBUG"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000222else
Josh Coalson57ba6f42002-06-07 05:27:37 +0000223 OUR_CFLAGS_TAIL="-O3 -DNDEBUG"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000224 if test x$GCC = xyes; then
Josh Coalson57ba6f42002-06-07 05:27:37 +0000225 OUR_CFLAGS_TAIL="$OUR_CFLAGS_TAIL -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000226 fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000227fi
Josh Coalson57ba6f42002-06-07 05:27:37 +0000228CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS $OUR_CFLAGS_TAIL"
229CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS $OUR_CFLAGS_TAIL"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000230
uid38180b4bc14b2002-09-09 20:53:08 +0000231AC_OUTPUT( \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000232 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 \
Josh Coalsonc49380d2002-08-07 17:38:08 +0000240 src/libOggFLAC/Makefile \
241 src/libOggFLAC/include/Makefile \
242 src/libOggFLAC/include/protected/Makefile \
243 src/libOggFLAC++/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000244 src/flac/Makefile \
245 src/metaflac/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000246 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 \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000252 src/plugin_xmms/Makefile \
253 src/share/Makefile \
254 src/test_libFLAC/Makefile \
255 src/test_libFLAC++/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000256 src/test_libOggFLAC/Makefile \
257 src/test_libOggFLAC++/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000258 src/test_streams/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000259 include/Makefile \
260 include/FLAC/Makefile \
Josh Coalson6ca4b1b2001-06-29 02:54:59 +0000261 include/FLAC/ordinals.h \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000262 include/FLAC++/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000263 include/OggFLAC/Makefile \
264 include/OggFLAC++/Makefile \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000265 include/share/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000266 doc/Makefile \
Josh Coalson130cbb52002-07-16 16:12:27 +0000267 doc/html/Makefile \
268 doc/html/images/Makefile \
269 doc/html/ru/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000270 man/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000271 test/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000272 build/Makefile \
273 obj/bin/Makefile \
274 obj/lib/Makefile \
275 obj/Makefile \
276 flac.pbproj/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000277)