o Removing Make.Rules causes all sorts of problems, so don't remove it.
o Switch to using $(CC) to build libraries, and modify soname-related rules
  accordingly.
o Change the warning flags passed to the compiler to avoid warnings about usage
  that may not be portable to non-ISO-compliant compilers, which is futile due
  to the non-portable nature of various modules (pam_limits, pam_lastlog,
  possibly others).
o Don't run ldconfig if we're installing into a fakeroot; we're probably not
  root (not when we're building an RPM package, anyway).
o Add targets for man pages to the Simple rules -- depending on which version of
  FHS you read, they belong in /usr/man or /usr/share/man, and we don't want to
  hard-code it in the individual makefiles.
o Put the pam_filter modules under the module directory instead of sbindir, for
  the sake of not creating a subdirectory under /sbin, which is frowned upon.
o Only build modules which have Makefiles in their directories, keeping stray
  subdirectories (ahem, CVS) from breaking the build process.
o Link pam_unix with libnsl (should probably use the autoconf macro).

--- Linux-PAM-0.75/Make.Rules.in	Sat Feb 10 17:33:09 2001
+++ Linux-PAM-0.75/Make.Rules.in	Tue Jul 10 00:14:23 2001
@@ -40,6 +40,10 @@
 
 # Mode to install shared libraries with
 SHLIBMODE=@SHLIBMODE@
+# Mode to install man pages with
+MANMODE=@MANMODE@
+# Mode to install configuration files with
+CONFMODE=@CONFMODE@
 
 NEED_LINK_LIB_C=@PAM_NEEDS_LIBC@
 HAVE_LCKPWDF=@HAVE_LCKPWDF@
@@ -79,10 +83,11 @@
 # generic build setup
 OS=@OS@
 CC=@CC@
-CFLAGS=$(WARNINGS) -D$(OS) $(OS_CFLAGS) $(HEADER_DIRS) @CONF_CFLAGS@
+CFLAGS=@CFLAGS@ $(WARNINGS) -D$(OS) $(OS_CFLAGS) $(HEADER_DIRS) @CONF_CFLAGS@
 LD=@LD@
 LD_D=@LD_D@
 LD_L=@LD_L@
+MV=@MV@
 DYNTYPE=@DYNTYPE@
 LIBDL=@LIBDL@
 MKDIR=@MKDIR@
@@ -92,3 +97,6 @@
 CC_STATIC=@CC_STATIC@
 
 LINKLIBS = $(NEED_LINK_LIB_C) $(LIBDL)
+
+USESONAME=@USESONAME@
+SOSWITCH=@SOSWITCH@
--- Linux-PAM-0.75/Makefile	Sat Jan 20 17:29:47 2001
+++ Linux-PAM-0.75/Makefile	Tue Jul 10 00:14:23 2001
@@ -11,9 +11,7 @@
 
 DISTNAME=Linux-PAM
 
-ifeq ($(shell test \! -f Make.Rules || echo yes),yes)
-    include Make.Rules
-endif
+-include Make.Rules
 
 THINGSTOMAKE = modules libpam libpamc libpam_misc doc examples
 
@@ -26,7 +24,7 @@
 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 Make.Rules #*#
+	rm -f security *~ *.orig *.rej #*#
 
 distclean: clean
 	rm -f Make.Rules _pam_aconf.h
--- Linux-PAM-0.75/configure.in	Sun Mar 18 20:56:36 2001
+++ Linux-PAM-0.75/configure.in	Tue Jul 10 00:14:23 2001
@@ -38,11 +38,14 @@
 USESONAME=yes			; AC_SUBST(USESONAME)
 NEEDSONAME=yes			; AC_SUBST(NEEDSONAME)
 SHLIBMODE=755			; AC_SUBST(SHLIBMODE)
+MANMODE=644			; AC_SUBST(MANMODE)
+CONFMODE=644			; AC_SUBST(CONFMODE)
 
 dnl ### Should enable this INSTALL detection.
 dnl ### Would need to distribute GNU's config.guess and config.sub
 dnl AC_PROG_INSTALL
-INSTALL=/usr/bin/install	; AC_SUBST(INSTALL)
+AC_PROG_INSTALL
+dnl INSTALL=/usr/bin/install	; AC_SUBST(INSTALL)
 
 dnl Checks for programs.
 AC_PROG_CC
@@ -59,7 +62,7 @@
 
 dnl lots of debugging information goes to /tmp/pam-debug.log
 AC_ARG_ENABLE(debug,
-[  --enable-debug           qspecify you are building with debugging on],
+[  --enable-debug           specify you are building with debugging on],
 	WITH_DEBUG=yes ; AC_DEFINE(DEBUG) , WITH_DEBUG=no)
 AC_SUBST(WITH_DEBUG)
 
@@ -172,7 +175,7 @@
 	HAVE_LIBCRACK=no)
 AC_SUBST(HAVE_LIBCRACK)
 
