]> granicus.if.org Git - php/commitdiff
Fix crypt_r detection under BSD system
authorDavid Carlier <devnexen@gmail.com>
Mon, 10 Aug 2020 20:16:10 +0000 (21:16 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 12 Aug 2020 13:09:21 +0000 (15:09 +0200)
For BSD systems, crypt.h does not exist, instead we need to
include unistd.h.

Closes GH-5971.

build/php.m4

index 0d0fb61fbe5d1a246108b3ee5fd9608f52396687..1797b383822d64f21ba4d6894bd1a53db615942c 100644 (file)
@@ -2217,6 +2217,17 @@ crypt_r("passwd", "hash", &buffer);
     fi
     ])
 
+    if test "$php_cv_crypt_r_style" = "none"; then
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <stdlib.h>
+#include <unistd.h>
+]],[[
+struct crypt_data buffer;
+crypt_r("passwd", "hash", &buffer);
+]])],[php_cv_crypt_r_style=struct_crypt_data],[])
+    fi
+    ])
+
   if test "$php_cv_crypt_r_style" = "cryptd"; then
     AC_DEFINE(CRYPT_R_CRYPTD, 1, [Define if crypt_r has uses CRYPTD])
   fi