🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #32

New macro for Autoconf 1.2

#32
From: Paul D. Smith
Date: Fri, 30 Oct 1992 04:59
106 lines
4426 bytes
I run GNU utilities on a SVR4-derived system (DG/UX 5.4.x).  As such,
our man pages are stored already formatted and compressed with pack(1)
under /usr/catman.  So, any new man pages installed on the system must
be formatted (packing is optional) during the install in order for man
to display them properly.

I've written a macro, PDS_MAN_FORMAT, which attempts to determine
whether formatting is needed, and if so, how to do it.  It's may be
a bit tailored to my needs but if others could generalize it a bit I
think it would make a nice addition to Autoconf for those packages
which have man pages (obviously renamed to AC_MAN_FORMAT :)

PDS_MAN_FORMAT takes no arguments.  It calls AC_SUBST on three
variables:

    MAKEMAN     either empty or a pipeline which takes a man page from
                stdin and writes the formatted man page to stdout.

                If /usr/catman exists, then a formatter is looked for.
                First "groff" is searched for then if that's not found
                "nroff" is searched for.  MAKEMAN contains one of:

                    | groff -Tascii -man -et | col
                    | eqn | tbl | nroff -man | col

    PACKMAN     either ":" or a compression command.  find(1) is used
                to locate man pages matching sh.*, then they are
                examined to find the extension.  A .z extension causes
                PACKMAN to be set to "pack", a .Z extension causes
                PACKMAN to be set to "compress".

    PACKEXT     either empty, ".z", or ".Z" depending on PACKMAN.

These are used in my install script as follows (all my man pages have
a .man extension and there's one per program...)

    PROGS   = prog1 prog2 prog3 prog4

    MAKEMAN = @MAKEMAN@
    PACKMAN = @PACKMAN@
    PACKEXT = @PACKEXT@

    install-man:
            for mn in $(PROGS); do \
              cat $mn.man $(MAKEMAN) > $mn.$(manext); \
              $(PACKMAN) $mn.$(manext); \
              $(INSTALL_DATA) $mn.$(manext)$(PACKEXT) $(mandir); done

The macro is below... I'm interested in any and all enhancements,
etc.; I've only been playing with Autoconf for a day or two so I'm
sure it's less than elegant :)

                                                                paul
-----
 ------------------------------------------------------------------
| Paul D. Smith                          |    paul_smith@dg.com    |
| Data General Corp.                     | pds@lemming.webo.dg.com |
| Network Systems Development Division   |                         |
| Open Network Systems Development       |   "Pretty Damn S..."    |
 ------------------------------------------------------------------
-------------------------------------------------------------------------------
define(PDS_MAN_FORMAT,
[echo checking for man formatting rules
# /usr/catman   --> formatted man pages
# other         --> unformatted man pages
MAKEMAN=
if test -d /usr/catman; then
  echo checking for groff
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/groff; then
      MAKEMAN="| groff -Tascii -man -et | col"
      break
    fi
  done
  if test -z "$MAKEMAN"; then
    echo checking for nroff
    for dir in $prefix/bin:$PATH; do
      test -z "$dir" && dir=.
      if test -f $dir/nroff; then
	MAKEMAN="| eqn | tbl | nroff -man | col"
	break
      fi
    done
  fi
  IFS="$saveifs"
  if test -z "$MAKEMAN"; then
    echo "couldn't find a man page formatting program!"
  fi
fi
echo checking for man packing rules
# sh.*.z    --> use pack(1)
# sh.*.Z    --> use compress(1)
PACKMAN=:
PACKEXT=
shpage=`find /usr/*man -name sh.\* -print`
for pg in $shpage; do
  case $pg in
    *.z) PACKMAN=pack; PACKEXT=.z; break;;
    *.Z) PACKMAN=compress; PACKEXT=.Z; break;;
  esac
done
AC_SUBST(MAKEMAN)dnl
AC_SUBST(PACKMAN)dnl
AC_SUBST(PACKEXT)])dnl
Technical Details
Message-ID: <9210301459.AA20139@lemming.webo.dg.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!lemming.webo.dg.com!pds

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!lemming.webo.dg.com!pds
From: pds@lemming.webo.dg.com (Paul D. Smith)
Newsgroups: gnu.utils.bug
Subject: New macro for Autoconf 1.2
Message-ID: <9210301459.AA20139@lemming.webo.dg.com>
Date: 30 Oct 92 04:59:38 GMT
Article-I.D.: lemming.9210301459.AA20139
Sender: gnulists@ai.mit.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 106
Approved: bug-gnu-utils@prep.ai.mit.edu