Skip to content

Commit c70b1d1

Browse files
committed
fix config.m4
1 parent e7a9d75 commit c70b1d1

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

config.m4

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,34 @@ if test "$PHP_XPASS" != "no"; then
1212
PHP_EVAL_LIBLINE([$LIBXCRYPT_LIBS], [XPASS_SHARED_LIBADD])
1313

1414
old_CFLAGS=$CFLAGS; CFLAGS="$CFLAGS $LIBXCRYPT_CFLAGS"
15-
old_LDFLAGS=$LDFLAGS; LDFLAGS="$LIBXCRYPT_LIBS $LDFLAGS"
15+
old_LIBS="$LIBS"; LIBS="$LIBXCRYPT_LIBS"
1616

1717
AC_MSG_CHECKING([for yescrypt])
18-
AC_RUN_IFELSE([AC_LANG_SOURCE([[
19-
#include <string.h>
20-
#include <unistd.h>
21-
#include <crypt.h>
22-
#include <stdlib.h>
23-
#include <string.h>
24-
25-
int main(void) {
26-
char salt[8];
27-
salt[0]='$'; salt[1]='y'; salt[2]='$'; salt[3]=0;
28-
return crypt_gensalt(salt, 0, NULL, 0) ? 0 : 1;
29-
}]])],[
30-
AC_DEFINE([HAVE_CRYPT_YESCRYPT], [1], [ Have yescrypt hash support ])
31-
AC_MSG_RESULT([available])
18+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
19+
#include <crypt.h>
20+
#include <string.h>
21+
]], [[
22+
struct crypt_data data;
23+
memset(&data, 0, sizeof(data));
24+
char *result = crypt_r("password", "$y$", &data);
25+
return (result != NULL && strncmp(result, "$y$", 3) == 0) ? 0 : 1;
26+
]])], [
27+
AC_MSG_RESULT([available])
28+
AC_DEFINE([HAVE_CRYPT_YESCRYPT], [1], [Define if libxcrypt supports SHA512])
3229
], [
33-
AC_MSG_RESULT([missing])
30+
AC_MSG_RESULT([missing])
3431
])
3532

3633
AC_MSG_CHECKING([for sha512 algo])
37-
AC_RUN_IFELSE([AC_LANG_SOURCE([[
38-
#include <string.h>
39-
#include <unistd.h>
40-
#include <crypt.h>
41-
#include <stdlib.h>
42-
#include <string.h>
43-
44-
int main(void) {
45-
char salt[8];
46-
salt[0]='$'; salt[1]='6'; salt[2]='$'; salt[3]=0;
47-
return crypt_gensalt(salt, 0, NULL, 0) ? 0 : 1;
48-
}]])],[
34+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
35+
#include <crypt.h>
36+
#include <string.h>
37+
]], [[
38+
struct crypt_data data;
39+
memset(&data, 0, sizeof(data));
40+
char *result = crypt_r("password", "$6$salt", &data);
41+
return (result != NULL && strncmp(result, "$6$", 3) == 0) ? 0 : 1;
42+
]])],[
4943
AC_DEFINE([HAVE_CRYPT_SHA512], [1], [ Have sha512 hash support ])
5044
AC_MSG_RESULT([available])
5145
], [

0 commit comments

Comments
 (0)