Allow configure to override CC_LD_DYNPATH
PATCH 1/2 Allow configure to override CC_LD_DYNPATH
Current Makefile does not allow configure to override CC_LD_DYNPATH because "-include config.mak" comes after the "ifdef NO_R_TO_GCC_LINKER". This patch moves the referred ifdef.
In addition, another piece of code was moved because the CC_LD_DYNPATH should be also used by ALL_LDFLAGS on NetBSD.
---
Ok, this is my third try... I have split the patch into two parts this time. This first one concerns only the minimal support needed on the Makefile side. The next one is the one that does the interesting thing. Sorry for my newbieness and hope it is up to Git coding standards this time :)
I have also changed some comments and replaced "-Wl,-rpath=" by "-Wl,-rpath," for the sake of homogeneity. This should be equivalent everywhere. Thanks Matthieu and Junio for the help.
Makefile | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-)
Makefile +14 -11
@@ -113,7 +113,7 @@ all:: # # Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib" # that tells runtime paths to dynamic libraries; -# "-Wl,-rpath=/path/lib" is used instead. +# "-Wl,-rpath,/path/lib" is used instead. # # Define USE_NSEC below if you want git to care about sub-second file mtimes # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
@@ -689,7 +689,6 @@ ifeq ($(uname_S),NetBSD) endif BASIC_CFLAGS += -I/usr/pkg/include BASIC_LDFLAGS += -L/usr/pkg/lib - ALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib endif ifeq ($(uname_S),AIX) NO_STRCASESTR=YesPlease
@@ -763,9 +762,21 @@ ifneq (,$(findstring arm,$(uname_M))) ARM_SHA1 = YesPlease endif +# Runtime dynamic library path switch +ifdef NO_R_TO_GCC_LINKER + # Some linkers use -Wl,-rpath, + CC_LD_DYNPATH = -Wl,-rpath, +else + # Some others need -R + CC_LD_DYNPATH = -R +endif + -include config.mak.autogen -include config.mak +ifeq ($(uname_S),NetBSD) + ALL_LDFLAGS += $(CC_LD_DYNPATH)/usr/pkg/lib +endif ifeq ($(uname_S),Darwin) ifndef NO_FINK ifeq ($(shell test -d /sw/lib && echo y),y)
@@ -781,19 +792,11 @@ ifeq ($(uname_S),Darwin) endif endif -ifdef NO_R_TO_GCC_LINKER - # Some gcc does not accept and pass -R to the linker to specify - # the runtime dynamic library path. - CC_LD_DYNPATH = -Wl,-rpath= -else - CC_LD_DYNPATH = -R -endif - ifdef NO_CURL BASIC_CFLAGS += -DNO_CURL else ifdef CURLDIR - # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case. + # Try specifying runtime dynamic library path in such a case. BASIC_CFLAGS += -I$(CURLDIR)/include CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl else
Signature · 1 line
1.5.4.3
Quoted 17 lines · Giovanni Funchal
(quoted diff) +5
-1@@ -689,7 +689,6 @@ ifeq ($(uname_S),NetBSD) endif BASIC_CFLAGS += -I/usr/pkg/include BASIC_LDFLAGS += -L/usr/pkg/lib - ALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib endif ifeq ($(uname_S),AIX) NO_STRCASESTR=YesPlease@@ -763,9 +762,21 @@ ifneq (,$(findstring arm,$(uname_M))) ARM_SHA1 = YesPlease endif +# Runtime dynamic library path switch +ifdef NO_R_TO_GCC_LINKER + # Some linkers use -Wl,-rpath, + CC_LD_DYNPATH = -Wl,-rpath, +else
Review ifneq (,$(findstring arm,$(uname_M))) · line 779
Quoted 10 lines
(quoted diff) +7
-0+ # Some others need -R + CC_LD_DYNPATH = -R +endif + -include config.mak.autogen -include config.mak +ifeq ($(uname_S),NetBSD) + ALL_LDFLAGS += $(CC_LD_DYNPATH)/usr/pkg/lib +endif
I think this NetBSD change might be a good idea.
By moving "ifdef" before where we "include config.mak", however, you broke existing setups that use NO_R_TO_GCC_LINKER to cause "-Wl,-rpath=" to be used.
How about doing it the way the attached patch does instead? Then the autoconf can configure CC_LD_DYNPATH to be used that may even be different from "-Wl,-rpath=" (e.g. the one with double-dash "-Wl,--rpath").
Makefile | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-)
Makefile +9 -8
@@ -688,8 +688,7 @@ ifeq ($(uname_S),NetBSD) NEEDS_LIBICONV = YesPlease endif BASIC_CFLAGS += -I/usr/pkg/include - BASIC_LDFLAGS += -L/usr/pkg/lib - ALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib + BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib endif ifeq ($(uname_S),AIX) NO_STRCASESTR=YesPlease
@@ -781,12 +780,14 @@ ifeq ($(uname_S),Darwin) endif endif -ifdef NO_R_TO_GCC_LINKER - # Some gcc does not accept and pass -R to the linker to specify - # the runtime dynamic library path. - CC_LD_DYNPATH = -Wl,-rpath= -else - CC_LD_DYNPATH = -R +ifndef CC_LD_DYNPATH + ifdef NO_R_TO_GCC_LINKER + # Some gcc does not accept and pass -R to the linker to specify + # the runtime dynamic library path. + CC_LD_DYNPATH = -Wl,-rpath, + else + CC_LD_DYNPATH = -R + endif endif ifdef NO_CURL