~ubuntu-branches/debian/sid/pion/sid

« back to all changes in this revision

Viewing changes to build/pion-config.inc

  • Committer: Package Import Robot
  • Author(s): Roberto C. Sanchez
  • Date: 2013-07-06 18:04:35 UTC
  • Revision ID: package-import@ubuntu.com-20130706180435-kejjzc1qpyz3qv6c
Tags: upstream-5.0.1+dfsg
ImportĀ upstreamĀ versionĀ 5.0.1+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# --------------------------------
 
2
# Pion autoconf configuration file
 
3
# --------------------------------
 
4
 
 
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.])
 
10
 
 
11
# Note: AM_CONFIG_HEADER is deprecated
 
12
AC_CONFIG_HEADERS(include/pion/config.hpp)
 
13
 
 
14
# Check for --with-cygwin
 
15
AC_MSG_CHECKING([for cygwin directory])
 
16
AC_ARG_WITH([cygwin],
 
17
    AC_HELP_STRING([--with-cygwin@<:@=DIR@:>@],[directory where cygwin is installed (Windows only)]),
 
18
    [with_cygwin=$withval],
 
19
    [with_cygwin=maybe])
 
20
if test "$with_cygwin" = "maybe"; then
 
21
        case "$build_os" in
 
22
        *cygwin*)
 
23
                PION_CYGWIN_DIRECTORY="c:/cygwin"
 
24
                AC_MSG_RESULT($PION_CYGWIN_DIRECTORY)
 
25
                ;;
 
26
        *)
 
27
                AC_MSG_RESULT(no)
 
28
                ;;
 
29
        esac
 
30
elif test "$with_cygwin" != "no"; then
 
31
        PION_CYGWIN_DIRECTOR="$with_cygwin"
 
32
        AC_MSG_RESULT($PION_CYGWIN_DIRECTORY)
 
33
else
 
34
        AC_MSG_RESULT(no)
 
35
fi
 
36
AC_DEFINE_UNQUOTED([PION_CYGWIN_DIRECTORY],["$PION_CYGWIN_DIRECTORY"],[Define to the directory where cygwin is installed.])
 
37
AC_SUBST(PION_CYGWIN_DIRECTORY)
 
38
 
 
39
 
 
40
# Check for malloc_trim support
 
41
AC_MSG_CHECKING(for malloc_trim() support)
 
42
AC_TRY_LINK([#include <malloc.h>],
 
43
        [
 
44
        malloc_trim(0);
 
45
        ],
 
46
        [ AC_MSG_RESULT(yes)
 
47
          AC_DEFINE([PION_HAVE_MALLOC_TRIM],[1],[Define to 1 if C library supports malloc_trim()])
 
48
        ],
 
49
        [ AC_MSG_RESULT(no) ])
 
50
 
 
51
     
 
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)
 
61
                        return(0);
 
62
                #else
 
63
                        #error only use gcc versions 4.1 or greater
 
64
                #endif
 
65
                ],
 
66
                [ AC_MSG_RESULT(ok) ],
 
67
                [ AC_MSG_RESULT(failed)
 
68
                  unordered_map_type=""
 
69
                ])
 
70
fi
 
71
if test "x$unordered_map_type" = "x"; then
 
72
        AC_CHECK_HEADERS([ext/hash_map],[unordered_map_type=ext_hash_map],[])
 
73
fi
 
74
if test "x$unordered_map_type" = "x"; then
 
75
        AC_CHECK_HEADERS([hash_map],[unordered_map_type=hash_map],[])
 
76
fi
 
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.])
 
83
else
 
84
        AC_MSG_ERROR([C++ compiler does not seem to support unordered containers])
 
85
fi
 
86
 
 
87
 
 
88
# Check for zlib
 
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
 
94
        AC_MSG_RESULT(yes)
 
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"
 
99
        fi
 
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)
 
109
                ])
 
110
        LIBS="$LIBS_SAVED"
 
111
        PION_ZLIB="-lz"
 
112
        # Found the zlib library
 
113
        AC_DEFINE([PION_HAVE_ZLIB],[1],[Define to 1 if you have the `zlib' library.])
 
114
else
 
115
        # zlib is disabled
 
116
        AC_MSG_RESULT(no)
 
117
fi
 
118
AC_SUBST(PION_ZLIB)
 
119
 
 
120
 
 
121
# Check for bzlib
 
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
 
127
        AC_MSG_RESULT(yes)
 
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"
 
132
        fi
 
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)
 
142
                ])
 
143
        LIBS="$LIBS_SAVED"
 
144
        PION_BZLIB="-lbz2"
 
145
        # Found the bzlib library
 
146
        AC_DEFINE([PION_HAVE_BZLIB],[1],[Define to 1 if you have the `bzlib' library.])
 
147
else
 
148
        # bzlib is disabled
 
149
        AC_MSG_RESULT(no)
 
150
fi
 
151
AC_SUBST(PION_BZLIB)
 
152
 
 
153
 
 
154
# Check for OpenSSL
 
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
 
160
        AC_MSG_RESULT(yes)
 
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"
 
165
        fi
 
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
 
169
        LIBS_SAVED="$LIBS"
 
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)
 
176
                ])
 
