-
Notifications
You must be signed in to change notification settings - Fork 34
/
configure.in
197 lines (165 loc) · 5.41 KB
/
configure.in
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
191
192
193
194
195
196
197
dnl Process this file with autoconf to produce a configure script.
AC_REVISION($Revision: 1.38 $)
AC_INIT(mimetic/mimetic.h)
AC_CANONICAL_SYSTEM
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(mimetic,0.9.8)
AM_CONFIG_HEADER(mimetic/config.h)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
dnl defines HAVE_MMAP if mmapping works
AC_FUNC_MMAP
AC_CHECK_FUNCS(madvise)
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL
AC_LANG_CPLUSPLUS
INCLUDEDIR=$includedir/mimetic
debug_enabled=false
dnl CFLAGS and CXXFLAGS default to -O2 -g
dnl CXXFLAGS="$CXXFLAGS -DNDEBUG -fno-exceptions"
CXXFLAGS="$CXXFLAGS -DNDEBUG"
AC_ARG_ENABLE(debug,
[ --enable-debug[=LEVEL] enables debug symbols [default=2]],
if test "$enableval" = "yes"; then
debug_enabled=true
CXXFLAGS="-g -Wall"
else
if test "$enableval" != "no"; then
debug_enabled=true
CXXFLAGS="-g$enableval -Wall"
fi
fi
)
AC_ARG_ENABLE(profile,
[ --enable-profile enables profiling],
if test "$enableval" = "yes"; then
CXXFLAGS="$CXXFLAGS -pg -a"
fi
)
dnl *** Checks for libraries.
AC_ARG_WITH(stlport,
[ --with-stlport[=BASEDIR] use STLport],
enable_stlport="yes"
dnl STLport base dir
if test "$withval" != "no"; then
if test $withval != "yes"; then
with_stlport_basedir=$withval
with_stlport_includes=${withval}/include/stlport
with_stlport_libraries=${withval}/lib
fi
fi
, enable_stlport=no)
AC_ARG_WITH(stlport-includes,
[ --with-stlport-includes=DIR where the STLport includes are ],
[with_stlport_includes=$withval])
AC_ARG_WITH(stlport-libraries,
[ --with-stlport-libraries=DIR where STLport library is installed],
[with_stlport_libraries=$withval])
AC_ARG_WITH(stlport-libname,
[ --with-stlport-libname=NAME STLport lib base name],
[with_stlport_libname=$withval])
dnl AC_ARG_WITH(stlport-debug,
dnl [ --with-stlport-debug STLport debug mode on/off.[default: on with --enable-debug off otherwise],
dnl [ with_stlport_libname=${with_stlport_libname}_stldebug ])
if test "$enable_stlport" = "yes"; then
dnl ** debug enabled ?
if test "$debug_enabled" = "true"; then
CXXFLAGS="$CXXFLAGS -D_STLP_DEBUG"
fi
dnl *** STLport include dir
if test "$with_stlport_includes"; then
AC_CHECK_HEADER(${with_stlport_includes}/stl_user_config.h,
stlp_headers_found=true)
else
stlp_include_dirs="/usr/local/include/stlport /usr/include/stlport"
for stlp_inc in $stlp_include_dirs; do
AC_CHECK_HEADER(${stlp_inc}/stl_user_config.h,
with_stlport_includes=$stlp_inc
export stlp_headers_found=true
break)
done
fi
if test "$stlp_headers_found" != "true"; then
AC_MSG_ERROR([I'm unable to find STLport include directory])
fi
if test "$with_stlport_libraries"; then
stlp_ldflags="$stlp_ldflags -L${with_stlport_libraries}"
fi
dnl *** STLport library(it must be linked with libm & libpthread on linux...
AC_CHECK_LIB(m, main,stlp_ldflags="$stlp_ldflags -lm")
case "$host_os" in
freebsd*)
stlp_ldflags="$stlp_ldflags -pthread";;
*netbsd*)
stlp_ldflags="$stlp_ldflags -L/usr/libexec -lm"
;;
*) stlp_ldflags="$stlp_ldflags -lpthread"
AC_CHECK_LIB(pthread, main,stlp_ldflags="$stlp_ldflags -lpthread")
;;
esac
if test "$with_stlport_libname"; then
AC_CHECK_LIB($with_stlport_libname,main,stlp_lib_found=true,,
[$stlp_ldflags])
else
dnl *** try to get stlport library name
stlp_libs="stlport_gcc stlport_icl stlport_cygwin stlport_dec \
stlport_djgpp stlport_mingw32 stlport_aCC stlport_kcc stlport_misppro \
stlport_sunpro stlport_vc5 stlport_vc6 stlport_vc7 stlport_watcom"
for stlp_libname in $stlp_libs; do
test "$debug_enabled" = "true" && stlp_libname=${stlp_libname}_debug
AC_CHECK_LIB($stlp_libname, main,
with_stlport_libname=$stlp_libname
stlp_lib_found=true
break,
,[$stlp_ldflags])
done
fi
if test "$stlp_lib_found" != "true"; then
AC_MSG_ERROR([I'm unable to find STLport library. You must call configure
with the --with-stlport-libname option])
fi
stlp_ldflags="$stlp_ldflags -l$with_stlport_libname"
CXXFLAGS="$CXXFLAGS -I$with_stlport_includes"
LDFLAGS="$LDFLAGS ${stlp_ldflags}"
fi
CXXFLAGS="$CXXFLAGS -DHAVE_MIMETIC_CONFIG"
CFLAGS="$CXXFLAGS"
dnl ** check for STL required features
AC_MSG_CHECKING([STL required features])
AC_TRY_COMPILE([#include <string>],
[using namespace std; char_traits<char>::eq('a','a');],
,
AC_MSG_ERROR([std::char_traits unsupported])
)
AC_TRY_COMPILE([#include <streambuf>],
[using namespace std; struct sbd:public streambuf {} msb;],
,
AC_MSG_ERROR([std::streambuf unsupported])
)
AC_MSG_RESULT([yes])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_OFF_T
AC_TYPE_UID_T
AC_HEADER_DIRENT
AC_CHECK_HEADERS(sys/stat.h)
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(stdint.h)
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(INCLUDEDIR)
AC_OUTPUT(Makefile \
mimetic/Makefile \
mimetic/codec/Makefile \
mimetic/rfc822/Makefile \
mimetic/os/Makefile \
mimetic/parser/Makefile \
test/Makefile \
examples/Makefile \
doc/Makefile \
doc/doxygen.config \
win32/Makefile)