From b77365f1cd2eb9976c1f5b3fd30ca1132e10ed49 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Fri, 6 Nov 2009 08:28:01 -0500
Subject: [PATCH 1/2] Clean up unused dependencies

---
 server/Makefile.am      |   21 ++++++++++++++-------
 server/external/krb5.m4 |   24 +++++++++++++++++++++++-
 sss_client/Makefile.am  |    1 -
 sss_client/pam_sss.c    |    1 -
 4 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/server/Makefile.am b/server/Makefile.am
index b26c3cd..ec8729d 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -98,6 +98,8 @@ libsss_crypt_la_SOURCES = \
     util/nss_sha512crypt.c
 libsss_crypt_la_CPPFLAGS = \
     $(NSS_CFLAGS)
+libsss_crypt_la_LIBADD = \
+    $(NSS_LIBS)
 
 if BUILD_PYTHON_BINDINGS
 pyexec_LTLIBRARIES = \
@@ -138,7 +140,6 @@ AM_CPPFLAGS = -Wall \
     -I. \
     $(POPT_CFLAGS) \
     $(TALLOC_CFLAGS) \
-    $(TDB_CFLAGS) \
     $(TEVENT_CFLAGS) \
     $(LDB_CFLAGS) \
     $(DBUS_CFLAGS) \
@@ -208,7 +209,6 @@ endif
 
 SSSD_LIBS = \
     $(TALLOC_LIBS) \
-    $(TDB_LIBS) \
     $(TEVENT_LIBS) \
     $(POPT_LIBS) \
     $(LDB_LIBS) \
@@ -223,7 +223,6 @@ SSSD_LIBS = \
 
 PYTHON_BINDINGS_LIBS = \
     $(TALLOC_LIBS) \
-    $(TDB_LIBS) \
     $(TEVENT_LIBS) \
     $(POPT_LIBS) \
     $(LDB_LIBS) \
@@ -234,7 +233,17 @@ PYTHON_BINDINGS_LIBS = \
     libsss_crypt.la
 
 TOOLS_LIBS = \
-    $(SSSD_LIBS)
+    $(TALLOC_LIBS) \
+    $(TEVENT_LIBS) \
+    $(POPT_LIBS) \
+    $(LDB_LIBS) \
+    $(DBUS_LIBS) \
+    $(PCRE_LIBS) \
+    $(INI_CFG_LIBS) \
+    $(COLLECTION_LIBS) \
+    $(DHASH_LIBS) \
+    $(REPLACE_LIBS) \
+    libsss_crypt.la
 
 if BUILD_SELINUX
     TOOLS_LIBS += $(SELINUX_LIBS)
@@ -385,7 +394,7 @@ sysdb_tests_CFLAGS = \
 sysdb_tests_LDADD = \
     $(SSSD_LIBS) \
     $(CHECK_LIBS)
-    
+
 strtonum_tests_SOURCES = \
     tests/strtonum-tests.c \
     util/debug.c \
@@ -499,8 +508,6 @@ libsss_krb5_la_SOURCES = \
 libsss_krb5_la_CFLAGS = \
     $(AM_CFLAGS) \
     $(KRB5_CFLAGS)
-libsss_krb5_la_LIBADD = \
-    $(KRB5_LIBS)
 libsss_krb5_la_LDFLAGS = \
     -version-info 1:0:0 \
     -module
diff --git a/server/external/krb5.m4 b/server/external/krb5.m4
index 95cd386..d02732b 100644
--- a/server/external/krb5.m4
+++ b/server/external/krb5.m4
@@ -1,5 +1,14 @@
 AC_SUBST(KRB5_CFLAGS)
 AC_SUBST(KRB5_LIBS)
+
+if test x$KRB5_LIBS != x; then
+    KRB5_PASSED_LIBS=$KRB5_LIBS
+fi
+
+if test x$KRB5_CFLAGS != x; then
+    KRB5_PASSED_CFLAGS=$KRB5_CFLAGS
+fi
+
 AC_PATH_PROG(KRB5_CONFIG, krb5-config)
 AC_MSG_CHECKING(for working krb5-config)
 if test -x "$KRB5_CONFIG"; then
@@ -7,9 +16,22 @@ if test -x "$KRB5_CONFIG"; then
   KRB5_LIBS="`$KRB5_CONFIG --libs`"
   AC_MSG_RESULT(yes)
 else
-  AC_MSG_ERROR(no. Please install MIT kerberos devel package)
+    if test x$KRB5_PASSED_LIBS = x; then
+        AC_MSG_ERROR(no. Please install MIT kerberos devel package)
+    fi
 fi
 
+if test x$KRB5_PASSED_LIBS != x; then
+    KRB5_LIBS=$KRB5_PASSED_LIBS
+fi
+
+if test x$KRB5_PASSED_CFLAGS != x; then
+    KRB5_CFLAGS=$KRB5_PASSED_CFLAGS
+fi
+
+AC_ARG_VAR([KRB5_CFLAGS], [C compiler flags for kerberos, overriding krb5-config])dnl
+AC_ARG_VAR([KRB5_LIBS], [linker flags for kerberos, overriding krb5-config])dnl
+
 SAVE_CFLAGS=$CFLAGS
 SAVE_LIBS=$LIBS
 CFLAGS="$CFLAGS $KRB5_CFLAGS"
diff --git a/sss_client/Makefile.am b/sss_client/Makefile.am
index 1332f44..b430af6 100644
--- a/sss_client/Makefile.am
+++ b/sss_client/Makefile.am
@@ -46,7 +46,6 @@ pam_sss_la_SOURCES = \
 
 pam_sss_la_LDFLAGS = \
     -lpam \
-    -lpam_misc \
     -module \
     -avoid-version \
     -Wl,--version-script,$(srcdir)/sss_pam.exports
diff --git a/sss_client/pam_sss.c b/sss_client/pam_sss.c
index 411afd1..1c4aed0 100644
--- a/sss_client/pam_sss.c
+++ b/sss_client/pam_sss.c
@@ -30,7 +30,6 @@
 #include <syslog.h>
 
 #include <security/pam_modules.h>
-#include <security/pam_misc.h>
 #include <security/pam_ext.h>
 #include <security/pam_modutil.h>
 #include "sss_pam_macros.h"
-- 
1.6.2.5

