{"thread":{"id":"15035","subject":"[PATCH 1/2] Allow configure to override CC_LD_DYNPATH","startedAt":"2008-08-16T13:01:07Z","lastAt":"2008-08-17T04:56:24Z","messageCount":2,"participants":["Giovanni Funchal","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"87377","messageId":"1218891667-6014-1-git-send-email-gafunchal@gmail.com","threadId":"15035","inReplyTo":null,"subject":"[PATCH 1/2] Allow configure to override CC_LD_DYNPATH","fromName":"Giovanni Funchal","fromEmail":"gafunchal@gmail.com","sentAt":"2008-08-16T13:01:07Z","receivedAt":"2008-08-16T13:01:07Z","isPatch":true,"sender":{"key":"gafunchal@gmail.com","avatar":"https://gravatar.com/avatar/96f8068bdfb134f61682ec4a9741b71b582efa9d102055028a88643507644e9c?d=mp&s=160"},"body":"Current Makefile does not allow configure to override CC_LD_DYNPATH because\n\"-include config.mak\" comes after the \"ifdef NO_R_TO_GCC_LINKER\". This patch\nmoves the referred ifdef.\n\nIn addition, another piece of code was moved because the CC_LD_DYNPATH should\nbe also used by ALL_LDFLAGS on NetBSD.\n\nSigned-Off-By: Giovanni Funchal <gafunchal@gmail.com>\n---\n\nOk, this is my third try... I have split the patch into two parts this time.\nThis first one concerns only the minimal support needed on the Makefile side.\nThe next one is the one that does the interesting thing. Sorry for my\nnewbieness and hope it is up to Git coding standards this time :)\n\nI have also changed some comments and replaced \"-Wl,-rpath=\" by\n\"-Wl,-rpath,\" for the sake of homogeneity. This should be equivalent\neverywhere. Thanks Matthieu and Junio for the help.\n\n Makefile |   25 ++++++++++++++-----------\n 1 files changed, 14 insertions(+), 11 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 53ab4b5..2572b4b 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -113,7 +113,7 @@ all::\n #\n # Define NO_R_TO_GCC_LINKER if your gcc does not like \"-R/path/lib\"\n # that tells runtime paths to dynamic libraries;\n-# \"-Wl,-rpath=/path/lib\" is used instead.\n+# \"-Wl,-rpath,/path/lib\" is used instead.\n #\n # Define USE_NSEC below if you want git to care about sub-second file mtimes\n # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and\n@@ -689,7 +689,6 @@ ifeq ($(uname_S),NetBSD)\n \tendif\n \tBASIC_CFLAGS += -I/usr/pkg/include\n \tBASIC_LDFLAGS += -L/usr/pkg/lib\n-\tALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib\n endif\n ifeq ($(uname_S),AIX)\n \tNO_STRCASESTR=YesPlease\n@@ -763,9 +762,21 @@ ifneq (,$(findstring arm,$(uname_M)))\n \tARM_SHA1 = YesPlease\n endif\n \n+# Runtime dynamic library path switch\n+ifdef NO_R_TO_GCC_LINKER\n+\t# Some linkers use -Wl,-rpath,\n+\tCC_LD_DYNPATH = -Wl,-rpath,\n+else\n+\t# Some others need -R\n+\tCC_LD_DYNPATH = -R\n+endif\n+\n -include config.mak.autogen\n -include config.mak\n \n+ifeq ($(uname_S),NetBSD)\n+\tALL_LDFLAGS += $(CC_LD_DYNPATH)/usr/pkg/lib\n+endif\n ifeq ($(uname_S),Darwin)\n \tifndef NO_FINK\n \t\tifeq ($(shell test -d /sw/lib && echo y),y)\n@@ -781,19 +792,11 @@ ifeq ($(uname_S),Darwin)\n \tendif\n endif\n \n-ifdef NO_R_TO_GCC_LINKER\n-\t# Some gcc does not accept and pass -R to the linker to specify\n-\t# the runtime dynamic library path.\n-\tCC_LD_DYNPATH = -Wl,-rpath=\n-else\n-\tCC_LD_DYNPATH = -R\n-endif\n-\n ifdef NO_CURL\n \tBASIC_CFLAGS += -DNO_CURL\n else\n \tifdef CURLDIR\n-\t\t# Try \"-Wl,-rpath=$(CURLDIR)/$(lib)\" in such a case.\n+\t\t# Try specifying runtime dynamic library path in such a case.\n \t\tBASIC_CFLAGS += -I$(CURLDIR)/include\n \t\tCURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl\n \telse\n-- \n1.5.4.3\n"},{"id":"87406","messageId":"7vwsig9r47.fsf@gitster.siamese.dyndns.org","threadId":"15035","inReplyTo":"1218891667-6014-1-git-send-email-gafunchal@gmail.com","subject":"Re: [PATCH 1/2] Allow configure to override CC_LD_DYNPATH","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-17T04:56:24Z","receivedAt":"2008-08-17T04:56:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Giovanni Funchal <gafunchal@gmail.com> writes:\n\n> @@ -689,7 +689,6 @@ ifeq ($(uname_S),NetBSD)\n>  \tendif\n>  \tBASIC_CFLAGS += -I/usr/pkg/include\n>  \tBASIC_LDFLAGS += -L/usr/pkg/lib\n> -\tALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib\n>  endif\n>  ifeq ($(uname_S),AIX)\n>  \tNO_STRCASESTR=YesPlease\n> @@ -763,9 +762,21 @@ ifneq (,$(findstring arm,$(uname_M)))\n>  \tARM_SHA1 = YesPlease\n>  endif\n>  \n> +# Runtime dynamic library path switch\n> +ifdef NO_R_TO_GCC_LINKER\n> +\t# Some linkers use -Wl,-rpath,\n> +\tCC_LD_DYNPATH = -Wl,-rpath,\n> +else\n> +\t# Some others need -R\n> +\tCC_LD_DYNPATH = -R\n> +endif\n> +\n>  -include config.mak.autogen\n>  -include config.mak\n>  \n> +ifeq ($(uname_S),NetBSD)\n> +\tALL_LDFLAGS += $(CC_LD_DYNPATH)/usr/pkg/lib\n> +endif\n\nI think this NetBSD change might be a good idea.\n\nBy moving \"ifdef\" before where we \"include config.mak\", however, you broke\nexisting setups that use NO_R_TO_GCC_LINKER to cause \"-Wl,-rpath=\" to be\nused.\n\nHow about doing it the way the attached patch does instead?  Then the\nautoconf can configure CC_LD_DYNPATH to be used that may even be different\nfrom \"-Wl,-rpath=\" (e.g. the one with double-dash \"-Wl,--rpath\").\n\n Makefile |   17 +++++++++--------\n 1 files changed, 9 insertions(+), 8 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 53ab4b5..264ede3 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -688,8 +688,7 @@ ifeq ($(uname_S),NetBSD)\n \t\tNEEDS_LIBICONV = YesPlease\n \tendif\n \tBASIC_CFLAGS += -I/usr/pkg/include\n-\tBASIC_LDFLAGS += -L/usr/pkg/lib\n-\tALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib\n+\tBASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib\n endif\n ifeq ($(uname_S),AIX)\n \tNO_STRCASESTR=YesPlease\n@@ -781,12 +780,14 @@ ifeq ($(uname_S),Darwin)\n \tendif\n endif\n \n-ifdef NO_R_TO_GCC_LINKER\n-\t# Some gcc does not accept and pass -R to the linker to specify\n-\t# the runtime dynamic library path.\n-\tCC_LD_DYNPATH = -Wl,-rpath=\n-else\n-\tCC_LD_DYNPATH = -R\n+ifndef CC_LD_DYNPATH\n+\tifdef NO_R_TO_GCC_LINKER\n+\t\t# Some gcc does not accept and pass -R to the linker to specify\n+\t\t# the runtime dynamic library path.\n+\t\tCC_LD_DYNPATH = -Wl,-rpath,\n+\telse\n+\t\tCC_LD_DYNPATH = -R\n+\tendif\n endif\n \n ifdef NO_CURL\n"}]}