help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

configure.ac patch for Solaris


From: Chip Seraphine
Subject: configure.ac patch for Solaris
Date: Wed, 28 Jul 2004 15:39:06 -0500
User-agent: KMail/1.5.4

Something that has annoyed me for a while but I only now decided to try and 
fix:  The Solaris linker, unlike everybody else's, likes to distinguish 
between runtime paths and compile time paths.  This is handy if your build 
machine is set up differently than the box you will deploy to, but is usually 
just a pain in the butt because it requires you to specify an often-redundant 
-R flag (which cfengine's configure scripts do).

The problem is that in some cases you don't want any runtime path at all.  
Cfengine is, among other things, a tool for recovering from failures; for 
this reason, statically compiling various dependencies is a common practice 
(well, I do it any rate :-) if the libs are not deployed on every client.  
Since Berkely DB is not shipped with Solaris, it is often shared via NFS, so 
it is a particularly likely candidate for static linking.

Anyway, if you static-link in BDB, the configure script still forces a -R flag 
that causes the cfengine executables to search the BERKELEY_DB_DIR at runtime 
anyway.  If you are in an automounter environment and built from a sandbox on 
your workstation, this can mean that you will get lots of errors in syslog 
every time a cfengine executable runs if that workstation is every offline-- 
not to mention a lot of extra network traffic as the automounter constantly 
tries to mount /home/adminworkstation/sandbox or whatever.

Anyway, here is a patch that causes configure to not specify a -R flag for 
Berkeley DB if it looks like it is going to be compiled in static.  It's 
pretty  simple, but I am not an autotools guy so....


--- configure.ac-       2004-07-28 15:26:30.225573000 -0500
+++ configure.ac.PATCHED        2004-07-28 15:27:10.230108000 -0500
@@ -169,8 +169,15 @@
         done

         case "$target_os" in
-        solaris*)  BERKELEY_DB_LDFLAGS="-L$BERKELEY_DB_DIR/lib -R
$BERKELEY_DB_DIR/lib";;
-        *)         BERKELEY_DB_LDFLAGS="-L$BERKELEY_DB_DIR/lib";;
+        solaris*)
+                       BERKELEY_DB_LDFLAGS="-L$BERKELEY_DB_DIR/lib"
+                       #If we are statically linking BDB files, we do not 
want the -R flag
+                       if [ -n "`ls $BERKELEY_DB_DIR/libdb*.so 2>/dev/
null`" ]
+                       then
+                               BERKELEY_DB_LDFLAGS="-$BERKELEY_DB_LDFLAGS -R
$BERKELEY_DB_DIR/lib"
+                       fi
+                       ;;
+               *)         BERKELEY_DB_LDFLAGS="-L$BERKELEY_DB_DIR/lib";;
         esac

         AC_MSG_RESULT($BERKELEY_DB_DIR)

FWIW, this is patched against configure.ac in 2.1.6.  I don't think it has 
changed to 2.1.7, though.  Hopefully this will merit inclusion so I don't 
have to edit out the '-R' flag every time I build a new cfengine :-)

-- 

Chip Seraphine
Unix Administrator
TradeLink, LLC
312-264-2048
chip@trdlnk.com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]