Commit 9373994a authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

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
parent 66108864
...@@ -710,75 +710,6 @@ AC_DEFUN([FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN], ...@@ -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 # FP_PROG_CONTEXT_DIFF
# -------------------- # --------------------
# Figure out how to do context diffs. Sets the output variable ContextDiffCmd. # Figure out how to do context diffs. Sets the output variable ContextDiffCmd.
...@@ -2048,36 +1979,32 @@ AC_DEFUN([XCODE_VERSION],[ ...@@ -2048,36 +1979,32 @@ AC_DEFUN([XCODE_VERSION],[
# are installed with a version suffix (e.g., llc-3.1). # are installed with a version suffix (e.g., llc-3.1).
# #
# $1 = the variable to set # $1 = the variable to set
# $2 = the with option name # $2 = the command to look for
# $3 = the command to look for # $3 = the version of the command to look for
# $4 = the version of the command to look for
# #
AC_DEFUN([FIND_LLVM_PROG],[ AC_DEFUN([FIND_LLVM_PROG],[
# Test for program with version name. # Test for program with and without version name.
FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3-$4]) AC_CHECK_TOOLS([$1], [$2-$3 $2])
if test -z "$$1"; then if test "$$1" != ":"; then
# Test for program without version name. AC_MSG_CHECKING([$$1 is version $3])
FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3]) if test `$$1 --version | grep -c "version $3"` -gt 0 ; then
if test -n "$$1"; then AC_MSG_RESULT(yes)
AC_MSG_CHECKING([$$1 is version $4]) else
if test `$$1 --version | grep -c "version $4"` -gt 0 ; then AC_MSG_RESULT(no)
AC_MSG_RESULT(yes) $1=""
else
AC_MSG_RESULT(no)
$1=""
fi
fi fi
fi fi
]) ])
# FIND_LD # FIND_LD
# ---------
# Find the version of `ld` to use. This is used in both in the top level # Find the version of `ld` to use. This is used in both in the top level
# configure.ac and in distrib/configure.ac.in. # configure.ac and in distrib/configure.ac.in.
# #
# $1 = the variable to set # $1 = the variable to set
# #
AC_DEFUN([FIND_LD],[ AC_DEFUN([FIND_LD],[
FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) AC_CHECK_TARGET_TOOL([LD], [ld])
case $target in case $target in
arm*linux* | \ arm*linux* | \
aarch64*linux* ) aarch64*linux* )
...@@ -2085,7 +2012,7 @@ AC_DEFUN([FIND_LD],[ ...@@ -2085,7 +2012,7 @@ AC_DEFUN([FIND_LD],[
# This case should catch at least arm-unknown-linux-gnueabihf, # This case should catch at least arm-unknown-linux-gnueabihf,
# arm-linux-androideabi, arm64-unknown-linux and # arm-linux-androideabi, arm64-unknown-linux and
# aarch64-linux-android # 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" $1="$LD_GOLD"
;; ;;
*) *)
......
...@@ -502,7 +502,14 @@ AC_SUBST([LdCmd]) ...@@ -502,7 +502,14 @@ AC_SUBST([LdCmd])
dnl ** Which nm to use? dnl ** Which nm to use?
dnl -------------------------------------------------------------- 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" if test "$TargetOS_CPP" = "darwin"
then then
...@@ -529,40 +536,40 @@ then ...@@ -529,40 +536,40 @@ then
esac esac
fi fi
NmCmd="$NM"
AC_SUBST([NmCmd])
dnl ** Which objdump to use? dnl ** Which objdump to use?
dnl -------------------------------------------------------------- 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" ObjdumpCmd="$OBJDUMP"
AC_SUBST([ObjdumpCmd]) AC_SUBST([ObjdumpCmd])
dnl ** Which ar to use? dnl ** Which ar to use?
dnl -------------------------------------------------------------- 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" ArCmd="$AR"
fp_prog_ar="$AR" fp_prog_ar="$AR"
AC_SUBST([ArCmd]) AC_SUBST([ArCmd])
dnl ** Which ranlib to use? dnl ** Which ranlib to use?
dnl -------------------------------------------------------------- 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" RanlibCmd="$RANLIB"
RANLIB="$RanlibCmd" 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 # 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 # tools we are looking for. In the past, GHC supported a number of
# versions of LLVM simultaneously, but that stopped working around # versions of LLVM simultaneously, but that stopped working around
...@@ -574,13 +581,13 @@ AC_DEFINE_UNQUOTED([sUPPORTED_LLVM_VERSION], ${sUPPORTED_LLVM_VERSION}, [The sup ...@@ -574,13 +581,13 @@ AC_DEFINE_UNQUOTED([sUPPORTED_LLVM_VERSION], ${sUPPORTED_LLVM_VERSION}, [The sup
dnl ** Which LLVM llc to use? dnl ** Which LLVM llc to use?
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
FIND_LLVM_PROG([LLC], [llc], [llc], [$LlvmVersion]) FIND_LLVM_PROG([LLC], [llc], [$LlvmVersion])
LlcCmd="$LLC" LlcCmd="$LLC"
AC_SUBST([LlcCmd]) AC_SUBST([LlcCmd])
dnl ** Which LLVM opt to use? dnl ** Which LLVM opt to use?
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
FIND_LLVM_PROG([OPT], [opt], [opt], [$LlvmVersion]) FIND_LLVM_PROG([OPT], [opt], [$LlvmVersion])
OptCmd="$OPT" OptCmd="$OPT"
AC_SUBST([OptCmd]) AC_SUBST([OptCmd])
......
...@@ -74,13 +74,13 @@ LlvmVersion=@LlvmVersion@ ...@@ -74,13 +74,13 @@ LlvmVersion=@LlvmVersion@
dnl ** Which LLVM llc to use? dnl ** Which LLVM llc to use?
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
FIND_LLVM_PROG([LLC], [llc], [llc], [$LlvmVersion]) FIND_LLVM_PROG([LLC], [llc], [$LlvmVersion])
LlcCmd="$LLC" LlcCmd="$LLC"
AC_SUBST([LlcCmd]) AC_SUBST([LlcCmd])
dnl ** Which LLVM opt to use? dnl ** Which LLVM opt to use?
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
FIND_LLVM_PROG([OPT], [opt], [opt], [$LlvmVersion]) FIND_LLVM_PROG([OPT], [opt], [$LlvmVersion])
OptCmd="$OPT" OptCmd="$OPT"
AC_SUBST([OptCmd]) AC_SUBST([OptCmd])
......
...@@ -24,6 +24,12 @@ Language ...@@ -24,6 +24,12 @@ Language
Compiler 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 - Derived ``Functor``, ``Foldable``, and ``Traversable`` instances are now
optimized when their last type parameters have phantom roles. optimized when their last type parameters have phantom roles.
Specifically, :: Specifically, ::
......
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