On 03/22/2017 03:20 AM, Joakim Jalap wrote: > Hello autoconf gurus! > > I am trying to write some autotools support for installing a latex > package. On CTAN I found some autoconf macros (which I had to modify a > bit) which I use to find for example latex(1) and pdflatex(1). So far so > good. This CTAN package also has a macro to find the path to the tex > installation, AC_TEXMF_PATH. This finds the correct path for me at It's poor practice to name a macro in the AC_ namespace if it is not actually owned by autoconf; you may want to choose a different namespace to make it obvious where the macro originates from. > /usr/share/texmf-dist. Now I want to put this as the default prefix so > that configure will "do the right thing" by default, but this is where I > fail. > > This is my configure.ac: > ---------------------------------------- > AC_INIT([package], [0.1], [blah]) > AC_PREREQ([2.60]) > AC_CONFIG_MACRO_DIR([m4]) > AM_INIT_AUTOMAKE([foreign]) > > AC_PROG_INSTALL > AC_PROG_LATEX > AC_PROG_KPSEWHICH > AC_PROG_PDFLATEX > AC_TEXMF_PATH > > AC_PREFIX_DEFAULT([$texmfpath]) > AC_MSG_NOTICE([$texmfpath]) > > AC_CONFIG_FILES(Makefile) > AC_OUTPUT > ---------------------------------------- > AC_TEXMF_PATH exports `texmfpath' and does AC_SUBST on it. (You can find > all the macros here: https://www.ctan.org/tex-archive/support/autoconf) > > The problem is with the AC_PREFIX_DEFAULT. It sets the default prefix to > empty. But the AC_MSG_NOTICE macro on the line below prints the correct > path! So somehow $texmfpath is expanded to the correct value by > AC_MSG_NOTICE, but it is expanded to nothing on the line above. If I do > AC_PREFIX_DEFAULT(["some_path"]) then the default prefix is correctly > set to "some_path". Indeed, thanks to the magic of m4 diversions, AC_PREFIX_DEFAULT expands to code that appears very early in configure, and using a shell variable that early in the run is tricky; while AC_MSG_NOTICE expands to code that runs at the place where the macro was used. > > Is it not possible to set the default prefix in this way? What other > good ways are there to set the default prefix to something discovered at > configure time? Is AC_PREFIX_PROGRAM any better for your use case? > > I'm not subscribed to the list so if somebody answers, please keep me on > cc :) That's GNU list policy anyways. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf