summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorReid Barton <rwbarton@gmail.com>2014-09-16 07:54:43 -0500
committerAustin Seipp <austin@well-typed.com>2014-09-16 07:54:43 -0500
commitcfd8c7ddcdae47fc676d7b16ce8af7b5328a1041 (patch)
tree7c3ee93dd5e52653789e494bc51f062187eb904e /aclocal.m4
parentcdf5a1c953c439de9e64a9a8364a2184049b9369 (diff)
downloadhaskell-cfd8c7ddcdae47fc676d7b16ce8af7b5328a1041.tar.gz
Find the target gcc when cross-compiling
Summary: "./configure --target=TARGET" was broken; it would use the host gcc. (So you had to explicitly specify "--with-gcc=TARGET-gcc" also, as a workaround.) This was broken by commit fc4856f9e811d9a23ae9212f43a09ddf5ef12b26 for #8148. A comment claimed that FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL was the same as FP_ARG_WITH_PATH_GNU_PROG except for not raising an error when the program isn't found; but that wasn't true -- the former didn't prepend the target name when cross-compiling. We actually need three versions of FP_ARG_WITH_PATH_GNU_PROG since the LLVM tools are usually not prefixed with the target name even when cross-compiling. So I generalized the logic in a single macro. Test Plan: Built with "./configure --target=i386-unknown-linux" and BuildFlavour=quick, successfully Reviewers: ezyang, austin Reviewed By: ezyang, austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D204
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m461
1 files changed, 22 insertions, 39 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 0dda8af655..62cf6fe4e9 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -640,19 +640,20 @@ AC_DEFUN([FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN],
])
-# FP_ARG_WITH_PATH_GNU_PROG
+# 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. An error will be thrown if the command isn't
-# found.
+# 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],
+AC_DEFUN([FP_ARG_WITH_PATH_GNU_PROG_GENERAL],
[
AC_ARG_WITH($2,
[AC_HELP_STRING([--with-$2=ARG],
@@ -672,58 +673,40 @@ AC_ARG_WITH($2,
[
if test "$HostOS" != "mingw32"
then
- if test "$target_alias" = "" ; 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 -z "$$1"
+ 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
+]) # 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.
-#
-# This is ignored on the mingw32 platform.
-#
-# $1 = the variable to set
-# $2 = the with option name
-# $3 = the command to look for
-#
AC_DEFUN([FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL],
-[
-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
- AC_PATH_PROG([$1], [$3])
- fi
-]
-)
-]) # 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
@@ -2063,7 +2046,7 @@ AC_DEFUN([XCODE_VERSION],[
# $3 = the command to look for
#
AC_DEFUN([FIND_LLVM_PROG],[
- FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([$1], [$2], [$3])
+ FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3])
if test "$$1" == ""; then
save_IFS=$IFS
IFS=":;"