From a74c36a33506424ced2861ba0837a0a64546e0e6 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Tue, 12 Dec 2006 07:38:04 +0000 Subject: MFH: fix #39795 (build fails on AIX because crypt_r() uses different data struct) --- acinclude.m4 | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index efc7ccca0f..d4af13aabf 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2590,3 +2590,55 @@ AC_DEFUN([PHP_DETECT_ICC], ) ]) +dnl +dnl PHP_CRYPT_R_STYLE +dnl detect the style of crypt_r() is any is available +dnl see APR_CHECK_CRYPT_R_STYLE() for original version +dnl +AC_DEFUN([PHP_CRYPT_R_STYLE], +[ + AC_CACHE_CHECK([which data struct is used by crypt_r], php_cv_crypt_r_style,[ + php_cv_crypt_r_style=none + AC_TRY_COMPILE([ +#include +],[ +CRYPTD buffer; +crypt_r("passwd", "hash", &buffer); +], +php_cv_crypt_r_style=cryptd) + + if test "$php_cv_crypt_r_style" = "none"; then + AC_TRY_COMPILE([ +#include +],[ +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" = "none"; then + AC_TRY_COMPILE([ +#define _GNU_SOURCE +#include +],[ +struct crypt_data buffer; +crypt_r("passwd", "hash", &buffer); +], +php_cv_crypt_r_style=struct_crypt_data_gnu_source) + fi + ]) + + if test "$php_cv_crypt_r_style" = "cryptd"; then + AC_DEFINE(CRYPT_R_CRYPTD, 1, [Define if crypt_r has uses CRYPTD]) + fi + if test "$php_cv_crypt_r_style" = "struct_crypt_data" -o "$php_cv_crypt_r_style" = "struct_crypt_data_gnu_source"; then + AC_DEFINE(CRYPT_R_STRUCT_CRYPT_DATA, 1, [Define if crypt_r uses struct crypt_data]) + fi + if test "$php_cv_crypt_r_style" = "struct_crypt_data_gnu_source"; then + AC_DEFINE(CRYPT_R_GNU_SOURCE, 1, [Define if struct crypt_data requires _GNU_SOURCE]) + fi + if test "$php_cv_crypt_r_style" = "none"; then + AC_MSG_ERROR([Unable to detect data struct is used by crypt_r]) + fi +]) -- cgit v1.2.1