Description: don't link with -lresolv
 Don't link with -lresolv to avoid unnecessary shared library
 dependencies. Strip unnecessary -I/usr/include and -L/usr/lib
 flags which may cause problems.
Author: Russ Allbery <rra@debian.org>
Reviewed-By: Jonathan Yu <jawnsy@cpan.org>
Origin: vendor
Forwarded: not-needed
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -8,7 +8,8 @@
 # any extra libraries?
 # add -lresolv here if you get errors like the following (usually on linux):
 #  undefined symbol: __res_search
-my $KRB5_EXTRALIBS = '-lresolv';
+# Only needed with static linking, so not needed on Debian.
+#my $KRB5_EXTRALIBS = '-lresolv';
 
 # location of Kerberos 5 includes
 my $KRB5_INCDIR = '/usr/include';
@@ -30,10 +31,14 @@
 	$cryptolib = '-lcrypto';
 }
 
+# Don't add -L/usr/lib or -I/usr/include; they can cause problems.
+my $ldflags  = ($KRB5_LIBDIR eq '/usr/lib')     ? '' : "-L${KRB5_LIBDIR}";
+my $cppflags = ($KRB5_INCDIR eq '/usr/include') ? '' : "-I${KRB5_INCDIR}";
+
 WriteMakefile(
     'NAME'	=> 'Authen::Krb5',
     'VERSION_FROM' => 'Krb5.pm',
-    'LIBS'	=> ["-L${KRB5_LIBDIR} -lkrb5 ${cryptolib} -lcom_err $KRB5_EXTRALIBS"],
+    'LIBS'     => ["$ldflags -lkrb5 ${cryptolib} -lcom_err $KRB5_EXTRALIBS"],
     'DEFINE'	=> '',
-    'INC'	=> "-I${KRB5_INCDIR} $KRB5_EXTRAINCS"
+    'INC'      => "$cppflags $KRB5_EXTRAINCS"
 );
