summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-07-25 16:44:35 -0400
committerBen Gamari <ben@smart-cactus.org>2021-09-20 10:25:14 -0400
commit3d48bce34b830a551345db760f5281db0f7db593 (patch)
tree9ae7f81b2e19faee6e868bd127b125e5994c3e7c
parentf8effe2f7dbf2086c3274f8aaada6d6183d6813c (diff)
downloadhaskell-3d48bce34b830a551345db760f5281db0f7db593.tar.gz
configure: Move nm search logic to new file
-rw-r--r--configure.ac34
-rw-r--r--m4/fp_find_nm.m440
2 files changed, 41 insertions, 33 deletions
diff --git a/configure.ac b/configure.ac
index da7598d621..7783065664 100644
--- a/configure.ac
+++ b/configure.ac
@@ -642,39 +642,7 @@ FP_PROG_LD_FILELIST
dnl ** Which nm to use?
dnl --------------------------------------------------------------
-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
- AC_MSG_CHECKING(whether nm program is broken)
- # Some versions of Xcode ship a broken version of `nm`. Detect and work
- # around this issue. See : https://gitlab.haskell.org/ghc/ghc/issues/11744
- nmver=$(${NM} --version | grep version | sed 's/ //g')
- case "$nmver" in
- LLVMversion7.3.0|LLVMversion7.3.1)
- AC_MSG_RESULT(yes)
- echo "The detected nm program is broken."
- echo
- echo "See: https://gitlab.haskell.org/ghc/ghc/issues/11744"
- echo
- echo "Try re-running configure with:"
- echo
- echo ' NM=$(xcrun --find nm-classic) ./configure'
- echo
- exit 1
- ;;
- *)
- AC_MSG_RESULT(no)
- ;;
- esac
-fi
+FP_FIND_NM
dnl ** Which objdump to use?
dnl --------------------------------------------------------------
diff --git a/m4/fp_find_nm.m4 b/m4/fp_find_nm.m4
new file mode 100644
index 0000000000..f3a75440eb
--- /dev/null
+++ b/m4/fp_find_nm.m4
@@ -0,0 +1,40 @@
+# FP_FIND_NM
+# ---------------------
+# Find nm and verify that it works.
+AC_DEFUN([FP_FIND_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
+ AC_MSG_CHECKING(whether nm program is broken)
+ # Some versions of Xcode ship a broken version of `nm`. Detect and work
+ # around this issue. See : https://gitlab.haskell.org/ghc/ghc/issues/11744
+ nmver=$(${NM} --version | grep version | sed 's/ //g')
+ case "$nmver" in
+ LLVMversion7.3.0|LLVMversion7.3.1)
+ AC_MSG_RESULT(yes)
+ echo "The detected nm program is broken."
+ echo
+ echo "See: https://gitlab.haskell.org/ghc/ghc/issues/11744"
+ echo
+ echo "Try re-running configure with:"
+ echo
+ echo ' NM=$(xcrun --find nm-classic) ./configure'
+ echo
+ exit 1
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ ;;
+ esac
+ fi
+])
+