From 73346dba777b023e46830a973148eb0ddbf8f8b4 Mon Sep 17 00:00:00 2001
From: "Andrew G. Morgan" <morgan@kernel.org>
Date: Sun, 19 Nov 2000 23:54:01 +0000
Subject: Relevant BUGIDs: task 15788, bugs 108297, 117476, 117474

Purpose of commit: autoconf support for Linux-PAM

Commit summary:
---------------
This is a merge of the autoconf support that was developed against
a 0-72 branch.

[Note, because CVS has some issues, this is actually only 95% of
 the actual commit. The other files were actually committed when
 the preparation branch Linux-PAM-0-73pre-autoconf was updated.
 Hopefully, this will complete the merge.]
---
 .cvsignore                                 |   7 +-
 CHANGELOG                                  |  11 +-
 Makefile                                   |  65 +++++++++++-
 README                                     | 161 ++---------------------------
 configure                                  |   2 +-
 configure.in                               |   2 +-
 doc/Makefile                               |  75 ++++++++++----
 doc/pam_source.sgml                        |  56 +---------
 doc/ps/.cvsignore                          |   2 +-
 examples/Makefile                          |  26 +++--
 examples/xsh.c                             |  27 +----
 libpam/Makefile                            |  79 ++++++--------
 libpam/pam_log.c                           |   9 +-
 libpam/pam_private.h                       |  11 +-
 libpam_misc/.cvsignore                     |   2 +
 libpam_misc/Makefile                       | 124 ++++++++++++----------
 libpam_misc/misc_conv.c                    |   5 +-
 libpamc/Makefile                           |  73 +++++++------
 libpamc/libpamc.h                          |   2 +-
 modules/Makefile                           |  20 +---
 modules/README                             |   2 +-
 modules/dont_makefile                      |   4 +-
 modules/pam_access/Makefile                | 103 ++----------------
 modules/pam_access/pam_access.c            |  11 +-
 modules/pam_cracklib/Makefile              | 115 +++------------------
 modules/pam_deny/Makefile                  | 122 +---------------------
 modules/pam_env/Makefile                   | 109 ++-----------------
 modules/pam_env/pam_env.c                  |   4 +-
 modules/pam_filter/Makefile                |  50 ++++-----
 modules/pam_filter/pam_filter.c            |   5 +-
 modules/pam_filter/upperLOWER/Makefile     |  37 ++-----
 modules/pam_filter/upperLOWER/upperLOWER.c |  27 ++---
 modules/pam_ftp/Makefile                   |  81 +--------------
 modules/pam_ftp/pam_ftp.c                  |   4 +-
 modules/pam_group/Makefile                 |  95 ++---------------
 modules/pam_group/pam_group.c              |   6 +-
 modules/pam_issue/Makefile                 |  83 ++-------------
 modules/pam_lastlog/Makefile               | 103 +-----------------
 modules/pam_lastlog/pam_lastlog.c          |   6 +-
 modules/pam_limits/Makefile                |  97 +++--------------
 modules/pam_limits/pam_limits.c            |  11 +-
 modules/pam_listfile/Makefile              |  81 ++-------------
 modules/pam_listfile/pam_listfile.c        |  10 +-
 modules/pam_mail/Makefile                  | 106 +------------------
 modules/pam_mail/pam_mail.c                |   7 +-
 modules/pam_mkhomedir/Makefile             |  81 +--------------
 modules/pam_motd/Makefile                  |  81 +--------------
 modules/pam_nologin/Makefile               |  83 ++-------------
 modules/pam_permit/Makefile                | 123 +---------------------
 modules/pam_pwdb/Makefile                  |  87 ++--------------
 modules/pam_pwdb/pam_pwdb.c                |   9 +-
 modules/pam_pwdb/pwdb_chkpwd.c             |   7 +-
 modules/pam_radius/Makefile                |  12 +--
 modules/pam_radius/pam_radius.h            |   6 +-
 modules/pam_rhosts/Makefile                | 107 +++----------------
 modules/pam_rootok/Makefile                | 110 +-------------------
 modules/pam_securetty/Makefile             |  80 ++------------
 modules/pam_shells/Makefile                |  81 ++-------------
 modules/pam_stress/Makefile                | 108 +------------------
 modules/pam_stress/pam_stress.c            |   8 +-
 modules/pam_tally/Makefile                 |  14 +--
 modules/pam_tally/pam_tally.c              |   7 +-
 modules/pam_time/Makefile                  |  95 ++---------------
 modules/pam_time/pam_time.c                |  11 +-
 modules/pam_unix/Makefile                  |  45 +++++---
 modules/pam_unix/pam_unix_acct.c           |   8 +-
 modules/pam_unix/pam_unix_auth.c           |   5 +-
 modules/pam_unix/pam_unix_passwd.c         |  10 +-
 modules/pam_unix/pam_unix_sess.c           |   7 +-
 modules/pam_unix/support.h                 |   4 +
 modules/pam_unix/unix_chkpwd.c             |   6 +-
 modules/pam_unix/yppasswd_xdr.c            |   5 +-
 modules/pam_userdb/Makefile                |  76 +++-----------
 modules/pam_userdb/pam_userdb.c            |  16 +--
 modules/pam_warn/Makefile                  |  95 +----------------
 modules/pam_wheel/Makefile                 |  83 ++-------------
 76 files changed, 613 insertions(+), 2895 deletions(-)

diff --git a/.cvsignore b/.cvsignore
index 31265a3f..4cae323b 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1,4 +1,9 @@
 default.defs
 .freezemake
 .filelist
-include
\ No newline at end of file
+include
+config.status
+config.log
+config.cache
+_pam_aconf.h
+Make.Rules
diff --git a/CHANGELOG b/CHANGELOG
index cfa64fef..7dbf8129 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,7 +5,6 @@ $Id$
 
 TODO:
 
-  - autoconf the modules?
   - sanitize use of md5 throughout distribution.. Make a static
     library for helping to develop modules that contains it and other
     stuff. Also add sha-1 and ripemd-160 digest algorithms.
@@ -21,6 +20,7 @@ TODO:
   - do we still need to remove openlog/closelog from modules..?
   - auth and acct support in pam_cracklib, "yes, I know the password
     you just typed was valid, I just don't think it was very strong..."
+  - add in the pam_cap and pam_netid modules
 
 ====================================================================
 Note, as of release 0.73, all checkins should be accompanied with a
@@ -47,12 +47,9 @@ Where you should replace XXXXX with a bug-id.
 * fix for C++ application support (Bug 111645 - fix agmorgan)
 * fix for typo in pam_client.h (Bug 111648 - fix agmorgan)
 * removal of -lpam from pam_mkhomedir Makefile (Bug 116380 - fix agmorgan)
-
-Planning to include:
-
-  - some autoconf support and other outstanding changes from Jan..
-  - some outstanding changes from Ben
-  - add in the pam_cap and pam_netid modules
+* autoconf support [Task ID 15788, Bug ID 108297 - agmorgan with help!]
+ - bugfix for libpamc.h include file [Bug ID 117476 - agmorgan]
+ - bugfix for pam_filter.h inclusion [Bug ID 117474 - agmorgan]
 
 0.72: Mon Dec 13 22:41:11 PST 1999
 
diff --git a/Makefile b/Makefile
index 7a5923e7..c17dc208 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,68 @@
 ##
 ## $Id$
 ##
-##
+
+## Note, ideally I would prefer it if this top level makefile did
+## not get created by autoconf. As I find typing 'make' and relying
+## on it to take care of all dependencies much more friendly than
+## the multi-stage autoconf+make and also worry about updates to
+## configure.in not getting propagated down the tree. (AGM) [I realise
+## that this may not prove possible, but at least I tried.. Sigh.]
+
+ifeq ($(shell test \! -f Make.Rules || echo yes),yes)
+    include Make.Rules
+endif
+
+THINGSTOMAKE = modules libpam libpamc libpam_misc doc examples
+
+all: $(THINGSTOMAKE)
+
+prep:
+	rm -f security
+	ln -sf . security
+
+clean:
+	if [ ! -f Make.Rules ]; then touch Make.Rules ; fi
+	for i in $(THINGSTOMAKE) ; do $(MAKE) -C $$i clean ; done
+	rm -f security *~ *.orig *.rej #*#
+
+distclean: clean
+	rm -f Make.Rules _pam_aconf.h
+	rm -f config.status config.cache config.log core
+
+maintainer-clean: distclean
+	@echo files should be ok for packaging now.
+
+# NB _pam_aconf.h.in changes will remake this too
+Make.Rules: configure Make.Rules.in _pam_aconf.h.in
+	@echo XXX - not sure how to preserve past configure options..
+	@echo XXX - so not attempting to. Feel free to run ./configure
+	@echo XXX - by hand, with the options you want.
+	./configure
+
+configure: configure.in
+	@$(MAKE) distclean
+	@echo
+	@echo You do not appear to have a ./configure file.
+	@echo Please run autoconf, and then ./configure [..options..]
+	@echo
+	@exit 1
+
+$(THINGSTOMAKE): _pam_aconf.h prep
+	$(MAKE) -C $@ all
+
+install: _pam_aconf.h prep
+	$(MKDIR) $(FAKEROOT)$(INCLUDED)
+	$(INSTALL) -m 444 security/_pam_aconf.h $(FAKEROOT)$(INCLUDED)
+	for x in $(THINGSTOMAKE) ; do make -C $$x install ; done
+
+remove:
+	rm -f $(FAKEROOT)$(INCLUDED)/_pam_aconf.h
+	for x in $(THINGSTOMAKE) ; do make -C $$x remove ; done
+
+## =================
+
+ifdef LEGACY_OLD_MAKEFILE
 
 # major and minor numbers of this release
 MAJOR_REL=0
@@ -281,3 +342,5 @@ release:
 	chmod 400 .filelist
 	$(MAKE) check
 	(cat .filelist ; echo $(RELNAME)/conf/.md5sum) | (cd .. ; tar -cz -f$(DISTFILE) -T-)
+
+endif # LEGACY_OLD_MAKEFILE
diff --git a/README b/README
index 8f988213..c9d39bba 100644
--- a/README
+++ b/README
@@ -6,162 +6,23 @@ Hello!
 
 Thanks for downloading Linux-PAM.
 
