summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-04-10 00:23:39 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-04-10 00:23:39 +0900
commitb35fbd3172169bb0f586fa9a708808dc6d8b7ecd (patch)
tree66a87963c7b4c6d9fa822a613ed0d5506b6f5f06 /src
parentd0ff31faf850b671220f60e81c4982d14aa6fccf (diff)
Print linked 3rd party libraries with version in `aria2c -v` output
Diffstat (limited to 'src')
-rw-r--r--src/FeatureConfig.cc81
-rw-r--r--src/FeatureConfig.h4
-rw-r--r--src/version_usage.cc2
3 files changed, 87 insertions, 0 deletions
diff --git a/src/FeatureConfig.cc b/src/FeatureConfig.cc
index 6b28f07a..36f8e90a 100644
--- a/src/FeatureConfig.cc
+++ b/src/FeatureConfig.cc
@@ -34,6 +34,34 @@
/* copyright --> */
#include "FeatureConfig.h"
+#ifdef HAVE_ZLIB
+# include <zlib.h>
+#endif // HAVE_ZLIB
+#ifdef HAVE_LIBXML2
+# include <libxml/xmlversion.h>
+#endif // HAVE_LIBXML2
+#ifdef HAVE_LIBEXPAT
+# include <expat.h>
+#endif // HAVE_LIBEXPAT
+#ifdef HAVE_SQLITE3
+# include <sqlite3.h>
+#endif // HAVE_SQLITE3
+#ifdef HAVE_LIBGNUTLS
+# include <gnutls/gnutls.h>
+#endif // HAVE_LIBGNUTLS
+#ifdef HAVE_OPENSSL
+# include <openssl/opensslv.h>
+#endif // HAVE_OPENSSL
+#ifdef HAVE_LIBGMP
+# include <gmp.h>
+#endif // HAVE_LIBGMP
+#ifdef HAVE_LIBGCRYPT
+# include <gcrypt.h>
+#endif // HAVE_LIBGCRYPT
+#ifdef HAVE_LIBCARES
+# include <ares.h>
+#endif // HAVE_LIBCARES
+
#include "util.h"
namespace aria2 {
@@ -141,4 +169,57 @@ const char* strSupportedFeature(int feature)
}
}
+std::string usedLibs()
+{
+ std::string res;
+#ifdef HAVE_ZLIB
+ res += "zlib/"ZLIB_VERSION" ";
+#endif // HAVE_ZLIB
+#ifdef HAVE_LIBXML2
+ res += "libxml2/"LIBXML_DOTTED_VERSION" ";
+#endif // HAVE_LIBXML2
+#ifdef HAVE_LIBEXPAT
+ res += fmt("expat/%d.%d.%d ",
+ XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION);
+#endif // HAVE_LIBEXPAT
+#ifdef HAVE_SQLITE3
+ res += "sqlite3/"SQLITE_VERSION" ";
+#endif // HAVE_SQLITE3
+#ifdef HAVE_APPLETLS
+ res += "appleTLS ";
+#endif // HAVE_APPLETLS
+#ifdef HAVE_LIBGNUTLS
+ res += "GnuTLS/"GNUTLS_VERSION" ";
+#endif // HAVE_LIBGNUTLS
+#ifdef HAVE_OPENSSL
+ res += fmt("OpenSSL/%d.%d.%d",
+ OPENSSL_VERSION_NUMBER >> 28,
+ (OPENSSL_VERSION_NUMBER >> 20) & 0xff,
+ (OPENSSL_VERSION_NUMBER >> 12) & 0xff);
+ if((OPENSSL_VERSION_NUMBER >> 4) & 0xff) {
+ res += 'a' + ((OPENSSL_VERSION_NUMBER >> 4) & 0xff) - 1;
+ }
+ res += " ";
+#endif // HAVE_OPENSSL
+#ifdef HAVE_LIBNETTLE
+ // No library version in header files.
+ res += "nettle ";
+#endif // HAVE_LIBNETTLE
+#ifdef HAVE_LIBGMP
+ res += fmt("GMP/%d.%d.%d ",
+ __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR,
+ __GNU_MP_VERSION_PATCHLEVEL);
+#endif // HAVE_LIBGMP
+#ifdef HAVE_LIBGCRYPT
+ res += "libgcrypt/"GCRYPT_VERSION" ";
+#endif // HAVE_LIBGCRYPT
+#ifdef HAVE_LIBCARES
+ res += "c-ares/"ARES_VERSION_STR" ";
+#endif // HAVE_LIBCARES
+ if(!res.empty()) {
+ res.erase(res.length()-1);
+ }
+ return res;
+}
+
} // namespace aria2
diff --git a/src/FeatureConfig.h b/src/FeatureConfig.h
index ce72aa4d..6f33871a 100644
--- a/src/FeatureConfig.h
+++ b/src/FeatureConfig.h
@@ -63,6 +63,10 @@ std::string featureSummary();
// available in the build. If it is not available, returns NULL.
const char* strSupportedFeature(int feature);
+// Returns summary string of 3rd party libraries directly used by
+// aria2.
+std::string usedLibs();
+
} // namespace aria2
#endif // D_FEATURE_CONFIG_H
diff --git a/src/version_usage.cc b/src/version_usage.cc
index f174a74d..a62f9261 100644
--- a/src/version_usage.cc
+++ b/src/version_usage.cc
@@ -75,6 +75,8 @@ void showVersion() {
<< _("Hash Algorithms") << ": "
<< MessageDigest::getSupportedHashTypeString() << "\n"
#endif // ENABLE_MESSAGE_DIGEST
+ << _("Libraries") << ": "
+ << usedLibs() << "\n"
<< "\n"
<< fmt(_("Report bugs to %s"), PACKAGE_BUGREPORT) << "\n"
<< _("Visit") << " " << PACKAGE_URL << std::endl;