summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorGiovanni Funchal <gafunchal@gmail.com>2008-08-16 13:01:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-08-18 00:42:02 (GMT)
commit798a94500230e4d2a1a18f005fe9592454fe451b (patch)
tree3e09b66d76f561b5602459959be45d308fd178aa /configure.ac
parentf5b904db6b02e0ded76732eabe106069a87859fd (diff)
downloadgit-798a94500230e4d2a1a18f005fe9592454fe451b.zip
git-798a94500230e4d2a1a18f005fe9592454fe451b.tar.gz
git-798a94500230e4d2a1a18f005fe9592454fe451b.tar.bz2
configure: auto detect dynamic library path switches
Most systems (e.g. Linux gcc) use "-Wl,-rpath," to pass to the linker the runtime dynamic library paths. Some other systems (e.g. Sun, some BSD) use "-R" etc. This patch adds tests in configure for the three most common switches (to my best knowledge) which should cover all current platforms where Git is used. Signed-Off-By: Giovanni Funchal <gafunchal@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac32
1 files changed, 32 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 7c2856e..27bab00 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])