[PATCH] autotools: don't link mount.cifs against krb5 library

Jeff Layton <[email protected]>
Newsgroups gmane.linux.file-systems.cifs
Message-ID <[email protected]>
mount.cifs is being linked against the krb5 library. Fix it so that
that doesn't happen.

Signed-off-by: Jeff Layton <[email protected]>
---
 Makefile.am  |    2 +-
 configure.ac |   11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 605206e..9cf25f6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,7 +11,7 @@ man_MANS = mount.cifs.8
 if CONFIG_CIFSUPCALL
 sbin_PROGRAMS = cifs.upcall
 cifs_upcall_SOURCES = cifs.upcall.c data_blob.c asn1.c spnego.c util.c
-cifs_upcall_LDADD = -ltalloc -lkrb5 -lkeyutils
+cifs_upcall_LDADD = -ltalloc -lkeyutils @KRB5_LDADD@
 man_MANS += cifs.upcall.8
 endif
 
diff --git a/configure.ac b/configure.ac
index b621750..a64113a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,7 +76,10 @@ if test $enable_cifsupcall != "no"; then
 			])
 fi
 if test $enable_cifsupcall != "no"; then
-	AC_CHECK_LIB([krb5], [krb5_init_context])
+	AC_CHECK_LIB([krb5], [krb5_init_context],
+			[ KRB5_LDADD='-lkrb5' ],
+			AC_MSG_ERROR([no functioning krb5 library found!]))
+	AC_SUBST(KRB5_LDADD)
 fi
 
 # Checks for typedefs, structures, and compiler characteristics.
@@ -97,6 +100,10 @@ AC_FUNC_STRNLEN
 # check for required functions
 AC_CHECK_FUNCS([alarm atexit endpwent getmntent getpass gettimeofday inet_ntop memset realpath setenv strchr strdup strerror strncasecmp strndup strpbrk strrchr strstr strtol strtoul uname], , [AC_MSG_ERROR([necessary functions(s) not found])])
 
+# ugly, but I'm not sure how to check for functions in a library that's not in $LIBS
+cu_saved_libs=$LIBS
+LIBS="$LIBS $KRB5_LDADD"
+
 # determine whether we can use MIT's new 'krb5_auth_con_getsendsubkey' to extract the signing key
 if test $enable_cifsupcall != "no"; then
 	AC_CHECK_FUNCS([krb5_auth_con_getsendsubkey])
@@ -107,6 +114,8 @@ if test $enable_cifsupcall != "no"; then
 	AC_CHECK_FUNCS([krb5_principal_get_realm krb5_free_unparsed_name])
 fi
 
+LIBS=$cu_saved_libs
+
 AM_CONDITIONAL(CONFIG_CIFSUPCALL, [test "$enable_cifsupcall" != "no"])
 
 AC_LIBCAP
-- 
1.6.6.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.