Re: Help with a variable in a .pc file



On Mon, Oct 02, 2006 at 06:01:30PM -0500, Daniel Espinosa wrote:
Could any help me on how to get a variable value in a .pc file?

I have the following values in the glade-3.pc file:

catalogdir=${prefix}/share/glade3/catalogs
pixmapdir=${prefix}/share/glade3/pixmaps
moduledir=${exec_prefix}/lib/glade3/modules

I need this variables in order to install the compiled and support files in
the correct plase to allow glade3 to find them.

This makes sense.

At moment I try in configure.in to use the following sentences:

    AC_SUBST(GLADE3_PIXMAP_DIR, '[$(shell pkg-config --variable=pixmapdir
glade-3)]')
    AC_SUBST(GLADE3_MODULES_DIR, '[$(shell pkg-config --variable=moduledir
glade-3)]')
    AC_SUBST(GLADE3_CATALOG_DIR, '[$(shell pkg-config --variable=catalogdir
glade-3)]')

But this doesn't.  If you want to use constructs like
$(shell ...), you can throw all configure away and write
a plain old nonportable Makefile directly embedding these.

Autoconf works by

1. Finding information about the system using portable shell
code.

2. Filling templates (of Makefiles, config.h and often of
other files too) with these information.

This way the generated files can avoid the use of special
smart (and nonportable) features because the smartness is in
configure.

Note that in configure I set the AC_OUTPUT to point to the glade directory,
./configure is generating the Makefiles but never compiles them. In the
glade/Makefile.am I have:

@INTLTOOL_XML_NOMERGE_RULE@

catalogsdir = $(GLADE3_CATALOG_DIR)
catalogs_DATA = gnomedb.xml gnomedb.xml.in

EXTRA_DIST = \
        $(catalogs_DATA)

INCLUDES = \
            -g -Wall \
            -I$(top_srcdir)                    \
            -I$(top_builddir)                \
            -DG_LOG_DOMAIN=\"GnomeDB\"      \
            $(LIBGNOMEDB_CFLAGS)             \
            $(WITHGNOME_CFLAGS)                \
            $(GLADE3_CFLAGS)

gladegnomedb_LTLIBRARIES = libgladegnomedb.la

gladegnomedbdir = $(GLADE3_MODULES_DIR)

libgladegnomedb_la_LIBADD = $(top_builddir)/libgnomedb/libgnomedb-3.la  \
                                $(LIBGNOMEDB_LIBS) $(WITHGNOME_LIBS)
$(GLADE3_LIBS)

libgladegnomedb_la_LDFLAGS = -module -avoid-version

libgladegnomedb_la_SOURCES = glade-gnomedb.c

There is neither @GLADE3_PIXMAP_DIR@, nor
@GLADE3_MODULES_DIR@ nor @GLADE3_CATALOG_DIR    So your
AC_SUBST has nothing to do.  Please read autoconf
documentation, but you should at least know AC_SUBST creates
@foo@ substitutons and AC_DEFINE creates config.h #defines.

You need at least something like

configure.ac:
  PKG_CHECK_MODULES(GLADE3, glade-3)
  GLADE3_PIXMAP_DIR=`pkg-config --variable=pixmapdir glade-3`
  GLADE3_MODULE_DIR=`pkg-config --variable=moduledir glade-3`
  GLADE3_CATALOG_DIR=`pkg-config --variable=catalogsdir glade-3`
  AC_SUBST(GLADE3_PIXMAP_DIR)
  AC_SUBST(GLADE3_MODULE_DIR)
  AC_SUBST(GLADE3_CATALOG_DIR)

Makefile.am:
  gladegnomedbdir = @GLADE3_MODULE_DIR@
  catalogdir = @GLADE3_CATALOG_DIR@
  ...

Yeti


--
Whatever.



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