-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.m4
61 lines (50 loc) · 1.5 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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 >= 4.4])
PHP_EVAL_INCLINE([$LIBXCRYPT_CFLAGS])
PHP_EVAL_LIBLINE([$LIBXCRYPT_LIBS], [XPASS_SHARED_LIBADD])
old_CFLAGS=$CFLAGS; CFLAGS="$CFLAGS $LIBXCRYPT_CFLAGS"
old_LIBS=$LIBS; LIBS="$LIBS $LIBXCRYPT_LIBS"
AC_MSG_CHECKING([for yescrypt algo])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <string.h>
#include <unistd.h>
#include <crypt.h>
#include <stdlib.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 algo])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <string.h>
#include <unistd.h>
#include <crypt.h>
#include <stdlib.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
LIBS=$old_LIBS
PHP_SUBST([XPASS_SHARED_LIBADD])
AC_DEFINE([HAVE_XPASS], [1], [ Have xpass support ])
PHP_NEW_EXTENSION(xpass, xpass.c, $ext_shared)
fi