blob: d583c20080c44a085a183653310beb16845e1a96 [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 Coalson49912902002-06-28 23:45:08 +000096AM_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 +000097AM_CONDITIONAL(FLaC__HAS_OGG, [test x$have_ogg = xyes])
98if test x$have_ogg = xyes ; then
99AC_DEFINE(FLAC__HAS_OGG)
100fi
Josh Coalsonf7fc5c82001-10-31 18:31:36 +0000101
Josh Coalson9f429ba2001-01-19 22:39:39 +0000102AM_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 +0000103AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
104
Josh Coalson5a804ca2002-05-17 06:08:13 +0000105SHARE_LIBS='$(top_builddir)/src/share/libutf8.a $(top_builddir)/src/share/libgetopt.a'
106
Josh Coalson130cbb52002-07-16 16:12:27 +0000107dnl check for i18n(internationalization); these are from libiconv/gettext
Josh Coalson412fa3b2002-07-11 06:15:30 +0000108AM_WITH_NLS
109AM_ICONV
110AM_LANGINFO_CODESET
111
Josh Coalson130cbb52002-07-16 16:12:27 +0000112dnl check id3lib libraries
Josh Coalson412fa3b2002-07-11 06:15:30 +0000113LIBS_save_blah_blah_blah=$LIBS
114LIBS=""
115AC_SEARCH_LIBS(ID3Tag_Link,"id3" "id3 -lstdc++" "id3 -lz" "id3 -lz -lstdc++",
116 [have_id3lib=yes],
117 [AC_MSG_WARN([id3lib not found - ID3v2 will not be supported, internal function support only id3v1])])
118AM_CONDITIONAL(FLaC__HAS_ID3LIB, [test x$have_id3lib = xyes])
119if test x$have_id3lib = xyes ; then
120AC_DEFINE(FLAC__HAS_ID3LIB)
121ID3LIBS=$LIBS
122fi
123AC_SUBST(ID3LIBS)
124
125dnl expected version for cross compiling
126ID3LIB_MAJOR=3
127ID3LIB_MINOR=8
128ID3LIB_PATCH=0
129
130AC_MSG_CHECKING(for id3lib version)
131 AC_TRY_RUN([
132#include <id3.h>
133#include <stdio.h>
134int
135main ()
136{
137 FILE *output;
138 output=fopen("conftest.id3","w");
139 fprintf(output,"ID3LIB_MAJOR=%d\nID3LIB_MINOR=%d\nID3LIB_PATCH=%d\n",ID3LIB_MAJOR_VERSION,ID3LIB_MINOR_VERSION,ID3LIB_PATCH_VERSION);
140 fclose(output);
141 exit(0);
142}
143], . 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"])
144AC_DEFINE_UNQUOTED(ID3LIB_MAJOR, $ID3LIB_MAJOR)
145AC_DEFINE_UNQUOTED(ID3LIB_MINOR, $ID3LIB_MINOR)
146AC_DEFINE_UNQUOTED(ID3LIB_PATCH, $ID3LIB_PATCH)
147
148LIBS=$LIBS_save_blah_blah_blah
149
Josh Coalsoncf030c82001-05-23 20:59:48 +0000150AC_CHECK_PROGS(NASM, nasm)
151AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
Josh Coalson0e3576e2001-05-25 00:07:51 +0000152if test -n "$NASM" ; then
153AC_DEFINE(FLAC__HAS_NASM)
154fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000155
Josh Coalson6ca4b1b2001-06-29 02:54:59 +0000156dnl Check for type sizes
157
158AC_CHECK_SIZEOF(short)
159AC_CHECK_SIZEOF(int)
160AC_CHECK_SIZEOF(long)
161AC_CHECK_SIZEOF(long long)
162
163case 2 in
164 $ac_cv_sizeof_short) FLaC__SIZE16="short" ; FLaC__USIZE16="unsigned short";;
165 $ac_cv_sizeof_int) FLaC__SIZE16="int" ; FLaC__USIZE16="unsigned int";;
166esac
167
168case 4 in
169 $ac_cv_sizeof_short) FLaC__SIZE32="short" ; FLaC__USIZE32="unsigned short";;
170 $ac_cv_sizeof_int) FLaC__SIZE32="int" ; FLaC__USIZE32="unsigned int";;
171 $ac_cv_sizeof_long) FLaC__SIZE32="long" ; FLaC__USIZE32="unsigned long";;
172esac
173
174case 8 in
175 $ac_cv_sizeof_int) FLaC__SIZE64="int" ; FLaC__USIZE64="unsigned int";;
176 $ac_cv_sizeof_long) FLaC__SIZE64="long" ; FLaC__USIZE64="unsigned long";;
177 $ac_cv_sizeof_long_long) FLaC__SIZE64="long long" ; FLaC__USIZE64="unsigned long long";;
178esac
179
180if test -z "$FLaC__SIZE16"; then
181 AC_MSG_ERROR(No 16 bit type found on this platform!)
182fi
183if test -z "$FLaC__USIZE16"; then
184 AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
185fi
186if test -z "$FLaC__SIZE32"; then
187 AC_MSG_ERROR(No 32 bit type found on this platform!)
188fi
189if test -z "$FLaC__USIZE32"; then
190 AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
191fi
192if test -z "$FLaC__SIZE64"; then
193 AC_MSG_WARN(No 64 bit type found on this platform!)
194fi
195if test -z "$FLaC__USIZE64"; then
196 AC_MSG_ERROR(No unsigned 64 bit type found on this platform!)
197fi
198
199AC_SUBST(FLaC__SIZE16)
200AC_SUBST(FLaC__USIZE16)
201AC_SUBST(FLaC__SIZE32)
202AC_SUBST(FLaC__USIZE32)
203AC_SUBST(FLaC__SIZE64)
204AC_SUBST(FLaC__USIZE64)
205
Josh Coalson5a804ca2002-05-17 06:08:13 +0000206AC_SUBST(SHARE_LIBS)
207
Josh Coalson57ba6f42002-06-07 05:27:37 +0000208OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
Josh Coalson9f429ba2001-01-19 22:39:39 +0000209if test x$debug = xtrue; then
Josh Coalson57ba6f42002-06-07 05:27:37 +0000210 OUR_CFLAGS_TAIL="-g -O0 -DDEBUG"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000211else
Josh Coalson57ba6f42002-06-07 05:27:37 +0000212 OUR_CFLAGS_TAIL="-O3 -DNDEBUG"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000213 if test x$GCC = xyes; then
Josh Coalson57ba6f42002-06-07 05:27:37 +0000214 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 +0000215 fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000216fi
Josh Coalson57ba6f42002-06-07 05:27:37 +0000217CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS $OUR_CFLAGS_TAIL"
218CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS $OUR_CFLAGS_TAIL"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000219
220AC_OUTPUT( Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000221 src/Makefile \
222 src/libFLAC/Makefile \
223 src/libFLAC/ia32/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000224 src/libFLAC/include/Makefile \
225 src/libFLAC/include/private/Makefile \
226 src/libFLAC/include/protected/Makefile \
Josh Coalson57ba6f42002-06-07 05:27:37 +0000227 src/libFLAC++/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000228 src/flac/Makefile \
229 src/metaflac/Makefile \
230 src/plugin_xmms/Makefile \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000231 src/share/Makefile \
Josh Coalson57ba6f42002-06-07 05:27:37 +0000232 src/test_libFLAC/Makefile \
233 src/test_libFLAC++/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000234 src/test_streams/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000235 include/Makefile \
236 include/FLAC/Makefile \
Josh Coalson6ca4b1b2001-06-29 02:54:59 +0000237 include/FLAC/ordinals.h \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000238 include/FLAC++/Makefile \
239 include/share/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000240 doc/Makefile \
Josh Coalson130cbb52002-07-16 16:12:27 +0000241 doc/html/Makefile \
242 doc/html/images/Makefile \
243 doc/html/ru/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000244 man/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000245 test/Makefile \
246)