New system for getting information about GTK
- From: Owen Taylor <owt1 cornell edu>
- To: gtk-list redhat com, gimp-developer scam xcf berkeley edu
- Subject: New system for getting information about GTK
- Date: Thu, 12 Mar 1998 18:33:39 -0500
[ I apologize to everybody who gets multiple copies of this - but I
would like to get feedback from as wide a range of people as
possible ]
Hi all,
I've been working on some changes to the way GTK programs get
information about the GTK library.
To summarize what I have now:
gtk-config [--version] [--libs] [--cflags]
gtk-config --version
0.99.5
gtk-config --libs
-L/usr/local/lib -L/usr/X11R6/lib -lgtk -lgdk -lglib -lXi -lXext -lX11 -lm
gtk-config --cflags
-I/usr/local/include -I/usr/X11R6/include
You can either use this directly from the command line or in a Makefile:
gcc -o prog `gtk-config --cflags` prog.c `gtk-config --libs`
[ And you could get away without the cflags part usually on the
command line ]
Or, by using a provided automake rule:
AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
A simple usage:
AM_PATH_GTK(0.99.5,
[LIBS="$LIBS $GTK_LIBS"
CFLAGS="$GTK_CFLAGS $CFLAGS"],
AC_MSG_ERROR(Cannot find GTK: gtk-config must be in path))
[ MINIMUM-VERSION actually tests against the libraries, not
against the `gtk-config --version` results, as a sanity-check ]
Appended below is a diff to the GIMP's configure.in that uses this.
Advantages:
- Provides a simple way to get the dependencies right, even without
shared library dependencies. Which would allow us to use
the released libtool-1.1
- Simplifies writing tests for GTK using autoconf/make
- Makes things easy for the user - The correct gtk-config must
simply be the first one in the user's path. (Or they can specify
GTK_CONFIG=/not/in/my/path/gtk-config configure)
- Although currently this change is only needed so that the XInput library
(-lXi) get linked correctly or not, it will become much more
necessary when gdk_imlib is integrated into GTK.
Known disadvantages:
- If you move GTK or X after building GTK, you'll have to rebuild
GTK or edit 'gtk-config' manually.
- No override flags are provided yet in gtk.m4, though they
could be easily be added. [ i.e. --gtk-libs=XXX ]
- It is philophically different from the gnomeConfig.sh mechanism
of GNOME. (I think it is better, but I might have done it
the otherway if I had seen that first)
- Tomorrow is the release for GTK 1.0
I'm looking for some feedback:
- Is this mechanism sufficient?
- Will it work on all installations?
The question is not really whether to include this or not with the GTK
release - it won't break anything that currently works - but whether
it is good enough and trusted enough to allow us to switch to libtool
1.1; which would "require" the GIMP to switch to this mechanism.
[ Yes, this really is a bug fix :-). There are some systems GTK
won't on build using libtool earlier than 1.1 ]
I'd really like to get this tested on a range of machines before the
release; so if you have the time, and you update from CVS, especially
if you have an unusual configuration; I'd appreciate it if people
could try:
* Updating, rebuilding and installing GTK.
* Applying the following patch to the GIMP.
* Doing an autoconf ; make clean; make on the GIMP.
(Unusual configuration means: "Install with --prefix != /usr/local",
and/or "Run on something other than Linux" ;-)
Comments (positive or negative) about the above description would be
appreciated even if you don't try it out. If the general setup sounds
good, it would be possible we can put out a GTK-1.0pre1 this evening
for people not using CVS to test.
Thanks,
Owen Taylor
Index: configure.in
===================================================================
RCS file: /debian/home/gnomecvs/gimp/configure.in,v
retrieving revision 1.37
diff -u -r1.37 configure.in
--- configure.in 1998/03/12 05:43:34 1.37
+++ configure.in 1998/03/12 22:26:34
@@ -42,46 +42,12 @@
AC_DEFUN(AC_GIMP_CHECK,
[
- AC_PATH_X
- AC_PATH_XTRA
-
- saved_cflags="$CFLAGS"
- saved_ldflags="$LDFLAGS"
-
- CFLAGS="$X_CFLAGS $CFLAGS"
- LDFLAGS="$X_LDFLAGS $X_LIBS $LDFLAGS"
-
- dnl Checks for libraries.
- AC_CHECK_LIB(X11, XOpenDisplay,
- x_libs="-lX11 $X_EXTRA_LIBS",
- [AC_MSG_ERROR(No X11 installed)],
- $X_EXTRA_LIBS)
-
- LD_FLAGS="$saved_ldflags $X_LDFLAGS $X_LIBS $x_libs"
-
- AC_CHECK_LIB(Xext, XShmAttach,
- x_libs="-lXext $x_libs", ,
- $x_libs)
-
- X_LIBS="$X_LIBS -lgtk -lgdk -lglib $x_libs -lm"
-
- LDFLAGS="$saved_ldflags $X_LDFLAGS $X_LIBS"
-
- dnl Dont cache this as it depends on CFLAGS, LDFLAGS, etc
- AC_MSG_CHECKING([for gtk >= 0.99.5])
- AC_TRY_LINK(
-[#include <gtk/gtk.h>],
-[gtk_preview_reset();],
-gtk_found=yes,
-gtk_found=no)
- AC_MSG_RESULT($gtk_found)
-
- if test $gtk_found = no; then
- AC_MSG_ERROR(Cannot include/link gtk/gdk/glib--check CFLAGS/LDFLAGS)
- fi
-
- dnl CFLAGS="$saved_cflags"
- dnl LDFLAGS="$saved_ldflags"
+ AM_PATH_GTK(0.99.5,,
+ AC_MSG_ERROR(Cannot include/link gtk/gdk/glib--check CFLAGS/LDFLAGS))
+ X_LIBS=$GTK_LIBS
+ X_CFLAGS=$GTK_CFLAGS
+ AC_SUBST(X_LIBS)
+ AC_SUBST(X_CFLAGS)
])
if test -n "$DEBUGFLAG"; then
@@ -96,6 +62,12 @@
AC_PROG_MAKE_SET
AC_GIMP_CHECK
+gimp_save_CFLAGS="$CFLAGS"
+gimp_save_LIBS="$LIBS"
+
+CFLAGS="$GTK_CFLAGS $CFLAGS"
+LIBS="$LIBS $GTK_LIBS"
+
if eval "test x$GCC = xyes"; then
if echo "$CFLAGS" | grep "\-Wall" > /dev/null 2> /dev/null; then
CFLAGS="$CFLAGS"
@@ -235,6 +207,9 @@
dnl TVM: check for compiler characteristics
AC_C_INLINE
+
+CFLAGS="$gimp_save_CFLAGS"
+LIBS="$gimp_save_LIBS"
gimpdatadir=$datadir/gimp
gimpplugindir=$libdir/$PACKAGE/$GIMP_MAJOR_VERSION_NUMBER.$GIMP_MINOR_VERSION_NUMBER
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]