Using autoconf in configure.ac I need to append to an output variable.
Specifically I want to append to the LIBS variable differently for each of my programs (myprogram1 and myprogram2 in the Makefile.am). Lets imagine myprogram1 requires a -lboost_python and myprogram2 requires -losg.
Essentially some programs require certain libs while others do not. Here is an example of what I am doing. Of course AC_SUBST does an assignment (= vs +=) from what I understand so that doesn't work.
AC_CHECK_LIB([boost_python], [main], [AC_SUBST([myprogram1_LIBS], ["-lboost_python"])
AC_DEFINE([HAVE_LIBBOOST_PYTHON], [1], [Define if you have libboost_python])],
[AC_MSG_FAILURE([boost_python library not found])])
AC_CHECK_LIB([osg], [main], [AC_SUBST([myprogram2_LIBS], ["-losg"])
AC_DEFINE([HAVE_LIBOSG], [1], [Define if you have libosg])],
[AC_MSG_FAILURE([osg library not found])])
What I need is for the myprogram1_SOURCES to be built with the first lib and the myprogram2_SOURCES to be built with the second lib.
Is there an AC_APPEND_SUBST type macro I can use? And/or is there a better way for me to do what I need to do to build different programs with different libraries being linked?