Subject: bug#23599: Including search directories for pdf and dvi

From: Mike Frysinger <[email-masked]>
Date: Sat, 22 Jan 2022 15:24:57 -0500

On 21 Jan 2022 19:33, Karl Berry wrote:
>     perhaps an easy way out of this ... if we just add -E
>     to the texi2dvi call, it forces makeinfo (and its flags) to be used.
> 
> Using -E is not desirable nowadays, it has myriad possibilities for
> affecting the output in bad/unpredictable ways.
> 
> _e used to be the way to support @macro. I surmise Automake used to
> always use this, hence AM_MAKEINFOFLAGS would get propagated there. 
> 
> I don't think the MAKEINFO envvar was ever used in the part of texi2dvi
> that calls TeX. I'm not sure it even applies to current makeinfo.
> 
> I'm not exactly sure what the right solution is. If we can supporting
> pass arguments (as in -I doc) to texi2dvi somehow (aka some new variable
> AM_TEXI2DVIFLAGS I guess -- should also apply to texi2pdf), that should
> work out. I don't think we could/should make AM_MAKEINFOFLAGS apply to
> texi2dvi/2pdf invocations, since many makeinfo options don't apply to
> texi2dvi.
> 
> Overriding TEXI2DVI does not seem all that bad to me either ...

what i dislike about forcing people to set TEXI2DVI is that it does not scale.
i came across this bug myself when converting newlib from recursive makes to a
single top-level makefile.  there are 2 subdirs, libm & libc, and each has a
manual, and each needs -I set to their own subdir.  so i'd have to:
TEXI2DVI = texi2dvi -I libc -I libm
and then hope each one doesn't otherwise use conflicting names.

in the original report here, and in my case, the issue could be distilled down
to the fact that makeinfo automatically includes -I flags to the subdir that
the files live in.  since it's libc/libc.texi, i get -I libc for free.  hence
my info targets generate fine without extra work.  so if i use the -e option:
TEXI2DVI = texi2dvi -e
the automatic -I flags from makeinfo get passed through and now pdfs work.

so if you say we should avoid -e because it has other side-effects, i think we
need to provide fallbacks, and smooth the default over in the process.
* provide AM_TEXI2FLAGS to apply to both texi2dvi & texi2pdf calls
  - i don't think we need sep AM_TEXI2DVIFLAGS & AM_TEXI2PDFFLAGS, at least
    for now.  if a request comes in, we can support both easily.
* update the lib/am/texibuild.am .dvi & .pdf rules to output automatic -I paths
  just like we do for makeinfo
* i guess delete the MAKEINFO= env var passing to texi2dvi & texi2pdf ?  if we
  don't want it to be used, prob best to throw it away to avoid confusion.
-mike