177
        LIBS="$LIBS_SAVED"
 
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.])
 
182
else
 
183
        # SSL is disabled
 
184
        AC_MSG_RESULT(no)
 
185
fi
 
186
AC_SUBST(PION_SSL_LIB)
 
187
 
 
188
 
 
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],
 
199
    [])
 
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],
 
203
    [])
 
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],
 
207
    [])
 
208
 
 
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.])
 
216
else
 
217
 
 
218
        # check for an available logging library (log4cplus, then log4cxx, then log4cpp)
 
219
 
 
220
        # log4cplus
 
221
        if test "$without_log4cplus" != "true"; then
 
222
                # Check if log4cplus location is specified
 
223
                if test "x$log4cplus_location" != "xyes"
 
224
                then
 
225
                        CPPFLAGS="$CPPFLAGS -I$log4cplus_location/include"
 
226
                        LDFLAGS="$LDFLAGS -L$log4cplus_location/lib"
 
227
                fi
 
228
                # Check for log4cplus library
 
229
                LIBS_SAVED="$LIBS"
 
230
                LIBS="$LIBS_SAVED -llog4cplus"
 
231
                AC_MSG_CHECKING(log4cplus library)
 
232
                AC_TRY_LINK([#include <log4cplus/logger.h>],[ log4cplus::Logger::getRoot(); return 0; ],
 
233
                        [ 
 
234
                          # Found the log4cplus library
 
235
                          AC_MSG_RESULT(ok) 
 
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"
 
240
                        ],
 
241
                        [ AC_MSG_RESULT(no) ])
 
242
                LIBS="$LIBS_SAVED"
 
243
        fi
 
244
 
 
245
        # log4cxx
 
246
        if test "$without_log4cxx" != "true"; then
 
247
                # Check if log4cxx location is specified
 
248
                if test "x$log4cxx_location" != "xyes"
 
249
                then
 
250
                        CPPFLAGS="$CPPFLAGS -I$log4cxx_location/include"
 
251
                        LDFLAGS="$LDFLAGS -L$log4cxx_location/lib"
 
252
                fi
 
253
                # Check for log4cxx library
 
254
                LIBS_SAVED="$LIBS"
 
255
                LIBS="$LIBS_SAVED -llog4cxx"
 
256
                AC_MSG_CHECKING(log4cxx library)
 
257
                AC_TRY_LINK([#include <log4cxx/logger.h>],[ log4cxx::Logger::getRootLogger(); return 0; ],
 
258
                        [ 
 
259
                          # Found the log4cxx library
 
260
                          AC_MSG_RESULT(ok) 
 
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"
 
265
                        ],
 
266
                        [ AC_MSG_RESULT(no) ])
 
267
                LIBS="$LIBS_SAVED"
 
268
        fi
 
269
        
 
270
        # log4cpp
 
271
        if test "$without_log4cpp" != "true"; then
 
272
                # Check if log4cpp location is specified
 
273
                if test "x$log4cpp_location" != "xyes"
 
274
                then
 
275
                        CPPFLAGS="$CPPFLAGS -I$log4cpp_location/include"
 
276
                        LDFLAGS="$LDFLAGS -L$log4cpp_location/lib"
 
277
                fi
 
278
                # Check for log4cpp library
 
279
                LIBS_SAVED="$LIBS"
 
280
                LIBS="$LIBS_SAVED -llog4cpp"
 
281
                AC_MSG_CHECKING(log4cpp library)
 
282
                AC_TRY_LINK([#include <log4cpp/Category.hh>],[ log4cpp::Category::getRoot(); return 0; ],
 
283
                        [ 
 
284
                          # Found the log4cpp library
 
285
                          AC_MSG_RESULT(ok) 
 
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"
 
290
                        ],
 
291
                        [ AC_MSG_RESULT(no) ])
 
292
                LIBS="$LIBS_SAVED"
 
293
        fi
 
294
 
 
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.])
 
300
                else
 
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.])
 
303
                fi
 
304
        fi
 
305
fi
 
306
AC_SUBST(PION_LOG_LIB)
 
307
 
 
308
 
 
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"
 
311
 
 
312
AC_SUBST(PION_EXTERNAL_LIBS)