[PATCH] Fix Linux-PAM 0.99.3.0 compiling when system headers don't define HOST_NAME_MAX. (fwd)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



				Hello!
	While compiling Linux-PAM 0.99.3.0 I've discovered that on my system 
compiling modules/pam_echo/pam_echo.c fails because of HOST_NAME_MAX is 
undefined on my system. Attached a patch that simply defines HOST_NAME_MAX to 
either MAXHOSTNAME (if that is defined in sys/param.h, which is my case) or to 
64, if the former is not defined (which is unlikely, but...). The patch is 
applied to configure.in only (of course, after that autoreconf should be 
invoked). Please apply.
-- 

    Sincerely Your, Dan.
--- 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)
_______________________________________________

Pam-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/pam-list

[Index of Archives]     [Fedora Users]     [Kernel]     [Red Hat Install]     [Linux for the blind]     [Gimp]

  Powered by Linux