New Makefile variable RPATH_FLAG, possibly used even when we're not
authorTom Yu <tlyu@mit.edu>
Tue, 5 Nov 2002 04:52:24 +0000 (04:52 +0000)
committerTom Yu <tlyu@mit.edu>
Tue, 5 Nov 2002 04:52:24 +0000 (04:52 +0000)
building shared libs.  TCL_MAYBE_RPATH gets used to account for
linking a shared tcl lib when we're not building shared libs.

ticket: 1228
status: open

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14969 dc483132-0cff-0310-8789-dd5450dbe970

src/ChangeLog
src/aclocal.m4
src/config/ChangeLog
src/config/pre.in
src/config/shlib.conf
src/kadmin/testing/util/ChangeLog
src/kadmin/testing/util/Makefile.in

index 26ff4d6dbe4b78095524af4498efc17f9e74caed..50a46008c0e9dde58f20cc6ef4d8f0aebe69adad 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-04  Tom Yu  <tlyu@mit.edu>
+
+       * aclocal.m4 (AC_KRB5_TCL_FIND_CONFIG): Set TCL_MAYBE_RPATH.
+       (KRB5_BUILD_PROGRAM): Substitute RPATH_FLAG.
+
 2002-10-31  Ken Raeburn  <raeburn@mit.edu>
 
        * aclocal.m4 (AC_KRB5_TCL_FIND_CONFIG): Use 'eval' when setting
index fe1e41bfb13b3ed4bfbef4c8ed2cd7dc35e4fd3a..c819d32d78e858bc456eeb1c83571fd6ff6407ff 100644 (file)
@@ -752,6 +752,7 @@ dnl
 dnl AC_KRB5_TCL_FIND_CONFIG (uses tcl_dir)
 dnl
 AC_DEFUN(AC_KRB5_TCL_FIND_CONFIG,[
+AC_REQUIRE([KRB5_LIB_AUX])dnl
 AC_MSG_CHECKING(for tclConfig.sh)
 if test -r "$tcl_dir/lib/tclConfig.sh" ; then
   tcl_conf="$tcl_dir/lib/tclConfig.sh"
@@ -827,6 +828,11 @@ if test -n "$tcl_ok_conf" ; then
   eval TCL_LIBS='"'$TCL_LIB_SPEC $TCL_LIBS $TCL_DL_LIBS'"'
   TCL_LIBPATH="-L$TCL_EXEC_PREFIX/lib"
   TCL_RPATH=":$TCL_EXEC_PREFIX/lib"
+  if test "$DEPLIBEXT" != "$SHLIBEXT" && test -n "$RPATH_FLAG"; then
+    TCL_MAYBE_RPATH='$(RPATH_FLAG)'"$TCL_EXEC_PREFIX/lib"
+  else
+    TCL_MAYBE_RPATH=
+  fi
   CPPFLAGS="$old_CPPFLAGS $TCL_INCLUDES"
   AC_CHECK_HEADER(tcl.h,AC_DEFINE(HAVE_TCL_H) tcl_header=yes)
   if test $tcl_header=no; then
@@ -839,6 +845,7 @@ AC_SUBST(TCL_INCLUDES)
 AC_SUBST(TCL_LIBS)
 AC_SUBST(TCL_LIBPATH)
 AC_SUBST(TCL_RPATH)
+AC_SUBST(TCL_MAYBE_RPATH)
 ])dnl
 dnl
 dnl AC_KRB5_TCL_TRYOLD
@@ -1059,6 +1066,7 @@ AC_DEFUN(KRB5_BUILD_PROGRAM,
 [AC_REQUIRE([KRB5_LIB_AUX])dnl
 AC_REQUIRE([KRB5_AC_NEED_LIBGEN])dnl
 AC_SUBST(CC_LINK)
+AC_SUBST(RPATH_FLAG)
 AC_SUBST(DEPLIBEXT)])
 
 dnl
