1dnl * Check for crypt() if unistd.h compiles with _XOPEN_SOURCE + _XPG6
2dnl * Add other macros there too "just in case".
3AC_DEFUN([DOVECOT_CRYPT_XPG6], [
4  AC_CACHE_CHECK([if we should use _XPG6 macro for crypt()],i_cv_use_xpg6_crypt,[
5    AC_TRY_COMPILE([
6      #define _XOPEN_SOURCE 4
7      #define _XOPEN_SOURCE_EXTENDED 1
8      #define _XOPEN_VERSION 4
9      #define _XPG4_2
10      #define _XPG6
11      #include <unistd.h>
12    ], [
13      crypt("a", "b");
14    ], [
15      i_cv_use_xpg6_crypt=yes
16    ], [
17      i_cv_use_xpg6_crypt=no
18    ])
19  ])
20  if test $i_cv_use_xpg6_crypt = yes; then
21    AC_DEFINE(CRYPT_USE_XPG6,, [Define if _XPG6 macro is needed for crypt()])
22  fi
23])
24