Re: Finding Version of GTK installed



On Tue, Dec 05, 2006 at 09:42:02AM -0500, David Vandepol wrote:
      I'm still having problems.  When I run java tool and view all of the
LaF's GTK is displayed, however gtk isn't available in the pkg-config

Does the LaF actually use Gtk+ or just emulates the look?
And if it uses Gtk+, does it use the common library or some
private copy?

AFAIK Java 1.5 Gtk+ LaF is Synth-based.

Just to be clear, GTK is installed
with Red Hat OS correct?

In a typical installation, yes.  But it is not mandatory.

I installed all the packages when installing the
OS and I assumed that it would be installed.

If you installed everything you should have Gtk+.

And java picks it up.

Or maybe not.

Also
there are other gtk packs in the pkgconfig folder, such as gkt-engines-2.pc
.  Do you or anyone know why the required info is not in pkgconfig?

First of all, pkg-config is intended for *compile time*
detection, and .pc files are in the develoment package, not
in run-time, you can't detect Gtk+ run-time with pkg-config
(of course if you installed everything, you should have the
development package too, but maybe you did not install
really everything).

So if you want to detect the run-time, forget pkg-config
and run something like this:

#include <dlfcn.h>
#include <stdio.h>
int
main(void)
{
    void *gtk;
    int *maj, *min, *mic;
    int status = 1;

    gtk = dlopen("libgtk-x11-2.0.so", RTLD_LAZY);
    if (!gtk)
        return 1;
    maj = dlsym(gtk, "gtk_major_version");
    min = dlsym(gtk, "gtk_minor_version");
    mic = dlsym(gtk, "gtk_micro_version");
    if (maj && min && mic) {
        printf("%d.%d.%d\n", *maj, *min, *mic);
        status = 0;
    }
    dlclose(gtk);
    return status;
}

(needs dlopen(), i.e. Linux, BSD, or something like that)

or just do

    printf("%d.%d.%d\n",
           gtk_major_version(), gtk_minor_version(), gtk_micro_version());

but such a program has to be linked with the lowest
acceptable version of Gtk+ to make sense, then it can be run
on systems with higher Gtk+.

Or depending on what you do, you can ask the package
management system...

Generally, the answer to the run-time environment question
`if I run something using Foo, what version of Foo it will
get dynamically linked with' is to actually do it and check
the outcome.

Yeti


--
Whatever.



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