blob: a6bb7b1fbc5975d3d2582745f194dacc92d3a667 [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 Coalsoncc682512002-06-08 04:53:42 +000022AM_INIT_AUTOMAKE(flac, 1.0.3_beta)
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 Coalsoncf030c82001-05-23 20:59:48 +0000107AC_CHECK_PROGS(NASM, nasm)
108AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
Josh Coalson0e3576e2001-05-25 00:07:51 +0000109if test -n "$NASM" ; then
110AC_DEFINE(FLAC__HAS_NASM)
111fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000112
Josh Coalson6ca4b1b2001-06-29 02:54:59 +0000113dnl Check for type sizes
114
115AC_CHECK_SIZEOF(short)
116AC_CHECK_SIZEOF(int)
117AC_CHECK_SIZEOF(long)
118AC_CHECK_SIZEOF(long long)
119
120case 2 in
121 $ac_cv_sizeof_short) FLaC__SIZE16="short" ; FLaC__USIZE16="unsigned short";;
122 $ac_cv_sizeof_int) FLaC__SIZE16="int" ; FLaC__USIZE16="unsigned int";;
123esac
124
125case 4 in
126 $ac_cv_sizeof_short) FLaC__SIZE32="short" ; FLaC__USIZE32="unsigned short";;
127 $ac_cv_sizeof_int) FLaC__SIZE32="int" ; FLaC__USIZE32="unsigned int";;
128 $ac_cv_sizeof_long) FLaC__SIZE32="long" ; FLaC__USIZE32="unsigned long";;
129esac
130
131case 8 in
132 $ac_cv_sizeof_int) FLaC__SIZE64="int" ; FLaC__USIZE64="unsigned int";;
133 $ac_cv_sizeof_long) FLaC__SIZE64="long" ; FLaC__USIZE64="unsigned long";;
134 $ac_cv_sizeof_long_long) FLaC__SIZE64="long long" ; FLaC__USIZE64="unsigned long long";;
135esac
136
137if test -z "$FLaC__SIZE16"; then
138 AC_MSG_ERROR(No 16 bit type found on this platform!)
139fi
140if test -z "$FLaC__USIZE16"; then
141 AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
142fi
143if test -z "$FLaC__SIZE32"; then
144 AC_MSG_ERROR(No 32 bit type found on this platform!)
145fi
146if test -z "$FLaC__USIZE32"; then
147 AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
148fi
149if test -z "$FLaC__SIZE64"; then
150 AC_MSG_WARN(No 64 bit type found on this platform!)
151fi
152if test -z "$FLaC__USIZE64"; then
153 AC_MSG_ERROR(No unsigned 64 bit type found on this platform!)
154fi
155
156AC_SUBST(FLaC__SIZE16)
157AC_SUBST(FLaC__USIZE16)
158AC_SUBST(FLaC__SIZE32)
159AC_SUBST(FLaC__USIZE32)
160AC_SUBST(FLaC__SIZE64)
161AC_SUBST(FLaC__USIZE64)
162
Josh Coalson5a804ca2002-05-17 06:08:13 +0000163AC_SUBST(SHARE_LIBS)
164
Josh Coalson57ba6f42002-06-07 05:27:37 +0000165OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
Josh Coalson9f429ba2001-01-19 22:39:39 +0000166if test x$debug = xtrue; then
Josh Coalson57ba6f42002-06-07 05:27:37 +0000167 OUR_CFLAGS_TAIL="-g -O0 -DDEBUG"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000168else
Josh Coalson57ba6f42002-06-07 05:27:37 +0000169 OUR_CFLAGS_TAIL="-O3 -DNDEBUG"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000170 if test x$GCC = xyes; then
Josh Coalson57ba6f42002-06-07 05:27:37 +0000171 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 +0000172 fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000173fi
Josh Coalson57ba6f42002-06-07 05:27:37 +0000174CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS $OUR_CFLAGS_TAIL"
175CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS $OUR_CFLAGS_TAIL"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000176
177AC_OUTPUT( Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000178 src/Makefile \
179 src/libFLAC/Makefile \
180 src/libFLAC/ia32/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000181 src/libFLAC/include/Makefile \
182 src/libFLAC/include/private/Makefile \
183 src/libFLAC/include/protected/Makefile \
Josh Coalson57ba6f42002-06-07 05:27:37 +0000184 src/libFLAC++/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000185 src/flac/Makefile \
186 src/metaflac/Makefile \
187 src/plugin_xmms/Makefile \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000188 src/share/Makefile \
Josh Coalson57ba6f42002-06-07 05:27:37 +0000189 src/test_libFLAC/Makefile \
190 src/test_libFLAC++/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000191 src/test_streams/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000192 include/Makefile \
193 include/FLAC/Makefile \
Josh Coalson6ca4b1b2001-06-29 02:54:59 +0000194 include/FLAC/ordinals.h \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000195 include/FLAC++/Makefile \
196 include/share/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000197 doc/Makefile \
198 doc/images/Makefile \
199 doc/ru/Makefile \
200 man/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000201 test/Makefile \
202)