---------------------------------------------------------------------
-Before you begin:
-
-  * This distribution requires GNU's Make
-  * It requires GNU's C-compiler: gcc (and 'ld')
-  * it also requires the GNU shell: bash
-  * some of the modules require the presence of libpwdb see redhat
-  * two modules have some need for libcrack too..
-
---------------------------------------------------------------------
-[
-Zeroth (optional) thing to do: check the detatched "pgp" signature for
-this distribution file, it should be signed by
-
-Type Bits/KeyID    Date       User ID
-pub  1024/2A398175 1996/11/17 Andrew G. Morgan <morgan@linux.kernel.org>
-]
-
-First thing to do (I assume you have successfully unpacked it!) is to
-run:
-
-    make check                           [ requires md5sum to be present ]
-
-This will also check that the distribution has arrived intact. [
-Later, If you change some things, running this command from this
-directory will show you what files you have altered. ]
-
-If you choose to get and install the RCS files that accompany this
-release, you may also run
-
-	make RCScheck
-
-from this directory.
-
-Next, you should check the symbolic link
-
-	.../Linux-PAM-X.YY/default.defs
-
-points to the file that best describes your system. The various *.defs
-files that are included in this distribution are to be found in the
-directory:
-
-	.../Linux-PAM-X.YY/defs/
-
-This should configure the distribution to compile on your system. The
-default is the version I use for maintaining the distribution. [If you
-don't find one that suits your needs, please try to create one, email
-it to me and I will include it in a future release.]
-
-If you are running an ELF based Linux system you should be able to
-compile the distribution straight from the box. If you are running an
-a.out based system, then some of the functionality of Linux-PAM will
-be unavailable to you. Instead, you must switch the DYNAMIC variables
-*off* in your "defs" file: comment out the DYNAMIC and DYNAMIC_LIBPAM
-defines and uncomment the STATIC and STATIC_LIBPAM defines. NOTE, for
-ELF based systems, almost any combination of these four definitions is
-legal... If you have ELF, I recommend the default however.
-
-Second, try to compile it. Use the following command in *this*
-directory:
-
-	make
-
-[ or 'make all' if you prefer ]. The first time you type make, it is
-likely to complain. This is to remind you to remove any libraries from
-previous versions of the distribution that are likely to confuse this
-make... Type 'make' again.
-
-Before you do the third thing. You should think about whether you want
-the default configuration scripts to be installed or not. If you have
-a working PAM based system you probably do *not* want this.. Whatever,
-before Linux-PAM installs the default scripts you will be prompted as
-to whether it is a good idea. Be sure to say NO if you are worried!
-** You have been warned. **
-
-Third, to install the stuff you need to be root. Do the following:
-
-	su -c "make install"
-
-If everything has worked as intended there should now be
-
-	some executables		in	./bin/
-	some filters for pam_filter	in	/usr/sbin/pam_filter/
-	some configuration files:
-		/etc/pam.conf
-		/etc/security/*.conf
-	libpam_misc.a (static library)	in	/usr/lib/
-
-In addition:
-
-    if dynamically linked:
-
-	libpam.so.XXX (shared library)	        in	/usr/lib/
-	libpam_misc.so.XXX (shared library)	in	/usr/lib/
-	pam_*.so (modules)		        in	/usr/lib/security/
-
-    if statically linked:
-
-	libpam.a (static library)	in	/usr/lib/
-
-[These are the default directories that I use. Your own system may
-differ as specified in your XXX.defs file.]
-
 NOTES:
 
-* The documentation, what there is of it, is in ./doc. I am only
-including the sgml format source-files. But try to make .ps files
-available from the above http address. To locally use these sgml files
-you should have linuxdoc-sgml installed. Sorry, but I'm conserving net
-bandwidth by only including sources!
+This is the evolving autoconf branch for Linux-PAM. It is supposed to
+be equivalent to Linux-PAM-0.72.
 
-* The source for each module is to be found in ./modules/XXX. If you
-want to add a new one, make a directory like XXX for it. Add the name
-(XXX) to MODDIRS in ./modules/Makefile and hopefully it will become
-part of the overall make. Note, the Makefile in ./modules/ is now
-smart enough to check if the directory is there before it changes into
-it; If you want to start working on a module, send me its name and I
-will add it to the "official" Makefile.. This way, you should be able
-to insert your developing module into any new release, and not have to
-worry at first about letting it out to the public. This may also give
-other people some idea about whether a module is currently being
-worked on or not.
+How to use it is as follows:
 
-* Currently, you have to 'make' binaries from this directory. 'make
-clean', however, works in any directory that has a Makefile.
+      ./configure --help | less
+      ./configure <your-options>
+      make
 
-* Also, you can 'make remove' (as root) from *this* directory and it
-will delete the various installed files dotted around the system. THIS
-IS A VERY BAD IDEA IF YOUR SYSTEM DEPENDS ON PAM TO WORK!!!
+  Note, this is all experimental so you may not want to do this one..(?)
 
-* 'make sterile' does 'make remove' and then 'make extraclean', this
-might be required if you are alternating your choice of
-STATIC(_LIBPAM) and DYNAMIC(_LIBPAM) compilation. SEE COMMENT IN
-UPPERCASE IN PARAGRAPH ABOVE!!!!
+      make install
 
-Best wishes
+Please report problems to me:
 
 Andrew Morgan
-
-Email bugs/comments to: the Linux-PAM list <pam-list@redhat.com>
-or me <morgan@linux.kernel.org>
-
-To see about joining the mailing list, send the following email:
---------------------------------
-To: pam-list-request@redhat.com
-Subject: help
-<empty text>
---------------------------------
-
-Additionally, some Linux-PAM files have been known to be found at one
-or more of the following places (they are not always the most up to
-date...):
-
-http://www.redhat.com/linux-info/pam/
-
-ftp://bach.cis.temple.edu/pub/People/Alex/private/PAM
-ftp://ftp.redhat.com/pub/misc/
-ftp://linux.nrao.edu/pub/linux/ALPHA/PAM/
-ftp://tsx-11.mit.edu/pub/linux/ALPHA/PAM/
+<morgan@kernel.org>
+<agmorgan@users.sourceforge.net>
diff --git a/configure b/configure
index e02f52d1..653e9087 100755
--- a/configure
+++ b/configure
@@ -555,7 +555,7 @@ fi
 
 
 LIBPAM_VERSION_MAJOR=0
-LIBPAM_VERSION_MINOR=72
+LIBPAM_VERSION_MINOR=73
 
 
 
diff --git a/configure.in b/configure.in
index 15224e72..b5500102 100644
--- a/configure.in
+++ b/configure.in
@@ -9,7 +9,7 @@ dnl Release specific
 dnl
 
 LIBPAM_VERSION_MAJOR=0
-LIBPAM_VERSION_MINOR=72
+LIBPAM_VERSION_MINOR=73
 
 AC_SUBST(LIBPAM_VERSION_MAJOR)
 AC_SUBST(LIBPAM_VERSION_MINOR)
diff --git a/doc/Makefile b/doc/Makefile
index 965f24b8..21ae3de2 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,13 +1,13 @@
 
 ### $Id$
 
-TXTER=sgml2txt
-HTMLER=sgml2html
-# older distributions use, sgml2ps
-# newer distributions than the one I use (AGM :^) need the following line:
-#PSER=sgml2latex -o ps
-# until I upgrade this is the default
-PSER=sgml2latex -p
+include ../Make.Rules
+
+# These two should probably be moved into autoconf...
+DOCDIR=/usr/doc/Linux-PAM
+MANDIR=/usr/man
+
+#######################################################
 
 FILES=pam pam_appl pam_modules
 FSRCS=pam.sgml pam_appl.sgml pam_modules.sgml
@@ -29,36 +29,48 @@ all: htmls texts postscript
 htmls: $(HTMLS)
 
 $(HTMLS) : $(FSRCS)
+ifeq ($(HAVE_SGML2HTML),yes)
 	@for i in $(FILES) ; do \
 	if [ ! -f "html/$$i.html" ] || [ "$$i.sgml" -nt "html/$$i.html" ]; \
 	then \
-		cd html ; $(HTMLER) ../$$i ; \
+		cd html ; sgml2html ../$$i ; \
 		if [ $$? -ne 0 ]; then exit 1 ; fi ; \
 		cd .. ; \
 	fi ; \
 	done
+else
+	@echo XXX - you do not have the sgml2html binary installed
+endif
 
 texts: $(TEXTS)
 
 $(TEXTS) : $(FSRCS)
+ifeq ($(HAVE_SGML2TXT),yes)
 	@for i in $(FILES) ; do \
 		if [ ! -f "txts/$$i.txt" ] \
 				|| [ "$$i.sgml" -nt "txts/$$i.txt" ]; then \
-			cd txts ; $(TXTER) ../$$i ; cd .. ; \
+			cd txts ; sgml2txt ../$$i ; cd .. ; \
 		fi ; \
 	done
+else
+	@echo XXX - you do not have the sgml2txt binary installed
+endif
 
 postscript: $(PSFILES)
 
 $(PSFILES): $(FSRCS)
+ifneq ($(PSER),)
 	@for i in $(FILES) ; do \
 	if [ ! -f "ps/$$i.ps" ] || [ "$$i.sgml" -nt "ps/$$i.ps" ]; then \
 		cd ps ; $(PSER) ../$$i ; cd .. ; \
 	fi ; \
 	done
+else
+	@echo XXX - neither sgml2ps nor sgml2latex binaries are installed
+endif
 
-pam.sgml: pam_source.sgml MODULES-SGML
-	@sed -e '/^<!\-\- insert\-file MODULES\-SGML \-\->/r MODULES-SGML' pam_source.sgml > pam.sgml
+pam.sgml: pam_source.sgml MODULES-SGML CREDITS
+	@sed -e '/^<!\-\- insert\-file MODULES\-SGML \-\->/r MODULES-SGML' pam_source.sgml | sed -e '/^<!\-\- insert\-file CREDITS \-\->/r CREDITS' > pam.sgml
 
 MODULES-SGML: $(MODULES)
 	@echo 'Building module text from files in modules/*.sgml'
@@ -70,25 +82,48 @@ MODULES-SGML: $(MODULES)
 
 extraclean: clean
 
-DOCDIR=/usr/doc/Linux-PAM
-MANDIR=/usr/man
+remove:
+	cd man && for file in *.3 ; do \
+	  rm -f $(FAKEROOT)$(MANDIR)/man3/$$file ; \
+	done
+	cd man && for file in *.8 ; do \
+	  rm -f $(FAKEROOT)$(MANDIR)/man8/$$file ; \
+	done
+	cd txts && for file in *.txt; do \
+	  rm -f $(FAKEROOT)$(DOCDIR)/text/$$file ; \
+	done
+	cd ps && for file in *.ps; do \
+	  rm -f $(FAKEROOT)$(DOCDIR)/ps/$$file  ; \
+	done
+	cd html && for file in *.html; do \
+	  rm -f $(FAKEROOT)$(DOCDIR)/html/$$file ; \
+	done
+
 install: all
-	mkdir -p $(FAKEROOT)$(DOCDIR)/{html,ps,text}
+ifeq ($(HAVE_SGML2TXT),yes)
+	mkdir -p $(FAKEROOT)$(DOCDIR)/text
 	for file in txts/*.txt; do \
-	  install -o root -g root -m 644 $$file $(FAKEROOT)$(DOCDIR)/text ; \
+	  install -m 644 $$file $(FAKEROOT)$(DOCDIR)/text ; \
 	done
+endif
+ifneq ($(PSER),)
+	mkdir -p $(FAKEROOT)$(DOCDIR)/ps
 	for file in ps/*.ps; do \
-	  install -o root -g root -m 644 $$file $(FAKEROOT)$(DOCDIR)/ps  ; \
+	  install -m 644 $$file $(FAKEROOT)$(DOCDIR)/ps  ; \
 	done
+endif
+ifeq ($(HAVE_SGML2HTML),yes)
+	mkdir -p $(FAKEROOT)$(DOCDIR)/html
 	for file in html/*.html; do \
-	  install -o root -g root -m 644 $$file $(FAKEROOT)$(DOCDIR)/html ; \
+	  install -m 644 $$file $(FAKEROOT)$(DOCDIR)/html ; \
 	done
+endif
 	mkdir -p $(FAKEROOT)$(MANDIR)/man{3,8}
 	for file in man/*.3 ; do \
-	  install -o root -g root -m 644 $$file $(FAKEROOT)$(MANDIR)/man3 ; \
+	  install -m 644 $$file $(FAKEROOT)$(MANDIR)/man3 ; \
 	done
 	for file in man/*.8 ; do \
-	  install -o root -g root -m 644 $$file $(FAKEROOT)$(MANDIR)/man8 ; \
+	  install -m 644 $$file $(FAKEROOT)$(MANDIR)/man8 ; \
 	done
 
 clean:
@@ -96,6 +131,6 @@ clean:
 	rm -f html/pam*.html
 	rm -f man/*~
 	rm -f $(TEXTS)
-	rm -f $(PSFILES)
+	rm -f $(PSFILES) ps/missfont.log
 	rm -f MODULES-SGML pam.sgml
 
diff --git a/doc/pam_source.sgml b/doc/pam_source.sgml
index 1c369403..346082b0 100644
--- a/doc/pam_source.sgml
+++ b/doc/pam_source.sgml
@@ -45,8 +45,8 @@ DAMAGE.
 <article>
 
 <title>The Linux-PAM System Administrators' Guide
-<author>Andrew G. Morgan, <tt>morgan@linux.kernel.org</tt>
-<date>DRAFT v0.71 1999/11/8
+<author>Andrew G. Morgan, <tt>morgan@kernel.org</tt>
+<date>DRAFT v0.73 2000/11/03
 <abstract>
 This manual documents what a system-administrator needs to know about
 the <bf>Linux-PAM</bf> library. It covers the correct syntax of the
@@ -1046,57 +1046,9 @@ and in such a way that they need not be distributed with Linux-PAM.
 <sect>Author/acknowledgments
 
 <p>
-This document was written by Andrew G. Morgan (morgan@linux.kernel.org)
+This document was written by Andrew G. Morgan (morgan@kernel.org)
 with many contributions from
-<!-- insert credits here -->
-<!--
- an sgml list of people to credit for their contributions to Linux-PAM
- $Id$
-  -->
-Chris Adams,
-Peter Allgeyer,
-Tim Baverstock,
-Tim Berger,
-Craig S. Bell,
-Derrick J. Brashear,
-Ben Buxton,
-Seth Chaiklin,
-Oliver Crow,
-Chris Dent,
-Marc Ewing,
-Cristian Gafton,
-Emmanuel Galanos,
-Brad M. Garcia,
-Eric Hester,
-Roger Hu,
-Eric Jacksch,
-Michael K. Johnson,
-David Kinchlea,
-Olaf Kirch,
-Marcin Korzonek,
-Stephen Langasek,
-Nicolai Langfeldt,
-Elliot Lee,
-Luke Kenneth Casson Leighton,
-Al Longyear,
-Ingo Luetkebohle,
-Marek Michalkiewicz,
-Robert Milkowski,
-Aleph One,
-Martin Pool,
-Sean Reifschneider,
-Jan Rekorajski,
-Erik Troan,
-Theodore Ts'o,
-Jeff Uphoff,
-Myles Uyema,
-Savochkin Andrey Vladimirovich,
-Ronald Wahl,
-David Wood,
-John Wilmes,
-Joseph S. D. Yao
-and
-Alex O.  Yuriev.
+<!-- insert-file CREDITS -->
 
 <p>
 Thanks are also due to Sun Microsystems, especially to Vipin Samar and
diff --git a/doc/ps/.cvsignore b/doc/ps/.cvsignore
index 8d83f2d0..fa1d1137 100644
--- a/doc/ps/.cvsignore
+++ b/doc/ps/.cvsignore
@@ -1 +1 @@
-pam*.ps
\ No newline at end of file
+pam*.ps
diff --git a/examples/Makefile b/examples/Makefile
index c6882473..bd15ddf2 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -2,18 +2,15 @@
 # $Id$
 #
 
-dummy:
-
-	@echo	"*** This is not a top level Makefile!"
+include ../Make.Rules
 
 PROGS = blank xsh check_user
 SRCS = blank.c xsh.c check_user.c
+PROGSUID =
 
-# have removed the following pair since they no longer conform to
-# any recognized conventions: vpass test
-# ditto: vpass.c test.c
+CFLAGS += -I../libpam_misc/inlcude -I../libpamc/include
 
-PROGSUID =
+LOADLIBES = -L../libpam -L../libpamc -L../libpam_misc -lpam -lpam_misc
 
 all: $(PROGS)
 
@@ -26,17 +23,18 @@ blank: blank.o
 xsh: xsh.o
 	$(CC) $(CFLAGS) -o $@ $< $(LOADLIBES)
 
+clean:
+	rm -f *.a *.so *.o *~ $(PROGS) $(PROGSUID)
+	rm -f *.a *.out *.o *.so
+
+# note, the programs are test programs, they should not be
+# installed on your system!
+
 install: all
 	if [ -n "$(PROGS)" ]; then cp $(PROGS) ../bin ; fi
 	if [ -n "$(PROGSUID)" ]; then \
-		$(INSTALL) -m 4555 -o root -g bin $(PROGSUID) ../bin ; fi
-
-clean:
-	rm -f *.a *.so *.o *~ $(PROGS) $(PROGSUID)
+		$(INSTALL) -m 4555 $(PROGSUID) ../bin ; fi
 
 remove:
 	cd ../bin ; rm -f $(PROGS) $(PROGSUID)
-
-extraclean: clean
-	rm -f *.a *.out *.o *.so
 	for x in $(PROGS) $(PROGSUID) ; do rm -f ../bin/$$x ; done
diff --git a/examples/xsh.c b/examples/xsh.c
index d4b50b37..13971a2d 100644
--- a/examples/xsh.c
+++ b/examples/xsh.c
@@ -1,31 +1,8 @@
 /*
  * $Id$
- *
- * $Log$
- * Revision 1.1  2000/06/20 22:11:13  agmorgan
- * Initial revision
- *
- * Revision 1.2  1999/11/08 05:39:53  morgan
- * removed void main def which was making gcc complain
- *
- * Revision 1.1.1.1  1998/07/12 05:17:14  morgan
- * Linux PAM sources pre-0.66
- *
- * Revision 1.4  1996/11/10 21:09:45  morgan
- * no gcc warnings
- *
- * Revision 1.3  1996/07/07 23:53:36  morgan
- * added support for non standard pam_fail_delay
- *
- * Revision 1.2  1996/05/02 04:44:48  morgan
- * moved conversaation to a libmisc routine.
- *
- * Revision 1.1  1996/04/07 08:18:55  morgan
- * Initial revision
- *
  */
 
-/* Andrew Morgan (morgan@parc.power.net) -- an example application
+/* Andrew Morgan (morgan@kernel.org) -- an example application
  * that invokes a shell, based on blank.c */
 
 #include <stdio.h>
