summaryrefslogtreecommitdiff
path: root/configure.in
blob: 74f0455b5659082c69ad8516fd15da0cb245ed31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
dnl Process this file with autoconf to produce a configure script

dnl ------------------------------------------------
dnl Initialization and Versioning
dnl ------------------------------------------------

AC_INIT(lib/mdct.c)
AM_INIT_AUTOMAKE(libvorbis,1.0rc3)

dnl Library versioning

V_LIB_CURRENT=1
V_LIB_REVISION=0
V_LIB_AGE=1
VF_LIB_CURRENT=2
VF_LIB_REVISION=0
VF_LIB_AGE=2
VE_LIB_CURRENT=1
VE_LIB_REVISION=0
VE_LIB_AGE=1
AC_SUBST(V_LIB_CURRENT)
AC_SUBST(V_LIB_REVISION)
AC_SUBST(V_LIB_AGE)
AC_SUBST(VF_LIB_CURRENT)
AC_SUBST(VF_LIB_REVISION)
AC_SUBST(VF_LIB_AGE)
AC_SUBST(VE_LIB_CURRENT)
AC_SUBST(VE_LIB_REVISION)
AC_SUBST(VE_LIB_AGE)

dnl --------------------------------------------------  
dnl Check for programs
dnl --------------------------------------------------  

dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
dnl if $CFLAGS is blank
cflags_save="$CFLAGS"
AC_PROG_CC
AC_PROG_CPP
CFLAGS="$cflags_save"

AM_PROG_LIBTOOL

dnl --------------------------------------------------
dnl Set build flags based on environment
dnl --------------------------------------------------

AC_CANONICAL_HOST

dnl Set some target options

cflags_save="$CFLAGS"
ldflags_save="$LDFLAGS"
if test -z "$GCC"; then
	case $host in 
	*-*-irix*)
		dnl If we're on IRIX, we wanna use cc even if gcc 
		dnl is there (unless the user has overriden us)...
		if test -z "$CC"; then
			CC=cc
		fi
		DEBUG="-g -signed" 
		CFLAGS="-O2 -w -signed"
		PROFILE="-p -g3 -O2 -signed" ;;
	sparc-sun-solaris*)
		DEBUG="-v -g"
		CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
		PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
	*)
		DEBUG="-g"
		CFLAGS="-O"
		PROFILE="-g -p" ;;
        esac
else

	case $host in 
	*86-*-linux*)
		DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
		CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
#              	PROFILE="-Wall -W -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
		PROFILE="-Wall -W -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"

		# glibc < 2.1.3 has a serious FP bug in the math inline header
		# that will cripple Vorbis.  Look to see if the magic FP stack
		# clobber is missing in the mathinline header, thus indicating
		# the buggy version

		AC_EGREP_CPP(log10.*fldlg2.*fxch,[
				#define __LIBC_INTERNAL_MATH_INLINES 1
			     	#define __OPTIMIZE__
				#include <math.h>
				],bad=maybe,bad=no)
		if test ${bad} = "maybe" ;then
		      AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
					[
					#define __LIBC_INTERNAL_MATH_INLINES 1
				     	#define __OPTIMIZE__
					#include <math.h>
					],bad=no,bad=yes)
		fi
 		if test ${bad} = "yes" ;then
 AC_MSG_WARN([                                                        ])
 AC_MSG_WARN([********************************************************])
 AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
 AC_MSG_WARN([* in /usr/include/bits/mathinline.h  This bug affects  *])
 AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
 AC_MSG_WARN([* machine.  Upgrading to glibc 2.1.3 is strongly urged *])
 AC_MSG_WARN([* to correct the problem.  Note that upgrading glibc   *])
 AC_MSG_WARN([* will not fix any previously built programs; this is  *])
 AC_MSG_WARN([* a compile-time time bug.                             *])
 AC_MSG_WARN([* To work around the problem for this build of Ogg,    *])
 AC_MSG_WARN([* autoconf is disabling all math inlining.  This will  *])
 AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
 AC_MSG_WARN([* will actually work.  Once glibc is upgraded, rerun   *])
 AC_MSG_WARN([* configure and make to build with inlining.           *])
 AC_MSG_WARN([********************************************************])
 AC_MSG_WARN([                                                        ])

  		CFLAGS=${OPT}" -D__NO_MATH_INLINES"
  		PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
  		fi;;
	*-*-linux*)
		DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
		CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char"
		PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
	sparc-sun-*)
		DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char -mv8"
		CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
		PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
	*-*-darwin*)
		DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
		CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char"
		PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";;
	*)
		DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char"
		CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char"
		PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
        esac
fi
CFLAGS="$CFLAGS $cflags_save"
LDFLAGS="$LDFLAGS $ldflags_save"

dnl --------------------------------------------------
dnl Check for headers
dnl --------------------------------------------------

AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)

dnl --------------------------------------------------
dnl Check for typedefs, structures, etc
dnl --------------------------------------------------

dnl none

dnl --------------------------------------------------
dnl Check for libraries
dnl --------------------------------------------------

AC_CHECK_LIB(m, cos, LIBS="-lm", LIBS="")
AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)

AM_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!))

dnl --------------------------------------------------
dnl Check for library functions
dnl --------------------------------------------------

AC_FUNC_ALLOCA
AC_FUNC_MEMCMP

AC_CHECK_FUNCS(sqrtf)
AC_CHECK_FUNCS(logf)
AC_CHECK_FUNCS(expf)
AC_CHECK_FUNCS(acosf)
AC_CHECK_FUNCS(atanf)
AC_CHECK_FUNCS(frexpf)
AC_CHECK_FUNCS(rintf)

dnl --------------------------------------------------
dnl Do substitutions
dnl --------------------------------------------------

LIBS="$LIBS $OGG_LIBS"

AC_SUBST(LIBS)
AC_SUBST(DEBUG)
AC_SUBST(PROFILE)
AC_SUBST(pthread_lib)

AC_OUTPUT(Makefile lib/Makefile lib/modes/Makefile lib/books/Makefile doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile include/Makefile include/vorbis/Makefile examples/Makefile win32/Makefile debian/Makefile vq/Makefile)