summaryrefslogtreecommitdiff
path: root/aclocal.m4
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 /aclocal.m4
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.
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m460
1 files changed, 36 insertions, 24 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