@@ -103,6 +103,38 @@ GIT_PARSE_WITH(tcltk))
103103AC_MSG_NOTICE ( [ CHECKS for programs] )
104104#
105105AC_PROG_CC ( [ cc gcc] )
106+ # which switch to pass runtime path to dynamic libraries to the linker
107+ AC_CACHE_CHECK ( [ if linker supports -R] , ld_dashr , [
108+ SAVE_LDFLAGS="${LDFLAGS}"
109+ LDFLAGS="${SAVE_LDFLAGS} -R /"
110+ AC_LINK_IFELSE ( AC_LANG_PROGRAM ( [ ] , [ ] ) , [ ld_dashr=yes] , [ ld_dashr=no] )
111+ LDFLAGS="${SAVE_LDFLAGS}"
112+ ] )
113+ if test "$ld_dashr" = "yes"; then
114+ AC_SUBST ( CC_LD_DYNPATH , [ -R] )
115+ else
116+ AC_CACHE_CHECK ( [ if linker supports -Wl,-rpath,] , ld_wl_rpath , [
117+ SAVE_LDFLAGS="${LDFLAGS}"
118+ LDFLAGS="${SAVE_LDFLAGS} -Wl,-rpath,/"
119+ AC_LINK_IFELSE ( AC_LANG_PROGRAM ( [ ] , [ ] ) , [ ld_wl_rpath=yes] , [ ld_wl_rpath=no] )
120+ LDFLAGS="${SAVE_LD_FLAGS}"
121+ ] )
122+ if test "$ld_wl_rpath" = "yes"; then
123+ AC_SUBST ( CC_LD_DYNPATH , [ -Wl,-rpath,] )
124+ else
125+ AC_CACHE_CHECK ( [ if linker supports -rpath] , ld_rpath , [
126+ SAVE_LDFLAGS="${LDFLAGS}"
127+ LDFLAGS="${SAVE_LDFLAGS} -rpath /"
128+ AC_LINK_IFELSE ( AC_LANG_PROGRAM ( [ ] , [ ] ) , [ ld_rpath=yes] , [ ld_rpath=no] )
129+ LDFLAGS="${SAVE_LD_FLAGS}"
130+ ] )
131+ if test "$ld_rpath" = "yes"; then
132+ AC_SUBST ( CC_LD_DYNPATH , [ -rpath] )
133+ else
134+ AC_MSG_WARN ( [ linker does not support runtime path to dynamic libraries] )
135+ fi
136+ fi
137+ fi
106138# AC_PROG_INSTALL # needs install-sh or install.sh in sources
107139AC_CHECK_TOOLS ( AR , [ gar ar] , : )
108140AC_CHECK_PROGS ( TAR , [ gtar tar] )
0 commit comments