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