]> granicus.if.org Git - php/commitdiff
Use pkg-config for libargon2
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 24 Nov 2020 10:46:03 +0000 (11:46 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 24 Nov 2020 10:52:43 +0000 (11:52 +0100)
We already tried this in PHP 7.4, but ran into issues, because
alpine did not support pkg-config for libargon2 (or had a broken
pc file, not sure). The Alpine issue has been resolved in the
meantime, so let's give this another try.

UPGRADING
ext/standard/config.m4

index c8c8d4b09e0891f1fffb6c2033d4cf3ec6635eb3..dcc8641f2d5fc77618d3db2e7b8729926f994b1a 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -61,6 +61,11 @@ PHP 8.1 UPGRADE NOTES
 - OpenSSL:
   . The OpenSSL extension now requires at least OpenSSL version 1.0.2.
 
+- Standard:
+  . --with-password-argon2 now uses pkg-config to detect libargon2. As such,
+    an alternative libargon2 location should now be specified using
+    PKG_CONFIG_PATH.
+
 ========================================
 10. New Global Constants
 ========================================
index 301540db58d24d92d0504d6a50dfbbc5296fcc20..d04add96298e91d6d1a1e2eb2362f2d97bad276a 100644 (file)
@@ -390,34 +390,13 @@ dnl Check for argon2
 dnl
 PHP_ARG_WITH([password-argon2],
   [for Argon2 support],
-  [AS_HELP_STRING([[--with-password-argon2[=DIR]]],
-    [Include Argon2 support in password_*. DIR is the Argon2 shared library
-    path])])
+  [AS_HELP_STRING([[--with-password-argon2]],
+    [Include Argon2 support in password_*])])
 
 if test "$PHP_PASSWORD_ARGON2" != "no"; then
-  AC_MSG_CHECKING([for Argon2 library])
-  for i in $PHP_PASSWORD_ARGON2 /usr /usr/local ; do
-    if test -r $i/include/argon2.h; then
-      ARGON2_DIR=$i;
-      AC_MSG_RESULT(found in $i)
-      break
-    fi
-  done
-
-  if test -z "$ARGON2_DIR"; then
-    AC_MSG_RESULT([not found])
-    AC_MSG_ERROR([Please ensure the argon2 header and library are installed])
-  fi
-
-  PHP_ADD_LIBRARY_WITH_PATH(argon2, $ARGON2_DIR/$PHP_LIBDIR)
-  PHP_ADD_INCLUDE($ARGON2_DIR/include)
-
-  AC_CHECK_LIB(argon2, argon2id_hash_raw, [
-    LIBS="$LIBS -largon2"
-    AC_DEFINE(HAVE_ARGON2LIB, 1, [ Define to 1 if you have the <argon2.h> header file ])
-  ], [
-    AC_MSG_ERROR([Problem with libargon2.(a|so). Please verify that Argon2 header and libraries >= 20161029 are installed])
-  ])
+  PKG_CHECK_MODULES([ARGON2], [libargon2])
+  PHP_EVAL_INCLINE($ARGON2_CFLAGS)
+  PHP_EVAL_LIBLINE($ARGON2_LIBS)
 fi
 
 dnl