--- Linux-PAM-0.99.3.0/configure.in.host-name-max	2005-12-12 19:56:27.000000000 +0300
+++ Linux-PAM-0.99.3.0/configure.in	2006-01-28 01:31:58.000000000 +0300
@@ -395,6 +395,46 @@
 AC_CHECK_FUNCS(getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r)
 AC_CHECK_FUNCS(getgrouplist getline getdelim)
 
+AH_BOTTOM([#ifndef HAVE_HOST_NAME_MAX
+ #ifdef HAVE_MAXHOSTNAME
+  #include <sys/param.h>
+  #define HOST_NAME_MAX MAXHOSTNAME
+ #else 
+  #define HOST_NAME_MAX 64
+ #endif
+#endif])
+ac_cv_maxhostname_defined=no
+AC_CACHE_CHECK([[whether HOST_NAME_MAX is defined in limits.h]],
+[ac_cv_host_name_max_defined],
+[AC_COMPILE_IFELSE([[#include <limits.h>
+
+char name[HOST_NAME_MAX];
+
+int main()
+{
+  return 0;
+}]], [ac_cv_host_name_max_defined=yes
+ AC_MSG_RESULT([ac_cv_host_name_max_defined])],
+[ac_cv_host_name_max_defined=no
+AC_MSG_RESULT([ac_cv_host_name_max_defined])
+AC_CACHE_CHECK([[whether MAXHOSTNAME is defined in sys/param.h]],
+[ac_cv_maxhostname_defined],
+[AC_COMPILE_IFELSE([[#include <sys/param.h>
+
+char name[MAXHOSTNAME];
+
+int main()
+{
+return 0;
+}]], [ac_cv_maxhostname_defined=yes], [ac_cv_maxhostname_defined=no])])
+AC_MSG_RESULT([ac_cv_maxhostname_defined])])])
+if test $ac_cv_host_name_max_defined = yes; then
+AC_DEFINE([HAVE_HOST_NAME_MAX], 1, [Define if system header limits.h defines HOST_NAME_MAX])
+fi
+if test $ac_cv_maxhostname_defined = yes; then
+AC_DEFINE([HAVE_MAXHOSTNAME], 1, [Define if system header sys/param.h defines MAXHOSTNAME])
+fi
+
 dnl Checks for programs/utilities
 AC_CHECK_PROG(SGML2PS, sgml2ps, yes, no)
 AC_CHECK_PROG(SGML2TXT, sgml2txt, yes, no)

