diff options
author | Owen Taylor <owt1@cornell.edu> | 1998-03-12 23:23:43 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1998-03-12 23:23:43 +0000 |
commit | c8e5c809edc8198d7eae9c15d0a4d4d21cd7479e (patch) | |
tree | 3c6cc4fc663ef242dd1d52a5dd25299ef00f13b6 | |
parent | 9b4919dcb8b87d52383703ddde1416fdebda6276 (diff) | |
download | gdk-pixbuf-c8e5c809edc8198d7eae9c15d0a4d4d21cd7479e.tar.gz |
Added a new mechanism for GTK-dependent programs to find out about the
Thu Mar 12 18:01:03 1998 Owen Taylor <owt1@cornell.edu>
* gtk.m4 gtk-config.in Makefile.am configure.in:
Added a new mechanism for GTK-dependent programs to
find out about the installed GTK. (Does not remove
any current functionality)
* gtk+-xconfig.in: Was no longer used for anything.
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | configure.in | 5 | ||||
-rw-r--r-- | gtk+.xconfig.in | 3 | ||||
-rw-r--r-- | gtk-config.in | 28 | ||||
-rw-r--r-- | gtk.m4 | 61 |
5 files changed, 97 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am index cb59e57a8..c23b18cc6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,11 +3,16 @@ SRC_SUBDIRS = glib gdk gtk SUBDIRS = $(SRC_SUBDIRS) docs +bin_SCRIPTS = gtk-config + EXTRA_DIST = \ gtk+.prj \ makecopyright \ TODO +m4datadir = $(datadir)/aclocal +m4data_DATA = gtk.m4 + .PHONY: files populate checkin release files: diff --git a/configure.in b/configure.in index 504373599..afde5d51b 100644 --- a/configure.in +++ b/configure.in @@ -128,12 +128,12 @@ else AC_DEFINE(XINPUT_NONE) fi - AC_SUBST(x_cflags) AC_SUBST(x_includes) AC_SUBST(x_ldflags) AC_SUBST(x_libs) AC_SUBST(xinput_progs) +AC_SUBST(GTK_VERSION) CFLAGS="$saved_cflags" LDFLAGS="$saved_ldflags" @@ -260,4 +260,5 @@ if test $gtk_ok = no; then AC_DEFINE(NO_FD_SET) fi -AC_OUTPUT(Makefile gtk+.xconfig docs/Makefile gdk/Makefile gtk/Makefile) +AC_OUTPUT([Makefile gtk-config docs/Makefile gdk/Makefile gtk/Makefile], + [chmod +x gtk-config]) diff --git a/gtk+.xconfig.in b/gtk+.xconfig.in deleted file mode 100644 index 8843df6ce..000000000 --- a/gtk+.xconfig.in +++ /dev/null @@ -1,3 +0,0 @@ -X_CFLAGS = @x_cflags@ -X_LDFLAGS = @x_ldflags@ -X_LIBS = @x_libs@ diff --git a/gtk-config.in b/gtk-config.in new file mode 100644 index 000000000..805d65410 --- /dev/null +++ b/gtk-config.in @@ -0,0 +1,28 @@ +#!/bin/sh + +prefix=@prefix@ +exec_prefix=@exec_prefix@ + +usage="\ +Usage: gtk-config [--version] [--libs] [--cflags]" + +if test $# -ne 1 ; then + echo "${usage}" 1>&2 + exit 1 +fi + +case $1 in + --version) + echo @GTK_VERSION@ + ;; + --cflags) + echo -I@includedir@ @x_cflags@ + ;; + --libs) + echo -L@libdir@ @x_ldflags@ -lgtk -lgdk -lglib @x_libs@ -lm + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; +esac
\ No newline at end of file @@ -0,0 +1,61 @@ +# Configure paths for GTK+ +# Owen Taylor 97-11-3 + +dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS +dnl +AC_DEFUN(AM_PATH_GTK, +[dnl +dnl Get the cflags and libraries from the gtk-config script +dnl + AC_CHECK_PROG(GTK_CONFIG, gtk-config, gtk-config, no) + ifelse($1 , ,min_gtk_version=$1,min_gtk_version=0.99.5) + AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) + no_gtk="" + if test "$GTK_CONFIG" != "no" ; then + GTK_CFLAGS=$($GTK_CONFIG --cflags) + GTK_LIBS=$($GTK_CONFIG --libs) + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" +dnl +dnl Now check if the installed GTK is sufficiently new. (Also sanity +dnl checks the results of gtk-config to some extent +dnl + AC_TRY_RUN([ +#include <gtk/gtk.h> +#include <stdio.h> + +int +main () +{ + int major, minor, micro; + + if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + return !((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))); +} +],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + else + no_gtk=yes + fi + if test x$no_gtk == x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + GTK_CFLAGS="" + GTK_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) +]) |