[patch] Sanitize `glibconfig.h'.


I have submitted two patches to ftp.gimp.org:/incoming.  Here's the
README.  The patches are


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', 


and its companion


* 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'.

  However, only `gdk' needs this particular feature.  This information
  is thus sent to `gtk+/configure' by adding a backdoor flag to
  `glib-config', which should be used only by `gtk+/configure'.

Here's the ChangeLog for `glib':

1998-07-11  Raja R Harinath  <harinath@cs.umn.edu>

	Sanitize `glibconfig.h'.
	* glib.h: Remove parts that depend on `configure' output.  All
	these have been moved to `glibconfig.h'.
	* Makefile.am (BUILT_SOURCES): Add `glibconfig.h'.
	(glibconfig.h): New rule.  Generate from `config.h'.
	* glibconfig.awk: New file.  Generates `glibconfig.h' for

	* configure.in (AM_CONFIG_HEADER): Generate `config.h', not
	(AC_PROG_AWK): New check.
	(CFLAGS -Wall -ansi -pedantic): Simplify.
	(GDK_WLIBS): New check.  `iswalnum' could be in `-lw'.
	* glib-config.in (---gdk-i18n-): New "hidden" flag.  Backdoor to
	pass `GDK_WLIBS' to gtk+/configure.in.  Yep, it is supposed to
	look ugly.
	* gerror.c (HAVE_CONFIG_H): Include <config.h>.
	* gmem.c (HAVE_CONFIG_H): Likewise.
	* gstrfuncs.c (HAVE_CONFIG_H): Likewise.
	* gutils.c (HAVE_CONFIG_H): Likewise.

and here's the ChangeLog for `gtk+':

1998-07-11  Raja R Harinath  <harinath@cs.umn.edu>

	* gtk/Makefile.am (LDADDS): Add GDK_WLIBS.

	* gdk/gdki18n.h (iswalnum): Use G_HAVE_FOO, not HAVE_FOO for stuff
	that is obtained from `glibconfig.h'.

	* gdk/Makefile.am (gdkinclude_HEADERS): Remove stray space.

	* configure.in (CFLAGS -Wall -ansi -pedantic): Simplify.
	(GDK_WLIBS): Use glib-config backdoor to get library information
	passed in from glib/configure.

Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash

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