Question

Not sure if this belongs on here or SuperUser, but here goes:

I have Homebrew installed in my $HOME/opt/homebrew dir (I'm pretty religious about isolation for user accounts - yes, I'm one of THOSE people). In any case, Homebrew doesn't install to /usr/local/. It works fine because I added Homebrew to the head of my personal path in .bashrc.

I'm now using autoconf. I'm a C newb. I have a configure.ac that checks for Apache Portable Runtime. It does the --install to generate a ./configure just fine. When I run ./configure, it doesn't find it - probably because it's not looking where Homebrew installed it.

I assume I have to provide arguments to the ./configure script setting the includedir and libdir. But it doesn't work. What is the right way to link to these Homebrew libs?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top