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
This commit is contained in:
Junio C Hamano 2008-09-07 23:45:56 -07:00
Родитель fdfb4cfadc 798a945002
Коммит cd50988ae0
3 изменённых файлов: 42 добавлений и 8 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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])