1
1
openmpi/config/opal_setup_man_pages.m4
Jeff Squyres 7ace873b50 Add MPI_T.5 man page for Open MPI-specific info
Also added infrastructure to have developers write man pages in
Markdown (vs. nroff).  Pandoc >=v1.12 is used to convert those
Markdown files into actual nroff man pages.

Dist tarballs will contain generated nroff man pages; we don't want to
require users to have Pandoc installed.  Anyone who builds Open MPI
from a git clone will need to have Pandoc installed (similar to how we
treat Flex).  You can opt out of Open MPI's Pandoc-generated man pages
by configuring Open MPI with --disable-man-pages.  This will also
disable "make dist" (i.e., "make dist" will error if you configured
with --disable-man-pages).

Also removed the stuff to re-generate man pages.

This commit also:

1. Includes a new man page, written in Markdown
   (ompi/mpi/man/man5/MPI_T.5.md) that contains Open MPI-specific
   information about MPI_T.
2. Includes a converted ompi/mpi/man/man3/MPI_T_init_thread.3.md (from
   MPI_T_init_thread.3in -- i.e., nroff) just to show that Markdown
   can be used throughout the Open MPI code base for man pages.
3. Made the Makefiles in ompi/mpi/man/man?/ be full-fledged
   Makefile.am's (vs. Makefile.extras that are designed to be included
   in ompi/Makefile.am).  It is more convenient to test generation /
   installation of man pages when you can "make" and "make install" in
   their respective directories (vs. doing a build / install for the
   entire ompi project).
4. Removed logic from ompi/Makefile.am that re-generated man pages if
   opal_config.h changes.

Other man pages -- hopefully all of them! -- will be converted to
Markdown over time.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
2020-05-02 12:45:31 -07:00

79 строки
3.0 KiB
Bash

dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
dnl
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
dnl
dnl Just in case someone looks for it here someday, here is a
dnl conveninent reference for what Markdown pandoc supports:
dnl
dnl https://rmarkdown.rstudio.com/authoring_pandoc_markdown.html
dnl
AC_DEFUN([OPAL_SETUP_MAN_PAGES],[
AC_ARG_ENABLE(man-pages,
[AC_HELP_STRING([--disable-man-pages],
[Do not generate/install man pages (default: enable)])])
PANDOC=
OPAL_ENABLE_MAN_PAGES=0
AC_MSG_CHECKING([if want man pages])
AS_IF([test -z "$enable_man_pages" || test "$enable_man_pages" = "yes"],
[AC_MSG_RESULT([yes])
OPAL_ENABLE_MAN_PAGES=1
_OPAL_SETUP_PANDOC],
[AC_MSG_RESULT([no])])
AC_SUBST(PANDOC)
AM_CONDITIONAL([OPAL_ENABLE_MAN_PAGES], [test $OPAL_ENABLE_MAN_PAGES -eq 1])
])
dnl Back-end pandoc setup
AC_DEFUN([_OPAL_SETUP_PANDOC],[
OPAL_VAR_SCOPE_PUSH([min_major_version min_minor_version pandoc_version pandoc_major pandoc_minor])
# If we need to generate man pages, we need pandoc >v1.12.
AC_PATH_PROG([PANDOC], [pandoc])
# If we found Pandoc, check its version. We need >=v1.12.
# To be clear: I know that v1.12 works, and I know that v1.9 does not
# work. I did not test the versions in between to know exactly what
# the lowest version is that works. Someone is free to update this
# check someday to be more accurate if they wish.
min_major_version=1
min_minor_version=12
AS_IF([test -n "$PANDOC"],
[pandoc_version=`pandoc --version | head -n 1 | awk '{ print $[2] }'`
pandoc_major=`echo $pandoc_version | cut -d\. -f1`
pandoc_minor=`echo $pandoc_version | cut -d\. -f2`
AC_MSG_CHECKING([pandoc version])
AC_MSG_RESULT([major: $pandoc_major, minor: $pandoc_minor])
AC_MSG_CHECKING([if pandoc version is >=v$min_major_version.$min_minor_version])
AS_IF([test $pandoc_major -lt $min_major_version], [PANDOC=])
AS_IF([test $pandoc_major -eq $min_major_version && test $pandoc_minor -lt $min_minor_version],
[PANDOC=])
AS_IF([test -n "$PANDOC"],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
])
AS_IF([test -z "$PANDOC" || test -n "`echo $PANDOC | $GREP missing`"],
[AS_IF([test ! -f "$srcdir/ompi/mpi/man/man5/MPI_T.5"],
[AC_MSG_WARN([*** Could not find a suitable pandoc on your system.])
AC_MSG_WARN([*** You need pandoc >=$min_major_version.$min_minor_version to build Open MPI man pages.])
AC_MSG_WARN([*** See pandoc.org.])
AC_MSG_WARN([*** NOTE: If you are building from a tarball downloaded from www.open-mpi.org, you do not need Pandoc])
AC_MSG_ERROR([Cannot continue])
])
])
OPAL_VAR_SCOPE_POP
])