I want to include two sample programs A and B into the existing library packages.
program A depends on libfoo library, and program B depends on libbar library.
libfoo and libbar are provided as pkg-config aware.
And I want that configure will automatically detect the existence of libfoo and libbar, and if libfoo found, program A should be built, and if libbar found, program B should be built.
Here is what I'm trying to in configure.ac:
PKG_CHECK_MODULE([FOO], [libfoo])
PKG_CHECK_MODULE([BAR], [libbar])
Here is what I'm trying to in Makefile.am:
if LIBFOO
noinst_PROGRAMS += A
A_SOURCES = ...
A_CPPFLAGS = $(FOO_CFLAGS)
A_LDADD = $(FOO_LIBS)
endif
if LIBBAR
noinst_PROGRAMS += B
B_SOURCES = ...
B_CPPFLAGS = $(BAR_CFLAGS)
B_LDADD = $(BAR_LIBS)
end
The problem is, I don't know how to define the predicates, LIBFOO and LIBBAR.
Any idea?