Re: Patch for NO_R_TO_GCC_LINKER

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> "Giovanni Funchal" <gafunchal@xxxxxxxxx> writes:
>
>> My changes should not break a lot of people's setups. Most people will
>> find the new default better because it works straight on
>> linux/windows.
>
> My understanding is that Linux/Windows people won't be using
> NO_R_TO_GCC_LINKER.  What I was afraid of breaking was people who have
> their own config.mak (which is included by Makefile) to customize the way
> the linkage works, setting NO_R_TO_GCC_LINKER appropriately.  Doesn't your
> change to the Makefile in a way not to pay attention to the variable break
> them?

In other words, wouldn't a patch like this (based on your change to
configure.ac, but I only hacked autoconf in very distant past so the
details may be wrong) be with much less impact to existing users and
achieve the same autodetection that configure.ac currently does not do?

I am not sure about another aspect of your change, which changes the use
of "-Wl,-rpath=$(path)" to "-Wl,-rpath,$(path)".  If both of them always
work (or neither of them and -R works), that would be great.  Otherwise,
if we need to detect one platform that accepts only -Wl,-rpath,$(path) and
other ones that accept only -Wl,-rpath=$(path), then it would make more
sense to check them separately in configure.ac, and override CC_LD_DYNPATH
directly, in which case Makefile needs to be modified as well.

 config.mak.in |    1 +
 configure.ac  |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/config.mak.in b/config.mak.in
index b776149..c079864 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -7,6 +7,7 @@ AR = @AR@
 TAR = @TAR@
 #INSTALL = @INSTALL@		# needs install-sh or install.sh in sources
 TCLTK_PATH = @TCLTK_PATH@
+NO_R_TO_GCC_LINKER = @no_r_to_gcc_linker@
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
diff --git a/configure.ac b/configure.ac
index 7c2856e..a23a7f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,6 +103,28 @@ GIT_PARSE_WITH(tcltk))
 AC_MSG_NOTICE([CHECKS for programs])
 #
 AC_PROG_CC([cc gcc])
+# which switch to pass runtime path to dynamic libraries to the linker
+AC_CACHE_CHECK([if linker supports -R], ld_dashr, [
+   SAVE_LDFLAGS="${LDFLAGS}"
+   LDFLAGS="${SAVE_LDFLAGS} -R /"
+   AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_dashr=yes], [ld_dashr=no])
+   LDFLAGS="${SAVE_LDFLAGS}"
+])
+if test "$ld_dashr" = "yes"; then
+   AC_SUBST(no_r_to_gcc_linker, [ ])
+else
+   AC_CACHE_CHECK([if linker supports -Wl,rpath,], ld_wl_rpath, [
+      SAVE_LDFLAGS="${LDFLAGS}"
+      LDFLAGS="${SAVE_LDFLAGS} -Wl,-rpath,/"
+      AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_wl_rpath=yes], [ld_wl_rpath=no])
+      LDFLAGS="${SAVE_LD_FLAGS}"
+   ])
+   if test "$ld_wl_rpath" = "yes"; then
+      AC_SUBST(no_r_to_gcc_linker, [YesPlease])
+   else
+      AC_MSG_ERROR([no linker support for runtime path to dynamic libraries])
+   fi
+fi
 #AC_PROG_INSTALL		# needs install-sh or install.sh in sources
 AC_CHECK_TOOLS(AR, [gar ar], :)
 AC_CHECK_PROGS(TAR, [gtar tar])
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux