$NetBSD: patch-ab,v 1.22 2005/11/03 23:09:24 rillig Exp $ --- unix/configure.orig 2005-06-29 16:43:10.000000000 +0000 +++ unix/configure @@ -1910,12 +1910,13 @@ fi # Step 3: set configuration options based on system name and version. do64bit_ok=no + RPATH_FLAG="" LDFLAGS_ORIG="$LDFLAGS" TCL_EXPORT_FILE_SUFFIX="" UNSHARED_LIB_SUFFIX="" TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`' ECHO_VERSION='`echo ${VERSION}`' - TCL_LIB_VERSIONS_OK=ok + TCL_LIB_VERSIONS_OK=nodots CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE=-O if test "$GCC" = "yes" ; then @@ -2585,7 +2586,6 @@ if eval "test \"`echo '$ac_cv_header_'$a # NetBSD/SPARC needs -fPIC, -fpic will not do. SHLIB_CFLAGS="-fPIC" - SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" @@ -2606,13 +2606,23 @@ EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then rm -rf conftest* - echo "$ac_t""yes" 1>&6 + + echo "$ac_t""yes" 1>&6 + SHLIB_LD='${TCL_CC} -shared -Wl,-x' + RPATH_FLAG='-Wl,-R' + LD_SEARCH_FLAGS='-Wl,-R${LIB_RUNTIME_DIR}' SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' + else rm -rf conftest* - echo "$ac_t""no" 1>&6 + + echo "$ac_t""no" 1>&6 + SHLIB_LD="ld -Bshareable -x" + RPATH_FLAG='-R' + LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + fi rm -f conftest* @@ -2699,12 +2709,13 @@ rm -f conftest* UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' TCL_LIB_VERSIONS_OK=nodots ;; - FreeBSD-*) + FreeBSD-*|DragonFly-*) # FreeBSD 3.* and greater have ELF. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" + RPATH_FLAG='-Wl,-R' DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" @@ -3521,7 +3532,7 @@ fi ;; IRIX*) ;; - NetBSD-*|FreeBSD-*|OpenBSD-*) + NetBSD-*|FreeBSD-*|OpenBSD-*|DragonFly-*) ;; Darwin-*) ;; @@ -3539,16 +3550,16 @@ fi fi if test "$SHARED_LIB_SUFFIX" = "" ; then - SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}${SHLIB_SUFFIX}' fi if test "$UNSHARED_LIB_SUFFIX" = "" ; then - UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' fi if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then LIB_SUFFIX=${SHARED_LIB_SUFFIX} - MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' - INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)' + MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS:.o=.lo} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS} -version-info 1:0' + INSTALL_LIB='$(INSTALL_LIBRARY) $(TK_LA_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)' else LIB_SUFFIX=${UNSHARED_LIB_SUFFIX} @@ -5091,7 +5102,11 @@ echo "configure:5089: checking for X11 l for i in $dirs ; do if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then echo "$ac_t""$i" 1>&6 - XLIBSW="-L$i -lX11" + if test "${RPATH_FLAG}" != ""; then + XLIBSW="-L$i ${RPATH_FLAG}$i -lX11" + else + XLIBSW="-L$i -lX11" + fi x_libraries="$i" break fi @@ -5100,7 +5115,11 @@ echo "configure:5089: checking for X11 l if test "$x_libraries" = ""; then XLIBSW=-lX11 else - XLIBSW="-L$x_libraries -lX11" + if test "${RPATH_FLAG}" != ""; then + XLIBSW="-L$x_libraries ${RPATH_FLAG}$x_libraries -lX11" + else + XLIBSW="-L$x_libraries -lX11" + fi fi fi if test "$XLIBSW" = nope ; then @@ -5172,6 +5191,10 @@ if test "x${x_libraries}" != "x"; then fi if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'` +elif test "${TCL_LD_SEARCH_FLAGS}" = '-R${LIB_RUNTIME_DIR}'; then + LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -R/g'` +elif test "${TCL_LD_SEARCH_FLAGS}" = '-Wl,-R${LIB_RUNTIME_DIR}'; then + LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -Wl,-R/g'` fi # The statement below is very tricky! It actually *evaluates* the @@ -5823,11 +5846,18 @@ else if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then eval TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}" + eval TK_BUILD_LIB_SPEC="libtk${VERSION}\${TK_DBGX}.la" else eval TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}" + eval TK_BUILD_LIB_SPEC="libtk`echo ${VERSION} | tr -d .`\${TK_DBGX}.la" fi - TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}" TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" + if test "${RPATH_FLAG}" != ""; then + TK_LIB_SPEC_RPATH="${RPATH_FLAG}${exec_prefix}/lib" + else + TK_LIB_SPEC_RPATH="" + fi + TK_LIB_SPEC="-L${exec_prefix}/lib ${TK_LIB_SPEC_RPATH} ${TK_LIB_FLAG}" else TK_BUILD_EXP_FILE="lib.exp" eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}"