gcc does not necessarily pass runtime libpath with -R
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Dec 27, 2006 at 14:17 UTC
bbfc63dd78037a3f94c3f342384caee1037d09ab
1 file changed
+16
-6
Makefile
+16
-6
@@ -79,6 +79,10 @@ all:
79
#
80
# Define NO_ICONV if your libc does not properly support iconv.
81
#
82
+# Define NO_R_TO_GCC if your gcc does not like "-R/path/lib" that
83
+# tells runtime paths to dynamic libraries; "-Wl,-rpath=/path/lib"
84
+# is used instead.
85
+#
86
# Define USE_NSEC below if you want git to care about sub-second file mtimes
87
# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
88
# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
@@ -422,11 +426,19 @@ ifeq ($(uname_S),Darwin)
426
endif
427
endif
428
429
+ifdef NO_R_TO_GCC_LINKER
430
+ # Some gcc does not accept and pass -R to the linker to specify
431
+ # the runtime dynamic library path.
432
+ CC_LD_DYNPATH = -Wl,-rpath=
433
+else
434
+ CC_LD_DYNPATH = -R
435
+endif
436
+
437
ifndef NO_CURL
438
ifdef CURLDIR
427
- # This is still problematic -- gcc does not always want -R.
439
+ # Try "-Wl,-rpath=$(CURLDIR)/lib" in such a case.
440
BASIC_CFLAGS += -I$(CURLDIR)/include
429
- CURL_LIBCURL = -L$(CURLDIR)/lib -R$(CURLDIR)/lib -lcurl
441
+ CURL_LIBCURL = -L$(CURLDIR)/lib $(CC_LD_DYNPATH)$(CURLDIR)/lib -lcurl
442
else
443
CURL_LIBCURL = -lcurl
444
endif
@@ -445,9 +457,8 @@ endif
457
ifndef NO_OPENSSL
458
OPENSSL_LIBSSL = -lssl
459
ifdef OPENSSLDIR
448
- # Again this may be problematic -- gcc does not always want -R.
460
BASIC_CFLAGS += -I$(OPENSSLDIR)/include
450
- OPENSSL_LINK = -L$(OPENSSLDIR)/lib -R$(OPENSSLDIR)/lib
461
+ OPENSSL_LINK = -L$(OPENSSLDIR)/lib $(CC_LD_DYNPATH)$(OPENSSLDIR)/lib
462
else
463
OPENSSL_LINK =
464
endif
@@ -463,9 +474,8 @@ else
474
endif
475
ifdef NEEDS_LIBICONV
476
ifdef ICONVDIR
466
- # Again this may be problematic -- gcc does not always want -R.
477
BASIC_CFLAGS += -I$(ICONVDIR)/include
468
- ICONV_LINK = -L$(ICONVDIR)/lib -R$(ICONVDIR)/lib
478
+ ICONV_LINK = -L$(ICONVDIR)/lib $(CC_LD_DYNPATH)$(ICONVDIR)/lib
479
else
480
ICONV_LINK =
481
endif