Skip to content

Commit 19e2101

Browse files
committed
Revert "ext/standard: Use PKG_CHECK_MODULES to detect the Argon2 library"
This reverts commit bdcef51. 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.
1 parent ce2b36b commit 19e2101

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

UPGRADING

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,6 @@ The following extensions and SAPIs are affected:
608608
- SQLite3:
609609
. --with-sqlite3 no longer accepts a directory.
610610

611-
- Standard:
612-
. --with-password-argon2 no longer accepts a directory.
613-
614611
- XSL:
615612
. --with-xsl no longer accepts a directory.
616613

ext/standard/config.m4

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,17 +407,35 @@ dnl
407407
dnl Check for argon2
408408
dnl
409409
PHP_ARG_WITH([password-argon2],
410-
[whether to build with Argon2 support],
411-
[AS_HELP_STRING([--with-password-argon2],
412-
[Build with Argon2 support])])
410+
[for Argon2 support],
411+
[AS_HELP_STRING([[--with-password-argon2[=DIR]]],
412+
[Include Argon2 support in password_*. DIR is the Argon2 shared library
413+
path])])
413414

414415
if test "$PHP_PASSWORD_ARGON2" != "no"; then
415-
PKG_CHECK_MODULES([ARGON2], [libargon2])
416+
AC_MSG_CHECKING([for Argon2 library])
417+
for i in $PHP_PASSWORD_ARGON2 /usr /usr/local ; do
418+
if test -r $i/include/argon2.h; then
419+
ARGON2_DIR=$i;
420+
AC_MSG_RESULT(found in $i)
421+
break
422+
fi
423+
done
424+
425+
if test -z "$ARGON2_DIR"; then
426+
AC_MSG_RESULT([not found])
427+
AC_MSG_ERROR([Please ensure the argon2 header and library are installed])
428+
fi
416429

417-
PHP_EVAL_INCLINE($ARGON2_CFLAGS)
418-
PHP_EVAL_LIBLINE($ARGON2_LIBS, ARGON2_SHARED_LIBADD)
430+
PHP_ADD_LIBRARY_WITH_PATH(argon2, $ARGON2_DIR/$PHP_LIBDIR)
431+
PHP_ADD_INCLUDE($ARGON2_DIR/include)
419432

420-
AC_DEFINE(HAVE_ARGON2LIB, 1, [ ])
433+
AC_CHECK_LIB(argon2, argon2id_hash_raw, [
434+
LIBS="$LIBS -largon2"
435+
AC_DEFINE(HAVE_ARGON2LIB, 1, [ Define to 1 if you have the <argon2.h> header file ])
436+
], [
437+
AC_MSG_ERROR([Problem with libargon2.(a|so). Please verify that Argon2 header and libraries >= 20161029 are installed])
438+
])
421439
fi
422440

423441
dnl

0 commit comments

Comments
 (0)