Commit c548fec4 authored by ian@well-typed.com's avatar ian@well-typed.com

Change the ranlib detection

On Windows, the ranlib in the path may not be the right ranlib (it may
be the 32bit ranlib when we are making a Win64 compiler, or vice-versa).
Therefore we can't leave it up to libffi to detect the right ranlib, but
need to tell it which ranlib to use. This means that we need to find
ranlib even if we don't actually need it ourselves.
parent 448b9818
......@@ -1096,30 +1096,42 @@ AC_SUBST([ArArgs], ["$fp_prog_ar_args"])
# FP_PROG_AR_NEEDS_RANLIB
# -----------------------
# Sets the output variable RANLIB to "ranlib" if it is needed and found,
# to "true" otherwise.
AC_DEFUN([FP_PROG_AR_NEEDS_RANLIB],
[AC_REQUIRE([FP_PROG_AR_IS_GNU])
AC_REQUIRE([FP_PROG_AR_ARGS])
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([whether ranlib is needed], [fp_cv_prog_ar_needs_ranlib],
[if test $fp_prog_ar_is_gnu = yes; then
fp_cv_prog_ar_needs_ranlib=no
elif echo $TargetPlatform | grep "^.*-apple-darwin$" > /dev/null 2> /dev/null; then
# It's quite tedious to check for Apple's crazy timestamps in .a files,
# so we hardcode it.
fp_cv_prog_ar_needs_ranlib=yes
elif echo $fp_prog_ar_args | grep "s" > /dev/null 2> /dev/null; then
fp_cv_prog_ar_needs_ranlib=no
else
fp_cv_prog_ar_needs_ranlib=yes
fi])
if test $fp_cv_prog_ar_needs_ranlib = yes; then
AC_PROG_RANLIB
else
RANLIB="true"
AC_SUBST([RANLIB])
fi
# Sets the output variable RANLIB_CMD to "ranlib" if it is needed and
# found, to "true" otherwise. Sets REAL_RANLIB_CMD to the ranlib program,
# even if we don't need ranlib (libffi might still need it).
AC_DEFUN([FP_PROG_AR_NEEDS_RANLIB],[
AC_REQUIRE([FP_PROG_AR_IS_GNU])
AC_REQUIRE([FP_PROG_AR_ARGS])
AC_REQUIRE([AC_PROG_CC])
AC_PROG_RANLIB
if test $fp_prog_ar_is_gnu = yes
then
fp_cv_prog_ar_needs_ranlib=no
elif test "$TargetOS_CPP" = "darwin"
then
# It's quite tedious to check for Apple's crazy timestamps in
# .a files, so we hardcode it.
fp_cv_prog_ar_needs_ranlib=yes
else
case $fp_prog_ar_args in
*s*)
fp_cv_prog_ar_needs_ranlib=no;;
*)
fp_cv_prog_ar_needs_ranlib=yes;;
esac
fi
REAL_RANLIB_CMD="$RANLIB"
if test $fp_cv_prog_ar_needs_ranlib = yes
then
RANLIB_CMD="$RANLIB"
else
RANLIB_CMD="true"
fi
AC_SUBST([REAL_RANLIB_CMD])
AC_SUBST([RANLIB_CMD])
])# FP_PROG_AR_NEEDS_RANLIB
......
......@@ -328,6 +328,7 @@ then
CC="${mingwbin}gcc.exe"
LD="${mingwbin}ld.exe"
NM="${mingwbin}nm.exe"
RANLIB="${mingwbin}ranlib.exe"
OBJDUMP="${mingwbin}objdump.exe"
fp_prog_ar="${mingwbin}ar.exe"
......
......@@ -815,7 +815,7 @@ define installLibsTo
case $$i in \
*.a) \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \
$(RANLIB) $2/`basename $$i` ;; \
$(RANLIB_CMD) $2/`basename $$i` ;; \
*.dll) \
$(call INSTALL_PROGRAM,$(INSTALL_OPTS),$$i,$2) ; \
$(STRIP_CMD) $2/`basename $$i` ;; \
......
......@@ -86,6 +86,7 @@ $(libffi_STAMP_CONFIGURE): $(TOUCH_DEP)
LD=$(LD) \
AR=$(AR_STAGE1) \
NM=$(NM) \
RANLIB=$(REAL_RANLIB_CMD) \
CFLAGS="$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE1) -w" \
LDFLAGS="$(SRC_LD_OPTS) $(CONF_GCC_LINKER_OPTS_STAGE1) -w" \
"$(SHELL)" ./configure \
......
......@@ -636,7 +636,8 @@ LN_S = @LN_S@
MV = mv
PERL = @PerlCmd@
PIC = pic
RANLIB = @RANLIB@
RANLIB_CMD = @RANLIB_CMD@
REAL_RANLIB_CMD = @REAL_RANLIB_CMD@
SED = @SedCmd@
SHELL = /bin/sh
......
......@@ -86,7 +86,7 @@ endif
$1_$2_CONFIGURE_OPTS += --configure-option=--with-cc="$$(CC_STAGE$3)"
$1_$2_CONFIGURE_OPTS += --with-ar="$$(AR_STAGE$3)"
$1_$2_CONFIGURE_OPTS += --with-ranlib="$$(RANLIB)"
$1_$2_CONFIGURE_OPTS += --with-ranlib="$$(REAL_RANLIB_CMD)"
$1_$2_CONFIGURE_OPTS += $$(if $$(ALEX),--with-alex="$$(ALEX)")
$1_$2_CONFIGURE_OPTS += $$(if $$(HAPPY),--with-happy="$$(HAPPY)")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment