1
1
dnl -*- autoconf -*-
2
2
dnl
3
3
dnl Copyright (c) 2020-2022 Cisco Systems, Inc. All rights reserved.
4
+ dnl Copyright (c) 2024 Jeffrey M. Squyres. All rights reserved.
4
5
dnl
5
6
dnl $COPYRIGHT$
6
7
dnl
@@ -20,6 +21,10 @@ dnl If $2 is empty, nothing will be displayed.
20
21
dnl Note: if $2 contains a #, be sure to double quote it
21
22
dnl (e.g., [[https://example.com/foo.html#some-anchor]])
22
23
dnl
24
+ dnl 3 -> (OPTIONAL) Filename of requirements.txt-like file containing
25
+ dnl the required Pip modules (to be displayed if rendering a
26
+ dnl simple RST project fails).
27
+ dnl
23
28
dnl This macro requires that OAC_PUSH_PREFIX was previously called.
24
29
dnl The pushed prefix may be used if this macro chooses to set {OAC
25
30
dnl prefix}_MAKEDIST_DISABLE. If set, it is a message indicating why
@@ -90,9 +95,54 @@ AC_DEFUN([OAC_SETUP_SPHINX],[
90
95
AC_MSG_RESULT ( [ yes] ) ] )
91
96
] )
92
97
98
+ # If we found Sphinx, check to ensure that we have all the things
99
+ # required to build Open MPI/PRRTE/OpenPMIx-like documentation
100
+ # (e.g., any required pip modules). If we can't render a sample
101
+ # OMPI-like doc, we're not going to automatically install any
102
+ # missing pip modules; we'll just mark Sphinx as being
103
+ # unavailable.
104
+ AS_IF ( [ test -n "$SPHINX_BUILD"] ,
105
+ [ AC_MSG_CHECKING ( [ for required Sphinx modules] )
106
+ oac_startdir=`pwd`
107
+ oac_tmpdir=conftmp.$$
108
+ rm -rf $oac_tmpdir
109
+ mkdir $oac_tmpdir
110
+ cd $oac_tmpdir
111
+ cat > conf.py <<EOF
112
+ # Minimum config that we need for Open MPI/PRRTE/OpenPMIx-like docs
113
+ project = 'Testing'
114
+ copyright = 'Testing'
115
+ author = 'Testing'
116
+ import sphinx_rtd_theme
117
+ # Note the extra quoting needed for square brackets because this is m4
118
+ extensions = [ [ 'recommonmark', 'sphinx_rtd_theme', 'sphinx.ext.extlinks' ] ]
119
+ html_theme = 'sphinx_rtd_theme'
120
+ EOF
121
+ echo "Hello world" > index.rst
122
+
123
+ # Try to render this trivial RST project as both HTML and
124
+ # man pages and see if it works.
125
+ oac_happy=0
126
+ OAC_LOG_COMMAND([ $SPHINX_BUILD -M html . build-html] ,
127
+ [ OAC_LOG_COMMAND([ $SPHINX_BUILD -M man . build-man] ,
128
+ [ oac_happy=1] )] )
129
+ AS_IF ( [ test $oac_happy -eq 1] ,
130
+ [ AC_MSG_RESULT ( [ found] ) ] ,
131
+ [ SPHINX_BUILD=
132
+ AC_MSG_RESULT ( [ not found] ) ] )
133
+
134
+ cd $oac_startdir
135
+ rm -rf $oac_tmpdir
136
+ ] )
137
+
93
138
AS_IF ( [ test -z "$SPHINX_BUILD"] ,
94
139
_oac_program_prefix [ _MAKEDIST_DISABLE="$] _oac_program_prefix [ _MAKEDIST_DISABLE Sphinx/Documentation"
95
140
AC_MSG_NOTICE ( [ Could not find a suitable sphinx-build on your system.] )
141
+ AS_IF ( [ test -n "$3 "] ,
142
+ [ AC_MSG_NOTICE ( [ If you want to build the documentation, ensure that the] )
143
+ AC_MSG_NOTICE ( [ Python modules in $3 ] )
144
+ AC_MSG_NOTICE ( [ are available.] )
145
+ ] )
96
146
AC_MSG_NOTICE ( [ You will not be able to build a distribution tarball.] )
97
147
] )
98
148
@@ -107,7 +157,7 @@ AC_DEFUN([OAC_SETUP_SPHINX],[
107
157
# abort. This is likely only useful to prevent "oops!" moments
108
158
# from developers.
109
159
AS_IF ( [ test -z "$SPHINX_BUILD" && test "$enable_sphinx" = "yes"] ,
110
- [ AC_MSG_WARN ( [ Sphinx was not found, but --enable-sphinx was specified] )
160
+ [ AC_MSG_WARN ( [ A suitable Sphinx was not found, but --enable-sphinx was specified] )
111
161
AC_MSG_ERROR ( [ Cannot continue] ) ] )
112
162
113
163
# Construct a summary message. Due SUMMARY_ADD's implementation,
0 commit comments