Re: Compiling Pango/GTK+/ATK with -D_REENTRANT but without -lgthread



Sebastian Wilhelmi <wilhelmi ira uka de> writes:

> Hi,
> 
> currently pango builds without -D_REENTRANT, whereas atk and gtk+ build with
                                                               ^^^^

I don't see that GTK+ is being build with -lgthread - I think it is
just being pulled in via ATK.

> -D_REENTRANT, but also with -lgthread. Both are wrong. In general a library
> should be compiled with -D_REENTRANT but without -lgthread. Because that's
> what we did for gtk+-1.2, I suppose, that this is just a lapse.

Yes, it is should be as you described.
 
> Now there are 3 possibilities to solve that:
> 
> 1.) Replace the search for GLib in pango/atk/gtk+ by
> 
>     AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION, :,
>                      AC_MSG_ERROR([get a grip]),
>                      gobject gmodule)
> 
>     GLIB_CFLAGS = `$PKG_CONFIG --cflags gobject-2.0 gmodule-2.0 \
>                    gthread-2.0`
> 
>     This is ugly, because here we write gobject and later gobject-2.0. So 
>     I wouldn't call this a nice solution.

Calling pkg-config separately is necessary in any case to suppress
duplicates; take a look at how I have the configure checks set up in
GTK+. I would consider them to be authoritively correct (except
perhaps in the matter of -D_REENTRANT.)

The correct fix, I think, for the GTK+ configure.in would be
to change:

 GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cflags $GDK_PIXBUF_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS"

To:

 GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cflags $GDK_PIXBUF_PACKAGES gthread-2.0` $GDK_PIXBUF_EXTRA_CFLAGS"

And so forth for the other libraries. Essentially the same thing
will work for ATK; The Pango configure.in might require some more
reworking since it is less rational in this area.

> 2.) Make @G_THREAD_CFLAGS@ (normally -D_REENTRANT) mandatory for
>     GLIB_FLAGS. That would make sense for libraries, might however not fit
>     applications too well. Then we could simply write
> 
>     AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION, :,
>                      AC_MSG_ERROR([get a grip]),
>                      gobject gmodule)

I don't think this is a good idea; while -D_REENTRANT has virtually no
effect for GNU libc (and it thus doesn't hurt to include or omit it),
it might be a signficant speed hit for other systems.

> 3.) Add an extra argument to AM_PATH_GTK_2_0 and AM_PATH_GLIB_2_0 to pass
>     over additional modules for GTK_CFLAGS resp. GLIB_CFLAGS. That would
>     allow us to write 
> 
>     AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION, :,
>                      AC_MSG_ERROR([get a grip]),
>                      gobject gmodule, gthread)
> 
>     All in all this seems to be the best solution to me. A patch to    
>     glib/m4macros/glib-2.0.m4 is appended to demostrate, what I mean.

Well, since GTK+ doesn't actually use the cflags coming out of
AM_PATH_GLIB_2_0, this wouldn't help for it. (And Atk is basically
set up the same way.)

Regards,
                                        Owen





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