From ca7ec1c2af80a30a3ade543464b129a66bd6a4a1 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Tue, 5 Nov 2002 04:52:24 +0000 Subject: [PATCH] New Makefile variable RPATH_FLAG, possibly used even when we're not 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 | 5 ++++ src/aclocal.m4 | 8 ++++++ src/config/ChangeLog | 9 ++++++ src/config/pre.in | 4 +++ src/config/shlib.conf | 44 +++++++++++++++++++---------- src/kadmin/testing/util/ChangeLog | 4 +++ src/kadmin/testing/util/Makefile.in | 4 +-- 7 files changed, 61 insertions(+), 17 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 26ff4d6db..50a46008c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-11-04 Tom Yu + + * aclocal.m4 (AC_KRB5_TCL_FIND_CONFIG): Set TCL_MAYBE_RPATH. + (KRB5_BUILD_PROGRAM): Substitute RPATH_FLAG. + 2002-10-31 Ken Raeburn * aclocal.m4 (AC_KRB5_TCL_FIND_CONFIG): Use 'eval' when setting diff --git a/src/aclocal.m4 b/src/aclocal.m4 index fe1e41bfb..c819d32d7 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -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 diff --git a/src/config/ChangeLog b/src/config/ChangeLog index 8f8edc07f..4199dfa17 100644 --- a/src/config/ChangeLog +++ b/src/config/ChangeLog @@ -1,3 +1,12 @@ +2002-11-04 Tom Yu + + * 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 * pre.in post.in (RECURSE_TARGETS): Add install-headers-recurse diff --git a/src/config/pre.in b/src/config/pre.in index eeefe1d03..ce8922252 100644 --- a/src/config/pre.in +++ b/src/config/pre.in @@ -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 diff --git a/src/config/shlib.conf b/src/config/shlib.conf index 351ca08ce..cae844cf1 100644 --- a/src/config/shlib.conf +++ b/src/config/shlib.conf @@ -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; ' diff --git a/src/kadmin/testing/util/ChangeLog b/src/kadmin/testing/util/ChangeLog index 72b0d4b44..9013928b9 100644 --- a/src/kadmin/testing/util/ChangeLog +++ b/src/kadmin/testing/util/ChangeLog @@ -1,3 +1,7 @@ +2002-11-04 Tom Yu + + * Makefile.in: Use $(TCL_MAYBE_RPATH). + 2002-08-29 Ken Raeburn * Makefile.in: Revert $(S)=>/ change, for Windows support. diff --git a/src/kadmin/testing/util/Makefile.in b/src/kadmin/testing/util/Makefile.in index 4c37226ff..6de033ac0 100644 --- a/src/kadmin/testing/util/Makefile.in +++ b/src/kadmin/testing/util/Makefile.in @@ -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 -- 2.26.2