Re: change glib-config to pkgconfig in configure.in
Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> writes:
> There is an easier way, you can use the PKG_CHECK_MODULES macro:
>
> PKG_CHECK_MODULES(PKGNAME, glib)
>
> This checks for pkg-config, checks that glib is installed, and sets the
> variables PKGNAME_CFLAGS and PKGNAME_LIBS to the necessary flags and
> libraries. Then you can, for example, call
>
> AC_SUBST(PKGNAME_CFLAGS)
> AC_SUBST(PKGNAME_LIBS)
>
> and access the flags in ${PKGNAME_CFLAGS} and ${PKGNAME_LIBS} in the Makefile.
General rule of thumb with anything Autoconf-related: always quote
everything. Therefore, better to say:
PKG_CHECK_MODULES([PKGNAME], [glib])
AC_SUBST([PKGNAME_CFLAGS])
AC_SUBST([PKGNAME_LIBS])
It doesn't matter until one day it does and you get bizarre and obscure
error messages and corrupted shell scripts and spend hours trying to
figure out why.
--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>
Reply to: