summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-03-09 11:37:18 -0500
committerMoritz Angermann <moritz.angermann@gmail.com>2021-03-26 16:49:31 +0800
commit36db1f90dcdc09d5726bbea4fe682fce3c90ee30 (patch)
tree390c97117128ae7f3148f9891957f72070d9d8d6
parentf9bcc9b629f8b8ffbf7bd4c83c8f6e92ef88b57c (diff)
downloadhaskell-36db1f90dcdc09d5726bbea4fe682fce3c90ee30.tar.gz
llvmGen: Accept range of LLVM versions
Previously we would support only one LLVM major version. Here we generalize this to accept a range, taking this range to be LLVM 10 to 11, as 11 is necessary for Apple M1 support. We also accept 12, as that is what apple ships with BigSur on the M1.
-rw-r--r--aclocal.m435
-rw-r--r--compiler/llvmGen/LlvmCodeGen.hs11
-rw-r--r--compiler/llvmGen/LlvmCodeGen/Base.hs9
-rw-r--r--compiler/main/SysTools/Tasks.hs8
-rw-r--r--configure.ac16
-rw-r--r--distrib/configure.ac.in7
-rw-r--r--ghc.mk7
-rw-r--r--hadrian/src/Rules/BinaryDist.hs3
-rw-r--r--hadrian/src/Rules/SourceDist.hs3
-rw-r--r--m4/ax_compare_version.m4177
10 files changed, 242 insertions, 34 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 99f77d910c..e194afe60a 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -3,6 +3,8 @@
# To be a good autoconf citizen, names of local macros have prefixed with FP_ to
# ensure we don't clash with any pre-supplied autoconf ones.
+m4_include([m4/ax_compare_version.m4])
+
# FPTOOLS_WRITE_FILE
# ------------------
# Write $2 to the file named $1.
@@ -2224,22 +2226,29 @@ AC_DEFUN([XCODE_VERSION],[
#
# $1 = the variable to set
# $2 = the command to look for
-# $3 = the version of the command to look for
+# $3 = the lower bound version of the command to look for
+# $4 = the upper bound version of the command to look for.
#
AC_DEFUN([FIND_LLVM_PROG],[
# Test for program with and without version name.
- AC_CHECK_TOOLS([$1], [$2-$3 $2-$3.0 $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
- else
- $1=""
- fi
+ PROG_VERSION_CANDIDATES=$(for llvmVersion in `seq $4 -1 $3`; do echo "$2-$llvmVersion $2-$llvmVersion.0"; done)
+ AC_CHECK_TOOLS([$1], [$PROG_VERSION_CANDIDATES $2], [])
+ AS_IF([test x"$$1" != x],[
+ PROG_VERSION=`$$1 --version | awk '/.*version [[0-9\.]]+/{for(i=1;i<=NF;i++){ if(\$i ~ /^[[0-9\.]]+$/){print \$i}}}'`
+ AS_IF([test x"$PROG_VERSION" == x],
+ [AC_MSG_RESULT(no)
+ $1=""
+ AC_MSG_NOTICE([We only support llvm $3 to $4 (no version found).])],
+ [AC_MSG_CHECKING([$$1 version ($PROG_VERSION) is between $3 and $4])
+ AX_COMPARE_VERSION([$PROG_VERSION], [lt], [$3],
+ [AC_MSG_RESULT(no)
+ $1=""
+ AC_MSG_NOTICE([We only support llvm $3 to $4 (found $PROG_VERSION).])],
+ [AX_COMPARE_VERSION([$PROG_VERSION], [gt], [$4],
+ [AC_MSG_RESULT(no)
+ $1=""
+ AC_MSG_NOTICE([We only support llvm $3 to $4 (found $PROG_VERSION).])],
+ [AC_MSG_RESULT(yes)])])])])
])
# CHECK_LD_COPY_BUG()
diff --git a/compiler/llvmGen/LlvmCodeGen.hs b/compiler/llvmGen/LlvmCodeGen.hs
index 396e94b102..67e95c1b89 100644
--- a/compiler/llvmGen/LlvmCodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen.hs
@@ -58,7 +58,8 @@ llvmCodeGen dflags h cmm_stream
let doWarn = wopt Opt_WarnUnsupportedLlvmVersion dflags
when (not (llvmVersionSupported ver) && doWarn) $ putMsg dflags $
"You are using an unsupported version of LLVM!" $$
- "Currently only " <> text (llvmVersionStr supportedLlvmVersion) <> " is supported." <+>
+ "Currently only" <+> text (llvmVersionStr supportedLlvmVersionMin) <+>
+ "to" <+> text (llvmVersionStr supportedLlvmVersionMax) <+> "is supported." <+>
"System LLVM version: " <> text (llvmVersionStr ver) $$
"We will try though..."
let isS390X = platformArch (targetPlatform dflags) == ArchS390X
@@ -67,8 +68,14 @@ llvmCodeGen dflags h cmm_stream
"Warning: For s390x the GHC calling convention is only supported since LLVM version 10." <+>
"You are using LLVM version: " <> text (llvmVersionStr ver)
+ -- HACK: the Nothing case here is potentially wrong here but we
+ -- currently don't use the LLVM version to guide code generation
+ -- so this is okay.
+ let llvm_ver :: LlvmVersion
+ llvm_ver = fromMaybe supportedLlvmVersionMin mb_ver
+
-- run code generation
- a <- runLlvm dflags (fromMaybe supportedLlvmVersion mb_ver) bufh $
+ a <- runLlvm dflags llvm_ver bufh $
llvmCodeGen' (liftStream cmm_stream)
bFlush bufh
diff --git a/compiler/llvmGen/LlvmCodeGen/Base.hs b/compiler/llvmGen/LlvmCodeGen/Base.hs
index 5d085ee888..88f9c03edb 100644
--- a/compiler/llvmGen/LlvmCodeGen/Base.hs
+++ b/compiler/llvmGen/LlvmCodeGen/Base.hs
@@ -268,6 +268,7 @@ llvmPtrBits dflags = widthInBits $ typeWidth $ gcWord dflags
-- Newtype to avoid using the Eq instance!
newtype LlvmVersion = LlvmVersion { llvmVersionNE :: NE.NonEmpty Int }
+ deriving (Eq, Ord)
parseLlvmVersion :: String -> Maybe LlvmVersion
parseLlvmVersion =
@@ -284,11 +285,13 @@ parseLlvmVersion =
(ver_str, rest) = span isDigit s
-- | The LLVM Version that is currently supported.
-supportedLlvmVersion :: LlvmVersion
-supportedLlvmVersion = LlvmVersion (sUPPORTED_LLVM_VERSION NE.:| [])
+supportedLlvmVersionMin, supportedLlvmVersionMax :: LlvmVersion
+supportedLlvmVersionMin = LlvmVersion (sUPPORTED_LLVM_VERSION_MIN NE.:| [])
+supportedLlvmVersionMax = LlvmVersion (sUPPORTED_LLVM_VERSION_MAX NE.:| [])
llvmVersionSupported :: LlvmVersion -> Bool
-llvmVersionSupported (LlvmVersion v) = NE.head v == sUPPORTED_LLVM_VERSION
+llvmVersionSupported v =
+ v > supportedLlvmVersionMin && v <= supportedLlvmVersionMax
llvmVersionStr :: LlvmVersion -> String
llvmVersionStr = intercalate "." . map show . llvmVersionList
diff --git a/compiler/main/SysTools/Tasks.hs b/compiler/main/SysTools/Tasks.hs
index 95432a0a03..82a609d8b3 100644
--- a/compiler/main/SysTools/Tasks.hs
+++ b/compiler/main/SysTools/Tasks.hs
@@ -23,7 +23,7 @@ import System.IO
import System.Process
import GhcPrelude
-import LlvmCodeGen.Base (LlvmVersion, llvmVersionStr, supportedLlvmVersion, parseLlvmVersion)
+import LlvmCodeGen.Base (LlvmVersion, llvmVersionStr, supportedLlvmVersionMin, supportedLlvmVersionMax, llvmVersionStr, parseLlvmVersion)
import SysTools.Process
import SysTools.Info
@@ -236,8 +236,10 @@ figureLlvmVersion dflags = traceToolCommand dflags "llc" $ do
errorMsg dflags $ vcat
[ text "Warning:", nest 9 $
text "Couldn't figure out LLVM version!" $$
- text ("Make sure you have installed LLVM " ++
- llvmVersionStr supportedLlvmVersion) ]
+ text ("Make sure you have installed LLVM between "
+ ++ llvmVersionStr supportedLlvmVersionMin
+ ++ " and "
+ ++ llvmVersionStr supportedLlvmVersionMax) ]
return Nothing)
diff --git a/configure.ac b/configure.ac
index 60d10f9206..ed610f3cc1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -690,10 +690,14 @@ AC_SUBST(InstallNameToolCmd)
# tools we are looking for. In the past, GHC supported a number of
# versions of LLVM simultaneously, but that stopped working around
# 3.5/3.6 release of LLVM.
-LlvmVersion=9
-AC_SUBST([LlvmVersion])
-sUPPORTED_LLVM_VERSION=$(echo \($LlvmVersion\) | sed 's/\./,/')
-AC_DEFINE_UNQUOTED([sUPPORTED_LLVM_VERSION], ${sUPPORTED_LLVM_VERSION}, [The supported LLVM version number])
+LlvmMinVersion=10
+LlvmMaxVersion=12 # inclusive
+AC_SUBST([LlvmMinVersion])
+AC_SUBST([LlvmMaxVersion])
+sUPPORTED_LLVM_VERSION_MIN=$(echo \($LlvmMinVersion\) | sed 's/\./,/')
+sUPPORTED_LLVM_VERSION_MAX=$(echo \($LlvmMaxVersion\) | sed 's/\./,/')
+AC_DEFINE_UNQUOTED([sUPPORTED_LLVM_VERSION_MIN], ${sUPPORTED_LLVM_VERSION_MIN}, [The minimum supported LLVM version number])
+AC_DEFINE_UNQUOTED([sUPPORTED_LLVM_VERSION_MAX], ${sUPPORTED_LLVM_VERSION_MAX}, [The maximum supported LLVM version number])
dnl ** Which LLVM clang to use?
dnl --------------------------------------------------------------
@@ -705,14 +709,14 @@ AC_SUBST([ClangCmd])
dnl ** Which LLVM llc to use?
dnl --------------------------------------------------------------
AC_ARG_VAR(LLC,[Use as the path to LLVM's llc [default=autodetect]])
-FIND_LLVM_PROG([LLC], [llc], [$LlvmVersion])
+FIND_LLVM_PROG([LLC], [llc], [$LlvmMinVersion], [$LlvmMaxVersion])
LlcCmd="$LLC"
AC_SUBST([LlcCmd])
dnl ** Which LLVM opt to use?
dnl --------------------------------------------------------------
AC_ARG_VAR(OPT,[Use as the path to LLVM's opt [default=autodetect]])
-FIND_LLVM_PROG([OPT], [opt], [$LlvmVersion])
+FIND_LLVM_PROG([OPT], [opt], [$LlvmMinVersion], [$LlvmMaxVersion])
OptCmd="$OPT"
AC_SUBST([OptCmd])
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
index 27533e0f43..e5d23d627f 100644
--- a/distrib/configure.ac.in
+++ b/distrib/configure.ac.in
@@ -124,19 +124,20 @@ AC_SUBST([StripCmd])
# tools we are looking for. In the past, GHC supported a number of
# versions of LLVM simultaneously, but that stopped working around
# 3.5/3.6 release of LLVM.
-LlvmVersion=@LlvmVersion@
+LlvmMinVersion=@LlvmMinVersion@
+LlvmMaxVersion=@LlvmMaxVersion@
dnl ** Which LLVM llc to use?
dnl --------------------------------------------------------------
AC_ARG_VAR(LLC,[Use as the path to LLVM's llc [default=autodetect]])
-FIND_LLVM_PROG([LLC], [llc], [$LlvmVersion])
+FIND_LLVM_PROG([LLC], [llc], [$LlvmMinVersion], [$LlvmMaxVersion])
LlcCmd="$LLC"
AC_SUBST([LlcCmd])
dnl ** Which LLVM opt to use?
dnl --------------------------------------------------------------
AC_ARG_VAR(OPT,[Use as the path to LLVM's opt [default=autodetect]])
-FIND_LLVM_PROG([OPT], [opt], [$LlvmVersion])
+FIND_LLVM_PROG([OPT], [opt], [$LlvmMinVersion], [$LlvmMaxVersion])
OptCmd="$OPT"
AC_SUBST([OptCmd])
diff --git a/ghc.mk b/ghc.mk
index 00556c1084..f096851467 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -1075,7 +1075,7 @@ BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk
unix-binary-dist-prep: $(includes_1_H_CONFIG) $(includes_1_H_PLATFORM) $(includes_1_H_VERSION)
$(call removeTrees,bindistprep/)
"$(MKDIRHIER)" $(BIN_DIST_PREP_DIR)
- set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh llvm-targets llvm-passes ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
+ set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile m4 aclocal.m4 config.sub config.guess install-sh llvm-targets llvm-passes ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
echo "HADDOCK_DOCS = $(HADDOCK_DOCS)" >> $(BIN_DIST_MK)
echo "BUILD_SPHINX_HTML = $(BUILD_SPHINX_HTML)" >> $(BIN_DIST_MK)
echo "BUILD_SPHINX_PDF = $(BUILD_SPHINX_PDF)" >> $(BIN_DIST_MK)
@@ -1168,11 +1168,12 @@ SRC_DIST_TESTSUITE_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_TESTSUITE_NAME).
#
# Files to include in source distributions
#
-SRC_DIST_GHC_DIRS = mk rules docs distrib bindisttest libffi includes \
+SRC_DIST_GHC_DIRS = mk m4 rules docs distrib bindisttest libffi includes \
utils docs rts compiler ghc driver libraries libffi-tarballs
SRC_DIST_GHC_FILES += \
configure.ac config.guess config.sub configure \
- aclocal.m4 README.md ANNOUNCE HACKING.md INSTALL.md LICENSE Makefile \
+ aclocal.m4 m4/ax_compare_version.m4 \
+ README.md ANNOUNCE HACKING.md INSTALL.md LICENSE Makefile \
install-sh llvm-targets llvm-passes VERSION GIT_COMMIT_ID \
boot packages ghc.mk MAKEHELP.md
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs
index d52e0c847c..24c5482a59 100644
--- a/hadrian/src/Rules/BinaryDist.hs
+++ b/hadrian/src/Rules/BinaryDist.hs
@@ -179,11 +179,14 @@ bindistRules = do
root -/- "bindist" -/- "ghc-*" -/- "configure" %> \configurePath -> do
ghcRoot <- topDirectory
copyFile (ghcRoot -/- "aclocal.m4") (ghcRoot -/- "distrib" -/- "aclocal.m4")
+ copyDirectory (ghcRoot -/- "m4") (ghcRoot -/- "distrib")
buildWithCmdOptions [] $
target (vanillaContext Stage1 ghc) (Autoreconf $ ghcRoot -/- "distrib") [] []
-- We clean after ourselves, moving the configure script we generated in
-- our bindist dir
removeFile (ghcRoot -/- "distrib" -/- "aclocal.m4")
+ removeDirectory (ghcRoot -/- "distrib" -/- "m4")
+
moveFile (ghcRoot -/- "distrib" -/- "configure") configurePath
-- Generate the Makefile that enables the "make install" part
diff --git a/hadrian/src/Rules/SourceDist.hs b/hadrian/src/Rules/SourceDist.hs
index 8eb215d9ea..8fa79820f6 100644
--- a/hadrian/src/Rules/SourceDist.hs
+++ b/hadrian/src/Rules/SourceDist.hs
@@ -111,7 +111,8 @@ prepareTree dest = do
, "mk"
, "rts"
, "rules"
- , "utils" ]
+ , "utils"
+ , "m4" ]
srcFiles =
[ "GIT_COMMIT_ID"
, "HACKING.md"
diff --git a/m4/ax_compare_version.m4 b/m4/ax_compare_version.m4
new file mode 100644
index 0000000000..ffb4997e8b
--- /dev/null
+++ b/m4/ax_compare_version.m4
@@ -0,0 +1,177 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_compare_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+#
+# DESCRIPTION
+#
+# This macro compares two version strings. Due to the various number of
+# minor-version numbers that can exist, and the fact that string
+# comparisons are not compatible with numeric comparisons, this is not
+# necessarily trivial to do in a autoconf script. This macro makes doing
+# these comparisons easy.
+#
+# The six basic comparisons are available, as well as checking equality
+# limited to a certain number of minor-version levels.
+#
+# The operator OP determines what type of comparison to do, and can be one
+# of:
+#
+# eq - equal (test A == B)
+# ne - not equal (test A != B)
+# le - less than or equal (test A <= B)
+# ge - greater than or equal (test A >= B)
+# lt - less than (test A < B)
+# gt - greater than (test A > B)
+#
+# Additionally, the eq and ne operator can have a number after it to limit
+# the test to that number of minor versions.
+#
+# eq0 - equal up to the length of the shorter version
+# ne0 - not equal up to the length of the shorter version
+# eqN - equal up to N sub-version levels
+# neN - not equal up to N sub-version levels
+#
+# When the condition is true, shell commands ACTION-IF-TRUE are run,
+# otherwise shell commands ACTION-IF-FALSE are run. The environment
+# variable 'ax_compare_version' is always set to either 'true' or 'false'
+# as well.
+#
+# Examples:
+#
+# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
+# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
+#
+# would both be true.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
+# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
+#
+# would both be false.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
+#
+# would be true because it is only comparing two minor versions.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
+#
+# would be true because it is only comparing the lesser number of minor
+# versions of the two values.
+#
+# Note: The characters that separate the version numbers do not matter. An
+# empty string is the same as version 0. OP is evaluated by autoconf, not
+# configure, so must be a string, not a variable.
+#
+# The author would like to acknowledge Guido Draheim whose advice about
+# the m4_case and m4_ifvaln functions make this macro only include the
+# portions necessary to perform the specific comparison specified by the
+# OP argument in the final configure script.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 13
+
+dnl #########################################################################
+AC_DEFUN([AX_COMPARE_VERSION], [
+ AC_REQUIRE([AC_PROG_AWK])
+
+ # Used to indicate true or false condition
+ ax_compare_version=false
+
+ # Convert the two version strings to be compared into a format that
+ # allows a simple string comparison. The end result is that a version
+ # string of the form 1.12.5-r617 will be converted to the form
+ # 0001001200050617. In other words, each number is zero padded to four
+ # digits, and non digits are removed.
+ AS_VAR_PUSHDEF([A],[ax_compare_version_A])
+ A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/[[^0-9]]//g'`
+
+ AS_VAR_PUSHDEF([B],[ax_compare_version_B])
+ B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/[[^0-9]]//g'`
+
+ dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
+ dnl # then the first line is used to determine if the condition is true.
+ dnl # The sed right after the echo is to remove any indented white space.
+ m4_case(m4_tolower($2),
+ [lt],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+ ],
+ [gt],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+ ],
+ [le],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+ ],
+ [ge],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+ ],[
+ dnl Split the operator from the subversion count if present.
+ m4_bmatch(m4_substr($2,2),
+ [0],[
+ # A count of zero means use the length of the shorter version.
+ # Determine the number of characters in A and B.
+ ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
+ ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
+
+ # Set A to no more than B's length and B to no more than A's length.
+ A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
+ B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
+ ],
+ [[0-9]+],[
+ # A count greater than zero means use only that many subversions
+ A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+ B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+ ],
+ [.+],[
+ AC_WARNING(
+ [invalid OP numeric parameter: $2])
+ ],[])
+
+ # Pad zeros at end of numbers to make same length.
+ ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
+ B="$B`echo $A | sed 's/./0/g'`"
+ A="$ax_compare_version_tmp_A"
+
+ # Check for equality or inequality as necessary.
+ m4_case(m4_tolower(m4_substr($2,0,2)),
+ [eq],[
+ test "x$A" = "x$B" && ax_compare_version=true
+ ],
+ [ne],[
+ test "x$A" != "x$B" && ax_compare_version=true
+ ],[
+ AC_WARNING([invalid OP parameter: $2])
+ ])
+ ])
+
+ AS_VAR_POPDEF([A])dnl
+ AS_VAR_POPDEF([B])dnl
+
+ dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
+ if test "$ax_compare_version" = "true" ; then
+ m4_ifvaln([$4],[$4],[:])dnl
+ m4_ifvaln([$5],[else $5])dnl
+ fi
+]) dnl AX_COMPARE_VERSION