diff options
author | Remi Collet <remi@remirepo.net> | 2024-08-27 10:50:21 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2024-08-27 10:50:21 +0200 |
commit | d4ff70e6cd95010bbe47f9a5a81a19bdae52e241 (patch) | |
tree | 3271a8fee984854524f79987cdcf21e3d6289fe6 /config.m4 | |
parent | 1c8bfa97ff1976f212b07e3dc30b78eac60b253d (diff) |
start development
Diffstat (limited to 'config.m4')
-rw-r--r-- | config.m4 | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/config.m4 b/config.m4 new file mode 100644 index 0000000..b473924 --- /dev/null +++ b/config.m4 @@ -0,0 +1,63 @@ +dnl config.m4 for extension xpass + +PHP_ARG_ENABLE([xpass], + [whether to enable xpass support], + [AS_HELP_STRING([--enable-xpass], + [Enable xpass support])], + [no]) + +if test "$PHP_XPASS" != "no"; then + PKG_CHECK_MODULES([LIBXCRYPT], [libxcrypt]) + PHP_EVAL_INCLINE($LIBXCRYPT_CFLAGS) + PHP_EVAL_LIBLINE($LIBXCRYPT_LIBS, XPASS_SHARED_LIBADD) + + old_CFLAGS=$CFLAGS; CFLAGS="$CFLAGS $LIBXCRYPT_CFLAGS" + old_LDFLAGS=$CFLAGS; LDFLAGS="$CFLAGS $LIBXCRYPT_LIBS" + + AC_MSG_CHECKING(for yescrypt) + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <string.h> +#include <unistd.h> +#include <crypt.h> +#include <stdlib.h> +#include <string.h> + +int main(void) { + char salt[8]; + salt[0]='$'; salt[1]='y'; salt[2]='$'; salt[3]=0; + return crypt_gensalt(salt, 0, NULL, 0) ? 0 : 1; +}]])],[ + AC_DEFINE(HAVE_CRYPT_YESCRYPT, 1, [ Have yescrypt hash support ]) + AC_MSG_RESULT([available]) + ], [ + AC_MSG_RESULT([missing]) + ]) + + AC_MSG_CHECKING(for sha512) + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <string.h> +#include <unistd.h> +#include <crypt.h> +#include <stdlib.h> +#include <string.h> + +int main(void) { + char salt[8]; + salt[0]='$'; salt[1]='6'; salt[2]='$'; salt[3]=0; + return crypt_gensalt(salt, 0, NULL, 0) ? 0 : 1; +}]])],[ + AC_DEFINE(HAVE_CRYPT_SHA512, 1, [ Have sha512 hash support ]) + AC_MSG_RESULT([available]) + ], [ + AC_MSG_RESULT([missing]) + ]) + + CFLAGS=$old_CFLAGS + LDFLAGS=$old_LDFLAGS + + PHP_SUBST(XPASS_SHARED_LIBADD) + + AC_DEFINE(HAVE_XPASS, 1, [ Have xpass support ]) + + PHP_NEW_EXTENSION(xpass, xpass.c, $ext_shared) +fi |