cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomidnl * Check for crypt() if unistd.h compiles with _XOPEN_SOURCE + _XPG6
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomidnl * Add other macros there too "just in case".
cca227d2929386ee11e4aa23464681ef35eb9679Aki TuomiAC_DEFUN([DOVECOT_CRYPT_XPG6], [
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_CACHE_CHECK([if we should use _XPG6 macro for crypt()],i_cv_use_xpg6_crypt,[
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_TRY_COMPILE([
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi #define _XOPEN_SOURCE 4
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi #define _XOPEN_SOURCE_EXTENDED 1
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi #define _XOPEN_VERSION 4
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi #define _XPG4_2
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi #define _XPG6
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi #include <unistd.h>
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ], [
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi crypt("a", "b");
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ], [
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi i_cv_use_xpg6_crypt=yes
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ], [
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi i_cv_use_xpg6_crypt=no
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi if test $i_cv_use_xpg6_crypt = yes; then
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_DEFINE(CRYPT_USE_XPG6,, [Define if _XPG6 macro is needed for crypt()])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi fi
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi])