[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Choosing man section at configure time
From: |
Stefano Lattarini |
Subject: |
Re: Choosing man section at configure time |
Date: |
Tue, 21 Jun 2011 20:09:35 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
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 @address@hidden
address@hidden@-in.man:
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