Skip to content

Commit 41618f7

Browse files
committed
opal_setup_sphinx.m4: make version check better
Older versions of Sphinx (e.g., v1.1.3 on RHEL 7) do not support the --version CLI argument. So make our Sphinx version check a little smarter to be able to handle both older and newer versions of Sphinx. Signed-off-by: Jeff Squyres <[email protected]>
1 parent a4c2d16 commit 41618f7

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

config/opal_setup_sphinx.m4

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,21 @@ AC_DEFUN([OPAL_SETUP_SPHINX],[
4343
# version.
4444
AS_IF([test -n "$SPHINX_BUILD"],
4545
[[sphinx_target_version=`sed -n -e 's/sphinx[><=]*\([0-9\.]\)/\1/p' $srcdir/docs/requirements.txt`]
46-
sphinx_found_version=`$SPHINX_BUILD --version 2>&1 | cut -d\ -f2`
46+
# Some older versions of Sphinx (e.g., Sphinx v1.1.3 in
47+
# RHEL 7):
48+
#
49+
# - Don't support "--version".
50+
# - But do emit the version number as part of the general
51+
# CLI help when they don't recognize the --version CLI
52+
# option.
53+
#
54+
# In that case, we only want the first line, and we want to
55+
# strip off the leading "v" from the version number.
56+
#
57+
# In the case where --version *is* recognized, all the
58+
# additional processing is harmless and we still end up
59+
# with the Sphinx version number.
60+
sphinx_found_version=`$SPHINX_BUILD --version 2>&1 | head -n 1 | cut -d\ -f2 | sed -e 's/^v//'`
4761
AC_MSG_CHECKING([if Sphinx version is high enough ($sphinx_found_version >= $sphinx_target_version)])
4862
AS_VERSION_COMPARE([$sphinx_found_version],
4963
[$sphinx_target_version],

0 commit comments

Comments
 (0)