Skip to content

Commit bdcef51

Browse files
hughmcmasterkrakjoe
authored andcommitted
ext/standard: Use PKG_CHECK_MODULES to detect the Argon2 library
1 parent 9d61036 commit bdcef51

File tree

3 files changed

+12
-28
lines changed

3 files changed

+12
-28
lines changed

azure/apt.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ steps:
3131
libreadline-dev \
3232
libldap2-dev \
3333
libsasl2-dev \
34+
libargon2-0-dev \
3435
postgresql \
3536
postgresql-contrib \
3637
${{ parameters.packages }}

azure/job.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
--enable-zend-test \
5959
--with-ldap \
6060
--with-ldap-sasl \
61+
--with-password-argon2 \
6162
--enable-werror \
6263
--with-config-file-path=/etc \
6364
--with-config-file-scan-dir=/etc/php.d

ext/standard/config.m4

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -406,36 +406,18 @@ AC_CHECK_DECLS([arc4random_buf])
406406
dnl
407407
dnl Check for argon2
408408
dnl
409-
PHP_ARG_WITH([password-argon2],
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])])
414-
415-
if test "$PHP_PASSWORD_ARGON2" != "no"; then
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
409+
PHP_ARG_WITH([argon2],
410+
[whether to build with Argon2 support],
411+
[AS_HELP_STRING([--with-argon2],
412+
[Build with Argon2 support])])
429413

430-
PHP_ADD_LIBRARY_WITH_PATH(argon2, $ARGON2_DIR/$PHP_LIBDIR)
431-
PHP_ADD_INCLUDE($ARGON2_DIR/include)
414+
if test "$PHP_ARGON2" != "no"; then
415+
PKG_CHECK_MODULES([ARGON2], [libargon2])
432416

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-
])
417+
PHP_EVAL_INCLINE($ARGON2_CFLAGS)
418+
PHP_EVAL_LIBLINE($ARGON2_LIBS, ARGON2_SHARED_LIBADD)
419+
420+
AC_DEFINE(HAVE_ARGON2LIB, 1, [ ])
439421
fi
440422

441423
dnl

0 commit comments

Comments
 (0)