summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-07-03 00:16:16 +0100
committerIan Lynagh <ian@well-typed.com>2013-07-03 12:13:57 +0100
commitc548fec4f11920244e81b9f83ebb2aaf7d08ba40 (patch)
tree29130a609525530f0e95ad581546a5ae9eaa2846
parent448b981844da83c98d378448c063a0c11e7ff839 (diff)
downloadhaskell-c548fec4f11920244e81b9f83ebb2aaf7d08ba40.tar.gz
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.
-rw-r--r--aclocal.m460
-rw-r--r--configure.ac1
-rw-r--r--ghc.mk2
-rw-r--r--libffi/ghc.mk1
-rw-r--r--mk/config.mk.in3
-rw-r--r--rules/build-package-data.mk2
6 files changed, 42 insertions, 27 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index af492dfac9..0852dbf90d 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -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
diff --git a/configure.ac b/configure.ac
index 7bbeca6605..8d8136f756 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"
diff --git a/ghc.mk b/ghc.mk
index 87b6ac884c..4754ad61f5 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -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` ;; \
diff --git a/libffi/ghc.mk b/libffi/ghc.mk
index ffef273ce3..d761a43a47 100644
--- a/libffi/ghc.mk
+++ b/libffi/ghc.mk
@@ -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 \
diff --git a/mk/config.mk.in b/mk/config.mk.in
index 12357984ed..2e36be533e 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -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
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk
index 24299426e5..82a2535844 100644
--- a/rules/build-package-data.mk
+++ b/rules/build-package-data.mk
@@ -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)")