From d030c5401e4988efbf1644de1fa5510a0372720e Mon Sep 17 00:00:00 2001 From: rakshasa Date: Tue, 16 Jan 2007 17:30:13 +0000 Subject: [PATCH] * Cleanup of the auto* scripts, curl and openssl checks are now done with pkg-config. * Minor changes to included headers and autoconf scripts required by Solaris. * Added const char* to VariableMap::has. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@846 e378c898-3ddf-0310-93e7-cc216c733640 --- configure.ac | 7 ++--- rak/socket_address.h | 8 +++-- scripts/checks.m4 | 66 +--------------------------------------- scripts/common.m4 | 2 ++ src/utils/variable_map.h | 3 ++ 5 files changed, 15 insertions(+), 71 deletions(-) diff --git a/configure.ac b/configure.ac index c7329ac8..47147fd4 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,6 @@ AC_PROG_LIBTOOL AC_SYS_LARGEFILE TORRENT_CHECK_EXECINFO() -TORRENT_CHECK_CURL() TORRENT_OTFD() TORRENT_WITHOUT_VARIABLE_FDSET() @@ -23,9 +22,9 @@ TORRENT_WITHOUT_NCURSESW() TORRENT_WITHOUT_STATVFS() TORRENT_WITHOUT_STATFS() -PKG_CHECK_MODULES(STUFF, sigc++-2.0 libtorrent >= 0.11.2, - CXXFLAGS="$CXXFLAGS $STUFF_CFLAGS $CURL_CFLAGS"; - LIBS="$LIBS $STUFF_LIBS $CURL_LIBS") +PKG_CHECK_MODULES(STUFF, sigc++-2.0 libcurl >= 7.12.0 libtorrent >= 0.11.2, + CXXFLAGS="$CXXFLAGS $STUFF_CFLAGS"; + LIBS="$LIBS $STUFF_LIBS") AC_DEFINE(HAVE_CONFIG_H, 1, true if config.h was included) AC_DEFINE(USER_AGENT, [std::string(PACKAGE "/" VERSION "/") + torrent::version()], Http user agent) diff --git a/rak/socket_address.h b/rak/socket_address.h index fd911f0c..e929abe5 100644 --- a/rak/socket_address.h +++ b/rak/socket_address.h @@ -63,12 +63,16 @@ class socket_address_inet6; class socket_address { public: static const sa_family_t af_local = AF_LOCAL; - static const sa_family_t af_unix = AF_UNIX; - // static const sa_family_t af_file = AF_FILE; static const sa_family_t af_inet = AF_INET; static const sa_family_t af_inet6 = AF_INET6; static const sa_family_t af_unspec = AF_UNSPEC; +#ifdef AF_UNIX + static const sa_family_t af_unix = AF_UNIX; +#else + static const sa_family_t af_unix = AF_FILE; +#endif + bool is_valid() const; bool is_bindable() const; bool is_address_any() const; diff --git a/scripts/checks.m4 b/scripts/checks.m4 index aa64b705..3f54e49c 100644 --- a/scripts/checks.m4 +++ b/scripts/checks.m4 @@ -1,67 +1,3 @@ -AC_DEFUN([TORRENT_CHECK_CURL], [ - - AC_CACHE_VAL(my_cv_curl_vers, [ - my_cv_curl_vers=NONE - dnl check is the plain-text version of the required version - check="7.12.0" - dnl check_hex must be UPPERCASE if any hex letters are present - check_hex="070C00" - - AC_MSG_CHECKING([for curl >= $check]) - - if eval curl-config --version 2>/dev/null >/dev/null; then - ver=`curl-config --version | sed -e "s/libcurl //g"` - hex_ver=`curl-config --vernum | tr 'a-f' 'A-F'` - ok=`echo "ibase=16; if($hex_ver>=$check_hex) $hex_ver else 0" | bc` - - if test x$ok != x0; then - my_cv_curl_vers="$ver" - AC_MSG_RESULT([$my_cv_curl_vers]) - - CURL_CFLAGS=`curl-config --cflags` - CURL_LIBS=`curl-config --libs` - else - AC_MSG_RESULT(FAILED) - AC_MSG_ERROR([$ver is too old. Need version $check or higher.]) - fi - else - AC_MSG_RESULT(FAILED) - AC_MSG_ERROR([curl-config was not found]) - fi - ]) -]) - - -AC_DEFUN([TORRENT_CHECK_OPENSSL], [ - # first, deal with the user option : set places to be 'search' or the prefix - AC_ARG_WITH(openssl, - [ --with-openssl=PATH Find the OpenSSL header and library in - `PATH/include' and `PATH/lib'. If PATH is of the - form `HEADER:LIB', then search for header files in - HEADER, and the library in LIB. If you omit the - option completely, the configure script will - search for OpenSSL in a number of standard - places.], - [ - if test "$withval" = "yes"; then - PKG_CHECK_MODULES(OPENSSL, openssl, - CXXFLAGS="$CXXFLAGS `pkg-config --cflags openssl`"; - LIBS="$LIBS -lcrypto `pkg-config --libs-only-L openssl`", - AC_MSG_ERROR([Could not find openssl's crypto library], [try --with-openssl=PATH])) - - else - CXXFLAGS="$CXXFLAGS -I$withval/include" - LIBS="$LIBS -lcrypto -L$withval/lib" - fi - ], [ - PKG_CHECK_MODULES(OPENSSL, openssl, - CXXFLAGS="$CXXFLAGS `pkg-config --cflags openssl`"; - LIBS="$LIBS -lcrypto `pkg-config --libs-only-L openssl`", - AC_MSG_ERROR([Could not find openssl's crypto library], [try --with-openssl=PATH])) - ]) -]) - - AC_DEFUN([TORRENT_CHECK_XFS], [ AC_MSG_CHECKING(for XFS support) @@ -345,7 +281,7 @@ AC_DEFUN([TORRENT_WITH_ADDRESS_SPACE], [ [ AC_CHECK_SIZEOF(long) - if test "$ac_cv_sizeof_long" = "4"; then + if test $ac_cv_sizeof_long = 8; then AC_DEFINE(DEFAULT_ADDRESS_SPACE_SIZE, 4096, Default address space size.) else AC_DEFINE(DEFAULT_ADDRESS_SPACE_SIZE, 1024, Default address space size.) diff --git a/scripts/common.m4 b/scripts/common.m4 index af7b9966..a433ad98 100644 --- a/scripts/common.m4 +++ b/scripts/common.m4 @@ -75,6 +75,7 @@ AC_DEFUN([TORRENT_MINCORE_SIGNEDNESS], [ AC_COMPILE_IFELSE( [[#include #include + #include void f() { mincore((char*)0, 0, (unsigned char*)0); } ]], [ @@ -86,6 +87,7 @@ AC_DEFUN([TORRENT_MINCORE_SIGNEDNESS], [ AC_COMPILE_IFELSE( [[#include #include + #include void f() { mincore((char*)0, 0, (char*)0); } ]], [ diff --git a/src/utils/variable_map.h b/src/utils/variable_map.h index f16a0ce5..a58ad03c 100644 --- a/src/utils/variable_map.h +++ b/src/utils/variable_map.h @@ -73,6 +73,9 @@ public: VariableMap() {} ~VariableMap(); + bool has(const char* key) const { return base_type::find(key) != base_type::end(); } + bool has(const std::string& key) const { return has(key.c_str()); } + void insert(key_type key, Variable* v); // Consider taking char* start and finish instead of std::string to