Home | History | Annotate | Line # | Download | only in cf
check-man.m4 revision 1.1
      1  1.1  elric dnl $Id: check-man.m4,v 1.1 2011/04/13 18:14:32 elric Exp $
      2  1.1  elric dnl check how to format manual pages
      3  1.1  elric dnl
      4  1.1  elric 
      5  1.1  elric AC_DEFUN([rk_CHECK_MAN],
      6  1.1  elric [AC_PATH_PROG(NROFF, nroff)
      7  1.1  elric AC_PATH_PROG(GROFF, groff)
      8  1.1  elric AC_CACHE_CHECK(how to format man pages,ac_cv_sys_man_format,
      9  1.1  elric [cat > conftest.1 << END
     10  1.1  elric .Dd January 1, 1970
     11  1.1  elric .Dt CONFTEST 1
     12  1.1  elric .Sh NAME
     13  1.1  elric .Nm conftest
     14  1.1  elric .Nd
     15  1.1  elric foobar
     16  1.1  elric END
     17  1.1  elric 
     18  1.1  elric if test "$NROFF" ; then
     19  1.1  elric 	for i in "-mdoc" "-mandoc"; do
     20  1.1  elric 		if "$NROFF" $i conftest.1 2> /dev/null | \
     21  1.1  elric 			grep Jan > /dev/null 2>&1 ; then
     22  1.1  elric 			ac_cv_sys_man_format="$NROFF $i"
     23  1.1  elric 			break
     24  1.1  elric 		fi
     25  1.1  elric 	done
     26  1.1  elric fi
     27  1.1  elric if test "$ac_cv_sys_man_format" = "" -a "$GROFF" ; then
     28  1.1  elric 	for i in "-mdoc" "-mandoc"; do
     29  1.1  elric 		if "$GROFF" -Tascii $i conftest.1 2> /dev/null | \
     30  1.1  elric 			grep Jan > /dev/null 2>&1 ; then
     31  1.1  elric 			ac_cv_sys_man_format="$GROFF -Tascii $i"
     32  1.1  elric 			break
     33  1.1  elric 		fi
     34  1.1  elric 	done
     35  1.1  elric fi
     36  1.1  elric if test "$ac_cv_sys_man_format"; then
     37  1.1  elric 	ac_cv_sys_man_format="$ac_cv_sys_man_format \[$]< > \[$]@"
     38  1.1  elric fi
     39  1.1  elric ])
     40  1.1  elric if test "$ac_cv_sys_man_format"; then
     41  1.1  elric 	CATMAN="$ac_cv_sys_man_format"
     42  1.1  elric 	AC_SUBST(CATMAN)
     43  1.1  elric fi
     44  1.1  elric AM_CONDITIONAL(CATMAN, test "$CATMAN")
     45  1.1  elric AC_CACHE_CHECK(extension of pre-formatted manual pages,ac_cv_sys_catman_ext,
     46  1.1  elric [if grep _suffix /etc/man.conf > /dev/null 2>&1; then
     47  1.1  elric 	ac_cv_sys_catman_ext=0
     48  1.1  elric else
     49  1.1  elric 	ac_cv_sys_catman_ext=number
     50  1.1  elric fi
     51  1.1  elric ])
     52  1.1  elric if test "$ac_cv_sys_catman_ext" = number; then
     53  1.1  elric 	CATMANEXT='$$section'
     54  1.1  elric else
     55  1.1  elric 	CATMANEXT=0
     56  1.1  elric fi
     57  1.1  elric AC_SUBST(CATMANEXT)
     58  1.1  elric ])