@@ -53,7 +30,7 @@ static struct pam_conv conv = {
 
 /* ------- the application itself -------- */
 
-int main(int argc, char **argv, char **envp)
+int main(int argc, char **argv)
 {
      pam_handle_t *pamh=NULL;
      char *username=NULL;
diff --git a/libpam/Makefile b/libpam/Makefile
index 66b2a705..b734dfa4 100644
--- a/libpam/Makefile
+++ b/libpam/Makefile
@@ -3,28 +3,12 @@
 #
 #
 
+include ../Make.Rules
+
 # need to tell libpam about the default directory for PAMs
 MOREFLAGS=-D"DEFAULT_MODULE_PATH=\"$(SECUREDIR)/\""
 
-# you may uncomment the following to build libpam in modified ways
-
-# lots of debugging information goes to /tmp/pam-debug.log
-#MOREFLAGS += -D"DEBUG"
-
-# pay attention to locked /etc/pam.conf or /etc/pam.d/* files
-#MOREFLAGS += -D"PAM_LOCKING"
-
-# read both the /etc/pam.d/ and pam.conf files specific to the deisred service
-#MOREFLAGS += -D"PAM_READ_BOTH_CONFS"
-
-# make a kludge attempt to be compatible with the old pam_strerror
-# calling convention
-#MOREFLAGS += -D"UGLY_HACK_FOR_PRIOR_BEHAVIOR_SUPPORT"
-
-# libpam.so needs -ldl, too.
-LINKLIBS += $(LIBDL)
-
-ifeq ($(DEBUG_REL),yes)
+ifeq ($(WITH_LIBDEBUG),yes)
  LIBNAME=libpamd
 else
  LIBNAME=libpam
@@ -34,8 +18,7 @@ MODIFICATION=.$(MINOR_REL)
 
 # ---------------------------------------------
 
-dummy:
-	@echo "*** This is not a top-level Makefile!"
+dummy: ../Make.Rules all
 
 # ---------------------------------------------
 
@@ -52,6 +35,7 @@ LIBPAMFULL = $(LIBPAMNAME)$(MODIFICATION)
 LIBPAMSTATIC = $(LIBNAME).a
 
 ifdef STATIC
+@echo Did you mean to set STATIC\?
 MODULES = $(shell cat ../modules/_static_module_objects)
 STATICOBJ = pam_static.o
 endif
@@ -65,15 +49,16 @@ LIBOBJECTS = pam_item.o pam_strerror.o pam_end.o pam_start.o pam_data.o \
 		pam_account.o pam_auth.o pam_session.o pam_password.o \
 		pam_env.o pam_log.o $(EXTRAS)
 
-ifdef DYNAMIC_LIBPAM
+ifeq ($(DYNAMIC_LIBPAM),yes)
+# libpam.so needs -ldl, too.
 DLIBOBJECTS = $(addprefix dynamic/,$(LIBOBJECTS) $(STATICOBJ))
-ifdef STATICOBJ
+ifeq ($(STATICOBJ),yes)
 dynamic/pam_static.o: pam_static.c ../modules/_static_module_objects
 	$(CC) $(CFLAGS) -c pam_static.c -o $@
 endif
 endif
 
-ifdef STATIC_LIBPAM
+ifeq ($(STATIC_LIBPAM),yes)
 SLIBOBJECTS = $(addprefix static/,$(LIBOBJECTS) $(STATICOBJ))
 ifdef STATICOBJ
 static/pam_static.o: pam_static.c ../modules/_static_module_objects
@@ -84,28 +69,29 @@ endif
 # ---------------------------------------------
 ## rules
 
-all: dirs $(LIBPAM) $(LIBPAMSTATIC)
+all: dirs $(LIBPAM) $(LIBPAMSTATIC) ../Make.Rules
 
 dirs:
-ifdef DYNAMIC_LIBPAM
-	mkdir -p dynamic
+ifeq ($(DYNAMIC_LIBPAM),yes)
+	$(MKDIR) dynamic
 endif
-ifdef STATIC_LIBPAM
-	mkdir -p static
+ifeq ($(STATIC_LIBPAM),yes)
+	$(MKDIR) static
 endif
 
 dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
 static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
 $(LIBPAM): $(DLIBOBJECTS)
-ifdef DYNAMIC_LIBPAM
+ifeq ($(DYNAMIC_LIBPAM),yes)
     ifeq ($(USESONAME),yes)
-	$(LD_L) $(SOSWITCH) $(LIBPAMNAME) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
+	$(LD_L) $(SOSWITCH) $(LIBPAMNAME) -o $@ $(DLIBOBJECTS) \
+		$(MODULES) $(LINKLIBS)
     else
-	$(LD_L) -o $@ $(DLIBOBJECTS) $(MODULES)
+	$(LD_L) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
     endif
     ifeq ($(NEEDSONAME),yes)
 	rm -f $(LIBPAMFULL)
@@ -116,13 +102,13 @@ ifdef DYNAMIC_LIBPAM
 endif
 
 $(LIBPAMSTATIC): $(SLIBOBJECTS)
-ifdef STATIC_LIBPAM
+ifeq ($(STATIC_LIBPAM),yes)
 	$(AR) $@ $(SLIBOBJECTS) $(MODULES)
 	$(RANLIB) $@
 endif
 
 install: all
-	$(MKDIR) $(FAKEROOT)$(INCLUDED) $(FAKEROOT)$(LIBDIR)
+	$(MKDIR) $(FAKEROOT)$(INCLUDED) $(FAKEROOT)$(libdir)
 	$(INSTALL) -m 644 include/security/pam_appl.h $(FAKEROOT)$(INCLUDED)
 	$(INSTALL) -m 644 include/security/pam_modules.h $(FAKEROOT)$(INCLUDED)
 	$(INSTALL) -m 644 include/security/_pam_macros.h $(FAKEROOT)$(INCLUDED)
@@ -131,15 +117,16 @@ install: all
 ifdef MEMORY_DEBUG
 	$(INSTALL) -m 644 include/security/pam_malloc.h $(FAKEROOT)$(INCLUDED)
 endif
-ifdef DYNAMIC_LIBPAM
-	$(INSTALL) -m $(SHLIBMODE) $(LIBPAM) $(FAKEROOT)$(LIBDIR)/$(LIBPAMFULL)
+ifeq ($(DYNAMIC_LIBPAM),yes)
+	$(INSTALL) -m $(SHLIBMODE) $(LIBPAM) $(FAKEROOT)$(libdir)/$(LIBPAMFULL)
 	$(LDCONFIG)
   ifneq ($(DYNTYPE),"sl")
-	( cd $(FAKEROOT)$(LIBDIR) ; rm -f $(LIBPAM) ; ln -s $(LIBPAMNAME) $(LIBPAM) )
+	( cd $(FAKEROOT)$(libdir) ; rm -f $(LIBPAM) ; \
+	  ln -s $(LIBPAMNAME) $(LIBPAM) )
   endif
 endif
-ifdef STATIC_LIBPAM
-	$(INSTALL) -m 644 $(LIBPAMSTATIC) $(FAKEROOT)$(LIBDIR)
+ifeq ($(STATIC_LIBPAM),yes)
+	$(INSTALL) -m 644 $(LIBPAMSTATIC) $(FAKEROOT)$(libdir)
 endif
 
 remove:
@@ -148,15 +135,13 @@ remove:
 	rm -f $(FAKEROOT)$(INCLUDED)/pam_appl.h
 	rm -f $(FAKEROOT)$(INCLUDED)/pam_modules.h
 	rm -f $(FAKEROOT)$(INCLUDED)/pam_malloc.h
-	rm -f $(FAKEROOT)$(LIBDIR)/$(LIBPAM).*
-	rm -f $(FAKEROOT)$(LIBDIR)/$(LIBPAM)
+	rm -f $(FAKEROOT)$(libdir)/$(LIBPAM).*
+	rm -f $(FAKEROOT)$(libdir)/$(LIBPAM)
 	$(LDCONFIG)
-	rm -f $(FAKEROOT)$(LIBDIR)/$(LIBPAMSTATIC)
+	rm -f $(FAKEROOT)$(libdir)/$(LIBPAMSTATIC)
 
 clean:
 	rm -f a.out core *~ static/*.o dynamic/*.o
-
-extraclean: clean
-	rm -f *.a *.out *.o *.so ./include/security/*~
+	rm -f *.a *.o *.so ./include/security/*~
 	if [ -d dynamic ]; then rmdir dynamic ; fi
 	if [ -d static ]; then rmdir static ; fi
diff --git a/libpam/pam_log.c b/libpam/pam_log.c
index d990c8c0..af6f2504 100644
--- a/libpam/pam_log.c
+++ b/libpam/pam_log.c
@@ -5,19 +5,12 @@
  *
  */
 
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#else
-# define _BSD_SOURCE
-#endif
+#include "pam_private.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
 
-#include "pam_private.h"
-
 #ifdef __hpux
 # include <stdio.h>
 # include <syslog.h>
diff --git a/libpam/pam_private.h b/libpam/pam_private.h
index 51660fd1..7b36fb02 100644
--- a/libpam/pam_private.h
+++ b/libpam/pam_private.h
@@ -10,14 +10,16 @@
  * Please see end of file for copyright.
  *
  * Creator: Marc Ewing.
- * Maintained: AGM
+ * Maintained: CVS
  */
 
 #ifndef _PAM_PRIVATE_H
 #define _PAM_PRIVATE_H
 
+#include <security/_pam_aconf.h>
+
 /* this is not used at the moment --- AGM */
-#define LIBPAM_VERSION 67
+#define LIBPAM_VERSION (LIBPAM_VERSION_MAJOR*0x100 + LIBPAM_VERSION_MINOR)
 
 #include <security/pam_appl.h>
 #include <security/pam_modules.h>
@@ -188,8 +190,6 @@ int _pam_make_env(pam_handle_t *pamh);
 /* delete the environment structure */
 void _pam_drop_env(pam_handle_t *pamh);
 
-#ifdef LINUX_PAM
-
 /* these functions deal with failure delays as required by the
    authentication modules and application. Their *interface* is likely
    to remain the same although their function is hopefully going to
@@ -204,9 +204,6 @@ void _pam_start_timer(pam_handle_t *pamh);
 /* this waits for the clock to stop ticking if status != PAM_SUCCESS */
 void _pam_await_timer(pam_handle_t *pamh, int status);
 
-
-#endif /* LINUX_PAM */
-
 typedef void (*voidfunc(void))(void);
 #ifdef PAM_STATIC
 
diff --git a/libpam_misc/.cvsignore b/libpam_misc/.cvsignore
index d04bebe5..b6cfd742 100644
--- a/libpam_misc/.cvsignore
+++ b/libpam_misc/.cvsignore
@@ -5,3 +5,5 @@ libpamd_misc.a
 help_env.o
 misc_conv.o
 xstrdup.o
+dynamic
+static
diff --git a/libpam_misc/Makefile b/libpam_misc/Makefile
index 89a27536..b41e61a0 100644
--- a/libpam_misc/Makefile
+++ b/libpam_misc/Makefile
@@ -1,96 +1,106 @@
+#
 # $Id$
 #
 
-dummy:
-	@echo "*** This is not a top-level Makefile!"
-
-# ///////////////////////////////////////////////////////////////////
-
-# uncomment if you wnat libpam_misc to be made as a dynamic library
-# AGM has had some segfaulting from libdl when I did this. I have not
-# investigated the cause...
+# lots of debugging information goes to /tmp/pam-debug.log
+#MOREFLAGS += -D"DEBUG"
 
-MAKE_DYNAMIC=yes
+include ../Make.Rules
 
 ifeq ($(DEBUG_REL),yes)
- LIBNAME=pamd_misc
+ LIBNAME=libpam_miscd
 else
- LIBNAME=pam_misc
+ LIBNAME=libpam_misc
 endif
-LIBMAJOR=$(MAJOR_REL)
-LIBMINOR=$(MINOR_REL)
+VERSION=.$(MAJOR_REL)
+MODIFICATION=.$(MINOR_REL)
 
-FILES=misc_conv help_env
-
-#
-# Probably no need to alter anything below here.
-#
+CFLAGS += $(MOREFLAGS) $(DYNAMIC) $(STATIC)
 
-# build dynamic library names
+# dynamic library names
 
-LIBDYNAMIC=lib$(LIBNAME).$(DYNTYPE)
-LIBDYNMAJ=$(LIBDYNAMIC).$(LIBMAJOR)
-LIBDYNMIN=$(LIBDYNMAJ).$(LIBMINOR)
+LIBNAMED = $(LIBNAME).$(DYNTYPE)
+LIBNAMEDNAME = $(LIBNAMED)$(VERSION)
+LIBNAMEDFULL = $(LIBNAMEDNAME)$(MODIFICATION)
 
 # static library name
 
-LIBSTATIC = lib$(LIBNAME).a
+LIBNAMEDSTATIC = $(LIBNAME).a
 
-# sources and object files
+LIBOBJECTS = help_env.o misc_conv.o
 
-LIBSRC = $(addsuffix .c,$(FILES))
-LIBOBJ = $(addsuffix .o,$(FILES))
+ifeq ($(DYNAMIC_LIBPAM),yes)
+DLIBOBJECTS = $(addprefix dynamic/,$(LIBOBJECTS))
+endif
+
+ifeq ($(STATIC_LIBPAM),yes)
+SLIBOBJECTS = $(addprefix static/,$(LIBOBJECTS))
+endif
 
-# rules
+# ---------------------------------------------
+## rules
 
-all: $(LIBSTATIC) $(LIBDYNAMIC)
+all: dirs $(LIBNAMED) $(LIBNAMEDSTATIC)
 
-$(LIBDYNAMIC): $(LIBOBJ)
-ifdef MAKE_DYNAMIC
+dirs:
+ifeq ($(DYNAMIC_LIBPAM),yes)
+	$(MKDIR) dynamic
+endif
+ifeq ($(STATIC_LIBPAM),yes)
+	$(MKDIR) static
+endif
+
+dynamic/%.o : %.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
+
+static/%.o : %.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
+
+$(LIBNAMED): $(DLIBOBJECTS)
+ifeq ($(DYNAMIC_LIBPAM),yes)
     ifeq ($(USESONAME),yes)
-	$(LD_L) $(SOSWITCH) $(LIBDYNMAJ) -o $@ $(LIBOBJ) $(LINKLIBS)
+	$(LD_L) $(SOSWITCH) $(LIBNAMEDNAME) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
     else
-	$(LD_L) -o $@ $(LIBOBJ)
+	$(LD_L) -o $@ $(DLIBOBJECTS) $(MODULES)
     endif
     ifeq ($(NEEDSONAME),yes)
-	rm -f $(LIBDYNMIN)
-	ln -s $(LIBDYNAMIC) $(LIBDYNMAJ)
-	rm -f $(LIBDYNMAJ)
-	ln -s $(LIBDYNAMIC) $(LIBDYNMIN)
+	rm -f $(LIBNAMEDFULL)
+	ln -s $(LIBNAMED) $(LIBNAMEDFULL)
+	rm -f $(LIBNAMEDNAME)
+	ln -s $(LIBNAMED) $(LIBNAMEDNAME)
     endif
 endif
 
-$(LIBSTATIC): $(LIBOBJ)
-	$(AR) $@ $(LIBOBJ)
+$(LIBNAMEDSTATIC): $(SLIBOBJECTS)
+ifeq ($(STATIC_LIBPAM),yes)
+	$(AR) $@ $(SLIBOBJECTS) $(MODULES)
 	$(RANLIB) $@
+endif
 
 install: all
 	$(MKDIR) $(FAKEROOT)$(INCLUDED)
-	$(INSTALL) -m 644 ./pam_misc.h $(FAKEROOT)$(INCLUDED)
-ifdef MAKE_DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBDYNAMIC) $(FAKEROOT)$(LIBDIR)/$(LIBDYNMIN)
+	$(INSTALL) -m 644 include/security/pam_misc.h $(FAKEROOT)$(INCLUDED)
+ifeq ($(DYNAMIC_LIBPAM),yes)
+	$(MKDIR) $(FAKEROOT)$(libdir)
+	$(INSTALL) -m $(SHLIBMODE) $(LIBNAMED) $(FAKEROOT)$(libdir)/$(LIBNAMEDFULL)
 	$(LDCONFIG)
   ifneq ($(DYNTYPE),"sl")
-	( cd $(FAKEROOT)$(LIBDIR) ; ln -sf $(LIBDYNMAJ) $(LIBDYNAMIC) )
+	( cd $(FAKEROOT)$(libdir) ; rm -f $(LIBNAMED) ; ln -s $(LIBNAMEDNAME) $(LIBNAMED) )
   endif
 endif
-	$(INSTALL) -m 644 $(LIBSTATIC) $(FAKEROOT)$(LIBDIR)
-
-clean:
-	rm -f *.so *.a core a.out *~
+ifeq ($(STATIC_LIBPAM),yes)
+	$(INSTALL) -m 644 $(LIBNAMEDSTATIC) $(FAKEROOT)$(libdir)
+endif
 
 remove:
 	rm -f $(FAKEROOT)$(INCLUDED)/pam_misc.h
-	rm -f $(FAKEROOT)$(LIBDIR)/$(LIBDYNAMIC).*
-	rm -f $(FAKEROOT)$(LIBDIR)/$(LIBDYNAMIC)
+	rm -f $(FAKEROOT)$(libdir)/$(LIBNAMEDFULL)
+	rm -f $(FAKEROOT)$(libdir)/$(LIBNAMED)
 	$(LDCONFIG)
-	rm -f $(FAKEROOT)$(LIBDIR)/$(LIBSTATIC)
-	rm -f $(FAKEROOT)$(INCLUDED)/chk_malloc.h
-
-.c.o:
-	$(CC) -c $(DEFS) $(CFLAGS) $<
-
-extraclean:
-	@$(MAKE) clean
-	rm -f *.o *.bak
+	rm -f $(FAKEROOT)$(libdir)/$(LIBNAMEDSTATIC)
 
+clean:
+	rm -f a.out core *~ static/*.o dynamic/*.o
+	rm -f *.a *.out *.o *.so ./include/security/*~
+	if [ -d dynamic ]; then rmdir dynamic ; fi
+	if [ -d static ]; then rmdir static ; fi
diff --git a/libpam_misc/misc_conv.c b/libpam_misc/misc_conv.c
index f2811a26..73ba5a83 100644
--- a/libpam_misc/misc_conv.c
+++ b/libpam_misc/misc_conv.c
@@ -6,10 +6,7 @@
  * Written by Andrew Morgan <morgan@linux.kernel.org>
  */
 
-#ifdef linux
-#define _GNU_SOURCE
-#include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <signal.h>
 #include <stdio.h>
diff --git a/libpamc/Makefile b/libpamc/Makefile
index 6052e96e..402f070f 100644
--- a/libpamc/Makefile
+++ b/libpamc/Makefile
@@ -5,6 +5,8 @@
 # lots of debugging information goes to /tmp/pam-debug.log
 #MOREFLAGS += -D"DEBUG"
 
+include ../Make.Rules
+
 ifeq ($(DEBUG_REL),yes)
  LIBNAME=libpamcd
 else
@@ -13,71 +15,64 @@ endif
 VERSION=.$(MAJOR_REL)
 MODIFICATION=.$(MINOR_REL)
 
-# ---------------------------------------------
-
-dummy:
-	@echo "*** This is not a top-level Makefile!"
-
-# ---------------------------------------------
-
-CFLAGS += $(DYNAMIC) $(STATIC) $(MOREFLAGS)
+CFLAGS += $(MOREFLAGS) $(DYNAMIC) $(STATIC)
 
 # dynamic library names
 
-LIBPAMC = $(LIBNAME).$(DYNTYPE)
-LIBPAMCNAME = $(LIBPAMC)$(VERSION)
-LIBPAMCFULL = $(LIBPAMCNAME)$(MODIFICATION)
+LIBNAMED = $(LIBNAME).$(DYNTYPE)
+LIBNAMEDNAME = $(LIBNAMED)$(VERSION)
+LIBNAMEDFULL = $(LIBNAMEDNAME)$(MODIFICATION)
 
 # static library name
 
-LIBPAMCSTATIC = $(LIBNAME).a
+LIBNAMEDSTATIC = $(LIBNAME).a
 
 LIBOBJECTS = pamc_client.o pamc_converse.o pamc_load.o
 
-ifdef DYNAMIC_LIBPAM
+ifeq ($(DYNAMIC_LIBPAM),yes)
 DLIBOBJECTS = $(addprefix dynamic/,$(LIBOBJECTS))
 endif
 
-ifdef STATIC_LIBPAM
+ifeq ($(STATIC_LIBPAM),yes)
 SLIBOBJECTS = $(addprefix static/,$(LIBOBJECTS))
 endif
 
 # ---------------------------------------------
 ## rules
 
-all: dirs $(LIBPAMC) $(LIBPAMCSTATIC)
+all: dirs $(LIBNAMED) $(LIBNAMEDSTATIC)
 
 dirs:
-ifdef DYNAMIC_LIBPAM
-	mkdir -p dynamic
+ifeq ($(DYNAMIC_LIBPAM),yes)
+	$(MKDIR) dynamic
 endif
-ifdef STATIC_LIBPAM
-	mkdir -p static
+ifeq ($(STATIC_LIBPAM),yes)
+	$(MKDIR) static
 endif
 
 dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
 static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
-$(LIBPAMC): $(DLIBOBJECTS)
-ifdef DYNAMIC_LIBPAM
+$(LIBNAMED): $(DLIBOBJECTS)
+ifeq ($(DYNAMIC_LIBPAM),yes)
     ifeq ($(USESONAME),yes)
-	$(LD_L) $(SOSWITCH) $(LIBPAMCNAME) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
+	$(LD_L) $(SOSWITCH) $(LIBNAMEDNAME) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
     else
 	$(LD_L) -o $@ $(DLIBOBJECTS) $(MODULES)
     endif
     ifeq ($(NEEDSONAME),yes)
-	rm -f $(LIBPAMCFULL)
-	ln -s $(LIBPAMC) $(LIBPAMCFULL)
-	rm -f $(LIBPAMCNAME)
-	ln -s $(LIBPAMC) $(LIBPAMCNAME)
+	rm -f $(LIBNAMEDFULL)
+	ln -s $(LIBNAMED) $(LIBNAMEDFULL)
+	rm -f $(LIBNAMEDNAME)
+	ln -s $(LIBNAMED) $(LIBNAMEDNAME)
     endif
 endif
 
-$(LIBPAMCSTATIC): $(SLIBOBJECTS)
-ifdef STATIC_LIBPAM
+$(LIBNAMEDSTATIC): $(SLIBOBJECTS)
+ifeq ($(STATIC_LIBPAM),yes)
 	$(AR) $@ $(SLIBOBJECTS) $(MODULES)
 	$(RANLIB) $@
 endif
@@ -85,26 +80,28 @@ endif
 install: all
 	$(MKDIR) $(FAKEROOT)$(INCLUDED)
 	$(INSTALL) -m 644 include/security/pam_client.h $(FAKEROOT)$(INCLUDED)
-ifdef DYNAMIC_LIBPAM
-	$(INSTALL) -m $(SHLIBMODE) $(LIBPAMC) $(FAKEROOT)$(LIBDIR)/$(LIBPAMCFULL)
+ifeq ($(DYNAMIC_LIBPAM),yes)
+	$(MKDIR) $(FAKEROOT)$(libdir)
+	$(INSTALL) -m $(SHLIBMODE) $(LIBNAMED) $(FAKEROOT)$(libdir)/$(LIBNAMEDFULL)
 	$(LDCONFIG)
   ifneq ($(DYNTYPE),"sl")
-	( cd $(FAKEROOT)$(LIBDIR) ; rm -f $(LIBPAMC) ; ln -s $(LIBPAMCNAME) $(LIBPAMC) )
+	( cd $(FAKEROOT)$(libdir) ; rm -f $(LIBNAMED) ; ln -s $(LIBNAMEDNAME) $(LIBNAMED) )
   endif
 endif
-ifdef STATIC_LIBPAM
-	$(INSTALL) -m 644 $(LIBPAMCSTATIC) $(FAKEROOT)$(LIBDIR)
+ifeq ($(STATIC_LIBPAM),yes)
+	$(INSTALL) -m 644 $(LIBNAMEDSTATIC) $(FAKEROOT)$(libdir)
 endif
 
 remove:
 	rm -f $(FAKEROOT)$(INCLUDED)/pam_client.h
+	rm -f $(FAKEROOT)$(libdir)/$(LIBNAMEDFULL)
+	rm -f $(FAKEROOT)$(libdir)/$(LIBNAMED)
 	$(LDCONFIG)
-	rm -f $(FAKEROOT)$(LIBDIR)/$(LIBPAMCSTATIC)
+	rm -f $(FAKEROOT)$(libdir)/$(LIBNAMEDSTATIC)
 
 clean:
 	rm -f a.out core *~ static/*.o dynamic/*.o
-
-extraclean: clean
 	rm -f *.a *.out *.o *.so ./include/security/*~
 	if [ -d dynamic ]; then rmdir dynamic ; fi
 	if [ -d static ]; then rmdir static ; fi
+
diff --git a/libpamc/libpamc.h b/libpamc/libpamc.h
index 15662cc3..93c833c6 100644
--- a/libpamc/libpamc.h
+++ b/libpamc/libpamc.h
@@ -9,7 +9,7 @@
 #define LIBPAMC_H
 
 #include <security/pam_client.h>
-#include <security/pam_misc.h>
+#include <security/_pam_macros.h>
 
 #include <sys/stat.h>
 #include <unistd.h>
diff --git a/modules/Makefile b/modules/Makefile
index 9b89ccfd..51964e5b 100644
--- a/modules/Makefile
+++ b/modules/Makefile
@@ -6,19 +6,12 @@
 #
 #
 
-MODDIRS=$(shell /bin/ls -d pam_*)
-
-# ////////////////////////////////////////////////////
-# // You should not modify anything below this line //
-# ////////////////////////////////////////////////////
+include ../Make.Rules
 
-dummy:
-	@echo	"*** This is not a top-level Makefile! ***"
-
-# -----------------------------------------------------------
+MODDIRS=$(shell /bin/ls -d pam_*)
 
 all:	
-	@echo modules for $(OS) are:
+	@echo modules sources available are:
 	@ls -d $(MODDIRS) 2>/dev/null ; echo :--------
 	@echo
 ifdef STATIC
@@ -61,10 +54,3 @@ clean: lclean
 		} fi ; \
 	done 
 
-extraclean: lclean
-	for i in $(MODDIRS) ; do \
-		if [ -d $$i ]; then \
-			$(MAKE) -C $$i extraclean ; \
-		fi ; \
-	done
-
diff --git a/modules/README b/modules/README
index 86415947..73d3cf0c 100644
--- a/modules/README
+++ b/modules/README
@@ -1,7 +1,7 @@
 This directory contains the modules.
 
 If you want to reserve a module name please email <pam-list@redhat.com>
-and announce its name. Andrew Morgan, <morgan@parc.power.net>, will
+and announce its name. Andrew Morgan, <morgan@linux.kernel.org>, will
 add it to the Makefile in the next release of Linux-PAM.
 
 As of Linux-PAM-0.40 modules can optionally conform to the static
diff --git a/modules/dont_makefile b/modules/dont_makefile
index f256ce1b..b7e11834 100644
--- a/modules/dont_makefile
+++ b/modules/dont_makefile
@@ -1,4 +1,6 @@
 #########################################################################
+# $Id$
+#########################################################################
 # This is a makefile that does nothing. It is designed to be included
 # by module Makefile-s when they are not compatable with the local
 # system
@@ -7,7 +9,7 @@
 all:
 	@echo "This module will not be compiled on this system"
 
-extraclean: clean
+remove: clean
 
 install: clean
 
diff --git a/modules/pam_access/Makefile b/modules/pam_access/Makefile
index 3d3611c4..d93c9f40 100644
--- a/modules/pam_access/Makefile
+++ b/modules/pam_access/Makefile
@@ -5,102 +5,17 @@
 # what you are doing!).
 #
 
-TITLE=pam_access
-CONFD=$(CONFIGED)/security
-export CONFD
-CONFILE=$(CONFD)/access.conf
-export CONFILE
-
-# Convenient defaults for compiling independently of the full source
-# tree.
-ifndef FULL_LINUX_PAM_SOURCE_TREE
-export DYNAMIC=-DPAM_DYNAMIC
-export CC=gcc
-export CFLAGS=-O2 -Dlinux -DLINUX_PAM \
-       -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
-       -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional \
-       -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
-       -Wshadow -pedantic -fPIC
-export MKDIR=mkdir -p
-export LD_D=gcc -shared -Xlinker -x
-endif
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
+include ../../Make.Rules
 
-DEFS=-DCONFILE=\"$(CONFILE)\"
+TITLE=pam_access
+LOCAL_CONFILE=./access.conf
+INSTALLED_CONFILE=$(SCONFIGD)/access.conf
 
+DEFS=-DDEFAULT_CONF_FILE=\"$(INSTALLED_CONFILE)\"
 CFLAGS += $(DEFS)
 
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-		$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-	$(MKDIR) $(FAKEROOT)$(SCONFIGED)
-	bash -f ./install_conf
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-	rm -f $(FAKEROOT)$(CONFILE)
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-	rm -f ./.ignore_age
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak
+MODULE_SIMPLE_INSTALL=bash -f ../install_conf "$(FAKEROOT)" "$(SCONFIGD)" "$(INSTALLED_CONFILE)" "$(TITLE)" "$(LOCAL_CONFILE)"
+MODULE_SIMPLE_REMOVE=rm -f $(FAKEROOT)$(INSTALLED_CONFILE)
+MODULE_SIMPLE_CLEAN=rm -f ./.ignore_age
 
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+include ../Simple.Rules
diff --git a/modules/pam_access/pam_access.c b/modules/pam_access/pam_access.c
index 12133392..b8722646 100644
--- a/modules/pam_access/pam_access.c
+++ b/modules/pam_access/pam_access.c
@@ -7,10 +7,7 @@
  *
  */
 
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -59,7 +56,11 @@ static void _log_err(const char *format, ... )
     closelog();
 }
 
