Преглед на файлове

2010-10-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	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
Tatsuhiro Tsujikawa преди 15 години
родител
ревизия
32d4ffa8ee
променени са 6 файла, в които са добавени 63 реда и са изтрити 50 реда
  1. 10 0
      ChangeLog
  2. 31 30
      configure
  3. 3 2
      m4/openssl.m4
  4. 12 12
      src/Netrc.cc
  5. 6 6
      src/Netrc.h
  6. 1 0
      src/Triplet.h

+ 10 - 0
ChangeLog

@@ -1,3 +1,13 @@
+2010-10-02  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	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  <t-tujikawa@users.sourceforge.net>
 
 	Execute 5 DHT tasks concurrently in each task queue.

+ 31 - 30
configure

@@ -6833,80 +6833,81 @@ 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
-$as_echo_n "checking for SSL_library_init in -lssl... " >&6; }
-if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then :
+  # 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="-lssl  $LIBS"
+LIBS="-lcrypto  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char SSL_library_init ();
+
 int
 main ()
 {
-return SSL_library_init ();
+return main ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_cxx_try_link "$LINENO"; then :
-  ac_cv_lib_ssl_SSL_library_init=yes
+  ac_cv_lib_crypto_main=yes
 else
-  ac_cv_lib_ssl_SSL_library_init=no
+  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_ssl_SSL_library_init" >&5
-$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; }
-if test "x$ac_cv_lib_ssl_SSL_library_init" = x""yes; then :
-  have_openssl=yes LIBS="-lssl $LIBS"
+{ $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 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 "$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
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypto  $LIBS"
+LIBS="-lssl  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SSL_library_init ();
 int
 main ()
 {
-return main ();
+return SSL_library_init ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_cxx_try_link "$LINENO"; then :
-  ac_cv_lib_crypto_main=yes
+  ac_cv_lib_ssl_SSL_library_init=yes
 else
-  ac_cv_lib_crypto_main=no
+  ac_cv_lib_ssl_SSL_library_init=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"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5
+$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&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

+ 3 - 2
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"

+ 12 - 12
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;
           }
         }

+ 6 - 6
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

+ 1 - 0
src/Triplet.h

@@ -35,6 +35,7 @@
 #ifndef D_TRIPLET_H
 #define D_TRIPLET_H
 
+#include <cstdlib>
 #include <utility>
 
 namespace aria2 {