index 8f8edc07f2be52ffe6f674a89ac0d56da994fadd..4199dfa176c924d81d8c4aa63920c73fa7c0ef75 100644 (file)
@@ -1,3 +1,12 @@
+2002-11-04  Tom Yu  <tlyu@mit.edu>
+
+       * pre.in: New variables RPATH_FLAG (set regardless of whether
+       we're building shared), TCL_MAYBE_RPATH (empty unless we're
+       building static and are capable of shared libs, in case there's a
+       shared tcl lib).
+
+       * shlib.conf: New variable RPATH_FLAG. 
+
 2002-10-07  Sam Hartman  <hartmans@mit.edu>
 
        * pre.in post.in (RECURSE_TARGETS): Add install-headers-recurse
index eeefe1d0388fbe2ffc5880f8e8bf5cebff38004d..ce892225282e99188cc2cf9044c6a65c25aa1e31 100644 (file)
@@ -207,6 +207,9 @@ EXEEXT =
 
 CC_LINK=@CC_LINK@
 
+# prefix (with no spaces after) for rpath flag to cc
+RPATH_FLAG=@RPATH_FLAG@
+
 # this gets set by configure to either $(STLIBEXT) or $(SHLIBEXT),
 # depending on whether we're building with shared libraries.
 DEPLIBEXT=@DEPLIBEXT@
@@ -317,6 +320,7 @@ KRB4_INCLUDES       = @KRB4_INCLUDES@
 TCL_LIBS       = @TCL_LIBS@
 TCL_LIBPATH    = @TCL_LIBPATH@
 TCL_RPATH      = @TCL_RPATH@
+TCL_MAYBE_RPATH = @TCL_MAYBE_RPATH@
 TCL_INCLUDES   = @TCL_INCLUDES@
 
 # error table rules
index 351ca08ce2ca17662331154d60ffb3ec891b52c0..cae844cf1c2cdcb7fd1ea1d00ecb0c1a99434118 100644 (file)
@@ -28,7 +28,8 @@ alpha*-dec-osf*)
        LDCOMBINE='ld -shared -expect_unresolved \* -update_registry $(BUILDTOP)/so_locations -soname lib$(LIB)$(SHLIBSEXT)'
        SHLIB_EXPFLAGS='-rpath $(SHLIB_RDIRS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
        PROFFLAGS=-pg
-       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -Wl,-rpath -Wl,$(PROG_RPATH) $(LDFLAGS)'
+       RPATH_FLAG='-Wl,-rpath -Wl,'
+       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        # Need -oldstyle_liblookup to avoid picking up shared libs from
        # other builds.  OSF/1 / Tru64 ld programs look through the entire
        # library path for shared libs prior to looking through the
@@ -58,6 +59,7 @@ alpha*-dec-osf*)
        SHLIBEXT=.sl
        SHLIBVEXT='.$(LIBMAJOR).$(LIBMINOR)'
        SHLIBSEXT='.$(LIBMAJOR)'
+       RPATH_FLAG='-Wl,+b,'
        if test "$krb5_cv_prog_gcc" = yes; then
                SHLIB_EXPFLAGS='-Wl,+s -Wl,+b,$(SHLIB_RDIRS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
                LDCOMBINE='gcc -fPIC -shared -Wl,+h,lib$(LIB)$(SHLIBSEXT)'
@@ -65,7 +67,7 @@ alpha*-dec-osf*)
                SHLIB_EXPFLAGS='+s +b $(SHLIB_RDIRS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
                LDCOMBINE='ld -b +h lib$(LIB)$(SHLIBSEXT)'
        fi
-       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -Wl,+s -Wl,+b,$(PROG_RPATH) $(LDFLAGS)'
+       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -Wl,+s $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(LDFLAGS)'
        RUN_ENV='SHLIB_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export SHLIB_PATH;'
        ;;
@@ -84,7 +86,8 @@ mips-sgi-irix6.3)     # This is a Kludge; see below
        SHLIB_EXPFLAGS='-rpath $(SHLIB_RDIRS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
        # no gprof for Irix...
        PROFFLAGS=-p