-#define PAM_ACCESS_CONFIG CONFILE
+#ifdef DEFAULT_CONF_FILE
+# define PAM_ACCESS_CONFIG DEFAULT_CONF_FILE
+#else
+# define PAM_ACCESS_CONFIG "/etc/security/access.conf"
+#endif
 
 int strcasecmp(const char *s1, const char *s2);
 
diff --git a/modules/pam_cracklib/Makefile b/modules/pam_cracklib/Makefile
index 554362d4..c279857c 100644
--- a/modules/pam_cracklib/Makefile
+++ b/modules/pam_cracklib/Makefile
@@ -1,118 +1,31 @@
 #
+# $Id$
+#
 # This Makefile controls a build process of $(TITLE) module for
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# Created by Cristian Gafton <gafton@redhat.com> 1996/09/10
-#
-
-ifndef FULL_LINUX_PAM_SOURCE_TREE
-#
-# here you should make default variable defines...
-#
-MKDIR=mkdir -p
-LD_D=gcc -shared -Xlinker -x
-INSTALL=install
-SECUREDIR=/usr/lib/security
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/10/08
 #
-HAVE_CRACKLIB=yes
-EXTRALS=-lcrypt
-endif
 
-ifeq ($(HAVE_CRACKLIB),yes)
+include ../../Make.Rules
 
 TITLE=pam_cracklib
-CRACKLIB=-lcrack
-ifeq ($(shell if [ -f /usr/lib/cracklib_dict.hwm ]; then echo yes ; fi),yes)
- CRACKLIB_DICTPATH=/usr/lib/cracklib_dict
-else
- CRACKLIB_DICTPATH=/usr/share/dict/cracklib_dict
-endif
-#
-ifeq ($(shell if [ -f /usr/include/crypt.h ]; then echo yes ; fi),yes)
- NEED_CRYPT_HEADER=-DNEED_CRYPT_HEADER
-endif
-#
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-ifdef CRACKLIB_DICTPATH
-CFLAGS+=-DCRACKLIB_DICTPATH=\"$(CRACKLIB_DICTPATH)\"
-endif
-
-dynamic/%.o : %.c
-	$(CC) $(NEED_CRYPT_HEADER) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(NEED_CRYPT_HEADER) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
 
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC) Makefile
+ifeq ($(HAVE_LIBCRACK),yes)
+BUILD_THIS_MODULE=yes
+MODULE_SIMPLE_EXTRALIBS=-lcrack
 
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD) $(CRACKLIB) $(EXTRALS) $(LINKLIBS)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
+# These two should really be provided by ../../pam_aconf.h
+CFLAGS+=-DCRACKLIB_DICTPATH=\"$(CRACKLIB_DICTPATH)\"
+ifeq ($(HAVE_LIBCRYPT),yes)
+ CFLAGS+=-DNEED_CRYPT_HEADER
 endif
 
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
 endif
 
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~ *.so
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
-
+ifeq ($(BUILD_THIS_MODULE),yes)
+ include ../Simple.Rules
 else
