diff --git a/ChangeLog b/ChangeLog index b0ce9b43..d3e3f404 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-10-02 Tatsuhiro Tsujikawa + + Fixed compile error on OpenBSD4.7(i386). In openssl.m4, we first + search libcrypto and then libssl because libssl depends on + libcrypto on OpenBSD. + * src/Netrc.cc + * src/Netrc.h + * src/Triplet.h + * src/openssl.m4 + 2010-10-02 Tatsuhiro Tsujikawa Execute 5 DHT tasks concurrently in each task queue. diff --git a/configure b/configure index 1a905a7f..afed7853 100755 --- a/configure +++ b/configure @@ -6833,7 +6833,44 @@ if test "x$have_openssl" != "xyes"; then LIBS="-L$openssl_prefix_lib $LIBS" CPPFLAGS="-I$openssl_prefix_include $CPPFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5 + # First check libcrypto, because libssl may depend on it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcrypto" >&5 +$as_echo_n "checking for main in -lcrypto... " >&6; } +if test "${ac_cv_lib_crypto_main+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_crypto_main=yes +else + ac_cv_lib_crypto_main=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_main" >&5 +$as_echo "$ac_cv_lib_crypto_main" >&6; } +if test "x$ac_cv_lib_crypto_main" = x""yes; then : + have_openssl=yes; LIBS="-lcrypto $LIBS" +fi + + if test "x$have_openssl" = "xyes"; then + have_openssl=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5 $as_echo_n "checking for SSL_library_init in -lssl... " >&6; } if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then : $as_echo_n "(cached) " >&6 @@ -6873,42 +6910,6 @@ if test "x$ac_cv_lib_ssl_SSL_library_init" = x""yes; then : have_openssl=yes LIBS="-lssl $LIBS" fi - if test "x$have_openssl" = "xyes"; then - have_openssl=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcrypto" >&5 -$as_echo_n "checking for main in -lcrypto... " >&6; } -if test "${ac_cv_lib_crypto_main+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcrypto $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -int -main () -{ -return main (); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - ac_cv_lib_crypto_main=yes -else - ac_cv_lib_crypto_main=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_main" >&5 -$as_echo "$ac_cv_lib_crypto_main" >&6; } -if test "x$ac_cv_lib_crypto_main" = x""yes; then : - have_openssl=yes; LIBS="-lcrypto $LIBS" -fi - if test "x$have_openssl" = "xyes"; then OPENSSL_LIBS="-L$openssl_prefix_lib -lssl -lcrypto" OPENSSL_CFLAGS="-I$openssl_prefix_include" diff --git a/m4/openssl.m4 b/m4/openssl.m4 index 68a4bfb0..e3ed9261 100644 --- a/m4/openssl.m4 +++ b/m4/openssl.m4 @@ -36,10 +36,11 @@ if test "x$have_openssl" != "xyes"; then LIBS="-L$openssl_prefix_lib $LIBS" CPPFLAGS="-I$openssl_prefix_include $CPPFLAGS" - AC_CHECK_LIB([ssl], [SSL_library_init], [have_openssl=yes LIBS="-lssl $LIBS"]) + # First check libcrypto, because libssl may depend on it + AC_CHECK_LIB([crypto], [main], [have_openssl=yes; LIBS="-lcrypto $LIBS"]) if test "x$have_openssl" = "xyes"; then have_openssl=no - AC_CHECK_LIB([crypto], [main], [have_openssl=yes; LIBS="-lcrypto $LIBS"]) + AC_CHECK_LIB([ssl], [SSL_library_init], [have_openssl=yes LIBS="-lssl $LIBS"]) if test "x$have_openssl" = "xyes"; then OPENSSL_LIBS="-L$openssl_prefix_lib -lssl -lcrypto" OPENSSL_CFLAGS="-I$openssl_prefix_include" diff --git a/src/Netrc.cc b/src/Netrc.cc index 713b8b45..d4672a2b 100644 --- a/src/Netrc.cc +++ b/src/Netrc.cc @@ -44,17 +44,17 @@ namespace aria2 { -const std::string Netrc::MACHINE("machine"); +const std::string Netrc::A2_MACHINE("machine"); -const std::string Netrc::DEFAULT("default"); +const std::string Netrc::A2_DEFAULT("default"); -const std::string Netrc::LOGIN("login"); +const std::string Netrc::A2_LOGIN("login"); -const std::string Netrc::PASSWORD("password"); +const std::string Netrc::A2_PASSWORD("password"); -const std::string Netrc::ACCOUNT("account"); +const std::string Netrc::A2_ACCOUNT("account"); -const std::string Netrc::MACDEF("macdef"); +const std::string Netrc::A2_MACDEF("macdef"); void Netrc::skipMacdef(std::ifstream& f) const { @@ -97,11 +97,11 @@ void Netrc::parse(const std::string& path) eoi = tokens.end(); iter != eoi; ++iter) { const std::string& token = *iter; if(state == GET_TOKEN) { - if(token == Netrc::MACHINE) { + if(token == Netrc::A2_MACHINE) { storeAuthenticator(authenticator); authenticator.reset(new Authenticator()); state = SET_MACHINE; - } else if(token == Netrc::DEFAULT) { + } else if(token == Netrc::A2_DEFAULT) { storeAuthenticator(authenticator); authenticator.reset(new DefaultAuthenticator()); } else { @@ -110,13 +110,13 @@ void Netrc::parse(const std::string& path) (StringFormat("Netrc:parse error. %s encounterd where 'machine'" " or 'default' expected.", token.c_str()).str()); } - if(token == Netrc::LOGIN) { + if(token == Netrc::A2_LOGIN) { state = SET_LOGIN; - } else if(token == Netrc::PASSWORD) { + } else if(token == Netrc::A2_PASSWORD) { state = SET_PASSWORD; - } else if(token == Netrc::ACCOUNT) { + } else if(token == Netrc::A2_ACCOUNT) { state = SET_ACCOUNT; - } else if(token == Netrc::MACDEF) { + } else if(token == Netrc::A2_MACDEF) { state = SET_MACDEF; } } diff --git a/src/Netrc.h b/src/Netrc.h index 6e399d13..8a0eb96a 100644 --- a/src/Netrc.h +++ b/src/Netrc.h @@ -160,17 +160,17 @@ public: authenticators_.push_back(authenticator); } - static const std::string MACHINE; + static const std::string A2_MACHINE; - static const std::string DEFAULT; + static const std::string A2_DEFAULT; - static const std::string LOGIN; + static const std::string A2_LOGIN; - static const std::string PASSWORD; + static const std::string A2_PASSWORD; - static const std::string ACCOUNT; + static const std::string A2_ACCOUNT; - static const std::string MACDEF; + static const std::string A2_MACDEF; }; } // namespace aria2 diff --git a/src/Triplet.h b/src/Triplet.h index 5632b1bb..f94b5ca3 100644 --- a/src/Triplet.h +++ b/src/Triplet.h @@ -35,6 +35,7 @@ #ifndef D_TRIPLET_H #define D_TRIPLET_H +#include #include namespace aria2 {