-       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -Wl,-rpath -Wl,$(PROG_RPATH) $(LDFLAGS)'
+       RPATH_FLAG='-Wl,-rpath -Wl,'
+       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(LDFLAGS)'
        # This grossness is necessary due to the presence of *three*
        # supported ABIs on Irix, and the precedence of the rpath over
@@ -106,7 +109,8 @@ mips-sgi-irix*)
        SHLIB_EXPFLAGS='-rpath $(SHLIB_RDIRS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
        # no gprof for Irix...
        PROFFLAGS=-p
-       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -Wl,-rpath -Wl,$(PROG_RPATH) $(LDFLAGS)'
+       RPATH_FLAG='-Wl,-rpath -Wl,'
+       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(LDFLAGS)'
        # This grossness is necessary due to the presence of *three*
        # supported ABIs on Irix, and the precedence of the rpath over
@@ -132,7 +136,8 @@ mips-sni-sysv4)
        SHLIBEXT=.so
        SHLIBVEXT='.so.$(LIBMAJOR).$(LIBMINOR)'
        SHLIBSEXT='.so.$(LIBMAJOR)'
-       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -R$(PROG_RPATH) $(LDFLAGS)'
+       RPATH_FLAG=-R
+       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(LDFLAGS)'
        RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;'
        PROFFLAGS=-pg
@@ -145,7 +150,8 @@ mips-*-netbsd*)
        SHLIBEXT=.so
        LDCOMBINE='ld -shared -soname lib$(LIB)$(SHLIBSEXT)'
        SHLIB_EXPFLAGS='-R$(SHLIB_RDIRS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
-       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -Wl,-rpath -Wl,$(PROG_RPATH) $(LDFLAGS)'
+       RPATH_FLAG='-Wl,-rpath -Wl,'
+       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(LDFLAGS)'
        RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;'
        PROFFLAGS=-pg
@@ -157,7 +163,8 @@ mips-*-netbsd*)
        SHLIBEXT=.so
        LDCOMBINE='ld -Bshareable'
        SHLIB_EXPFLAGS='-R$(SHLIB_RDIRS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
-       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -R$(PROG_RPATH) $(LDFLAGS)'
+       RPATH_FLAG=-R
+       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(LDFLAGS)'
        RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;'
        PROFFLAGS=-pg
@@ -172,11 +179,12 @@ mips-*-netbsd*)
        PICFLAGS=-fpic
        if test "x$objformat" = "xelf" ; then
                SHLIBVEXT='.so.$(LIBMAJOR)'
-               CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -Wl,-rpath -Wl,$(PROG_RPATH) $(LDFLAGS)'
+               RPATH_FLAG='-Wl,-rpath -Wl,'
        else
+               RPATH_FLAG=-R
                SHLIBVEXT='.so.$(LIBMAJOR).$(LIBMINOR)'
-               CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -R$(PROG_RPATH) $(LDFLAGS)'
        fi
+       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        SHLIBEXT=.so
        LDCOMBINE='ld -Bshareable'
        SHLIB_EXPFLAGS='-R$(SHLIB_RDIRS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
@@ -191,7 +199,8 @@ mips-*-netbsd*)
        SHLIBEXT=.so
        LDCOMBINE='ld -Bshareable'
        SHLIB_EXPFLAGS='-R$(SHLIB_RDIRS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
-       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -R$(PROG_RPATH) $(LDFLAGS)'
+       RPATH_FLAG=-R
+       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(LDFLAGS)'
        RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;'
        PROFFLAGS=-pg
@@ -223,7 +232,8 @@ mips-*-netbsd*)
        SHLIBEXT=.so
        SHLIB_EXPFLAGS='-R$(SHLIB_RDIRS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
        PROFFLAGS=-pg
-       CC_LINK_SHARED='$(PURE) $(CC) $(PROG_LIBPATH) -R$(PROG_RPATH) $(LDFLAGS)'
+       RPATH_FLAG=-R
+       CC_LINK_SHARED='$(PURE) $(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        CC_LINK_STATIC='$(PURE) $(CC) $(PROG_LIBPATH) $(LDFLAGS)'
        RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;'
        ;;
