1
# --------------------------------
2
# Pion autoconf configuration file
3
# --------------------------------
5
# Set Pion version information
6
PION_LIBRARY_VERSION=`echo $PACKAGE_VERSION | sed 's;^\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\).*$;\1;'`
7
# AC_MSG_NOTICE("Pion Library Version: $PION_LIBRARY_VERSION")
8
AC_SUBST(PION_LIBRARY_VERSION)
9
AC_DEFINE_UNQUOTED([PION_VERSION],["$PACKAGE_VERSION"],[Define to the version number of Pion.])
11
# Note: AM_CONFIG_HEADER is deprecated
12
AC_CONFIG_HEADERS(include/pion/config.hpp)
14
# Check for --with-cygwin
15
AC_MSG_CHECKING([for cygwin directory])
17
AC_HELP_STRING([--with-cygwin@<:@=DIR@:>@],[directory where cygwin is installed (Windows only)]),
18
[with_cygwin=$withval],
20
if test "$with_cygwin" = "maybe"; then
23
PION_CYGWIN_DIRECTORY="c:/cygwin"
24
AC_MSG_RESULT($PION_CYGWIN_DIRECTORY)
30
elif test "$with_cygwin" != "no"; then
31
PION_CYGWIN_DIRECTOR="$with_cygwin"
32
AC_MSG_RESULT($PION_CYGWIN_DIRECTORY)
36
AC_DEFINE_UNQUOTED([PION_CYGWIN_DIRECTORY],["$PION_CYGWIN_DIRECTORY"],[Define to the directory where cygwin is installed.])
37
AC_SUBST(PION_CYGWIN_DIRECTORY)
40
# Check for malloc_trim support
41
AC_MSG_CHECKING(for malloc_trim() support)
42
AC_TRY_LINK([#include <malloc.h>],
47
AC_DEFINE([PION_HAVE_MALLOC_TRIM],[1],[Define to 1 if C library supports malloc_trim()])
49
[ AC_MSG_RESULT(no) ])
52
# Check for unordered container support
53
AC_CHECK_HEADERS([tr1/unordered_map],[unordered_map_type=tr1_unordered_map],[])
54
if test "x$unordered_map_type" = "xtr1_unordered_map"; then
55
# test to make sure it's good enough
56
AC_MSG_CHECKING(if unordered_map is ok)
57
AC_TRY_LINK([#include <tr1/unordered_map>],[
58
#if defined(__APPLE__)
59
#error completely broken on OSX, even for gcc 4.2
60
#elif !defined(__GNUC__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
63
#error only use gcc versions 4.1 or greater
66
[ AC_MSG_RESULT(ok) ],
67
[ AC_MSG_RESULT(failed)
71
if test "x$unordered_map_type" = "x"; then
72
AC_CHECK_HEADERS([ext/hash_map],[unordered_map_type=ext_hash_map],[])
74
if test "x$unordered_map_type" = "x"; then
75
AC_CHECK_HEADERS([hash_map],[unordered_map_type=hash_map],[])
77
if test "$unordered_map_type" = "tr1_unordered_map"; then
78
AC_DEFINE([PION_HAVE_UNORDERED_MAP],[1],[Define to 1 if you have the <unordered_map> header file.])
79
elif test "$unordered_map_type" = "ext_hash_map"; then
80
AC_DEFINE([PION_HAVE_EXT_HASH_MAP],[1],[Define to 1 if you have the <ext/hash_map> header file.])
81
elif test "$unordered_map_type" = "hash_map"; then
82
AC_DEFINE([PION_HAVE_HASH_MAP],[1],[Define to 1 if you have the <hash_map> header file.])
84
AC_MSG_ERROR([C++ compiler does not seem to support unordered containers])
89
AC_MSG_CHECKING([for gzip compression support (zlib)])
90
AC_ARG_WITH([zlib], AC_HELP_STRING([--with-zlib@<:@=DIR@:>@],[location of zlib library (for gzip compression); use --without-zlib to disable]),
91
[ zlib_location=$withval ], [ zlib_location=yes ])
92
# Check if zlib location is specified
93
if test "x_$zlib_location" != "x_no"; then
95
if test "x_$zlib_location" != "x_yes"; then
96
# alternative location provided
97
CPPFLAGS="$CPPFLAGS -I$zlib_location/include"
98
LDFLAGS="$LDFLAGS -L$zlib_location/lib"
100
# Check for zlib headers
101
AC_CHECK_HEADERS([zlib.h],,AC_MSG_ERROR([Unable to find the zlib headers]))
102
# Check for zlib library
103
LIBS="$LIBS_SAVED -lz"
104
AC_MSG_CHECKING(linking with zlib)
105
AC_TRY_LINK([#include <zlib.h>],[ zlibVersion(); return(0); ],
106
[ AC_MSG_RESULT(ok) ],
107
[ AC_MSG_RESULT(failed)
108
AC_MSG_ERROR(Unable to link with the zlib library)
112
# Found the zlib library
113
AC_DEFINE([PION_HAVE_ZLIB],[1],[Define to 1 if you have the `zlib' library.])
122
AC_MSG_CHECKING([for bzip2 compression support (bzlib)])
123
AC_ARG_WITH([bzlib], AC_HELP_STRING([--with-bzlib@<:@=DIR@:>@],[location of bzlib library (for bzip2 compression); use --without-bzlib to disable]),
124
[ bzlib_location=$withval ], [ bzlib_location=yes ])
125
# Check if bzlib location is specified
126
if test "x_$bzlib_location" != "x_no"; then
128
if test "x_$bzlib_location" != "x_yes"; then
129
# alternative location provided
130
CPPFLAGS="$CPPFLAGS -I$bzlib_location/include"
131
LDFLAGS="$LDFLAGS -L$bzlib_location/lib"
133
# Check for bzlib headers
134
AC_CHECK_HEADERS([bzlib.h],,AC_MSG_ERROR([Unable to find the bzlib headers]))
135
# Check for bzlib library
136
LIBS="$LIBS_SAVED -lbz2"
137
AC_MSG_CHECKING(linking with bzlib)
138
AC_TRY_LINK([#include <bzlib.h>],[ BZ2_bzlibVersion(); return(0); ],
139
[ AC_MSG_RESULT(ok) ],
140
[ AC_MSG_RESULT(failed)
141
AC_MSG_ERROR(Unable to link with the bzlib library; use --without-bzlib to disable)
145
# Found the bzlib library
146
AC_DEFINE([PION_HAVE_BZLIB],[1],[Define to 1 if you have the `bzlib' library.])
155
AC_MSG_CHECKING([for SSL support (openssl)])
156
AC_ARG_WITH([openssl], AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],[location of OpenSSL library (enables SSL support); use --without-openssl to disable]),
157
[ openssl_location=$withval ], [ openssl_location=yes ])
158
# Check if openssl location is specified
159
if test "x_$openssl_location" != "x_no"; then
161
if test "x_$openssl_location" != "x_yes"; then
162
# alternative location provided
163
CPPFLAGS="$CPPFLAGS -I$openssl_location/include"
164
LDFLAGS="$LDFLAGS -L$openssl_location/lib"
166
# Check for OpenSSL headers
167
AC_CHECK_HEADERS([openssl/ssl.h],,AC_MSG_ERROR([Unable to find the OpenSSL headers]))
168
# Check for OpenSSL library
170
LIBS="$LIBS_SAVED -lssl -lcrypto"
171
AC_MSG_CHECKING(linking with openssl)
172
AC_TRY_LINK([#include <openssl/ssl.h>],[ SSL_library_init(); return(0); ],
173
[ AC_MSG_RESULT(ok) ],
174
[ AC_MSG_RESULT(failed)
175
AC_MSG_ERROR(Unable to link with the openssl library; use --without-openssl to disable)
178
PION_SSL_LIB="-lssl -lcrypto"
179
# Found the OpenSSL library
180
AC_MSG_NOTICE(Building Pion with support for SSL (using OpenSSL))
181
AC_DEFINE([PION_HAVE_SSL],[1],[Define to 1 if you have the `OpenSSL' library.])
186
AC_SUBST(PION_SSL_LIB)
189
# Check for logging support
190
AC_ARG_ENABLE([logging],
191
AC_HELP_STRING([--disable-logging],[disable all logging support (including std::ostream)]),
192
[enable_logging=$enableval], [enable_logging=yes])
193
AC_ARG_WITH([ostream-logging],
194
AC_HELP_STRING([--with-ostream-logging],[use std::ostream logging instead of library]),
195
[ ostream_logging=yes ], [ ostream_logging=no ])
196
AC_ARG_WITH([log4cplus],
197
AC_HELP_STRING([--with-log4cplus@<:@=DIR@:>@],[location of log4cplus library (recommended)]),
198
[ log4cplus_location=$withval without_log4cxx=true without_log4cpp=true],
200
AC_ARG_WITH([log4cxx],
201
AC_HELP_STRING([--with-log4cxx@<:@=DIR@:>@],[location of log4cxx library]),
202
[ log4cxx_location=$withval without_log4cplus=true without_log4cpp=true],
204
AC_ARG_WITH([log4cpp],
205
AC_HELP_STRING([--with-log4cpp@<:@=DIR@:>@],[location of log4cpp library]),
206
[ log4cpp_location=$withval without_log4cplus=true without_log4cxx=true],
209
if test "x$enable_logging" == "xno"; then
210
# Display notice if no logging found
211
AC_MSG_NOTICE(Logging has been disabled)
212
AC_DEFINE([PION_DISABLE_LOGGING],[1],[Define to 1 to disable logging.])
213
elif test "x$ostream_logging" == "xyes"; then
214
AC_MSG_NOTICE(Using std::ostream for logging)
215
AC_DEFINE([PION_USE_OSTREAM_LOGGING],[1],[Define to 1 to use std::cout and std::cerr for logging.])
218
# check for an available logging library (log4cplus, then log4cxx, then log4cpp)
221
if test "$without_log4cplus" != "true"; then
222
# Check if log4cplus location is specified
223
if test "x$log4cplus_location" != "xyes"
225
CPPFLAGS="$CPPFLAGS -I$log4cplus_location/include"
226
LDFLAGS="$LDFLAGS -L$log4cplus_location/lib"
228
# Check for log4cplus library
230
LIBS="$LIBS_SAVED -llog4cplus"
231
AC_MSG_CHECKING(log4cplus library)
232
AC_TRY_LINK([#include <log4cplus/logger.h>],[ log4cplus::Logger::getRoot(); return 0; ],
234
# Found the log4cplus library
236
AC_DEFINE([PION_USE_LOG4CPLUS],[1],[Define to 1 if you have the `log4cplus' library (-llog4cplus).])
237
AC_MSG_NOTICE(Using log4cplus for logging)
238
without_log4cxx=true without_log4cpp=true
239
PION_LOG_LIB="-llog4cplus"
241
[ AC_MSG_RESULT(no) ])
246
if test "$without_log4cxx" != "true"; then
247
# Check if log4cxx location is specified
248
if test "x$log4cxx_location" != "xyes"
250
CPPFLAGS="$CPPFLAGS -I$log4cxx_location/include"
251
LDFLAGS="$LDFLAGS -L$log4cxx_location/lib"
253
# Check for log4cxx library
255
LIBS="$LIBS_SAVED -llog4cxx"
256
AC_MSG_CHECKING(log4cxx library)
257
AC_TRY_LINK([#include <log4cxx/logger.h>],[ log4cxx::Logger::getRootLogger(); return 0; ],
259
# Found the log4cxx library
261
AC_DEFINE([PION_USE_LOG4CXX],[1],[Define to 1 if you have the `log4cxx' library (-llog4cxx).])
262
AC_MSG_NOTICE(Using log4cxx for logging)
263
without_log4cplus=true without_log4cpp=true
264
PION_LOG_LIB="-llog4cxx"
266
[ AC_MSG_RESULT(no) ])
271
if test "$without_log4cpp" != "true"; then
272
# Check if log4cpp location is specified
273
if test "x$log4cpp_location" != "xyes"
275
CPPFLAGS="$CPPFLAGS -I$log4cpp_location/include"
276
LDFLAGS="$LDFLAGS -L$log4cpp_location/lib"
278
# Check for log4cpp library
280
LIBS="$LIBS_SAVED -llog4cpp"
281
AC_MSG_CHECKING(log4cpp library)
282
AC_TRY_LINK([#include <log4cpp/Category.hh>],[ log4cpp::Category::getRoot(); return 0; ],
284
# Found the log4cpp library
286
AC_DEFINE([PION_USE_LOG4CPP],[1],[Define to 1 if you have the `log4cpp' library (-llog4cpp).])
287
AC_MSG_NOTICE(Using log4cpp for logging)
288
without_log4cplus=true without_log4cxx=true
289
PION_LOG_LIB="-llog4cpp"
291
[ AC_MSG_RESULT(no) ])
295
# no log library found
296
if test "x$PION_LOG_LIB" == "x"; then
297
if test "x$ostream_logging" == "xno"; then
298
AC_MSG_WARN(No logging library found - disabling logging)
299
AC_DEFINE([PION_DISABLE_LOGGING],[1],[Define to 1 to disable logging.])
301
AC_MSG_WARN(No logging library found - using std::ostream for logging)
302
AC_DEFINE([PION_USE_OSTREAM_LOGGING],[1],[Define to 1 to use std::cout and std::cerr for logging.])
306
AC_SUBST(PION_LOG_LIB)
309
# Set external library dependencies
310
PION_EXTERNAL_LIBS="$BOOST_THREAD_LIB $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_REGEX_LIB $BOOST_DATE_TIME_LIB $PION_LOG_LIB $PION_SSL_LIB $PION_ZLIB $PION_BZLIB $PION_EXTERNAL_LIBS"
312
AC_SUBST(PION_EXTERNAL_LIBS)