[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: change glib-config to pkgconfig in configure.in



On Sex, 15 Mai 2009, Francesco Namuri wrote:
Hi,
I'm trying to solve bug #523713, it regards pmidi package, the problem
is that the build depends on glib 1.2 that is going to be removed from
unstable. I've seen that the program compiles fine with glib 2.0, but
the configure look only to 1.2 version using the glib-config tool.

Now, I've managed to solve this problem changing these lines in
config.in

from:

if test "$included_glib" = "auto" || test "$included_glib" = "no"; then
                AC_PATH_PROG(GLIBCNF, glib-config, true, $PATH)
                CFLAGS="$CFLAGS `$GLIBCNF --cflags`"
                LIBS="$LIBS `$GLIBCNF --libs`"
                WITH_INCLUDED_GLIB=0
                AC_SUBST(GLIBCNF)
        fi

to something like:

if test "$included_glib" = "auto" || test "$included_glib" = "no"; then
                AC_PATH_PROG(GLIBCNF, glib-config, true, $PATH)
                CFLAGS="$CFLAGS `pkg-config --cflags glib-2.0`"
                LIBS="$LIBS `pkg-config --libs glib-2.0`"
                WITH_INCLUDED_GLIB=0
                AC_SUBST(GLIBCNF)
        fi

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.


--
Eduardo M KALINOWSKI
eduardo@kalinowski.com.br


Reply to: