automake: Subdirectories with AC_SUBST

1 
1 7.2.3 Subdirectories with ‘AC_SUBST’
1 ------------------------------------
1 
1 Another possibility is to define ‘MAYBE_OPT’ from ‘./configure’ using
1 ‘AC_SUBST’:
1 
1      ...
1      if test "$want_opt" = yes; then
1        MAYBE_OPT=opt
1      else
1        MAYBE_OPT=
1      fi
1      AC_SUBST([MAYBE_OPT])
1      AC_CONFIG_FILES([Makefile src/Makefile opt/Makefile])
1      ...
1 
1    In this case the top-level ‘Makefile.am’ should look as follows.
1 
1      SUBDIRS = src $(MAYBE_OPT)
1      DIST_SUBDIRS = src opt
1 
1    The drawback is that since Automake cannot guess what the possible
1 values of ‘MAYBE_OPT’ are, it is necessary to define ‘DIST_SUBDIRS’.
1