Hi David, * David Byron wrote on Wed, Nov 16, 2005 at 12:40:42AM CET: > I've defined some macros that I'd like to share across projects. Seems > to me I've got two choices for getting them in my dist tarball: > > 1. include the macros I wrote in the files I wrote > 2. include the macros I wrote in aclocal.m4 > > >From what I can tell, automake chooses #1 when ACLOCAL_AMFLAGS is a > relative path:
> and it chooses #2 when ACLOCAL_AMFLAGS is an absolute path: Yes, correct. > Unfortunately, with #1, my files don't make it in the dist tarball. > Instead, the generated makefile creates the directory: > and then copies my macros there. No big surprise that this doesn't > work Yes. > I've come up with: > > ACLOCAL_AMFLAGS = -I `cd ../../../util/scripts/m4 && pwd` Hehe, I did not know this worked at all. > as a solution, but it feels funny. It gets the macros included in > aclocal.m4 so my dist tarball is complete, and it keeps the extra > directories from getting created. Is there a better way? I'd like to > avoid the absolute path so people can grab this file from revision > control and stick it wherever they want as long as they grab the scripts > too. First idea: In the directory, where aclocal searches by default ($prefix/share/aclocal, usually), edit/create the file `dirlist' to point to the directory your macros are in. Then, #2 will work without any ACLOCAL_AMFLAGS. OTOH having one file per macro is much nicer: Why not mkdir m4 add `ACLOCAL_AMFLAGS = -I m4' to Makefile.am add `AC_CONFIG_MACRO_DIR([m4])' to configure.ac? Then, with Automake <= 1.9.6 you can add a cp /my/macros/*.m4 m4/ to your bootstrap script (the one that executes automake etc,) and with CVS Automake you could simplify that to aclocal --install -I m4 (or add `ACLOCAL_AMFLAGS = -I m4 --install' to Makefile.am and have autoreconf run it for you). > The other small downside to this solution is that instead of just > sharing the macros as they are in the tree of files from revision > control, they get compiled into aclocal.m4 in each project that uses > them. Yes. I'd not put them in revision control, though. But this issue (whether to store generated files there) is controversial, and there are arguments for both sides. Cheers, Ralf