[350] in Hesiod

home help back first fref pref prev next nref lref last post

hesiod-3.0.2: explicit struct passwd configure tests

daemon@ATHENA.MIT.EDU (Gordon Matzigkeit)
Wed Jan 29 02:25:18 1997

To: hesiod@MIT.EDU
From: Gordon Matzigkeit <gord@m-tech.ab.ca>
Date: 29 Jan 1997 00:12:04 -0700

--Multipart_Wed_Jan_29_00:12:04_1997-1
Content-Type: text/plain; charset=US-ASCII

Hi, all!

Here is a patch that checks for members of struct passwd by trying to
compile test programs rather than just egrepping pwd.h.

Yes, I know this is probably not a part of Hesiod that is shakey, but
I want to report it because it may cause problems in the future, and
it's nice to see what is happening when configure runs.

-- 
  Gord Matzigkeit   | Proudly running pieces of the GNU operating system.
 gord@m-tech.ab.ca  |  Jacques Cousteau loved programming in assembler.


--Multipart_Wed_Jan_29_00:12:04_1997-1
Content-Type: application/octet-stream; type=patch
Content-Disposition: attachment; filename="hesiod-3.0.2-3.0.2a.diff"
Content-Transfer-Encoding: 7bit

diff -r --unif=2 --entire --exclude=configure hesiod-3.0.2/aclocal.m4 hesiod-3.0.2a/aclocal.m4
--- hesiod-3.0.2/aclocal.m4	Wed Dec 31 17:00:00 1969
+++ hesiod-3.0.2a/aclocal.m4	Wed Jan 29 00:08:03 1997
@@ -0,0 +1,12 @@
+dnl Check for a member of the password structure.
+dnl
+dnl Usage: hesiod_STRUCT_PASSWD(pw_comment) defines HAVE_PW_COMMENT
+AC_DEFUN(hesiod_STRUCT_PASSWD,
+[AC_CACHE_CHECK([for $1 in struct passwd], hesiod_cv_struct_passwd_$1,
+[AC_TRY_COMPILE([#include <pwd.h>], [struct passwd p; p.$1;],
+hesiod_cv_struct_passwd_$1=yes, hesiod_cv_struct_passwd_$1=no)])
+if test "$hesiod_cv_struct_passwd_$1" = yes; then
+  hesiod_tr_arg=HAVE_`echo $1 | tr 'abcdedfghijklmnopqrstuvwxyz./\055' 'ABCDEDFGHIJKLMNOPQRSTUVWXYZ___'`
+  AC_DEFINE($hesiod_tr_arg)
+fi
+])
diff -r --unif=2 --entire --exclude=configure hesiod-3.0.2/configure.in hesiod-3.0.2a/configure.in
--- hesiod-3.0.2/configure.in	Sun Dec  8 14:27:59 1996
+++ hesiod-3.0.2a/configure.in	Wed Jan 29 00:08:51 1997
@@ -9,9 +9,10 @@
 AC_PROG_RANLIB
 
-AC_EGREP_HEADER(pw_quota, pwd.h, AC_DEFINE(HAVE_PW_QUOTA))
-AC_EGREP_HEADER(pw_comment, pwd.h, AC_DEFINE(HAVE_PW_COMMENT))
-AC_EGREP_HEADER(pw_class, pwd.h, AC_DEFINE(HAVE_PW_CLASS))
-AC_EGREP_HEADER(pw_change, pwd.h, AC_DEFINE(HAVE_PW_CHANGE))
-AC_EGREP_HEADER(pw_expire, pwd.h, AC_DEFINE(HAVE_PW_EXPIRE))
+dnl Check for various members of struct passwd.
+hesiod_STRUCT_PASSWD(pw_quota)
+hesiod_STRUCT_PASSWD(pw_comment)
+hesiod_STRUCT_PASSWD(pw_class)
+hesiod_STRUCT_PASSWD(pw_change)
+hesiod_STRUCT_PASSWD(pw_expire)
 
 AC_CHECK_FUNC(res_mkquery, :, [AC_CHECK_LIB(resolv, res_mkquery)])

--Multipart_Wed_Jan_29_00:12:04_1997-1--

home help back first fref pref prev next nref lref last post