1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT(src/framing.c)
4
5AM_INIT_AUTOMAKE(libogg,1.2.0)
6AM_MAINTAINER_MODE
7
8dnl Library versioning
9
10LIB_CURRENT=7
11LIB_REVISION=0
12LIB_AGE=7
13AC_SUBST(LIB_CURRENT)
14AC_SUBST(LIB_REVISION)
15AC_SUBST(LIB_AGE)
16
17AC_PROG_CC
18AM_PROG_LIBTOOL
19AM_PROG_CC_C_O
20
21dnl config.h
22AM_CONFIG_HEADER(config.h)
23
24dnl Set some options based on environment
25
26cflags_save="$CFLAGS"
27if test -z "$GCC"; then
28        case $host in
29        *-*-irix*)
30                DEBUG="-g -signed"
31                CFLAGS="-O2 -w -signed"
32                PROFILE="-p -g3 -O2 -signed"
33		;;
34        sparc-sun-solaris*)
35                DEBUG="-v -g"
36                CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
37                PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc"
38		;;
39        *)
40                DEBUG="-g"
41                CFLAGS="-O"
42                PROFILE="-g -p"
43		;;
44        esac
45else
46        case $host in
47        *-*-linux*)
48                DEBUG="-g -Wall -fsigned-char"
49                CFLAGS="-O20 -ffast-math -fsigned-char"
50                PROFILE="-Wall -W -pg -g -O20 -ffast-math -fsigned-char"
51		;;
52        sparc-sun-*)
53                sparc_cpu=""
54                AC_MSG_CHECKING([if gcc supports -mv8])
55                old_cflags="$CFLAGS"
56                CFLAGS="$CFLAGS -mv8"
57                AC_TRY_COMPILE(, [return 0;], [
58                        AC_MSG_RESULT([yes])
59                        sparc_cpu="-mv8"
60                ])
61                CFLAGS="$old_cflags"
62                DEBUG="-g -Wall -fsigned-char $sparc_cpu"
63                CFLAGS="-O20 -ffast-math -fsigned-char $sparc_cpu"
64                PROFILE="-pg -g -O20 -fsigned-char $sparc_cpu"
65		;;
66	*-*-darwin*)
67		DEBUG="-fno-common -g -Wall -fsigned-char"
68		CFLAGS="-fno-common -O4 -Wall -fsigned-char -ffast-math"
69		PROFILE="-fno-common -O4 -Wall -pg -g -fsigned-char -ffast-math"
70		;;
71        *)
72                DEBUG="-g -Wall -fsigned-char"
73                CFLAGS="-O20 -fsigned-char"
74                PROFILE="-O20 -g -pg -fsigned-char"
75		;;
76        esac
77fi
78CFLAGS="$CFLAGS $cflags_save"
79DEBUG="$DEBUG $cflags_save"
80PROFILE="$PROFILE $cflags_save"
81
82dnl Checks for programs.
83
84dnl Checks for libraries.
85
86dnl Checks for header files.
87AC_HEADER_STDC
88
89dnl Checks for typedefs, structures, and compiler characteristics.
90AC_C_CONST
91
92dnl Check for types
93
94AC_MSG_CHECKING(for int16_t)
95AC_CACHE_VAL(has_cv_int16_t,
96[AC_TRY_RUN([
97#if defined __BEOS__ && !defined __HAIKU__
98#include <inttypes.h>
99#endif
100#include <sys/types.h>
101int16_t foo;
102int main() {return 0;}
103],
104has_cv_int16_t=yes,
105has_cv_int16_t=no,
106has_cv_int16_t=no
107)])
108AC_MSG_RESULT($has_cv_int16_t)
109
110AC_MSG_CHECKING(for int32_t)
111AC_CACHE_VAL(has_cv_int32_t,
112[AC_TRY_RUN([
113#if defined __BEOS__ && !defined __HAIKU__
114#include <inttypes.h>
115#endif
116#include <sys/types.h>
117int32_t foo;
118int main() {return 0;}
119],
120has_cv_int32_t=yes,
121has_cv_int32_t=no,
122has_cv_int32_t=no
123)])
124AC_MSG_RESULT($has_cv_int32_t)
125
126AC_MSG_CHECKING(for uint32_t)
127AC_CACHE_VAL(has_cv_uint32_t,
128[AC_TRY_RUN([
129#if defined __BEOS__ && !defined __HAIKU__
130#include <inttypes.h>
131#endif
132#include <sys/types.h>
133uint32_t foo;
134int main() {return 0;}
135],
136has_cv_uint32_t=yes,
137has_cv_uint32_t=no,
138has_cv_uint32_t=no
139)])
140AC_MSG_RESULT($has_cv_uint32_t)
141
142AC_MSG_CHECKING(for uint16_t)
143AC_CACHE_VAL(has_cv_uint16_t,
144[AC_TRY_RUN([
145#if defined __BEOS__ && !defined __HAIKU__
146#include <inttypes.h>
147#endif
148#include <sys/types.h>
149uint16_t foo;
150int main() {return 0;}
151],
152has_cv_uint16_t=yes,
153has_cv_uint16_t=no,
154has_cv_uint16_t=no
155)])
156AC_MSG_RESULT($has_cv_uint16_t)
157
158AC_MSG_CHECKING(for u_int32_t)
159AC_CACHE_VAL(has_cv_u_int32_t,
160[AC_TRY_RUN([
161#if defined __BEOS__ && !defined __HAIKU__
162#include <inttypes.h>
163#endif
164#include <sys/types.h>
165u_int32_t foo;
166int main() {return 0;}
167],
168has_cv_u_int32_t=yes,
169has_cv_u_int32_t=no,
170has_cv_u_int32_t=no
171)])
172AC_MSG_RESULT($has_cv_u_int32_t)
173
174AC_MSG_CHECKING(for u_int16_t)
175AC_CACHE_VAL(has_cv_u_int16_t,
176[AC_TRY_RUN([
177#if defined __BEOS__ && !defined __HAIKU__
178#include <inttypes.h>
179#endif
180#include <sys/types.h>
181u_int16_t foo;
182int main() {return 0;}
183],
184has_cv_u_int16_t=yes,
185has_cv_u_int16_t=no,
186has_cv_u_int16_t=no
187)])
188AC_MSG_RESULT($has_cv_u_int16_t)
189
190AC_MSG_CHECKING(for int64_t)
191AC_CACHE_VAL(has_cv_int64_t,
192[AC_TRY_RUN([
193#if defined __BEOS__ && !defined __HAIKU__
194#include <inttypes.h>
195#endif
196#include <sys/types.h>
197int64_t foo;
198int main() {return 0;}
199],
200has_cv_int64_t=yes,
201has_cv_int64_t=no,
202has_cv_int64_t=no
203)])
204AC_MSG_RESULT($has_cv_int64_t)
205
206AC_CHECK_SIZEOF(short,2)
207AC_CHECK_SIZEOF(int,4)
208AC_CHECK_SIZEOF(long,4)
209AC_CHECK_SIZEOF(long long,8)
210
211
212if test x$has_cv_int16_t = "xyes" ; then
213        SIZE16="int16_t"
214else
215        case 2 in
216                $ac_cv_sizeof_short) SIZE16="short";;
217                $ac_cv_sizeof_int) SIZE16="int";;
218        esac
219fi
220
221if test x$has_cv_int32_t = "xyes" ; then
222        SIZE32="int32_t"
223else
224        case 4 in
225                $ac_cv_sizeof_short) SIZE32="short";;
226                $ac_cv_sizeof_int) SIZE32="int";;
227                $ac_cv_sizeof_long) SIZE32="long";;
228        esac
229fi
230
231if test x$has_cv_uint32_t = "xyes" ; then
232        USIZE32="uint32_t"
233else
234        if test x$has_cv_u_int32_t = "xyes" ; then
235                USIZE32="u_int32_t"
236        else
237                case 4 in
238                        $ac_cv_sizeof_short) USIZE32="unsigned short";;
239                        $ac_cv_sizeof_int) USIZE32="unsigned int";;
240                        $ac_cv_sizeof_long) USIZE32="unsigned long";;
241                esac
242        fi
243fi
244
245if test x$has_cv_uint16_t = "xyes" ; then
246        USIZE16="uint16_t"
247else
248        if test x$has_cv_u_int16_t = "xyes" ; then
249                USIZE16="u_int16_t"
250        else
251                case 2 in
252                        $ac_cv_sizeof_short) USIZE16="unsigned short";;
253                        $ac_cv_sizeof_int) USIZE16="unsigned int";;
254                        $ac_cv_sizeof_long) USIZE16="unsigned long";;
255                esac
256        fi
257fi
258
259if test x$has_cv_int64_t = "xyes" ; then
260        SIZE64="int64_t"
261else
262case 8 in
263        $ac_cv_sizeof_int) SIZE64="int";;
264        $ac_cv_sizeof_long) SIZE64="long";;
265        $ac_cv_sizeof_long_long) SIZE64="long long";;
266esac
267fi
268
269if test -z "$SIZE16"; then
270        AC_MSG_ERROR(No 16 bit type found on this platform!)
271fi
272if test -z "$USIZE16"; then
273        AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
274fi
275if test -z "$SIZE32"; then
276        AC_MSG_ERROR(No 32 bit type found on this platform!)
277fi
278if test -z "$USIZE32"; then
279        AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
280fi
281if test -z "$SIZE64"; then
282        AC_MSG_WARN(No 64 bit type found on this platform!)
283fi
284
285dnl Checks for library functions.
286AC_FUNC_MEMCMP
287
288dnl Make substitutions
289
290AC_SUBST(LIBTOOL_DEPS)
291AC_SUBST(SIZE16)
292AC_SUBST(USIZE16)
293AC_SUBST(SIZE32)
294AC_SUBST(USIZE32)
295AC_SUBST(SIZE64)
296AC_SUBST(OPT)
297AC_SUBST(LIBS)
298AC_SUBST(DEBUG)
299AC_SUBST(CFLAGS)
300AC_SUBST(PROFILE)
301
302AC_OUTPUT([
303Makefile
304src/Makefile
305doc/Makefile doc/libogg/Makefile
306include/Makefile include/ogg/Makefile include/ogg/config_types.h
307libogg.spec
308ogg.pc
309ogg-uninstalled.pc
310])
311