For posterity:
In configure.ac
, I use the PKG_CHECK_MODULES
macro. This assumes, of course, that you have pkg-check
installed, which I do via Homebrew.
PKG_CHECK_MODULES(GLIB2, glib-2.0, [], [AC_MSG_FAILURE([glib-2.0 is not installed])])
The macro above sets a group of variables for use in the autoconf and automake files prefixed with GLIB2
.
I use this in the Makefile.am
thus:
bin_PROGRAMS = <myprogram>
<myprogram>_SOURCES = \
main.c
<myprogram>_CFLAGS = ${GLIB2_CFLAGS}
<myprogram>_LDADD = ${LIBS} ${GLIB2_LIBS}
It's really rather straightforward if you use pkg-config
. You can even package your own libs and install them for use that way, linking them in place with Homebrew.