Using help2man in autoconf/automake


Results 1 to 5 of 5

Thread: Using help2man in autoconf/automake

  1. #1
    Join Date
    Oct 2000
    Posts
    200

    Using help2man in autoconf/automake

    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

  2. #2
    Join Date
    Apr 2001
    Location
    SF Bay Area, CA
    Posts
    14,936
    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.

  3. #3
    Join Date
    Oct 2000
    Posts
    200
    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?

  4. #4
    Join Date
    Oct 2000
    Posts
    200
    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


  5. #5
    Join Date
    Mar 2015
    Posts
    1
    Great ! Thank you so much ! I extended it a bit for using help2man only if it's installed:

    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)
    HAVE_HELP2MAN=true
    fi
    AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HAVE_HELP2MAN = xtrue])
    }])

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

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

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

    (A tab key preceeds the line $(HELP2MAN) -o $@ $<)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •