summaryrefslogtreecommitdiff
path: root/m4/fp_find_root.m4
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-04-02 11:52:47 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-05 05:42:38 -0400
commit7ffbdc3fa603c6411249ba9b758cf8f109c5fb30 (patch)
tree8a05d6e03ce2790e6e59651c824e569fee088d33 /m4/fp_find_root.m4
parent6acadb79afe685c635fd255f90551a0fbfcbe3dc (diff)
downloadhaskell-7ffbdc3fa603c6411249ba9b758cf8f109c5fb30.tar.gz
Break up aclocal.m4
Diffstat (limited to 'm4/fp_find_root.m4')
-rw-r--r--m4/fp_find_root.m437
1 files changed, 37 insertions, 0 deletions
diff --git a/m4/fp_find_root.m4 b/m4/fp_find_root.m4
new file mode 100644
index 0000000000..37099984ea
--- /dev/null
+++ b/m4/fp_find_root.m4
@@ -0,0 +1,37 @@
+# --------------------------------------------------------------
+# Calculate absolute path to build tree
+# --------------------------------------------------------------
+
+AC_DEFUN([FP_FIND_ROOT],[
+AC_MSG_CHECKING(for path to top of build tree)
+ if test "$windows" = YES
+ then
+ dnl Make sure this is a c:/foo/bar (mixed) style path. Some parts of
+ dnl the build system might depend on it (such as the sed expression
+ dnl `"s|$(TOP)/||i"` in addCFileDeps in rules/build-dependencies.mk).
+ hardtop=$(cygpath -m "$(pwd)")
+ else
+ hardtop=$(pwd)
+ fi
+
+ dnl Remove common automounter nonsense
+ hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|'`
+
+ if ! test -d "$hardtop"; then
+ AC_MSG_ERROR([cannot determine current directory])
+ fi
+
+ dnl We don't support building in directories with spaces.
+ case "$hardtop" in
+ *' '*)
+ AC_MSG_ERROR([
+ The build system does not support building in a directory
+ containing space characters.
+ Suggestion: move the build tree somewhere else.])
+ ;;
+ esac
+
+ AC_SUBST(hardtop)
+
+ AC_MSG_RESULT($hardtop)
+])