-AC_CHECK_LIB(crypt, fcrypt, HAVE_LIBCRYPT=yes ; AC_DEFINE(HAVE_LIBCRYPT),
+AC_CHECK_LIB(crypt, crypt, HAVE_LIBCRYPT=yes ; AC_DEFINE(HAVE_LIBCRYPT),
 	HAVE_LIBCRYPT=no)
 AC_SUBST(HAVE_LIBCRYPT)
 AC_CHECK_LIB(util, logwtmp, HAVE_LIBUTIL=yes ; AC_DEFINE(HAVE_LIBUTIL),
@@ -181,7 +184,7 @@
 AC_CHECK_LIB(ndbm, dbm_store, HAVE_LIBNDBM=yes ; AC_DEFINE(HAVE_LIBNDBM),
 	HAVE_LIBNDBM=no)
 AC_SUBST(HAVE_LIBNDBM)
-AC_CHECK_LIB(db, dbm_store, HAVE_LIBDB=yes ; AC_DEFINE(HAVE_LIBDB),
+AC_CHECK_LIB(db, __db_ndbm_fetch, HAVE_LIBDB=yes ; AC_DEFINE(HAVE_LIBDB),
 	HAVE_LIBDB=no)
 AC_SUBST(HAVE_LIBDB)
 AC_CHECK_LIB(fl, yylex, yyterminate, HAVE_LIBFL=yes ; AC_DEFINE(HAVE_LIBFL),
@@ -264,16 +267,18 @@
 if test "$GCC" = yes; then
 ###
 ### Non-Linux needs attention on per-OS basis
-	OS_CFLAGS="-ansi -D_POSIX_SOURCE -pedantic"
+	OS_CFLAGS=""
 	WARNINGS="$GCC_WARNINGS"
 	PIC="-fPIC"
 #can/should we use LD=gcc ???
 	LD=ld				
 	LD_D="gcc -shared -Xlinker -x"
-	LD_L="$LD -x -shared"
-	RANLIB=ranlib
+	LD_L="gcc -shared"
+	RANLIB=:
 	STRIP=strip
-	CC_STATIC="-Xlinker -export-dynamic"
+# use a soname
+	USESONAME=yes
+	SOSWITCH="-Wl,-soname -Wl,"
 else
 ###
 ### Non-gcc needs attention on per-OS basis
@@ -290,6 +295,9 @@
 	CC_STATIC=
 fi
 
+AC_SUBST(USESONAME)
+AC_SUBST(SOSWITCH)
+
 AC_SUBST(OS_CFLAGS)
 AC_SUBST(WARNINGS)
 AC_SUBST(PIC)
--- Linux-PAM-0.75/libpam/Makefile	Sat Feb 10 02:17:53 2001
+++ Linux-PAM-0.75/libpam/Makefile	Tue Jul 10 00:14:23 2001
@@ -92,7 +92,7 @@
 $(LIBPAM): $(DLIBOBJECTS)
 ifeq ($(DYNAMIC_LIBPAM),yes)
     ifeq ($(USESONAME),yes)
-	$(LD_L) $(SOSWITCH) $(LIBPAMNAME) -o $@ $(DLIBOBJECTS) \
+	$(LD_L) $(SOSWITCH)$(LIBPAMNAME) -o $@ $(DLIBOBJECTS) \
 		$(MODULES) $(LINKLIBS)
     else
 	$(LD_L) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
@@ -107,9 +107,11 @@
 
 $(LIBPAMSTATIC): $(SLIBOBJECTS)
 ifeq ($(STATIC_LIBPAM),yes)
-	ar cr $@ $(SLIBOBJECTS) $(MODULES)
+	$(AR) cru $@ $(SLIBOBJECTS) $(MODULES)
+ifdef RANLIB
 	$(RANLIB) $@
 endif
+endif
 
 install: all
 	$(MKDIR) $(FAKEROOT)$(INCLUDED) $(FAKEROOT)$(libdir)
@@ -141,7 +143,9 @@
 	rm -f $(FAKEROOT)$(INCLUDED)/pam_malloc.h
 	rm -f $(FAKEROOT)$(libdir)/$(LIBPAM).*
 	rm -f $(FAKEROOT)$(libdir)/$(LIBPAM)
+ifndef FAKEROOT
 	$(LDCONFIG)
+endif
 	rm -f $(FAKEROOT)$(libdir)/$(LIBPAMSTATIC)
 
 clean:
--- Linux-PAM-0.75/libpam_misc/Makefile	Sat Feb 10 02:17:53 2001
+++ Linux-PAM-0.75/libpam_misc/Makefile	Tue Jul 10 00:14:23 2001
@@ -15,6 +15,7 @@
 VERSION=.$(MAJOR_REL)
 MODIFICATION=.$(MINOR_REL)
 
+FILES=misc_conv help_env
 CFLAGS += $(MOREFLAGS) $(DYNAMIC) $(STATIC)
 
 # dynamic library names
@@ -23,6 +24,10 @@
 LIBNAMEDNAME = $(LIBNAMED)$(VERSION)
 LIBNAMEDFULL = $(LIBNAMEDNAME)$(MODIFICATION)
 
+LIBDYNAMIC=lib$(LIBNAME).$(DYNTYPE)
+LIBDYNMAJ=$(LIBDYNAMIC).$(LIBMAJOR)
+LIBDYNMIN=$(LIBDYNMAJ).$(LIBMINOR)
+
 # static library name
 
 LIBNAMEDSTATIC = $(LIBNAME).a
@@ -59,9 +66,9 @@
 $(LIBNAMED): $(DLIBOBJECTS)
 ifeq ($(DYNAMIC_LIBPAM),yes)
     ifeq ($(USESONAME),yes)
-	$(LD_L) $(SOSWITCH) $(LIBNAMEDNAME) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
+	$(LD_L) $(SOSWITCH)$(LIBNAMEDNAME) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
     else
-	$(LD_L) -o $@ $(DLIBOBJECTS) $(MODULES)
+	$(LD_L) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
     endif
     ifeq ($(NEEDSONAME),yes)
 	rm -f $(LIBNAMEDFULL)
@@ -73,9 +80,12 @@
 
 $(LIBNAMEDSTATIC): $(SLIBOBJECTS)
 ifeq ($(STATIC_LIBPAM),yes)
+	$(AR) rcu $@ $(SLIBOBJECTS) $(MODULES)
+ifdef RANLIB
 	$(AR) rc $@ $(SLIBOBJECTS) $(MODULES)
 	$(RANLIB) $@
 endif
+endif
 
 install: all
 	$(MKDIR) $(FAKEROOT)$(INCLUDED)
--- Linux-PAM-0.75/libpamc/Makefile	Sat Feb 10 02:17:53 2001
+++ Linux-PAM-0.75/libpamc/Makefile	Tue Jul 10 00:14:23 2001
@@ -59,7 +59,7 @@
 $(LIBNAMED): $(DLIBOBJECTS)
 ifeq ($(DYNAMIC_LIBPAM),yes)
     ifeq ($(USESONAME),yes)
-	$(LD_L) $(SOSWITCH) $(LIBNAMEDNAME) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
+	$(LD_L) $(SOSWITCH)$(LIBNAMEDNAME) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
     else
 	$(LD_L) -o $@ $(DLIBOBJECTS) $(MODULES)
     endif
@@ -73,9 +73,11 @@
 
 $(LIBNAMEDSTATIC): $(SLIBOBJECTS)
 ifeq ($(STATIC_LIBPAM),yes)
-	$(AR) rc $@ $(SLIBOBJECTS) $(MODULES)
+	$(AR) rcu $@ $(SLIBOBJECTS) $(MODULES)
+ifdef RANLIB
 	$(RANLIB) $@
 endif
+endif
 
 install: all
 	$(MKDIR) $(FAKEROOT)$(INCLUDED)
--- Linux-PAM-0.75/modules/Simple.Rules	Wed Feb 21 23:55:41 2001
+++ Linux-PAM-0.75/modules/Simple.Rules	Tue Jul 10 00:14:23 2001
@@ -39,10 +39,10 @@
 
 dirs:
 ifdef DYNAMIC
-	$(MKDIR) ./dynamic
+	@$(MKDIR) ./dynamic
 endif
 ifdef STATIC
-	$(MKDIR) ./static
+	@$(MKDIR) ./static
 endif
 
 register:
@@ -74,6 +74,18 @@
 ifdef DYNAMIC
 	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
 endif
+ifdef MAN3
+	test -d $(FAKEROOT)$(mandir)/man3 || $(MKDIR) $(FAKEROOT)$(mandir)/man3
+	$(INSTALL) -m $(MANMODE) $(MAN3) $(FAKEROOT)$(mandir)/man3/
+endif
+ifdef MAN5
+	test -d $(FAKEROOT)$(mandir)/man5 || $(MKDIR) $(FAKEROOT)$(mandir)/man5
+	$(INSTALL) -m $(MANMODE) $(MAN5) $(FAKEROOT)$(mandir)/man5/
+endif
+ifdef MAN8
+	test -d $(FAKEROOT)$(mandir)/man8 || $(MKDIR) $(FAKEROOT)$(mandir)/man8
+	$(INSTALL) -m $(MANMODE) $(MAN8) $(FAKEROOT)$(mandir)/man8/
+endif
 	$(MODULE_SIMPLE_INSTALL)
 
 remove:
--- Linux-PAM-0.75/modules/pam_access/Makefile	Sun Nov 19 18:54:03 2000
+++ Linux-PAM-0.75/modules/pam_access/Makefile	Tue Jul 10 00:14:23 2001
@@ -12,10 +12,11 @@
 INSTALLED_CONFILE=$(SCONFIGD)/access.conf
 
 DEFS=-DDEFAULT_CONF_FILE=\"$(INSTALLED_CONFILE)\"
-CFLAGS += $(DEFS)
+CFLAGS += $(DEFS) -DNIS
 
 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
+MODULE_SIMPLE_EXTRALIBS=-lnsl
 
 include ../Simple.Rules
--- Linux-PAM-0.75/modules/pam_filter/Makefile	Thu Dec 21 01:06:34 2000
+++ Linux-PAM-0.75/modules/pam_filter/Makefile	Tue Jul 10 00:14:23 2001
@@ -18,9 +18,12 @@
 
 TITLE=pam_filter
 FILTERS=upperLOWER
-FILTERSDIR=$(SUPLEMENTED)/pam_filter
+FILTERSDIR=$(SECUREDIR)/pam_filter
 export FILTERSDIR
 
+CFLAGS += -I. -I..
+#
+
 CFLAGS += -Iinclude
 
 LIBSRC = $(TITLE).c
--- Linux-PAM-0.75/modules/pam_filter/upperLOWER/Makefile	Sun Nov 19 18:54:03 2000
+++ Linux-PAM-0.75/modules/pam_filter/upperLOWER/Makefile	Tue Jul 10 00:14:23 2001
@@ -21,7 +21,7 @@
 all: $(TITLE)
 
 $(TITLE): $(OBJS)
-	$(CC) -o $(TITLE) $(OBJS)
+	$(CC) -o $(TITLE) $(CFLAGS) $(OBJS)
 	$(STRIP) $(TITLE)
 
 install:
--- Linux-PAM-0.75/modules/pam_limits/Makefile	Sun Nov 19 18:54:04 2000
+++ Linux-PAM-0.75/modules/pam_limits/Makefile	Tue Jul 10 00:14:23 2001
@@ -24,6 +24,9 @@
 
 include ../Simple.Rules
 
+#else
+#include ../dont_makefile
+#endif
 else
 
 include ../dont_makefile
--- Linux-PAM-0.75/modules/pam_tally/Makefile	Sun Nov 19 18:54:05 2000
+++ Linux-PAM-0.75/modules/pam_tally/Makefile	Tue Jul 10 00:14:23 2001
@@ -88,7 +88,7 @@
 	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
 endif
 	$(MKDIR) $(FAKEROOT)$(SUPLEMENTED)
-#	$(INSTALL) -m $(APPMODE) $(APPLICATION) $(FAKEROOT)$(SUPLEMENTED)
+	$(INSTALL) -m $(APPMODE) $(APPLICATION) $(FAKEROOT)$(SUPLEMENTED)
 
 remove:
 	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
--- Linux-PAM-0.75/modules/pam_unix/Makefile	Sun Feb 11 01:33:53 2001
+++ Linux-PAM-0.75/modules/pam_unix/Makefile	Tue Jul 10 00:14:23 2001
@@ -18,6 +18,13 @@
 #USE_CRACKLIB=-D"USE_CRACKLIB"
 #endif
 
+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
+EXTRAS += -DCRACKLIB_DICTS=\"$(CRACKLIB_DICTPATH)\"
+
 # do you want to use lckpwdf?
 ifeq ($(WITH_LCKPWDF),yes)
 USE_LCKPWDF=-D"USE_LCKPWDF"
@@ -42,7 +49,7 @@
 ########################################################################
 
 CFLAGS += $(USE_CRACKLIB) $(USE_LCKPWDF) $(NEED_LCKPWDF) $(EXTRAS)
-LDLIBS = $(EXTRALS)
+LDLIBS = $(EXTRALS) -lnsl -lcrypt
 
 ifdef USE_CRACKLIB
 CRACKLIB = -lcrack
@@ -69,7 +76,7 @@
 
 ########################### don't edit below #######################
 
-all: dirs info $(PLUS) $(LIBSHARED) $(LIBSTATIC) $(CHKPWD) register
+all: dirs $(PLUS) $(LIBSHARED) $(LIBSTATIC) $(CHKPWD) register
 
 dynamic/%.o : %.c
 	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
@@ -81,11 +88,6 @@
 	@echo "**** This is not a top-level Makefile "
 	exit
 
-info:
-	@echo
-	@echo "*** Building pam-unix module of the framework..."
-	@echo
-
 dirs:
 ifdef DYNAMIC
 	mkdir -p ./dynamic
--- Linux-PAM-0.75/modules/pam_userdb/Makefile	Sat Feb 17 22:03:31 2001
+++ Linux-PAM-0.75/modules/pam_userdb/Makefile	Tue Jul 10 00:14:23 2001
@@ -33,3 +33,8 @@
 include ../Simple.Rules
 
 endif
+
+.PHONY: register
+
+test:
+	install -m 755 $(TITLE).so /tmp
--- Linux-PAM-0.75/modules/Makefile	Sun Nov 19 18:54:03 2000
+++ Linux-PAM-0.75/modules/Makefile	Tue Jan 23 12:22:22 2001
@@ -8,7 +8,7 @@
 
 include ../Make.Rules
 
-MODDIRS=$(shell /bin/ls -d pam_*)
+MODDIRS=$(shell /bin/ls -d pam_*/Makefile | cut -f1 -d/)
 
 all:	
 	@echo modules sources available are:
