[5599] in Moira

home help back first fref pref prev next nref lref last post

use krb5-config instead of hardcoding library names?

daemon@ATHENA.MIT.EDU (Benjamin Kaduk)
Wed Feb 24 23:24:05 2010

Date: Wed, 24 Feb 2010 23:23:58 -0500 (EST)
From: Benjamin Kaduk <kaduk@MIT.EDU>
To: moiradev@MIT.EDU
Message-ID: <alpine.GSO.1.10.1002242253070.29136@multics.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII

Hi all,

Still working to get moira clients compiling on FreeBSD. The present 
hiccough being that gethostbyname() is in libc, and there is no libresolv, 
so any test program that configure tries to link against libresolv will 
fail. Interestingly, this only seems to show up for the libzephyr check.

Anyway, getting a list of which libraries to link against seems
to be precisely the purpose of the krb5-config utility; perhaps
something akin to the following would be in order?

--- configure.in.orig	2010-02-24 22:34:06.000000000 -0500
+++ configure.in	2010-02-24 23:21:17.000000000 -0500
@@ -163,8 +163,13 @@
  	MR_LIBS($krb5/lib)
      fi
      MR_DEFINE(HAVE_KRB5)
-    KRB5_LIBS="-lkrb5 -l${crypto} -lcom_err -lresolv"
-    REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -lkrb5 -l${crypto} -lresolv"
+    if test -x /usr/bin/krb5-config ; then
+	KRB5_LIBS=/usr/bin/krb5-config --libs
+        REG_SVR_LIBS=/usr/bin/krb5-config --libs kadm-client
+    else
+        KRB5_LIBS="-lkrb5 -l${crypto} -lcom_err -lresolv"
+        REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -lkrb5 -l${crypto} -lresolv"
+    fi
  else
      REG_SVR_DEFS=-DKRB4
      REG_SVR_LIBS=-lkadm


I note that I still have not fixed the build against heimdal, so
this patch is only lightly tested.

-Ben Kaduk

home help back first fref pref prev next nref lref last post