fe393cee2c7f1f7648fb5ba57c1b84b1389791a0
[platform/upstream/flac.git] / configure.in
1 #  FLAC - Free Lossless Audio Codec
2 #  Copyright (C) 2001  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.2)
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_MAKE_SET
32
33 AC_CANONICAL_HOST
34 case $host_cpu in
35         i*86)   cpu_ia32=true ; AC_DEFINE(FLAC__CPU_IA32) ;;
36         powerpc)        cpu_ppc=true ; AC_DEFINE(FLAC__CPU_PPC) ;;
37         sparc)  cpu_sparc=true ; AC_DEFINE(FLAC__CPU_SPARC) ;;
38 esac
39 AM_CONDITIONAL(FLaC__CPU_IA32, test x$cpu_ia32 = xtrue)
40 AM_CONDITIONAL(FLaC__CPU_PPC, test x$cpu_ppc = xtrue)
41 AM_CONDITIONAL(FLaC__CPU_SPARC, test x$cpu_sparc = xtrue)
42 case "$host" in
43         i[[3-6]]86-*-openbsd*) OBJ_FORMAT=aoutb ;;
44         *) OBJ_FORMAT=elf ;;
45 esac
46 AC_SUBST(OBJ_FORMAT)
47
48 if test x$cpu_ia32 = xtrue ; then
49 AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
50 fi
51
52 AC_ARG_ENABLE(asm-optimizations, [  --disable-asm-optimizations    Don't use any assembly optimization routines], asm_opt=no, asm_opt=yes)
53 AM_CONDITIONAL(FLaC__NO_ASM, test x$asm_opt = xno)
54 if test x$asm_opt = xno ; then
55 AC_DEFINE(FLAC__NO_ASM)
56 fi
57
58 AC_ARG_ENABLE(debug,
59 [  --enable-debug                 Turn on debugging],
60 [case "${enableval}" in
61         yes) debug=true ;;
62         no)  debug=false ;;
63         *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
64 esac],[debug=false])
65 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
66
67 AC_ARG_ENABLE(sse,
68 [  --enable-sse                   Enable SSE support by asserting that the OS supports SSE instructions],
69 [case "${enableval}" in
70         yes) sse_os=true ;;
71         no)  sse_os=false ;;
72         *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
73 esac],[sse_os=false])
74 AM_CONDITIONAL(FLaC__SSE_OS, test x$sse_os = xtrue)
75 if test x$sse_os = xtrue ; then
76 AC_DEFINE(FLAC__SSE_OS)
77 fi
78
79 AC_ARG_ENABLE(3dnow,
80 [  --enable-3dnow                 Enable 3DNOW! support],
81 [case "${enableval}" in
82         yes) use_3dnow=true ;;
83         no)  use_3dnow=false ;;
84         *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
85 esac],[use_3dnow=false])
86 AM_CONDITIONAL(FLaC__USE_3DNOW, test x$use_3dnow = xtrue)
87 if test x$use_3dnow = xtrue ; then
88 AC_DEFINE(FLAC__USE_3DNOW)
89 fi
90
91 AC_CHECK_LIB(ogg, ogg_stream_init,
92              [LIBS="$LIBS -logg"; have_ogg=yes],
93              [AC_MSG_WARN([*** Ogg development enviroment not installed - ogg support will not be built])])
94 AM_CONDITIONAL(FLaC__HAS_OGG, [test x$have_ogg = xyes])
95 if test x$have_ogg = xyes ; then
96 AC_DEFINE(FLAC__HAS_OGG)
97 fi
98
99 AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - xmms support will not be built]))
100 AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
101
102 AC_CHECK_PROGS(NASM, nasm)
103 AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
104 if test -n "$NASM" ; then
105 AC_DEFINE(FLAC__HAS_NASM)
106 fi
107
108 dnl Check for type sizes
109
110 AC_CHECK_SIZEOF(short)
111 AC_CHECK_SIZEOF(int)
112 AC_CHECK_SIZEOF(long)
113 AC_CHECK_SIZEOF(long long)
114
115 case 2 in
116         $ac_cv_sizeof_short) FLaC__SIZE16="short" ; FLaC__USIZE16="unsigned short";;
117         $ac_cv_sizeof_int) FLaC__SIZE16="int" ; FLaC__USIZE16="unsigned int";;
118 esac
119
120 case 4 in
121         $ac_cv_sizeof_short) FLaC__SIZE32="short" ; FLaC__USIZE32="unsigned short";;
122         $ac_cv_sizeof_int) FLaC__SIZE32="int" ; FLaC__USIZE32="unsigned int";;
123         $ac_cv_sizeof_long) FLaC__SIZE32="long" ; FLaC__USIZE32="unsigned long";;
124 esac
125
126 case 8 in
127         $ac_cv_sizeof_int) FLaC__SIZE64="int" ; FLaC__USIZE64="unsigned int";;
128         $ac_cv_sizeof_long) FLaC__SIZE64="long" ; FLaC__USIZE64="unsigned long";;
129         $ac_cv_sizeof_long_long) FLaC__SIZE64="long long" ; FLaC__USIZE64="unsigned long long";;
130 esac
131
132 if test -z "$FLaC__SIZE16"; then
133         AC_MSG_ERROR(No 16 bit type found on this platform!)
134 fi
135 if test -z "$FLaC__USIZE16"; then
136         AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
137 fi
138 if test -z "$FLaC__SIZE32"; then
139         AC_MSG_ERROR(No 32 bit type found on this platform!)
140 fi
141 if test -z "$FLaC__USIZE32"; then
142         AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
143 fi
144 if test -z "$FLaC__SIZE64"; then
145         AC_MSG_WARN(No 64 bit type found on this platform!)
146 fi
147 if test -z "$FLaC__USIZE64"; then
148         AC_MSG_ERROR(No unsigned 64 bit type found on this platform!)
149 fi
150
151 AC_SUBST(FLaC__SIZE16)
152 AC_SUBST(FLaC__USIZE16)
153 AC_SUBST(FLaC__SIZE32)
154 AC_SUBST(FLaC__USIZE32)
155 AC_SUBST(FLaC__SIZE64)
156 AC_SUBST(FLaC__USIZE64)
157
158 SAVE_CFLAGS="$CFLAGS"
159 CFLAGS='-I$(top_builddir) -I$(srcdir)/include -I $(top_srcdir)/include -Wall -W'
160 if test x$debug = xtrue; then
161         CFLAGS="$CFLAGS -g -O0 -DDEBUG"
162 else
163         CFLAGS="$CFLAGS -O3 -DNDEBUG"
164         if test x$GCC = xyes; then
165                 CFLAGS="$CFLAGS -fomit-frame-pointer -funroll-loops -finline-functions -Winline -DFLaC__INLINE=__inline__"
166         fi
167 fi
168 CFLAGS="$CFLAGS $SAVE_CFLAGS"
169
170 AC_OUTPUT(      Makefile        \
171         src/Makefile    \
172         src/libFLAC/Makefile    \
173         src/libFLAC/ia32/Makefile       \
174         src/libFLAC/include/Makefile    \
175         src/libFLAC/include/private/Makefile    \
176         src/libFLAC/include/protected/Makefile  \
177         src/flac/Makefile       \
178         src/metaflac/Makefile   \
179         src/plugin_xmms/Makefile        \
180         src/test_streams/Makefile       \
181         src/test_unit/Makefile  \
182         include/Makefile \
183         include/FLAC/Makefile \
184         include/FLAC/ordinals.h \
185         doc/Makefile \
186         doc/images/Makefile \
187         doc/ru/Makefile \
188         man/Makefile \
189         test/Makefile   \
190 )