@@ -240,7 +250,9 @@ mips-*-netbsd*)
        LDCOMBINE='LD_LIBRARY_PATH=`echo $(SHLIB_DIRS) | sed -e "s/-L//g" -e "s/ /:/g"` ld -dp -assert pure-text'
        SHLIB_EXPFLAGS='-L$(SHLIB_RDIRS) $(SHLIB_EXPLIBS)'
        PROFFLAGS=-pg
-       CC_LINK_SHARED='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"` $(PURE) $(CC) -L$(PROG_RPATH) $(LDFLAGS)'
+       # ick.
+       RPATH_FLAG=-L
+       CC_LINK_SHARED='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"` $(PURE) $(CC) $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        CC_LINK_STATIC='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g` $(PURE) $(CC) $(LDFLAGS)'
        RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;'
        ;;
@@ -262,7 +274,8 @@ mips-*-netbsd*)
        # built in this tree...
        SHLIB_EXPFLAGS='-R$(SHLIB_RDIRS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
        PROFFLAGS=-pg
-       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -Wl,-rpath -Wl,$(PROG_RPATH) $(LDFLAGS)'
+       RPATH_FLAG='-Wl,-rpath -Wl,'
+       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(LDFLAGS)'
        CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(LDFLAGS)'
        RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;'
        ;;
@@ -276,10 +289,11 @@ mips-*-netbsd*)
        SHLIB_EXPFLAGS='  $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
        PROFFLAGS=-pg
        if test "$krb5_cv_prog_gcc" = "yes" ; then
-         CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -Wl,-blibpath:$(PROG_RPATH):/usr/lib:/lib $(LDFLAGS)'
+         RPATH_FLAG='-Wl,-blibpath:'
        else
-         CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) -blibpath:$(PROG_RPATH):/usr/lib:/lib $(LDFLAGS)'
+         RPATH_FLAG=-bilbpath:
        fi
+       CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH):/usr/lib:/lib $(LDFLAGS)'
        CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(LDFLAGS)'
        # $(PROG_RPATH) is here to handle things like a shared tcl library
        RUN_ENV='LIBPATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`:$(PROG_RPATH):/usr/lib:/usr/local/lib; export LIBPATH; '
index 72b0d4b4467f6289806865ceb4047a166e44f321..9013928b909489d0877886f0aa220c0a02b8d939 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-04  Tom Yu  <tlyu@mit.edu>
+
+       * Makefile.in: Use $(TCL_MAYBE_RPATH).
+
 2002-08-29  Ken Raeburn  <raeburn@mit.edu>
 
        * Makefile.in: Revert $(S)=>/ change, for Windows support.
index 4c37226ffca741b5a48514e2d49bda9db454b5f1..6de033ac04b444b7c7da5709275cfcbda8b74fb9 100644 (file)
@@ -25,11 +25,11 @@ all-::
 all-tcl:: $(CLNTPROG) $(SRVPROG)
 
 $(SRVPROG): $(OBJS) $(KADMSRV_DEPLIBS) $(KRB5_BASE_DEPLIBS)
-       $(CC_LINK) -o $(SRVPROG) $(OBJS) \
+       $(CC_LINK) -o $(SRVPROG) $(OBJS) $(TCL_MAYBE_RPATH) \
                $(KADMSRV_LIBS) $(KRB5_BASE_LIBS) $(TCL_LIBS)
 
 $(CLNTPROG): $(OBJS) $(KADMCLNT_DEPLIBS) $(KRB5_BASE_DEPLIBS)
-       $(CC_LINK) -o $(CLNTPROG) $(OBJS) \
+       $(CC_LINK) -o $(CLNTPROG) $(OBJS) $(TCL_MAYBE_RPATH) \
                $(KADMCLNT_LIBS) $(KRB5_BASE_LIBS) $(TCL_LIBS)
 
 bsddb_dump: bsddb_dump.o