Alexandre Duret-Lutz wrote: > Bruce> SUBDIRS = @MAYBE_BAR@ > Bruce> EXTRA_DIST = @NOT_MAYBE_BAR@ > > Odd. I don't understand how you get duplicates this way.
It all has to do with configuring the Makefile incorporated in the distributed subdirectory. There is no way to do it conditionally. Leastwise, not that I can tell. If there is, then it is again because I have trouble remembering & searching for what I want. I tried to make it conditional once, and the distribution wound up trying to configure a file named, ".in". The implementing code decided that since I wanted to configure "@LIBOPTS_MAKEFILE@", it would then run sed on "@LIBOPTS_MAKEFILE@.in". Oops. So, I configure it unconditionally. Besides, I have to distribute both the bar/Makefile.am and bar/Makefile.in. Should I try something like this: > if [ -z "@LIBOPTS_MAKEFILE@" ] > then > AC_OUTPUT(Makefile blocksort.lsm blocksort.spec) > else > AC_OUTPUT(Makefile blocksort.lsm blocksort.spec > @LIBOPTS_MAKEFILE@) > fi The problem with doing stuff like that is that certain "special" macros have side effects that take effect outside the scope of the if/then/else clauses. e.g., AC_SUBST(). But there are others. Given the special effects of AC_OUTPUT, I wasn't in the mood to try it. It seems very special to me. Was I wrong? Should I have read the source? Should I just use a "distcheck-hook" that un-write protects the source hierarchy? :-) Why should it be necessary to become a autoconf/automake expert just to incorporate a sometimes compiled/sometimes not but always distributed component in a project? > So what's wrong with the last proposal of my previous mail > (using a conditional)? This seems to suit your requirements. That proposal being: if BAR MAYBE_BAR = bar fi SUBDIRS = foo $(MAYBE_BAR) The issues are: 1. How do you distribute "bar" when BAR is not defined? "bar" must be listed in either DIST_SUBDIRS or SUBDIRS, always one of them, but not both. I guess you add to that: if BAR SUBDIR_BAR = bar DIST_BAR = else SUBDIR_BAR = DIST_BAR = bar fi SUBDIRS = foo $(SUBDIR_BAR) EXTRA_DIST = $(DIST_BAR) This is essentially what I am doing now. 2. bar/Makefile.in must get generated by automake. Can you tell it to do that without listing it in the AC_CONFIGURE()? 3. If you list it there, then it will put stuff in the build directory that will conflict with stuff in the source dir. *THAT* will cause conflicts come "make distcheck" time.