]> granicus.if.org Git - php/commitdiff
Revert "ext/standard: Use PKG_CHECK_MODULES to detect the Argon2 library"
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 13 Jun 2019 14:50:57 +0000 (16:50 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 13 Jun 2019 14:53:05 +0000 (16:53 +0200)
This reverts commit bdcef51bcb367323f2eea4808f34a1b3e58bd3d8.

It seems that pkg-config support for libargon2 is still flaky:
 * No pc file on Alpine.
 * Custom builds of released libargon2 versions create a broken
   pc file. This is fixed in master, but not released.

Go back to the old detection code for now.

UPGRADING
ext/standard/config.m4

index 42671609cd4f04469f3464cc7275ba542884cf6b..66be319cb9b2d305bc12b33ec9c7f0b3c1fd252c 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -608,9 +608,6 @@ The following extensions and SAPIs are affected:
 - SQLite3:
   . --with-sqlite3 no longer accepts a directory.
 
-- Standard:
-  . --with-password-argon2 no longer accepts a directory.
-
 - XSL:
   . --with-xsl no longer accepts a directory.
 
index 0a46b1e3419f22c1e901c281fadd387053aef48b..891fca2ffa026c565cfd2b46e9d459ff9128b447 100644 (file)
@@ -407,17 +407,35 @@ dnl
 dnl Check for argon2
 dnl
 PHP_ARG_WITH([password-argon2],
-  [whether to build with Argon2 support],
-  [AS_HELP_STRING([--with-password-argon2],
-    [Build with Argon2 support])])
+  [for Argon2 support],
+  [AS_HELP_STRING([[--with-password-argon2[=DIR]]],
+    [Include Argon2 support in password_*. DIR is the Argon2 shared library
+    path])])
 
 if test "$PHP_PASSWORD_ARGON2" != "no"; then
-  PKG_CHECK_MODULES([ARGON2], [libargon2])
+  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_EVAL_INCLINE($ARGON2_CFLAGS)
-  PHP_EVAL_LIBLINE($ARGON2_LIBS, ARGON2_SHARED_LIBADD)
+  PHP_ADD_LIBRARY_WITH_PATH(argon2, $ARGON2_DIR/$PHP_LIBDIR)
+  PHP_ADD_INCLUDE($ARGON2_DIR/include)
 
-  AC_DEFINE(HAVE_ARGON2LIB, 1, [ ])
+  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])
+  ])
 fi
 
 dnl