Click to See Complete Forum and Search --> : Using help2man in autoconf/automake


NeilBlue
09-12-2003, 03:55 PM
Hello,

I am trying to generate man pages with help2man using automake. Well I have managed to get it working with the following entry in Makefile.am:

info_TEXINFOS=coldcompress.texi
dist_man_MANS=coldcompress.1

coldcompress.1: ../src/coldcompress$(EXEEXT)
echo "$<"
help2man -o coldcompress.1 $<

This works though I can see a problem if the client machine does not have help2man or even if some of the texinfo tools are missing. Is there a better way to account for this using autoconf/automake?

Thanks
Neil

bwkaz
09-12-2003, 07:40 PM
Put a specific check for help2man and/or the rest of the texinfo stuff in the configure.ac file would be how I'd do it. Something like AC_PROG(...) maybe -- put it right near the AC_PROG_CC checks and stuff.

NeilBlue
09-13-2003, 10:28 AM
Here is what I have so far:

configure.ac
AC_CHECK_PROGS([HELP2MAN], [help2man])

Makefile.am
dist_man_MANS=coldcompress.1

coldcompress.1: ../src/coldcompress$(EXEEXT)
if ! test -z "$(HELP2MAN)" ; \
then \
$(HELP2MAN) -o coldcompress.1 $<; \
fi

problem is I want to make
dist_man_MANS=coldcompress.1 conditional on HELP2MAN being set?

NeilBlue
09-13-2003, 12:50 PM
With some further enhancements I now have a macro:

acsite.m4:
# check for the presence of help2man
# if it is available then set MANPAGES to
# the list of man page files to create
#
# AC_PROG_HELP2MAN(list-of-man-pages)

AC_DEFUN([AC_PROG_HELP2MAN],
[{
AC_CHECK_PROGS([HELP2MAN], [help2man])
if ! test -z "$HELP2MAN"
then
AC_SUBST(MANPAGES, $1)
fi
}])

configure.ac:
AC_PROG_HELP2MAN([coldcompress.1])

Makefile.am:
dist_man_MANS=$(MANPAGES)
CLEANFILES=$(MANPAGES)

coldcompress.1: ../src/coldcompress$(EXEEXT)
$(HELP2MAN) -o $@ $<

Neil

:)