summaryrefslogtreecommitdiffstats
path: root/third_party/heimdal/cf/check-man.m4
blob: ad013a4daf8de185ee646f0af609f2ee28fc185a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
dnl $Id$
dnl check how to format manual pages
dnl

AC_DEFUN([rk_CHECK_MAN],
[AC_PATH_PROG(NROFF, nroff)
AC_PATH_PROG(GROFF, groff)
AC_CACHE_CHECK(how to format man pages,ac_cv_sys_man_format,
[cat > conftest.1 << END
.Dd January 1, 1970
.Dt CONFTEST 1
.Sh NAME
.Nm conftest
.Nd foobar
END

if test "$NROFF" ; then
	for i in "-mdoc" "-mandoc"; do
		if "$NROFF" $i conftest.1 2> /dev/null | \
			grep Jan > /dev/null 2>&1 ; then
			ac_cv_sys_man_format="$NROFF $i"
			break
		fi
	done
fi
if test "$ac_cv_sys_man_format" = "" -a "$GROFF" ; then
	for i in "-mdoc" "-mandoc"; do
		if "$GROFF" -Tascii $i conftest.1 2> /dev/null | \
			grep Jan > /dev/null 2>&1 ; then
			ac_cv_sys_man_format="$GROFF -Tascii $i"
			break
		fi
	done
fi
if test "$ac_cv_sys_man_format"; then
	ac_cv_sys_man_format="$ac_cv_sys_man_format \[$]< > \[$]@"
fi
])
if test "$ac_cv_sys_man_format"; then
	CATMAN="$ac_cv_sys_man_format"
	AC_SUBST(CATMAN)
fi
AM_CONDITIONAL(CATMAN, test "$CATMAN")
AC_CACHE_CHECK(extension of pre-formatted manual pages,ac_cv_sys_catman_ext,
[if grep _suffix /etc/man.conf > /dev/null 2>&1; then
	ac_cv_sys_catman_ext=0
else
	ac_cv_sys_catman_ext=number
fi
])
if test "$ac_cv_sys_catman_ext" = number; then
	CATMANEXT='$$section'
else
	CATMANEXT=0
fi
AC_SUBST(CATMANEXT)
])