-
-include ../dont_makefile
-
+ include ../dont_makefile
 endif
diff --git a/modules/pam_deny/Makefile b/modules/pam_deny/Makefile
index e6fa2e60..7dd7b4fd 100644
--- a/modules/pam_deny/Makefile
+++ b/modules/pam_deny/Makefile
@@ -5,127 +5,11 @@
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# $Log$
-# Revision 1.1  2000/06/20 22:11:33  agmorgan
-# Initial revision
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
-# Revision 1.1.1.1  1998/07/12 05:17:16  morgan
-# Linux PAM sources pre-0.66
-#
-# Revision 1.7  1997/04/05 06:43:41  morgan
-# full-source-tree and fakeroot
-#
-# Revision 1.6  1997/02/15 19:04:27  morgan
-# fixed email
-#
-# Revision 1.5  1996/11/10 20:11:48  morgan
-# crossplatform support
-#
-# Revision 1.4  1996/09/05 06:50:12  morgan
-# ld --> gcc
-#
-# Revision 1.3  1996/05/26 15:48:38  morgan
-# make dynamic and static dirs
-#
-# Revision 1.2  1996/05/26 04:00:16  morgan
-# changes for automated static/dynamic modules
-#
-# Revision 1.1  1996/03/16 17:47:36  morgan
-# Initial revision
-#
-#
-# Created by Andrew Morgan <morgan@parc.power.net> 1996/3/11
-#
-
-# Convenient defaults for compiling independently of the full source
-# tree.
-ifndef FULL_LINUX_PAM_SOURCE_TREE
-export DYNAMIC=-DPAM_DYNAMIC
-export CC=gcc
-export CFLAGS=-O2 -Dlinux -DLINUX_PAM \
-       -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
-       -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional \
-       -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
-       -Wshadow -pedantic -fPIC
-export MKDIR=mkdir -p
-export LD_D=gcc -shared -Xlinker -x
-endif
 
-#
+include ../../Make.Rules
 
 TITLE=pam_deny
 
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-		$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
-
+include ../Simple.Rules
diff --git a/modules/pam_env/Makefile b/modules/pam_env/Makefile
index e872d1ee..fa711ce3 100644
--- a/modules/pam_env/Makefile
+++ b/modules/pam_env/Makefile
@@ -5,107 +5,18 @@
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# $Log$
-# Revision 1.1  2000/06/20 22:11:33  agmorgan
-# Initial revision
-#
-# Revision 1.2  1999/10/09 05:08:28  morgan
-# removed libpwdb dependencies (libpwdb support is depreciated)
-#
-# Revision 1.1.1.1  1998/07/12 05:17:16  morgan
-# Linux PAM sources pre-0.66
-#
-# Revision 1.1  1997/04/05 06:42:35  morgan
-# Initial revision
-#
-# Revision 1.1  1997/01/04 20:32:52  morgan
-# Initial revision
-#
-# Created by Andrew Morgan <morgan@parc.power.net> 1996/12/8
-# Adaptations by Dave Kinclea and Cristian Gafton
-#
-
-TITLE=pam_env
-
-CONFD=$(CONFIGED)/security
-export CONFD
-CONFILE=$(CONFD)/pam_env.conf
-export CONFILE
-
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
+include ../../Make.Rules
 
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD) $(EXTRALIB)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS) $(EXTRALIB)
-endif
-
-install: all
-ifdef DYNAMIC
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-	$(MKDIR) $(FAKEROOT)$(SCONFIGED)
-	bash -f ./install_conf
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
+TITLE=pam_env
+LOCAL_CONFILE=./pam_env.conf-example
+INSTALLED_CONFILE=$(SCONFIGD)/pam_env.conf
 
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
+DEFS=-DDEFAULT_CONF_FILE=\"$(INSTALLED_CONFILE)\"
+CFLAGS += $(DEFS)
 
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+MODULE_SIMPLE_INSTALL=bash -f ../install_conf "$(FAKEROOT)" "$(SCONFIGD)" "$(INSTALLED_CONFILE)" "$(TITLE)" "$(LOCAL_CONFILE)"
+MODULE_SIMPLE_REMOVE=rm -f $(FAKEROOT)$(INSTALLED_CONFILE)
+MODULE_SIMPLE_CLEAN=rm -f ./.ignore_age
 
+include ../Simple.Rules
diff --git a/modules/pam_env/pam_env.c b/modules/pam_env/pam_env.c
index 5ba89268..f140f3cb 100644
--- a/modules/pam_env/pam_env.c
+++ b/modules/pam_env/pam_env.c
@@ -15,10 +15,8 @@
 #define DEFAULT_ETC_ENVFILE     "/etc/environment"
 #define DEFAULT_READ_ENVFILE    1
 
-#define _GNU_SOURCE
-#define _BSD_SOURCE
+#include <security/_pam_aconf.h>
 
-#include <features.h>
 #include <ctype.h>
 #include <errno.h>
 #include <pwd.h>
diff --git a/modules/pam_filter/Makefile b/modules/pam_filter/Makefile
index f4db56a9..97181663 100644
--- a/modules/pam_filter/Makefile
+++ b/modules/pam_filter/Makefile
@@ -14,13 +14,14 @@ include ../dont_makefile
 
 else
 
+include ../../Make.Rules
+
 TITLE=pam_filter
 FILTERS=upperLOWER
 FILTERSDIR=$(SUPLEMENTED)/pam_filter
 export FILTERSDIR
 
-CFLAGS += -I. -I..
-#
+CFLAGS += -Iinclude
 
 LIBSRC = $(TITLE).c
 LIBOBJ = $(TITLE).o
@@ -43,10 +44,6 @@ endif
 
 ####################### don't edit below #######################
 
-dummy:
-	@echo "**** This is not a top-level Makefile "
-	exit
-
 #
 # this is where we compile this module
 #
@@ -54,7 +51,7 @@ dummy:
 all: dirs $(LIBSHARED) $(LIBSTATIC) register filters
 
 dirs:
-	if [ ! -f security ]; then ln -sf include security ; fi
+	if [ ! -e include/security ]; then ln -sf . include/security ; fi
 ifdef DYNAMIC
 	$(MKDIR) ./dynamic
 endif
@@ -93,6 +90,15 @@ $(LIBSTATIC): $(LIBOBJS)
 	$(LD) -r -o $@ $(LIBOBJS)
 endif
 
+remove:
+	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
+	rm -f $(FAKEROOT)$(INCLUDED)/pam_filter.h
+	@for i in $(FILTERS) ; do \
+		if [ -d $$i ]; then \
+		   $(MAKE) -C $$i remove ; \
+		fi ; \
+	done
+
 install: all
 	@for i in $(FILTERS) ; do \
 		if [ -d $$i ]; then \
@@ -106,35 +112,15 @@ endif
 	$(MKDIR) $(FAKEROOT)$(INCLUDED)
 	$(INSTALL) -m 644 include/pam_filter.h $(FAKEROOT)$(INCLUDED)
 
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-	rm -f $(FAKEROOT)$(INCLUDED)/pam_filter.h
-	@for i in $(FILTERS) ; do \
-		if [ -d $$i ]; then \
-		   $(MAKE) -C $$i remove ; \
-		fi ; \
-	done
-
-lclean:
-	rm -f $(LIBSHARED) $(LIBOBJD) $(LIBOBJS) core *~
-
-clean: lclean
+clean:
 	@for i in $(FILTERS) ; do \
 		if [ -d $$i ]; then \
 		   $(MAKE) -C $$i clean ; \
 		fi ; \
 	done
-
-extraclean: lclean
-	@rm -f security
-	@rm -f *.a *.o *.so *.bak
-	for i in $(FILTERS) ; do \
-		if [ -d $$i ]; then \
-		   $(MAKE) -C $$i extraclean ; \
-		fi ; \
-	done
-
-security:
-	ln -s include security
+	rm -f $(LIBSHARED) $(LIBOBJD) $(LIBOBJS) core *~
+	rm -f include/security
+	rm -fr dynamic static
+	rm -f *.a *.o *.so *.bak
 
 endif
diff --git a/modules/pam_filter/pam_filter.c b/modules/pam_filter/pam_filter.c
index a1ba10b0..f67ec0d2 100644
--- a/modules/pam_filter/pam_filter.c
+++ b/modules/pam_filter/pam_filter.c
@@ -5,10 +5,7 @@
  * Richard Stevens' UNIX Network Programming book.
  */
 
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdlib.h>
 #include <syslog.h>
diff --git a/modules/pam_filter/upperLOWER/Makefile b/modules/pam_filter/upperLOWER/Makefile
index a75b06bb..6db8d6e3 100644
--- a/modules/pam_filter/upperLOWER/Makefile
+++ b/modules/pam_filter/upperLOWER/Makefile
@@ -1,50 +1,28 @@
 #
 # $Id$
 #
-# $Log$
-# Revision 1.1  2000/06/20 22:11:37  agmorgan
-# Initial revision
-#
-# Revision 1.1.1.1  1998/07/12 05:17:16  morgan
-# Linux PAM sources pre-0.66
-#
-# Revision 1.5  1997/04/05 06:41:35  morgan
-# fakeroot
-#
-# Revision 1.4  1997/01/04 20:25:04  morgan
-# removed need for make
-#
-# Revision 1.3  1996/11/10 20:13:08  morgan
-# email address
-#
-# Revision 1.2  1996/11/10 20:12:24  morgan
-# cross platform support
-#
-# Revision 1.1  1996/06/02 08:17:02  morgan
-# Initial revision
-#
-#
 # This directory contains a pam_filter filter executable
 #
-# Created by Andrew Morgan <morgan@parc.power.net> 1996/3/11
+# Created by Andrew Morgan <morgan@transmeta.com> 1996/3/11
 #
 
+include ../../../Make.Rules
+
 TITLE=upperLOWER
 
 #
 
+CFLAGS += -I../include
+
 OBJS = $(TITLE).o
 
 ####################### don't edit below #######################
 
-dummy:
-	@echo "**** This is not a top-level Makefile "
-
 all: $(TITLE)
 
 $(TITLE): $(OBJS)
 	$(CC) -o $(TITLE) $(OBJS)
-	strip $(TITLE)
+	$(STRIP) $(TITLE)
 
 install:
 	$(MKDIR) $(FAKEROOT)$(FILTERSDIR)
@@ -56,9 +34,6 @@ remove:
 clean:
 	rm -f $(TITLE) $(OBJS) core *~
 
-extraclean: clean
-	rm -f *.bak
-
 .c.o:	
 	$(CC) $(CFLAGS) -c $<
 
diff --git a/modules/pam_filter/upperLOWER/upperLOWER.c b/modules/pam_filter/upperLOWER/upperLOWER.c
index 3f7d26cd..c85a950a 100644
--- a/modules/pam_filter/upperLOWER/upperLOWER.c
+++ b/modules/pam_filter/upperLOWER/upperLOWER.c
@@ -5,26 +5,9 @@
  * provided with Linux-PAM). This filter simply transposes upper and
  * lower case letters, it is intended for demonstration purposes and
  * it serves no purpose other than to annoy the user...
- *
- * $Log$
- * Revision 1.1  2000/06/20 22:11:37  agmorgan
- * Initial revision
- *
- * Revision 1.2  1999/07/08 05:01:48  morgan
- * glibc fixes (Thorsten Kukuk, Adam J. Richter)
- *
- * Revision 1.1.1.1  1998/07/12 05:17:16  morgan
- * Linux PAM sources pre-0.66
- *
- * Revision 1.1  1996/06/02 08:17:02  morgan
- * Initial revision
- *
  */
 
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdio.h>
 #include <syslog.h>
@@ -66,7 +49,9 @@ static void do_transpose(char *buffer,int len)
      }
 }
 
-int main(int argc, char **argv, char **envp) 
+extern char **environ;
+
+int main(int argc, char **argv) 
 {
      char buffer[BUFSIZ];
      fd_set readers;
@@ -78,8 +63,8 @@ int main(int argc, char **argv, char **envp)
 	  int i;
 
 	  fprintf(stderr,"environment :[\r\n");
-	  for (i=0; envp[i]; ++i) {
-	       fprintf(stderr,"-> %s\r\n",envp[i]);
+	  for (i=0; environ[i]; ++i) {
+	       fprintf(stderr,"-> %s\r\n",environ[i]);
 	  }
 	  fprintf(stderr,"]: end\r\n");
      }
diff --git a/modules/pam_ftp/Makefile b/modules/pam_ftp/Makefile
index 0ce77a7a..fb61ac16 100644
--- a/modules/pam_ftp/Makefile
+++ b/modules/pam_ftp/Makefile
@@ -5,84 +5,11 @@
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# Created by Andrew Morgan <morgan@linux.kernel.org> 1996/11/14
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
 
-TITLE=pam_ftp
-
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
+include ../../Make.Rules
 
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+TITLE=pam_ftp
 
+include ../Simple.Rules
diff --git a/modules/pam_ftp/pam_ftp.c b/modules/pam_ftp/pam_ftp.c
index eb2c3fd9..bebcd2b2 100644
--- a/modules/pam_ftp/pam_ftp.c
+++ b/modules/pam_ftp/pam_ftp.c
@@ -14,10 +14,8 @@
 /* the following is a password that "can't be correct" */
 #define BLOCK_PASSWORD "\177BAD PASSWPRD\177"
 
-#define _GNU_SOURCE
-#define _BSD_SOURCE
+#include <security/_pam_aconf.h>
 
-#include <features.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/modules/pam_group/Makefile b/modules/pam_group/Makefile
index b61a57de..cb3c4c89 100644
--- a/modules/pam_group/Makefile
+++ b/modules/pam_group/Makefile
@@ -1,98 +1,21 @@
-#
 # $Id$
 #
 # This Makefile controls a build process of $(TITLE) module for
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
-#
-# Created by Andrew Morgan <morgan@linux.kernel.org> 1996/6/11
-#
-
-TITLE=pam_group
-CONFD=$(CONFIGED)/security
-export CONFD
-CONFILE=$(CONFD)/group.conf
-export CONFILE
-
 #
 
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
+include ../../Make.Rules
 
-DEFS=-DCONFILE=\"$(CONFILE)\"
+TITLE=pam_group
+LOCAL_CONFILE=./group.conf
+INSTALLED_CONFILE=$(SCONFIGD)/group.conf
 
+DEFS=-DDEFAULT_CONF_FILE=\"$(CONFILE)\"
 CFLAGS += $(DEFS)
 
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-		$(LD_D) -o $@ $(LIBOBJD) $(ELIBS)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS) $(ELIBS)
-endif
-
-install: all
-ifdef DYNAMIC
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-	$(MKDIR) $(FAKEROOT)$(SCONFIGED)
-	bash -f ./install_conf
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-	rm -f $(FAKEROOT)$(CONFILE)
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-	rm -f ./.ignore_age
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+MODULE_SIMPLE_INSTALL=bash -f ../install_conf "$(FAKEROOT)" "$(SCONFIGD)" "$(INSTALLED_CONFILE)" "$(TITLE)" "$(LOCAL_CONFILE)"
+MODULE_SIMPLE_REMOVE=rm -f $(FAKEROOT)$(INSTALLED_CONFILE)
+MODULE_SIMPLE_CLEAN=rm -f ./.ignore_age
 
