summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-04-25 18:32:24 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-25 18:39:49 -0400
commit9373994acaf1b73fe0e7cf8e03594c63cec8d235 (patch)
treeb62be20056a3148835dbc59088cb79cfb54b596b
parent66108864540601837ad77847f4062a670362361f (diff)
downloadhaskell-9373994acaf1b73fe0e7cf8e03594c63cec8d235.tar.gz
configure: Kill off FP_ARG_WITH_*
This replaces the --with-* configure flags with the usual autoconf environment variables, as suggested by #13583. Test Plan: Configure on various platforms Reviewers: hvr, trofi, thomie, austin Reviewed By: trofi Subscribers: rwbarton, erikd GHC Trac Issues: #13583 Differential Revision: https://phabricator.haskell.org/D3499
-rw-r--r--aclocal.m4101
-rw-r--r--configure.ac47
-rw-r--r--distrib/configure.ac.in4
-rw-r--r--docs/users_guide/8.4.1-notes.rst6
4 files changed, 49 insertions, 109 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 545a15a646..dfb7892497 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -710,75 +710,6 @@ AC_DEFUN([FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN],
])
-# FP_ARG_WITH_PATH_GNU_PROG_GENERAL
-# --------------------
-# Find the specified command on the path or allow a user to set it manually
-# with a --with-<command> option.
-#
-# This is ignored on the mingw32 platform.
-#
-# $1 = the variable to set
-# $2 = the with option name
-# $3 = the command to look for
-# $4 = prepend target to program name? if 'no', use the name unchanged
-# $5 = optional? if 'no', then raise an error if the command isn't found
-#
-AC_DEFUN([FP_ARG_WITH_PATH_GNU_PROG_GENERAL],
-[
-AC_ARG_WITH($2,
-[AC_HELP_STRING([--with-$2=ARG],
- [Use ARG as the path to $2 [default=autodetect]])],
-[
- if test "$HostOS" = "mingw32"
- then
- AC_MSG_WARN([Request to use $withval will be ignored])
- else
- $1=$withval
- fi
-
- # Remember that we set this manually. Used to override CC_STAGE0
- # and friends later, if we are not cross-compiling.
- With_$2=$withval
-],
-[
- if test "$HostOS" != "mingw32"
- then
- if test "$4" = "no" -o "$target_alias" = "" ; then
- AC_PATH_PROG([$1], [$3])
- else
- AC_PATH_PROG([$1], [$target_alias-$3])
- fi
- if test "$5" = "no" -a -z "$$1"
- then
- AC_MSG_ERROR([cannot find $3 in your PATH])
- fi
- fi
-]
-)
-]) # FP_ARG_WITH_PATH_GNU_PROG_GENERAL
-
-
-# FP_ARG_WITH_PATH_GNU_PROG
-# --------------------
-# The usual case: prepend the target, and the program is not optional.
-AC_DEFUN([FP_ARG_WITH_PATH_GNU_PROG],
-[FP_ARG_WITH_PATH_GNU_PROG_GENERAL([$1], [$2], [$3], [yes], [no])])
-
-# FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL
-# --------------------
-# Same as FP_ARG_WITH_PATH_GNU_PROG but no error will be thrown if the command
-# isn't found.
-AC_DEFUN([FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL],
-[FP_ARG_WITH_PATH_GNU_PROG_GENERAL([$1], [$2], [$3], [yes], [yes])])
-
-# FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET
-# --------------------
-# Same as FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL but don't prepend the target name
-# (used for LLVM).
-AC_DEFUN([FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET],
-[FP_ARG_WITH_PATH_GNU_PROG_GENERAL([$1], [$2], [$3], [no], [yes])])
-
-
# FP_PROG_CONTEXT_DIFF
# --------------------
# Figure out how to do context diffs. Sets the output variable ContextDiffCmd.
@@ -2048,36 +1979,32 @@ AC_DEFUN([XCODE_VERSION],[
# are installed with a version suffix (e.g., llc-3.1).
#
# $1 = the variable to set
-# $2 = the with option name
-# $3 = the command to look for
-# $4 = the version of the command to look for
+# $2 = the command to look for
+# $3 = the version of the command to look for
#
AC_DEFUN([FIND_LLVM_PROG],[
- # Test for program with version name.
- FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3-$4])
- if test -z "$$1"; then
- # Test for program without version name.
- FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3])
- if test -n "$$1"; then
- AC_MSG_CHECKING([$$1 is version $4])
- if test `$$1 --version | grep -c "version $4"` -gt 0 ; then
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- $1=""
- fi
+ # Test for program with and without version name.
+ AC_CHECK_TOOLS([$1], [$2-$3 $2])
+ if test "$$1" != ":"; then
+ AC_MSG_CHECKING([$$1 is version $3])
+ if test `$$1 --version | grep -c "version $3"` -gt 0 ; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ $1=""
fi
fi
])
# FIND_LD
+# ---------
# Find the version of `ld` to use. This is used in both in the top level
# configure.ac and in distrib/configure.ac.in.
#
# $1 = the variable to set
#
AC_DEFUN([FIND_LD],[
- FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld])
+ AC_CHECK_TARGET_TOOL([LD], [ld])
case $target in
arm*linux* | \
aarch64*linux* )
@@ -2085,7 +2012,7 @@ AC_DEFUN([FIND_LD],[
# This case should catch at least arm-unknown-linux-gnueabihf,
# arm-linux-androideabi, arm64-unknown-linux and
# aarch64-linux-android
- FP_ARG_WITH_PATH_GNU_PROG([LD_GOLD], [ld.gold], [ld.gold])
+ AC_CHECK_TARGET_TOOL([LD_GOLD], [ld.gold])
$1="$LD_GOLD"
;;
*)
diff --git a/configure.ac b/configure.ac
index 194d37bd57..46e37ab3e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -502,7 +502,14 @@ AC_SUBST([LdCmd])
dnl ** Which nm to use?
dnl --------------------------------------------------------------
-FP_ARG_WITH_PATH_GNU_PROG([NM], [nm], [nm])
+if test "$HostOS" != "mingw32"; then
+ AC_CHECK_TARGET_TOOL([NM], [nm])
+ if test "$NM" = ":"; then
+ AC_MSG_ERROR([cannot find nm in your PATH])
+ fi
+fi
+NmCmd="$NM"
+AC_SUBST([NmCmd])
if test "$TargetOS_CPP" = "darwin"
then
@@ -529,40 +536,40 @@ then
esac
fi
-NmCmd="$NM"
-AC_SUBST([NmCmd])
-
dnl ** Which objdump to use?
dnl --------------------------------------------------------------
-FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([OBJDUMP], [objdump], [objdump])
+dnl Note: we may not have objdump on OS X, and we only need it on Windows (for DLL checks)
+case $HostOS_CPP in
+ cygwin32|mingw32)
+ AC_CHECK_TARGET_TOOL([OBJDUMP], [objdump])
+ ;;
+esac
+
ObjdumpCmd="$OBJDUMP"
AC_SUBST([ObjdumpCmd])
dnl ** Which ar to use?
dnl --------------------------------------------------------------
-FP_ARG_WITH_PATH_GNU_PROG([AR], [ar], [ar])
+if test "$HostOS" != "mingw32"; then
+ AC_CHECK_TARGET_TOOL([AR], [ar])
+ if test "$AR" = ":"; then
+ AC_MSG_ERROR([cannot find ar in your PATH])
+ fi
+fi
ArCmd="$AR"
fp_prog_ar="$AR"
AC_SUBST([ArCmd])
dnl ** Which ranlib to use?
dnl --------------------------------------------------------------
-FP_ARG_WITH_PATH_GNU_PROG([RANLIB], [ranlib], [ranlib])
+AC_PROG_RANLIB
+if test "$RANLIB" = ":"; then
+ AC_MSG_ERROR([cannot find ranlib in your PATH])
+fi
RanlibCmd="$RANLIB"
RANLIB="$RanlibCmd"
-# Note: we may not have objdump on OS X, and we only need it on Windows (for DLL checks)
-case $HostOS_CPP in
-cygwin32|mingw32)
- dnl ** Which objdump to use?
- dnl --------------------------------------------------------------
- FP_ARG_WITH_PATH_GNU_PROG([OBJDUMP], [objdump], [objdump])
- ObjdumpCmd="$OBJDUMP"
- AC_SUBST([ObjdumpCmd])
- ;;
-esac
-
# Here is where we re-target which specific version of the LLVM
# tools we are looking for. In the past, GHC supported a number of
# versions of LLVM simultaneously, but that stopped working around
@@ -574,13 +581,13 @@ AC_DEFINE_UNQUOTED([sUPPORTED_LLVM_VERSION], ${sUPPORTED_LLVM_VERSION}, [The sup
dnl ** Which LLVM llc to use?
dnl --------------------------------------------------------------
-FIND_LLVM_PROG([LLC], [llc], [llc], [$LlvmVersion])
+FIND_LLVM_PROG([LLC], [llc], [$LlvmVersion])
LlcCmd="$LLC"
AC_SUBST([LlcCmd])
dnl ** Which LLVM opt to use?
dnl --------------------------------------------------------------
-FIND_LLVM_PROG([OPT], [opt], [opt], [$LlvmVersion])
+FIND_LLVM_PROG([OPT], [opt], [$LlvmVersion])
OptCmd="$OPT"
AC_SUBST([OptCmd])
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
index e733f64bbe..ffa057449d 100644
--- a/distrib/configure.ac.in
+++ b/distrib/configure.ac.in
@@ -74,13 +74,13 @@ LlvmVersion=@LlvmVersion@
dnl ** Which LLVM llc to use?
dnl --------------------------------------------------------------
-FIND_LLVM_PROG([LLC], [llc], [llc], [$LlvmVersion])
+FIND_LLVM_PROG([LLC], [llc], [$LlvmVersion])
LlcCmd="$LLC"
AC_SUBST([LlcCmd])
dnl ** Which LLVM opt to use?
dnl --------------------------------------------------------------
-FIND_LLVM_PROG([OPT], [opt], [opt], [$LlvmVersion])
+FIND_LLVM_PROG([OPT], [opt], [$LlvmVersion])
OptCmd="$OPT"
AC_SUBST([OptCmd])
diff --git a/docs/users_guide/8.4.1-notes.rst b/docs/users_guide/8.4.1-notes.rst
index e72213fd5e..71eaa40331 100644
--- a/docs/users_guide/8.4.1-notes.rst
+++ b/docs/users_guide/8.4.1-notes.rst
@@ -24,6 +24,12 @@ Language
Compiler
~~~~~~~~
+- The ``configure`` script now no longer accepts ``--with-TOOL`` flags (e.g.
+ ``--with-nm``, ``--with-ld``, etc.). Instead, these are taken from environment
+ variables, as is typical in ``autoconf`` scripts. For instance,
+ ``./configure --with-nm=/usr/local/bin/nm`` turns into
+ ``./configure NM=/usr/local/bin/nm``.
+
- Derived ``Functor``, ``Foldable``, and ``Traversable`` instances are now
optimized when their last type parameters have phantom roles.
Specifically, ::