On Tuesday 21 June 2011, Harlan Stenn wrote:
> I'm trying to allow the selection of target man sections for each man
> page at configure time.
> 
> For example, I have 'sntp.man.in' and 'sntp.mdoc.in' in the distribution
> tarball, and at configure time "stuff happens" where the decision is
> made as to which version (man or mdoc) of the manual is to be installed,
> and also the manual section it should go in to.
> 
> I AC_SUBST([SNTP_MS]), and SNTP_MS will have the value "1", "1m", or
> "8".
> 
> I also AC_SUBST([MANTAGFMT]), and MANTAGFMT is either "man" or "mdoc".
> 
> I have tried using the following in my Makefile.am:
> 
>  ...
>  man_MANS=       sntp.$(SNTP_MS)
>  ...
>  sntp.$(SNTP_MS): $(srcdir)sntp.$(MANTAGFMT).in
>         sed -f m4/mansec.sed $(srcdir)sntp.$(MANTAGFMT).in > sntp.$(SNTP_MS)
> 
> and also:
> 
>  ...
>  sntp.1 sntp.1c sntp.8: $(srcdir)sntp.$(MANTAGFMT).in
>         sed -f m4/mansec.sed $(srcdir)sntp.$(MANTAGFMT).in > sntp.$(SNTP_MS)
> 
> but the 'install-man' target remains "empty".
> 
> I'm really hoping I don't have to enumerate the choices and use automake
> conditionals to choose the verisons I want...
> 
> 
Well, sort of.  Here is how I'd do it do (untested!).

Rename the foo.man.in and foo.mdco.in pages to resp. foo.man-in and
foo.mdoc-in.

In Makefile.am use then:

  SUFFIXES = .man @MANTAGFMT@-in
  .@[email protected]:
       sed -f m4/mansec.sed '$(srcdir)/$<' > $@

  my_manpages = sntp.man

  if IN_SECTION_8
  man8_MANS = $(my_manpages)
  endif
  if IN_SECTION_1
  man1_MANS = $(my_manpages)
  endif
  if IN_SECTION_1m
  man1m_MANS = $(my_manpages)
  endif

where `IN_SECTION_8' etc. are properly defined as automake conditionals
in configure.ac:

  AM_CONDITIONAL([IN_SECTION_8], [test $SNTP_MS = 8])
  ...

Let me know if it doesn't work, I'll try to think of something better.

HTH,
  Stefano

Reply via email to