+include ../Simple.Rules
diff --git a/modules/pam_group/pam_group.c b/modules/pam_group/pam_group.c
index 81953f76..2b820df2 100644
--- a/modules/pam_group/pam_group.c
+++ b/modules/pam_group/pam_group.c
@@ -28,7 +28,11 @@ const static char rcsid[] =
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#define PAM_GROUP_CONF          CONFILE /* from external define */
+#ifdef DEFAULT_CONF_FILE
+# define PAM_GROUP_CONF         DEFAULT_CONF_FILE /* from external define */
+#else
+# define PAM_GROUP_CONF         "/etc/security/group.conf"
+#endif
 #define PAM_GROUP_BUFLEN        1000
 #define FIELD_SEPARATOR         ';'   /* this is new as of .02 */
 
diff --git a/modules/pam_issue/Makefile b/modules/pam_issue/Makefile
index 6770ef36..d73710e1 100644
--- a/modules/pam_issue/Makefile
+++ b/modules/pam_issue/Makefile
@@ -1,86 +1,15 @@
 #
+# $Id$
+#
 # This Makefile controls a build process of $(TITLE) module for
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# Michael K. Johnson <johnsonm@redhat.com> 1996/10/24
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
 
-TITLE=pam_issue
-
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
+include ../../Make.Rules
 
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	mkdir -p ./dynamic
-endif
-ifdef STATIC
-	mkdir -p ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-		$(LD_D) -o $@ $(LIBOBJD) $(LINKLIBS)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	mkdir -p $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	install -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+TITLE=pam_issue
 
+include ../Simple.Rules
diff --git a/modules/pam_lastlog/Makefile b/modules/pam_lastlog/Makefile
index b5a6f212..31035a99 100644
--- a/modules/pam_lastlog/Makefile
+++ b/modules/pam_lastlog/Makefile
@@ -5,108 +5,11 @@
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# $Log$
-# Revision 1.1  2000/06/20 22:11:40  agmorgan
-# Initial revision
-#
-# Revision 1.1.1.1  1998/07/12 05:17:17  morgan
-# Linux PAM sources pre-0.66
-#
-# Revision 1.2  1997/04/05 06:17:14  morgan
-# fakeroot fixed
-#
-# Revision 1.1  1997/01/04 20:29:28  morgan
-# Initial revision
-#
-#
-#
-# Created by Andrew Morgan <morgan@parc.power.net> 1996/12/8
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
 
-# Convenient defaults for compiling independently of the full source
-# tree.
-ifndef FULL_LINUX_PAM_SOURCE_TREE
-export DYNAMIC=-DPAM_DYNAMIC
-export CC=gcc
-export CFLAGS=-O2 -Dlinux -DLINUX_PAM \
-       -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
-       -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional \
-       -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
-       -Wshadow -pedantic -fPIC
-export MKDIR=mkdir -p
-export LD_D=gcc -shared -Xlinker -x
-endif
+include ../../Make.Rules
 
 TITLE=pam_lastlog
 
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-
-####################### don't edit below #######################
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
-
+include ../Simple.Rules
diff --git a/modules/pam_lastlog/pam_lastlog.c b/modules/pam_lastlog/pam_lastlog.c
index 7207976e..05c3c083 100644
--- a/modules/pam_lastlog/pam_lastlog.c
+++ b/modules/pam_lastlog/pam_lastlog.c
@@ -10,10 +10,7 @@
  * present (login) service.
  */
 
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <fcntl.h>
 #include <time.h>
@@ -28,6 +25,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
+#define __USE_BSD
 #include <syslog.h>
 #include <unistd.h>
 
diff --git a/modules/pam_limits/Makefile b/modules/pam_limits/Makefile
index fe684863..9473d915 100644
--- a/modules/pam_limits/Makefile
+++ b/modules/pam_limits/Makefile
@@ -1,98 +1,31 @@
 #
+# $Id$
+#
 # This Makefile controls a build process of $(TITLE) module for
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# Created by Cristian Gafton <gafton@redhat.com> 1996/09/10
-#
-
-ifeq ($(OS),linux)
-TITLE=pam_limits
-CONFD=$(CONFIGED)/security
-export CONFD
-CONFILE=$(CONFD)/limits.conf
-export CONFILE
-
-CFLAGS+=-DLIMITS_FILE=\"$(CONFILE)\"
-
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
 
-dummy:
+include ../../Make.Rules
 
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
+TITLE=pam_limits
 
-install: all
-ifdef DYNAMIC
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-	$(MKDIR) $(FAKEROOT)$(SCONFIGED)
-	bash -f ./install_conf
+ifeq ($(OS),linux)
 
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
+LOCAL_CONFILE=./limits.skel
+INSTALLED_CONFILE=$(SCONFIGD)/limits.conf
 
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~ *.so
+DEFS=-DDEFAULT_CONF_FILE=\"$(INSTALLED_CONFILE)\"
+CFLAGS += $(DEFS)
 
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
+MODULE_SIMPLE_INSTALL=bash -f ../install_conf "$(FAKEROOT)" "$(SCONFIGD)" "$(INSTALLED_CONFILE)" "$(TITLE)" "$(LOCAL_CONFILE)"
+MODULE_SIMPLE_REMOVE=rm -f $(FAKEROOT)$(INSTALLED_CONFILE)
+MODULE_SIMPLE_CLEAN=rm -f ./.ignore_age
 
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+include ../Simple.Rules
 
 else
+
 include ../dont_makefile
+
 endif
diff --git a/modules/pam_limits/pam_limits.c b/modules/pam_limits/pam_limits.c
index e832dc63..8ecb5682 100644
--- a/modules/pam_limits/pam_limits.c
+++ b/modules/pam_limits/pam_limits.c
@@ -17,10 +17,7 @@
 #error THIS CODE IS KNOWN TO WORK ONLY ON LINUX !!!
 #endif 
 
-#define _GNU_SOURCE
-#define _BSD_SOURCE
-
-#include <features.h>
+#include <security/_pam_aconf.h>
 
 #include <stdio.h>
 #include <unistd.h>
@@ -119,8 +116,10 @@ static int _pam_parse(int argc, const char **argv)
 
 
 /* limits stuff */
-#ifndef LIMITS_FILE
-#define LIMITS_FILE "/etc/security/limits.conf"
+#ifdef DEFAULT_CONF_FILE
+# define LIMITS_FILE DEFAULT_CONF_FILE
+#else
+# define LIMITS_FILE "/etc/security/limits.conf"
 #endif
 
 #define LIMIT_ERR 1 /* error setting a limit */
diff --git a/modules/pam_listfile/Makefile b/modules/pam_listfile/Makefile
index 02940390..18315256 100644
--- a/modules/pam_listfile/Makefile
+++ b/modules/pam_listfile/Makefile
@@ -1,84 +1,15 @@
 #
+# $Id$
+#
 # This Makefile controls a build process of $(TITLE) module for
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-
-TITLE=pam_listfile
-
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
 
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
+include ../../Make.Rules
 
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-		$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+TITLE=pam_listfile
 
+include ../Simple.Rules
diff --git a/modules/pam_listfile/pam_listfile.c b/modules/pam_listfile/pam_listfile.c
index 8b1b45f0..5a8c83e0 100644
--- a/modules/pam_listfile/pam_listfile.c
+++ b/modules/pam_listfile/pam_listfile.c
@@ -10,15 +10,7 @@
  * This code began life as the pam_rootok module.
  */
 
-#ifdef linux
-# define _SVID_SOURCE
-# define _BSD_SOURCE
-# define __USE_BSD
-# define __USE_SVID
-# define __USE_MISC
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/modules/pam_mail/Makefile b/modules/pam_mail/Makefile
index 64f73b0b..93ca429b 100644
--- a/modules/pam_mail/Makefile
+++ b/modules/pam_mail/Makefile
@@ -5,109 +5,11 @@
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# $Log$
-# Revision 1.1  2000/06/20 22:11:45  agmorgan
-# Initial revision
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
-# Revision 1.1.1.1  1998/07/12 05:17:17  morgan
-# Linux PAM sources pre-0.66
-#
-# Revision 1.3  1997/04/05 06:37:45  morgan
-# fakeroot
-#
-# Revision 1.2  1997/02/15 16:07:22  morgan
-# optional libpwdb compilation
-#
-# Revision 1.1  1997/01/04 20:32:52  morgan
-# Initial revision
-#
-#
-#
-# Created by Andrew Morgan <morgan@parc.power.net> 1996/12/8
-#
-
-TITLE=pam_mail
-
-ifndef STATIC
-ifeq ($(HAVE_PWDBLIB),yes)
-CFLAGS += -DWANT_PWDB
-EXTRALIB = -lpwdb
-endif
-endif
-
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
 
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
+include ../../Make.Rules
 
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD) $(EXTRALIB)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS) $(EXTRALIB)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+TITLE=pam_mail
 
+include ../Simple.Rules
diff --git a/modules/pam_mail/pam_mail.c b/modules/pam_mail/pam_mail.c
index f67b6f02..4f1152b3 100644
--- a/modules/pam_mail/pam_mail.c
+++ b/modules/pam_mail/pam_mail.c
@@ -16,12 +16,7 @@
 #define YOUR_MAIL_STANDARD_FORMAT "You have %smail."
 #define NO_MAIL_STANDARD_FORMAT   "No mail." 
 
-#define _BSD_SOURCE
-
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <ctype.h>
 #include <pwd.h>
diff --git a/modules/pam_mkhomedir/Makefile b/modules/pam_mkhomedir/Makefile
index fa79b489..d518c26f 100644
--- a/modules/pam_mkhomedir/Makefile
+++ b/modules/pam_mkhomedir/Makefile
@@ -5,86 +5,11 @@
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# Created by Andrew Morgan <morgan@parc.power.net> 1996/3/11
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
 
-# Convenient defaults for compiling independently of the full source
-# tree.
-
-#
+include ../../Make.Rules
 
 TITLE=pam_mkhomedir
 
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-		$(LD_D) -o $@ $(LIBOBJD) $(LINKLIBS)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+include ../Simple.Rules
diff --git a/modules/pam_motd/Makefile b/modules/pam_motd/Makefile
index ef9f3113..ae4acb8c 100644
--- a/modules/pam_motd/Makefile
+++ b/modules/pam_motd/Makefile
@@ -5,86 +5,11 @@
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# Created by Andrew Morgan <morgan@parc.power.net> 1996/3/11
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
 
-# Convenient defaults for compiling independently of the full source
-# tree.
-
-#
+include ../../Make.Rules
 
 TITLE=pam_motd
 
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-		$(LD_D) -o $@ $(LIBOBJD) $(LINKLIBS)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+include ../Simple.Rules
diff --git a/modules/pam_nologin/Makefile b/modules/pam_nologin/Makefile
index 03d779bf..130787e7 100644
--- a/modules/pam_nologin/Makefile
+++ b/modules/pam_nologin/Makefile
@@ -1,86 +1,15 @@
 #
+# $Id$
+#
 # This Makefile controls a build process of $(TITLE) module for
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# Michael K. Johnson <johnsonm@redhat.com> 1996/10/24
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
 
-TITLE=pam_nologin
-
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
+include ../../Make.Rules
 
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	mkdir -p ./dynamic
-endif
-ifdef STATIC
-	mkdir -p ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-		$(LD_D) -o $@ $(LIBOBJD) -lc
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	mkdir -p $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	install -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+TITLE=pam_nologin
 
+include ../Simple.Rules
diff --git a/modules/pam_permit/Makefile b/modules/pam_permit/Makefile
index c291599e..b4cc3b5b 100644
--- a/modules/pam_permit/Makefile
+++ b/modules/pam_permit/Makefile
@@ -5,128 +5,11 @@
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# $Log$
-# Revision 1.1  2000/06/20 22:11:46  agmorgan
-# Initial revision
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
-# Revision 1.1.1.1  1998/07/12 05:17:16  morgan
-# Linux PAM sources pre-0.66
-#
-# Revision 1.8  1997/04/05 06:33:25  morgan
-# fakeroot
-#
-# Revision 1.7  1997/02/15 19:02:27  morgan
-# updated email address
-#
-# Revision 1.6  1996/11/10 20:14:34  morgan
-# cross platform support
-#
-# Revision 1.5  1996/09/05 06:32:45  morgan
-# ld --> gcc
-#
-# Revision 1.4  1996/05/26 15:49:25  morgan
-# make dynamic and static dirs
-#
-# Revision 1.3  1996/05/26 04:04:26  morgan
-# automated static support
-#
-# Revision 1.2  1996/03/16 17:56:38  morgan
-# tidied up
-#
-#
-# Created by Andrew Morgan <morgan@parc.power.net> 1996/3/11
-#
-
-# Convenient defaults for compiling independently of the full source
-# tree.
-ifndef FULL_LINUX_PAM_SOURCE_TREE
-export DYNAMIC=-DPAM_DYNAMIC
-export CC=gcc
-export CFLAGS=-O2 -Dlinux -DLINUX_PAM \
-       -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
-       -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional \
-       -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
-       -Wshadow -pedantic -fPIC
-export MKDIR=mkdir -p
-export LD_D=gcc -shared -Xlinker -x
-endif
 
-#
-#
+include ../../Make.Rules
 
 TITLE=pam_permit
 
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(TARGET_ARCH) -c $< -o $@
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-endif
-
-ifdef DYNAMIC
-$(LIBSHARED):	$(LIBOBJD)
-		$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-endif
-
-ifdef STATIC
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
-
+include ../Simple.Rules
diff --git a/modules/pam_pwdb/Makefile b/modules/pam_pwdb/Makefile
index fcb7aec4..2b581dcd 100644
--- a/modules/pam_pwdb/Makefile
+++ b/modules/pam_pwdb/Makefile
@@ -7,46 +7,20 @@
 # <morgan@parc.power.net> 1996/11/6
 #
 
-#
-# Note, the STATIC module is commented out because it doesn't work.
-# please fix!
-#
+include ../../Make.Rules
 
-ifndef FULL_LINUX_PAM_SOURCE_TREE
-export DYNAMIC=-DPAM_DYNAMIC
-export CC=gcc
-export CFLAGS=-O2 -Dlinux -DLINUX_PAM \
-       -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
-       -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional \
-       -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
-       -Wshadow -pedantic -fPIC
-export MKDIR=mkdir -p
-export LD_D=gcc -shared -Xlinker -x
-export HAVE_PWDBLIB=yes
-endif
+ifeq ($(HAVE_LIBPWDB),yes)
 
-ifeq ($(shell if [ -f /lib/libcrypt.so.* ]; then echo yes ; else echo no ; fi),yes)
-EXTRALS += -lcrypt
-endif
+EXTRALS += -lpwdb 
+EXTRAS += -DCHKPWD_HELPER=\"$(SUPLEMENTED)/$(CHKPWD)\"
 
-ifeq ($(HAVE_PWDBLIB),yes)
+ifeq ($(HAVE_LIBCRYPT),yes)
+  EXTRALS += -lcrypt
+endif
 
 TITLE=pam_pwdb
 CHKPWD=pwdb_chkpwd
 
-# compilation flags
-EXTRAS=
-# extra object files
-PLUS=
-# extra files that may be needed to be created
-CREATE=
-
-# NOTE: this module links dynamically to the libpwdb library.
-EXTRALS += -lpwdb 
-EXTRAS += -DCHKPWD_HELPER=\"$(SUPLEMENTED)/$(CHKPWD)\"
-
-########################### don't edit below ##########################
-
 LIBSRC = $(TITLE).c
 LIBOBJ = $(TITLE).o
 LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
