aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-09-07 23:45:56 -0700
committerJunio C Hamano <gitster@pobox.com>2008-09-07 23:45:56 -0700
commitcd50988ae03e086ca1a8f18584153d359699ea25 (patch)
treeadf7e5f2721d768e5a39146e1d8f6dae0f3dde91
parentfdfb4cfadcfdfe4ebafd0545b5ebb661433ea66c (diff)
parent798a94500230e4d2a1a18f005fe9592454fe451b (diff)
downloadgit-cd50988ae03e086ca1a8f18584153d359699ea25.tar.gz
git-cd50988ae03e086ca1a8f18584153d359699ea25.tar.xz
Merge branch 'jc/cc-ld-dynpath'
* jc/cc-ld-dynpath: configure: auto detect dynamic library path switches Makefile: Allow CC_LD_DYNPATH to be overriden Conflicts: Makefile config.mak.in
-rw-r--r--Makefile17
-rw-r--r--config.mak.in1
-rw-r--r--configure.ac32
3 files changed, 42 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index dfed7bae9..cd3d621ae 100644
--- a/Makefile
+++ b/Makefile
@@ -697,8 +697,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
THREADED_DELTA_SEARCH = YesPlease
endif
ifeq ($(uname_S),AIX)
@@ -793,12 +792,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
diff --git a/config.mak.in b/config.mak.in
index f67d673d0..17e9861c0 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -4,6 +4,7 @@
CC = @CC@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
+CC_LD_DYNPATH = @CC_LD_DYNPATH@
AR = @AR@
TAR = @TAR@
#INSTALL = @INSTALL@ # needs install-sh or install.sh in sources
diff --git a/configure.ac b/configure.ac
index 7c2856efc..27bab00a4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,6 +103,38 @@ 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(CC_LD_DYNPATH, [-R])
+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(CC_LD_DYNPATH, [-Wl,-rpath,])
+ else
+ AC_CACHE_CHECK([if linker supports -rpath], ld_rpath, [
+ SAVE_LDFLAGS="${LDFLAGS}"
+ LDFLAGS="${SAVE_LDFLAGS} -rpath /"
+ AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_rpath=yes], [ld_rpath=no])
+ LDFLAGS="${SAVE_LD_FLAGS}"
+ ])
+ if test "$ld_rpath" = "yes"; then
+ AC_SUBST(CC_LD_DYNPATH, [-rpath])
+ else
+ AC_MSG_WARN([linker does not support runtime path to dynamic libraries])
+ fi
+ 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])