In my Automake project I have a certain number of sub-packages among which I want to switch depending on a configure time option. According to the Automake documentation this is possible: https://www.gnu.org/software/automake/manual/html_node/Subdirectories-with-AC_005fSUBST.html
So I am doing the following:
# configure.ac
if test_condition_1 ; then
SUBDIR_TO_BUILD=dir1
elif test_condition_2 ; then
SUBDIR_TO_BUILD=dir2
else
SUBDIR_TO_BUILD=dir3
fi
AC_SUBST(SUBDIR_TO_BUILD)
...
# Makefile.am
SUBDIR_TO_BUILD=@SUBDIR_TO_BUILD@
SUBDIRS=$(SUBDIR_TO_BUILD)
DIST_SUBDIRS=dir1 dir2 dir3
...
However, if I try running autoreconf I get the following error:
Makefile.am:4: error: required directory $(SUBDIR_TO_BUILD) does not exist