@@ -132,7 +106,7 @@ ifdef DYNAMIC
 	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
 endif
 	$(MKDIR) $(FAKEROOT)$(SUPLEMENTED)
-	$(INSTALL) -m 4555 -o root -g root $(CHKPWD) $(FAKEROOT)$(SUPLEMENTED)
+	$(INSTALL) -m 4555 $(CHKPWD) $(FAKEROOT)$(SUPLEMENTED)
 
 remove:
 	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
@@ -140,54 +114,11 @@ remove:
 
 clean:
 	rm -f $(CHKPWD) $(LIBOBJD) $(LIBOBJS) $(MOREDELS) core *~ *.o *.so
-
-extraclean: clean
 	rm -f *.a *.o *.so *.bak
+	rm -fr dynamic static
 
 else
 
 include ../dont_makefile
 
 endif
-
-#####################################################################
-# $Log$
-# Revision 1.1  2000/06/20 22:11:47  agmorgan
-# Initial revision
-#
-# Revision 1.4  1999/08/01 16:18:27  morgan
-# added a conditional for libcrypt
-#
-# Revision 1.3  1999/07/08 05:02:02  morgan
-# glibc fixes (Thorsten Kukuk, Adam J. Richter)
-#
-# Revision 1.2  1999/07/04 23:22:38  morgan
-# Andrey's MD5 (bigendian) work around + cleanup to address problems with
-# applications that let an (ab)user kill them off without giving PAM the
-# opportunity to end. [Problem report from Tani Hosokawa on bugtraq.]
-#
-# Revision 1.1.1.1  1998/07/12 05:17:16  morgan
-# Linux PAM sources pre-0.66
-#
-# Revision 1.7  1997/04/05 06:28:50  morgan
-# fakeroot
-#
-# Revision 1.6  1997/02/15 17:25:32  morgan
-# update for .56 . extra commands for new helper binary
-#
-# Revision 1.5  1997/01/04 20:39:08  morgan
-# conditional on having libpwdb
-#
-# Revision 1.4  1996/12/01 03:02:03  morgan
-# changed banner, removed linking libraries
-#
-# Revision 1.3  1996/11/10 20:14:42  morgan
-# cross platform support
-#
-# Revision 1.2  1996/09/05 06:36:49  morgan
-# options added and use of LD altered
-#
-# Revision 1.1  1996/08/29 13:23:29  morgan
-# Initial revision
-#
-#
diff --git a/modules/pam_pwdb/pam_pwdb.c b/modules/pam_pwdb/pam_pwdb.c
index 4d335572..d736c6a8 100644
--- a/modules/pam_pwdb/pam_pwdb.c
+++ b/modules/pam_pwdb/pam_pwdb.c
@@ -20,14 +20,7 @@ static const char rcsid[] =
 
 /* #define DEBUG */
 
-#define _SVID_SOURCE
-#define _BSD_SOURCE
-#define _BSD_COMPAT
-
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <sys/types.h>
 #include <stdarg.h>
diff --git a/modules/pam_pwdb/pwdb_chkpwd.c b/modules/pam_pwdb/pwdb_chkpwd.c
index 2c7ba29c..fdd3cfa3 100644
--- a/modules/pam_pwdb/pwdb_chkpwd.c
+++ b/modules/pam_pwdb/pwdb_chkpwd.c
@@ -13,12 +13,7 @@
  *
  */
 
-#define _BSD_SOURCE
-
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdarg.h>
 #include <stdio.h>
diff --git a/modules/pam_radius/Makefile b/modules/pam_radius/Makefile
index a74b911f..aa149d3e 100644
--- a/modules/pam_radius/Makefile
+++ b/modules/pam_radius/Makefile
@@ -8,13 +8,15 @@
 # STATIC modules are not supported
 #
 
+include ../../Make.Rules
+
 TITLE=pam_radius
 CONFD=$(CONFIGED)/security
 export CONFD
 CONFILE=$(CONFD)/radius.conf
 export CONFILE
 
-ifeq ($(HAVE_PWDBLIB),yes)
+ifeq ($(HAVE_LIBPWDB),yes)
 
 #
 
@@ -41,11 +43,6 @@ endif
 
 ####################### don't edit below #######################
 
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
-
 all: dirs $(LIBSHARED) $(LIBSTATIC) register
 
 dirs:
@@ -85,9 +82,8 @@ remove:
 
 clean:
 	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
 	rm -f *.a *.o *.so *.bak dynamic/* static/*
+	rm -rf dynamic static
 
 .c.o:	
 	$(CC) $(CFLAGS) -c $<
diff --git a/modules/pam_radius/pam_radius.h b/modules/pam_radius/pam_radius.h
index 1f860eb5..8cee7ff1 100644
--- a/modules/pam_radius/pam_radius.h
+++ b/modules/pam_radius/pam_radius.h
@@ -1,9 +1,11 @@
+/*
+ * $Id$
+ */
 
 #ifndef PAM_RADIUS_H
 #define PAM_RADIUS_H
 
-#define _GNU_SOURCE
-#include <features.h>
+#include <security/_pam_aconf.h>
 
 #include <stdio.h>
 
diff --git a/modules/pam_rhosts/Makefile b/modules/pam_rhosts/Makefile
index 431842b2..46d75d6a 100644
--- a/modules/pam_rhosts/Makefile
+++ b/modules/pam_rhosts/Makefile
@@ -1,98 +1,15 @@
-# This Makefile controls a build process of the pam_rhosts modules
-# for Linux-PAM. You should not modify this Makefile.
+#
+# $Id$
+#
+# This Makefile controls a build process of $(TITLE) module for
+# Linux-PAM. You should not modify this Makefile (unless you know
+# what you are doing!).
+#
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
+#
 
-LIBAUTHOBJ = pam_rhosts_auth.o
-LIBAUTHSRC = pam_rhosts_auth.c
-LIBSESSOBJ =
-LIBSESSSRC =
-LIBPASSWDSRC =
-LIBPASSWDOBJ =
-LIBOBJ = $(LIBAUTHOBJ) $(LIBSESSOBJ) $(LIBPASSWDOBJ)
-LIBSRC = $(LIBAUTHSRC) $(LIBSESSSRC) $(LIBPASSWDSRC)
+include ../../Make.Rules
 
-ifdef STATIC
-LIBSTATIC = libpam_rhosts.o
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-endif
+TITLE=pam_rhosts_auth
 
-ifdef DYNAMIC
-LIBSESSSH =
-LIBAUTHSH = pam_rhosts_auth.so
-LIBPASSWDSH =
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBSHARED = $(LIBSESSSH) $(LIBAUTHSH) $(LIBPASSWDSH)
-endif
-
-ifeq ($(shell if [ -f /usr/include/fsuid.h ]; then echo yes ; fi),yes)
- CFLAGS += -DNEED_FSUID_H
-endif
-
-####################### don't edit below #######################
-
-dummy:
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; \
-	  ./register_static pam_rhosts_auth pam_rhosts/libpam_rhosts.o )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-endif
-
-ifdef DYNAMIC
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-endif
-
-ifdef STATIC
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-
-endif
-
-#.c.o:	
-#	$(CC) -c $(CFLAGS) $<
-
-install: all
-ifdef DYNAMIC
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-# tidy up
-
-remove:
-	cd $(FAKEROOT)$(SECUREDIR) && rm -f $(LIBSHARED)
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) a.out core *~
-
-extraclean:
-	rm -f *.a *.out *.o *.so *.bak dynamic/* static/*
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
+include ../Simple.Rules
diff --git a/modules/pam_rootok/Makefile b/modules/pam_rootok/Makefile
index f3f2e53d..3460c2a2 100644
--- a/modules/pam_rootok/Makefile
+++ b/modules/pam_rootok/Makefile
@@ -5,113 +5,11 @@
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# $Log$
-# Revision 1.1  2000/06/20 22:11:56  agmorgan
-# Initial revision
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
-# Revision 1.1.1.1  1998/07/12 05:17:16  morgan
-# Linux PAM sources pre-0.66
-#
-# Revision 1.7  1997/04/05 06:25:20  morgan
-# fakeroot
-#
-# Revision 1.6  1997/02/15 19:15:50  morgan
-# fixed email
-#
-# Revision 1.5  1996/11/10 20:16:10  morgan
-# cross platform support
-#
-# Revision 1.4  1996/09/05 06:29:36  morgan
-# ld --> gcc
-#
-# Revision 1.3  1996/05/26 15:47:46  morgan
-# make dynamic/static dirs!
-#
-# Revision 1.2  1996/05/26 04:04:53  morgan
-# automated static support
-#
-# Revision 1.1  1996/05/05 17:14:15  morgan
-# Initial revision
-#
-#
-# Created by Andrew Morgan <morgan@parc.power.net> 1996/5/5
-#
-
-TITLE=pam_rootok
-
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
+include ../../Make.Rules
 
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+TITLE=pam_rootok
 
+include ../Simple.Rules
diff --git a/modules/pam_securetty/Makefile b/modules/pam_securetty/Makefile
index d8a09ea1..9b80d2e9 100644
--- a/modules/pam_securetty/Makefile
+++ b/modules/pam_securetty/Makefile
@@ -1,83 +1,15 @@
 #
+# $Id$
+#
 # This Makefile controls a build process of $(TITLE) module for
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-
-TITLE=pam_securetty
-
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
 
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
+include ../../Make.Rules
 
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
+TITLE=pam_securetty
 
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+include ../Simple.Rules
diff --git a/modules/pam_shells/Makefile b/modules/pam_shells/Makefile
index 121b19a0..b057dc00 100644
--- a/modules/pam_shells/Makefile
+++ b/modules/pam_shells/Makefile
@@ -1,84 +1,15 @@
 #
+# $Id$
+#
 # This Makefile controls a build process of $(TITLE) module for
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-
-TITLE=pam_shells
-
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
 
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
+include ../../Make.Rules
 
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+TITLE=pam_shells
 
+include ../Simple.Rules
diff --git a/modules/pam_stress/Makefile b/modules/pam_stress/Makefile
index 1bcfa502..598809a5 100644
--- a/modules/pam_stress/Makefile
+++ b/modules/pam_stress/Makefile
@@ -1,115 +1,15 @@
 #
 # $Id$
 #
-# Created by Andrew Morgan <morgan@parc.power.net> 1996/3/11
-#
 # This Makefile controls a build process of $(TITLE) module for
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# $Log$
-# Revision 1.1  2000/06/20 22:11:57  agmorgan
-# Initial revision
-#
-# Revision 1.1.1.1  1998/07/12 05:17:16  morgan
-# Linux PAM sources pre-0.66
-#
-# Revision 1.7  1997/04/05 06:23:08  morgan
-# fakeroot
-#
-# Revision 1.6  1997/02/15 19:05:55  morgan
-# fixed email
-#
-# Revision 1.5  1996/11/10 20:17:55  morgan
-# cross platform support
-#
-# Revision 1.4  1996/09/05 06:31:09  morgan
-# ld --> gcc
-#
-# Revision 1.3  1996/05/26 15:50:43  morgan
-# make dynamic and static dirs
-#
-# Revision 1.2  1996/05/26 04:11:56  morgan
-# automated static support
-#
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
-#
-
-TITLE=pam_stress
-
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
+include ../../Make.Rules
 
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-		$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+TITLE=pam_stress
 
+include ../Simple.Rules
diff --git a/modules/pam_stress/pam_stress.c b/modules/pam_stress/pam_stress.c
index e5813579..f5126fd2 100644
--- a/modules/pam_stress/pam_stress.c
+++ b/modules/pam_stress/pam_stress.c
@@ -5,14 +5,14 @@
  * created by Andrew Morgan <morgan@linux.kernel.org> 1996/3/12
  */
 
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdlib.h>
 #include <stdio.h>
+
+#define __USE_BSD
 #include <syslog.h>
+
 #include <stdarg.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/modules/pam_tally/Makefile b/modules/pam_tally/Makefile
index 78ce621d..7949b558 100644
--- a/modules/pam_tally/Makefile
+++ b/modules/pam_tally/Makefile
@@ -7,6 +7,8 @@
 #
 #
 
+include ../../Make.Rules
+
 TITLE=pam_tally
 
 #
@@ -44,14 +46,7 @@ APPMODE = 755
 
 ####################### don't edit below #######################
 
-dummy:
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-# we're not yet in a position to build this. If you want it, build it
-# separately...
-# $(APPLICATION)
+all: dirs $(LIBSHARED) $(LIBSTATIC) register $(APPLICATION)
 
 dirs:
 ifdef DYNAMIC
@@ -101,9 +96,8 @@ remove:
 
 clean:
 	rm -f $(LIBOBJD) $(LIBOBJS) $(APPOBJD) $(APPOBJS) core *~
-
-extraclean: clean
 	rm -f *.a *.o *.so *.bak dynamic/* static/* $(APPLICATION)
+	rm -rf dynamic static
 
 .c.o:   
 	$(CC) $(CFLAGS) -c $<
diff --git a/modules/pam_tally/pam_tally.c b/modules/pam_tally/pam_tally.c
index ff75697d..436ce956 100644
--- a/modules/pam_tally/pam_tally.c
+++ b/modules/pam_tally/pam_tally.c
@@ -11,10 +11,7 @@
  * Stuff stolen from pam_rootok and pam_listfile
  */
 
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdio.h>
 #include <string.h>
