Autoconf / Automake Terms and Dist Rules

I recently started using autoconf and automake for a project I'm working on. Project documentation is written in LaTeX. Since I don't want LaTeX to be dependent, I want to check for the pdflatex binary file using autoconf and then use this information in Makefile.am to decide whether to simply copy the .tex file to the documentation directory or to create a PDF file and copy it both of them.

This is the corresponding section in the configure.ac file:

# Check for presence of pdfLaTeX AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex) if test -z "$PDFLATEX"; then AC_MSG_WARN([Unable to create PDF version of the user manual.]) fi AM_CONDITIONAL([HAVE_PDFLATEX], test -n "$PDFLATEX") 

In the doc / directory, I have the following Makefile.am:

 docfiles = manual.tex QuickStart.txt if HAVE_PDFLATEX docfiles += manual.pdf MANNAME = manual MANTEXSRC = $(MANNAME).tex MANAUX = $(MANNAME).aux MANPDF = $(MANNAME).pdf CLEANFILES = $(MANPDF) $(MANNAME).log $(MANNAME).idx $(MANNAME).out \ $(MANNAME).toc $(MANAUX) $(MANPDF): $(srcdir)/$(MANTEXSRC) $(PDFLATEX) $< endif dist_doc_DATA = $(docfiles) 

This setting works when pdflatex is present, but when it does not work, make make works, but make distcheck asks how to create the PDF file:

 make[1]: *** No rule to make target `manual.pdf', needed by `distdir'. Stop. 

Looking at the makefile generated by automake, I see:

 #am__append_1 = manual.pdf am__dist_doc_DATA_DIST = manual.tex QuickStart.txt manual.pdf 

and then I find:

 docfiles = manual.tex QuickStart.txt $(am__append_1) #MANNAME = manual #MANTEXSRC = $(MANNAME).tex #MANAUX = $(MANNAME).aux #MANPDF = $(MANNAME).pdf #CLEANFILES = $(MANPDF) $(MANNAME).log $(MANNAME).idx $(MANNAME).out \ # $(MANNAME).toc $(MANAUX) .btmp dist_doc_DATA = $(docfiles) 

What am I missing here?

+4
source share
1 answer

I think your problem is that you conditionally "distribute" manual.pdf and produce rather conservatively about dist rules. Try the following:

 if HAVE_PDFLATEX doc_DATA = manual.pdf # Rest of your stuff... endif 
+5
source

All Articles