Re: [patch] Sanitize `glibconfig.h'.




Raja R Harinath <harinath@cs.umn.edu> writes:

> I have submitted two patches to ftp.gimp.org:/incoming.  Here's the
> README.  The patches are
> 
> 	glib-rrh-980712-0.patch.gz
> 	gtk-rrh-980712-0.patch.gz
> 
> If given the go-ahead, I can commit these changes to CVS, too.
> 
> - Hari
> 
> Installed header files should not define/test HAVE_* macros which are
> the output of a configure process -- this will prevent unnecessary
> interactions with other packages that define/use similar HAVE_* macros.
> 
> They should use sanitized macros that are conditionally defined, and
> they can depend on header files that are installed under $exec_prefix to
> provide the sanitized values.
> 
> Applying this philosophy to glib/gtk+ gives us this patch to `glib', 
> 
>     glib-rrh-980712-0.patch.gz
> 
> and its companion
> 
>     gtk-rrh-980712-0.patch.gz

The cleanup is a welcome thing; we've known about the problem
for a long time, but it hasn't actually ever caused problems
so nobody has bothered to fix it.

One note of possible concern is that 'awk' is not one of the
programs on autoconf's list of acceptable programs for Makefile
use. I suspect awk is pretty universal, so it may not be worth
trying to avoid using it.

(The alternate method would probably just to use sed to
rename all the HAVE_* to G_HAVE_*; but that certainly wouldn't
be as pretty.)
 
> * Sanitize `glibconfig.h'
> 
>   `glibconfig.h' is an installed file, but it has stuff that are the
>   output of a `configure' process -- especially the HAVE_* defines.
>   These defines can pollute the HAVE_* namespace of other programs that
>   include `glibconfig.h'.
> 
>   This cleanup also gives an opportunity to make `glib.h' more readable,
>   without a lot of wrangling about defining G_{MIN,MAX}{INT,LONG,FLOAT},
>   and the typedefs g[u]int{8,16,32}.
> 
> * This clean-up exposed a dependency of gdk/gdk-i18n.h on the
>   glib/configure, rather than gtk+/configure.  These HAVE_* symbols are
>   renamed to G_HAVE_* in `glibconfig.h'.  The companion patch to `gtk+'
>   does the other half.
> 
> * Locales and -lw: On Solaris 2.5, programs that use the isw... and other
>   wctype.h functions need to link against libw.{a,so}.  I have added a
>   configure check for `-lw'.

This dependency was left because it was easier to leave it there
than to install a new config header. (Because autoconf
is only set up to allow a single config header). But if we
accept this awk stuff for glib, then it looks like a good
basis for creating an installed header for GTK+. And that
would be cleaner than going through hoops to maintain the
dependency.

(I think there may in the future be a considerable amount
of internationalization support for glib, but it won't be
to similar to the current gdki18n.h)

Regards,
                                        Owen



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