@@ -70,7 +67,9 @@ enum TALLY_RESET {
 #endif
 
 static struct faillog faillog;
+#ifndef MAIN
 static time_t fail_time;
+#endif /* ndef MAIN */
 
 /*---------------------------------------------------------------------*/
 
diff --git a/modules/pam_time/Makefile b/modules/pam_time/Makefile
index 03105bb1..9c2d0eb3 100644
--- a/modules/pam_time/Makefile
+++ b/modules/pam_time/Makefile
@@ -1,98 +1,21 @@
-#
 # $Id$
 #
 # This Makefile controls a build process of $(TITLE) module for
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
-#
-# Created by Andrew Morgan <morgan@linux.kernel.org> 1996/6/11
-#
-
-TITLE=pam_time
-CONFD=$(CONFIGED)/security
-export CONFD
-CONFILE=$(CONFD)/time.conf
-export CONFILE
-
 #
 
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
+include ../../Make.Rules
 
-DEFS=-DCONFILE=\"$(CONFILE)\"
+TITLE=pam_time
+LOCAL_CONFILE=./time.conf
+INSTALLED_CONFILE=$(SCONFIGD)/time.conf
 
+DEFS=-DDEFAULT_CONF_FILE=\"$(INSTALLED_CONFILE)\"
 CFLAGS += $(DEFS)
 
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
-
-dummy:
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-		$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-ifdef DYNAMIC
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-	$(MKDIR) $(FAKEROOT)$(SCONFIGED)
-	bash -f ./install_conf
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-	rm -f $(FAKEROOT)$(CONFILE)
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-	rm -f ./.ignore_age
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+MODULE_SIMPLE_INSTALL=bash -f ../install_conf "$(FAKEROOT)" "$(SCONFIGD)" "$(INSTALLED_CONFILE)" "$(TITLE)" "$(LOCAL_CONFILE)"
+MODULE_SIMPLE_REMOVE=rm -f $(FAKEROOT)$(INSTALLED_CONFILE)
+MODULE_SIMPLE_CLEAN=rm -f ./.ignore_age
 
+include ../Simple.Rules
diff --git a/modules/pam_time/pam_time.c b/modules/pam_time/pam_time.c
index 2ca51859..b3ce0df9 100644
--- a/modules/pam_time/pam_time.c
+++ b/modules/pam_time/pam_time.c
@@ -13,10 +13,7 @@ const static char rcsid[] =
 "\t\tVersion 0.22 for Linux-PAM\n"
 "Copyright (C) Andrew G. Morgan 1996 <morgan@linux.kernel.org>\n";
 
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <sys/file.h>
 #include <stdio.h>
@@ -31,7 +28,11 @@ const static char rcsid[] =
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#define PAM_TIME_CONF          CONFILE /* from external define */
+#ifdef DEFAULT_CONF_FILE
+# define PAM_TIME_CONF         DEFAULT_CONF_FILE /* from external define */
+#else
+# define PAM_TIME_CONF         "/etc/security/time.conf"
+#endif
 #define PAM_TIME_BUFLEN        1000
 #define FIELD_SEPARATOR        ';'   /* this is new as of .02 */
 
diff --git a/modules/pam_unix/Makefile b/modules/pam_unix/Makefile
index 89b33cfd..dc0b6ac2 100644
--- a/modules/pam_unix/Makefile
+++ b/modules/pam_unix/Makefile
@@ -4,23 +4,35 @@
 # for Linux-PAM. You should not modify this Makefile.
 #
 
+include ../../Make.Rules
+
 ########################################################################
 # some options... uncomment to take effect
 ########################################################################
 
+# Unless someone wants to work out how to make this work with the new
+# autoconf stuff, you should use a separate module for this type of thing
+# pam_cracklib perhaps..?
 # do you want cracklib?
-ifeq ($(HAVE_CRACKLIB),yes)
-USE_CRACKLIB=-D"USE_CRACKLIB"
-endif
+#ifeq ($(HAVE_CRACKLIB),yes)
+#USE_CRACKLIB=-D"USE_CRACKLIB"
+#endif
 
 # do you want to use lckpwdf?
+ifeq ($(WITH_LCKPWDF),yes)
 USE_LCKPWDF=-D"USE_LCKPWDF"
-
 # do you need to include the locking functions in the source?
-#NEED_LCKPWDF=-D"NEED_LCKPWDF"
+ifeq ($(HAVE_LCKPWDF),no)
+  NEED_LCKPWDF=-D"NEED_LCKPWDF"
+endif
+endif
+
+ifeq ($(HAVE_LIBNSL),yes)
+  LIBNSL = -lnsl
+endif
 
-ifeq ($(shell ./need_nsl.sh),yes)
-LIBNSL = -lnsl
+ifeq ($(HAVE_LIBCRYPT),yes)
+  LIBCRYPT=-lcrypt
 endif
 
 CHKPWD=unix_chkpwd
@@ -95,20 +107,20 @@ ifdef DYNAMIC
 $(LIBOBJD): $(LIBSRC)
 
 $(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD) $(PLUS) $(CRACKLIB) $(LDLIBS) $(LIBNSL)
+	$(LD_D) -o $@ $(LIBOBJD) $(PLUS) $(CRACKLIB) $(LDLIBS) $(LIBNSL) $(LIBCRYPT)
 endif
 
 ifdef STATIC
 $(LIBOBJS): $(LIBSRC)
 
 $(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS) $(PLUS) $(CRACKLIB) $(LDLIBS) $(LIBNSL)
+	$(LD) -r -o $@ $(LIBOBJS) $(PLUS) $(CRACKLIB) $(LDLIBS) $(LIBNSL) $(LIBCRYPT)
 endif
 
 $(CHKPWD): unix_chkpwd.o md5_good.o md5_broken.o \
 		md5_crypt_good.o md5_crypt_broken.o \
 		bigcrypt.o
-	$(CC) -o $(CHKPWD) $^ $(LDLIBS)
+	$(CC) -o $(CHKPWD) $^ $(LDLIBS) $(LIBCRYPT)
 
 unix_chkpwd.o: unix_chkpwd.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
@@ -133,22 +145,21 @@ install: all
 	mkdir -p $(FAKEROOT)$(SECUREDIR)
 ifdef DYNAMIC
 	install -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-	ln -sf $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)/pam_unix_auth.so
-	ln -sf $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)/pam_unix_acct.so
-	ln -sf $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)/pam_unix_passwd.so
-	ln -sf $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)/pam_unix_session.so
+	for x in pam_unix_auth pam_unix_acct pam_unix_passwd pam_unix_session;\
+		do ln -sf $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)/$$x.so ; done
 endif
 	install $(CHKPWD) $(FAKEROOT)$(SUPLEMENTED)
 
 remove:
-	cd $(FAKEROOT)$(SECUREDIR) && rm -f $(LIBSHARED)
+	rm -f $(FAKEROOT)$(SECUREDIR)/$(LIBSHARED)
+	for x in pam_unix_auth pam_unix_acct pam_unix_passwd pam_unix_session;\
+		do rm -f $(FAKEROOT)$(SECUREDIR)/$$x.so ; done
 	rm -f $(FAKEROOT)$(SUPLEMENTED)/$(CHKPWD)
 
 clean:
 	rm -f $(LIBOBJD) $(LIBOBJS) $(CHKPWD) *.o *.so core
-
-extraclean: clean
 	rm -f *~ *.a *.out *.bak
+	rm -rf dynamic static
 
 .c.o:	
 	$(CC) -c $(CFLAGS) $<
diff --git a/modules/pam_unix/pam_unix_acct.c b/modules/pam_unix/pam_unix_acct.c
index f86f56e5..8aeb43f3 100644
--- a/modules/pam_unix/pam_unix_acct.c
+++ b/modules/pam_unix/pam_unix_acct.c
@@ -34,12 +34,7 @@
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define _BSD_SOURCE
-
-#ifdef linux
-#define _GNU_SOURCE
-#include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -51,7 +46,6 @@
 #include <shadow.h>
 #include <time.h>		/* for time() */
 
-
 #include <security/_pam_macros.h>
 
 /* indicate that the following groups are defined */
diff --git a/modules/pam_unix/pam_unix_auth.c b/modules/pam_unix/pam_unix_auth.c
index 7c639d88..bec9d99f 100644
--- a/modules/pam_unix/pam_unix_auth.c
+++ b/modules/pam_unix/pam_unix_auth.c
@@ -37,10 +37,7 @@
 
 /* #define DEBUG */
 
-#ifdef linux
-#define _GNU_SOURCE
-#include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/modules/pam_unix/pam_unix_passwd.c b/modules/pam_unix/pam_unix_passwd.c
index a3925895..e4998afd 100644
--- a/modules/pam_unix/pam_unix_passwd.c
+++ b/modules/pam_unix/pam_unix_passwd.c
@@ -35,13 +35,7 @@
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define _BSD_SOURCE
-#define __USE_SVID
-
-#ifdef linux
-#define _GNU_SOURCE
-#include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -50,6 +44,7 @@
 #include <malloc.h>
 #include <unistd.h>
 #include <errno.h>
+#include <sys/types.h>
 #include <pwd.h>
 #include <syslog.h>
 #include <shadow.h>
@@ -57,7 +52,6 @@
 #include <fcntl.h>
 #include <ctype.h>
 #include <sys/time.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <rpc/rpc.h>
 #include <rpcsvc/yp_prot.h>
diff --git a/modules/pam_unix/pam_unix_sess.c b/modules/pam_unix/pam_unix_sess.c
index ec658453..e97bc1f0 100644
--- a/modules/pam_unix/pam_unix_sess.c
+++ b/modules/pam_unix/pam_unix_sess.c
@@ -1,4 +1,6 @@
 /*
+ * $Id$
+ *
  * Copyright Alexander O. Yuriev, 1996.  All rights reserved.
  * Copyright Jan R�korajski, 1999.  All rights reserved.
  *
@@ -34,10 +36,7 @@
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifdef linux
-#define _GNU_SOURCE
-#include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/modules/pam_unix/support.h b/modules/pam_unix/support.h
index 68686738..419f5273 100644
--- a/modules/pam_unix/support.h
+++ b/modules/pam_unix/support.h
@@ -1,3 +1,7 @@
+/*
+ * $Id$
+ */
+
 #ifndef _PAM_UNIX_SUPPORT_H
 #define _PAM_UNIX_SUPPORT_H
 
diff --git a/modules/pam_unix/unix_chkpwd.c b/modules/pam_unix/unix_chkpwd.c
index 66c0ad7f..6e7d3b28 100644
--- a/modules/pam_unix/unix_chkpwd.c
+++ b/modules/pam_unix/unix_chkpwd.c
@@ -13,11 +13,7 @@
  *
  */
 
-#define _BSD_SOURCE
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <stdarg.h>
 #include <stdio.h>
diff --git a/modules/pam_unix/yppasswd_xdr.c b/modules/pam_unix/yppasswd_xdr.c
index eeb36423..b1a60b4c 100644
--- a/modules/pam_unix/yppasswd_xdr.c
+++ b/modules/pam_unix/yppasswd_xdr.c
@@ -10,10 +10,7 @@
  * editied manually.
  */
 
-#ifdef linux
-# define _GNU_SOURCE
-# include <features.h>
-#endif
+#include <security/_pam_aconf.h>
 
 #include <rpc/rpc.h>
 #include <rpcsvc/yp_prot.h>
diff --git a/modules/pam_userdb/Makefile b/modules/pam_userdb/Makefile
index 39226242..8951fd91 100644
--- a/modules/pam_userdb/Makefile
+++ b/modules/pam_userdb/Makefile
@@ -6,76 +6,28 @@
 # $Id$
 # Created by Cristian Gafton <gafton@redhat.com>
 
-WHICH_DB=$(shell ./libdbfound.sh)
-ifeq ($(WHICH_DB),none)
-
-include ../dont_makefile
-
-else
+include ../../Make.Rules
 
 TITLE=pam_userdb
 
-LIBSRC = $(TITLE).c conv.c
-LIBOBJ = $(TITLE).o conv.o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-#LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-EXTRALS += -ldb
-CFLAGS += $(WHICH_DB)
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-#static/%.o : %.c
-#	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
+ifeq ($(HAVE_LIBDB),yes)
+ WHICH_DB=db
+ MODULE_SIMPLE_EXTRALIBS = -ldb
+else
+ifeq ($(HAVE_LIBNDBM),yes)
+ WHICH_DB=ndbm
+ MODULE_SIMPLE_EXTRALIBS = -lndbm
+else
+ WHICH_DB=none
 endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD) $(EXTRALS)
 endif
 
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~ *.so
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
+ifeq ($(WHICH_DB),none)
 
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+include ../dont_makefile
 
-.PHONY: register
+else
 
-test:
-	install -m 755 $(TITLE).so /tmp
+include ../Simple.Rules
 
 endif
diff --git a/modules/pam_userdb/pam_userdb.c b/modules/pam_userdb/pam_userdb.c
index 20ca5d10..7af5d384 100644
--- a/modules/pam_userdb/pam_userdb.c
+++ b/modules/pam_userdb/pam_userdb.c
@@ -6,10 +6,8 @@
  * See the end of the file for Copyright Information
  */
 
-#define _GNU_SOURCE
-#define _BSD_SOURCE
+#include <security/_pam_aconf.h>
 
-#include <features.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
@@ -22,12 +20,16 @@
 
 #include "pam_userdb.h"
 
-#ifdef USE_NDBM_H
-# include <ndbm.h>
-#else /* USE_NDBM_H */
+#ifdef HAVE_LIBDB
 # define DB_DBM_HSEARCH    1 /* use the dbm interface */
 # include <db.h>
-#endif /* USE_NDBM_H */
+#else
+# ifdef HAVE_LIBNDBM
+#  include <ndbm.h>
+# else
+#  error "failed to find a libdb or equivalent"
+# endif
+#endif
 
 /*
  * here, we make a definition for the externally accessible function
diff --git a/modules/pam_warn/Makefile b/modules/pam_warn/Makefile
index 7b48689c..44c56f17 100644
--- a/modules/pam_warn/Makefile
+++ b/modules/pam_warn/Makefile
@@ -5,98 +5,11 @@
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# $Log$
-# Revision 1.1  2000/06/20 22:12:10  agmorgan
-# Initial revision
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
-# Revision 1.1.1.1  1998/07/12 05:17:17  morgan
-# Linux PAM sources pre-0.66
-#
-# Revision 1.2  1997/04/05 06:20:16  morgan
-# fixed fakeroot
-#
-# Revision 1.1  1996/12/01 03:12:22  morgan
-# Initial revision
-#
-#
-# Created by Andrew Morgan <morgan@parc.power.net> 1996/11/14
-#
-
-TITLE=pam_warn
-
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-static/%.o : %.c
-	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
 
-####################### don't edit below #######################
+include ../../Make.Rules
 
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
-
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-ifdef STATIC
-	$(MKDIR) ./static
-endif
-
-register:
-ifdef STATIC
-	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD)
-endif
-
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-
-$(LIBSTATIC): $(LIBOBJS)
-	$(LD) -r -o $@ $(LIBOBJS)
-endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+TITLE=pam_warn
 
+include ../Simple.Rules
diff --git a/modules/pam_wheel/Makefile b/modules/pam_wheel/Makefile
index a262babf..66945ff5 100644
--- a/modules/pam_wheel/Makefile
+++ b/modules/pam_wheel/Makefile
@@ -1,86 +1,15 @@
 #
+# $Id$
+#
 # This Makefile controls a build process of $(TITLE) module for
 # Linux-PAM. You should not modify this Makefile (unless you know
 # what you are doing!).
 #
-# Created by Cristian Gafton <gafton@sorosis.ro> 1996/09/10
+# Created by Andrew Morgan <morgan@linux.kernel.org> 2000/08/27
 #
 
-TITLE=pam_wheel
-
-#
-
-LIBSRC = $(TITLE).c
-LIBOBJ = $(TITLE).o
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
-#LIBOBJS = $(addprefix static/,$(LIBOBJ))
-
-dynamic/%.o : %.c
-	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-#static/%.o : %.c
-#	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
-
-
-ifdef DYNAMIC
-LIBSHARED = $(TITLE).so
-endif
-
-#ifdef STATIC
-#LIBSTATIC = lib$(TITLE).o
-#endif
-
-####################### don't edit below #######################
-
-dummy:
-
-	@echo "**** This is not a top-level Makefile "
-	exit
+include ../../Make.Rules
 
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-
-dirs:
-ifdef DYNAMIC
-	$(MKDIR) ./dynamic
-endif
-#ifdef STATIC
-#	$(MKDIR) ./static
-#endif
-
-register:
-#ifdef STATIC
-#	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-#endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-
-$(LIBSHARED):	$(LIBOBJD)
-	$(LD_D) -o $@ $(LIBOBJD) $(EXTRALS)
-endif
-
-#ifdef STATIC
-#$(LIBOBJS): $(LIBSRC)
-#
-#$(LIBSTATIC): $(LIBOBJS)
-#	$(LD) -r -o $@ $(LIBOBJS) $(EXTRALS)
-#endif
-
-install: all
-	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
-	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
-
-remove:
-	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
-
-clean:
-	rm -f $(LIBOBJD) $(LIBOBJS) core *~ *.so
-
-extraclean: clean
-	rm -f *.a *.o *.so *.bak dynamic/* static/*
-
-.c.o:	
-	$(CC) $(CFLAGS) -c $<
+TITLE=pam_wheel
 
+include ../Simple.Rules
-- 
cgit v1.2.3