Re: [Mit-devel] [PATCH] Don't abort the build if docbook2man is missing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 17, 2009 at 04:45:39PM -0400, Mike Frysinger wrote:
> On Tuesday 17 March 2009 12:45:54 Michal Marek wrote:
> > diff --git a/configure.ac b/configure.ac
> > index 9f09102..7b860b1 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -22,7 +22,9 @@ AC_PROG_CC
> >  AC_CHECK_PROGS(DOCBOOKTOMAN, docbook-to-man docbook2man, [no],)
> >  if test x"$DOCBOOKTOMAN" = xno
> >  then
> > -	AC_MSG_ERROR([docbook2man not found])
> > +	AC_MSG_WARN([docbook2man not found])
> > +	# fail with a meaningfull error if $DOCBOOKTOMAN called by the makefile
> 
> dont know if Jon cares, but some people prefer dnl for comments since the 
> literal comment moved to configure is useless ...

The rest of the configure.ac also uses '#', so I'll stick to that.


> > +	DOCBOOKTOMAN='${top_srcdir}/missing docbook2man'
> >  fi
> 
> awesome, thanks ... i just wonder now if the /dev/null redirect that exists in 
> the Makefile will prevent the pretty message from being displayed ?


Argh. The >/dev/null redirection is not a problem here, because the
makefile will run the else branch, but this will generate an empty
manpage due to the '> $@' there and it also won't fail due to the sed
pipe:

$ make
if [ "./missing docbook2man" = "docbook2man" ]; then                     \
            ./missing docbook2man doc/lsmod.sgml > /dev/null 2>&1;                       \
        else                                                               \
            ./missing docbook2man doc/lsmod.sgml 2>&1 > lsmod.8 | sed 's/^[^:]*://';              \
        fi
 `docbook2man' is needed, and is missing on your system.
         You might have modified some files without having the
         proper tools for further handling them.  Check the `README' file,
         it often tells you about the needed prerequisites for installing
         this package.  You may also peek at any GNU archive site, in case
         some other package would contain this missing `docbook2man' program.
$ make
make: Nothing to be done for `all'.

Third try:

Subject: [PATCH] Don't abort the build if docbook2man is missing

Instead of aborting the build, print a warning if neither
docbook2man nor docbook-to-man is found. Also, don't hide
or mangle docbook2man / docbook-to-man errors in the Makefile.

Signed-off-by: Michal Marek <mmarek@xxxxxxx>
---
 Makefile.am  |    9 +++++++--
 configure.ac |    4 +++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index bf9292f..412b4b9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -47,9 +47,14 @@ MAINTAINERCLEANFILES := $(man_MANS)
 # docbook2man writes file itself, doesn't do stdout.
 %.8: doc/%.sgml
 	if [ "$(DOCBOOKTOMAN)" = "docbook2man" ]; then                     \
-	    $(DOCBOOKTOMAN) $< > /dev/null 2>&1;                       \
+	    $(DOCBOOKTOMAN) $< >/dev/null;                                 \
 	else                                                               \
-	    $(DOCBOOKTOMAN) $< 2>&1 > $@ | sed 's/^[^:]*://';              \
+	    if $(DOCBOOKTOMAN) $< > $@.tmp; then                           \
+	        mv -f $@.tmp $@;                                           \
+	    else                                                           \
+	        rm -f $@.tmp;                                              \
+		exit 1;                                                    \
+	    fi                                                             \
 	fi
 
 %.5: doc/%.sgml
diff --git a/configure.ac b/configure.ac
index 9f09102..7b860b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,9 @@ AC_PROG_CC
 AC_CHECK_PROGS(DOCBOOKTOMAN, docbook-to-man docbook2man, [no],)
 if test x"$DOCBOOKTOMAN" = xno
 then
-	AC_MSG_ERROR([docbook2man not found])
+	AC_MSG_WARN([docbook2man not found])
+	# fail with a meaningfull error if $DOCBOOKTOMAN called by the makefile
+	DOCBOOKTOMAN='${top_srcdir}/missing docbook2man'
 fi
  
 # Delay adding the zlib_flags until after AC_PROG_CC, so we can distinguish



--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux