summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-09-02 12:05:23 -0500
committerDan McGee <dan@archlinux.org>2010-09-02 12:05:23 -0500
commiteba521913d68da16cdd18d5e996c00c554408272 (patch)
tree9520a62f5b5dccf6e370030bb5a46074295744d6 /configure.ac
parent24d8a1530877f8e5fe36675954e1137ff89e17d4 (diff)
downloadpacman-eba521913d68da16cdd18d5e996c00c554408272.tar.xz
Use OpenSSL MD5 crypto functions if available
I've noticed my Atom-powered laptop is dog-slow when doing integrity checks on packages, and it turns out our MD5 implementation isn't near as good as that provided by OpenSSL. Using their routines instead provided anywhere from a 1.4x up to a 1.8x performance benefit over our built-in MD5 function. This does not remove the MD5 code from our codebase, but it does enable linking against OpenSSL to get their much faster implementation if it is available on whatever platform you are using. At configure-time, we will default to using it if it is available, but this can be easily changed by using the `--with-openssl` or `--without-openssl` arguments to configure. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac19
1 files changed, 18 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index b845f9ca..e0aafba6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,7 +70,7 @@ AC_DEFINE_UNQUOTED([LIB_VERSION], ["$LIB_VERSION"], [libalpm version number])
# Help line for root directory
AC_ARG_WITH(root-dir,
- AS_HELP_STRING([--with-root-dir=path], [set the location of pacman's root operating directory]),
+ AS_HELP_STRING([--with-root-dir=path], [set the location of the root operating directory]),
[ROOTDIR=$withval], [ROOTDIR=/])
# Help line for package extension
@@ -88,6 +88,11 @@ AC_ARG_WITH(buildscript,
AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
[BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])
+# Help line for using OpenSSL
+AC_ARG_WITH(openssl,
+ AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
+ [], [with_openssl=check])
+
# Help line for libfetch
AC_ARG_ENABLE(internal-download,
AS_HELP_STRING([--disable-internal-download], [do not build with libfetch support]),
@@ -131,6 +136,18 @@ AM_GNU_GETTEXT_VERSION(0.13.1)
AC_CHECK_LIB([archive], [archive_read_data], ,
AC_MSG_ERROR([libarchive is needed to compile pacman!]))
+# Check for OpenSSL
+AC_MSG_CHECKING(whether to link with libssl)
+AS_IF([test "x$with_openssl" != "xno"],
+ [AC_MSG_RESULT(yes)
+ AC_CHECK_LIB([ssl], [MD5_Final], ,
+ [if test "x$with_openssl" != "xcheck"; then
+ AC_MSG_FAILURE([--with-openssl was given, but -lssl was not found])
+ fi],
+ [-lcrypto])],
+ AC_MSG_RESULT(no))
+AM_CONDITIONAL([HAVE_LIBSSL], [test "x$ac_cv_lib_ssl_MD5_Final" = "xyes"])
+
# Enable or disable usage of libfetch
AC_MSG_CHECKING(whether to link with libfetch)
if test "x$internaldownload" = "xyes" ; then