From b1446447fc2ea7edfb6e7415b0509d63a71233ba Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sat, 4 Apr 1998 00:12:58 +0000 Subject: [PATCH] Added flags --prefix[=dir] and --exec-prefix[=DIR] which allow querying Fri Apr 3 18:33:47 1998 Owen Taylor * gtk-config.in: Added flags --prefix[=dir] and --exec-prefix[=DIR] which allow querying and overriding the configured-in prefix and exec-prefix. * gtk.m4: Added configure flags --with-gtk-prefix= and --with-gtk-exec-prefix= to set the --prefix and --exec-prefix argumetns to gtk.m4 --- ChangeLog | 13 +++++++-- ChangeLog.pre-2-0 | 13 +++++++-- ChangeLog.pre-2-10 | 13 +++++++-- ChangeLog.pre-2-2 | 13 +++++++-- ChangeLog.pre-2-4 | 13 +++++++-- ChangeLog.pre-2-6 | 13 +++++++-- ChangeLog.pre-2-8 | 13 +++++++-- docs/gtk-config.txt | 49 ++++++++++++++++++++++++++++----- gtk-config.in | 67 +++++++++++++++++++++++++++++++-------------- gtk.m4 | 22 +++++++++++++-- 10 files changed, 179 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68d2a5052c..600909472b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,15 @@ +Fri Apr 3 18:33:47 1998 Owen Taylor + + * gtk-config.in: Added flags --prefix[=dir] and + --exec-prefix[=DIR] which allow querying and overriding the + configured-in prefix and exec-prefix. + + * gtk.m4: Added configure flags --with-gtk-prefix= + and --with-gtk-exec-prefix= to set the --prefix and + --exec-prefix argumetns to gtk.m4 + Fri Apr 3 17:14:55 1998 Owen Taylor - * glib/testglib.c: Removed literal german from strings - to appease SGI compiler. - * gdk/gdk.c: More extensive debugging output * gtk/gtkalignment.c gtk/gtkbutton.c gtk/gtkcheckbutton.c diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 68d2a5052c..600909472b 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,8 +1,15 @@ +Fri Apr 3 18:33:47 1998 Owen Taylor + + * gtk-config.in: Added flags --prefix[=dir] and + --exec-prefix[=DIR] which allow querying and overriding the + configured-in prefix and exec-prefix. + + * gtk.m4: Added configure flags --with-gtk-prefix= + and --with-gtk-exec-prefix= to set the --prefix and + --exec-prefix argumetns to gtk.m4 + Fri Apr 3 17:14:55 1998 Owen Taylor - * glib/testglib.c: Removed literal german from strings - to appease SGI compiler. - * gdk/gdk.c: More extensive debugging output * gtk/gtkalignment.c gtk/gtkbutton.c gtk/gtkcheckbutton.c diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 68d2a5052c..600909472b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,8 +1,15 @@ +Fri Apr 3 18:33:47 1998 Owen Taylor + + * gtk-config.in: Added flags --prefix[=dir] and + --exec-prefix[=DIR] which allow querying and overriding the + configured-in prefix and exec-prefix. + + * gtk.m4: Added configure flags --with-gtk-prefix= + and --with-gtk-exec-prefix= to set the --prefix and + --exec-prefix argumetns to gtk.m4 + Fri Apr 3 17:14:55 1998 Owen Taylor - * glib/testglib.c: Removed literal german from strings - to appease SGI compiler. - * gdk/gdk.c: More extensive debugging output * gtk/gtkalignment.c gtk/gtkbutton.c gtk/gtkcheckbutton.c diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 68d2a5052c..600909472b 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,8 +1,15 @@ +Fri Apr 3 18:33:47 1998 Owen Taylor + + * gtk-config.in: Added flags --prefix[=dir] and + --exec-prefix[=DIR] which allow querying and overriding the + configured-in prefix and exec-prefix. + + * gtk.m4: Added configure flags --with-gtk-prefix= + and --with-gtk-exec-prefix= to set the --prefix and + --exec-prefix argumetns to gtk.m4 + Fri Apr 3 17:14:55 1998 Owen Taylor - * glib/testglib.c: Removed literal german from strings - to appease SGI compiler. - * gdk/gdk.c: More extensive debugging output * gtk/gtkalignment.c gtk/gtkbutton.c gtk/gtkcheckbutton.c diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 68d2a5052c..600909472b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,8 +1,15 @@ +Fri Apr 3 18:33:47 1998 Owen Taylor + + * gtk-config.in: Added flags --prefix[=dir] and + --exec-prefix[=DIR] which allow querying and overriding the + configured-in prefix and exec-prefix. + + * gtk.m4: Added configure flags --with-gtk-prefix= + and --with-gtk-exec-prefix= to set the --prefix and + --exec-prefix argumetns to gtk.m4 + Fri Apr 3 17:14:55 1998 Owen Taylor - * glib/testglib.c: Removed literal german from strings - to appease SGI compiler. - * gdk/gdk.c: More extensive debugging output * gtk/gtkalignment.c gtk/gtkbutton.c gtk/gtkcheckbutton.c diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 68d2a5052c..600909472b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,8 +1,15 @@ +Fri Apr 3 18:33:47 1998 Owen Taylor + + * gtk-config.in: Added flags --prefix[=dir] and + --exec-prefix[=DIR] which allow querying and overriding the + configured-in prefix and exec-prefix. + + * gtk.m4: Added configure flags --with-gtk-prefix= + and --with-gtk-exec-prefix= to set the --prefix and + --exec-prefix argumetns to gtk.m4 + Fri Apr 3 17:14:55 1998 Owen Taylor - * glib/testglib.c: Removed literal german from strings - to appease SGI compiler. - * gdk/gdk.c: More extensive debugging output * gtk/gtkalignment.c gtk/gtkbutton.c gtk/gtkcheckbutton.c diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 68d2a5052c..600909472b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,8 +1,15 @@ +Fri Apr 3 18:33:47 1998 Owen Taylor + + * gtk-config.in: Added flags --prefix[=dir] and + --exec-prefix[=DIR] which allow querying and overriding the + configured-in prefix and exec-prefix. + + * gtk.m4: Added configure flags --with-gtk-prefix= + and --with-gtk-exec-prefix= to set the --prefix and + --exec-prefix argumetns to gtk.m4 + Fri Apr 3 17:14:55 1998 Owen Taylor - * glib/testglib.c: Removed literal german from strings - to appease SGI compiler. - * gdk/gdk.c: More extensive debugging output * gtk/gtkalignment.c gtk/gtkbutton.c gtk/gtkcheckbutton.c diff --git a/docs/gtk-config.txt b/docs/gtk-config.txt index 4934fbe5d9..68555fabfe 100644 --- a/docs/gtk-config.txt +++ b/docs/gtk-config.txt @@ -16,17 +16,27 @@ $exec_prefix/bin): Invoking gtk-config ------------------- -gtk-config can be invoked in one of three forms: +gtk-config takes the following flags: - gtk-config --version + --version Prints out the version of GTK installed - gtk-config --cflags + --cflags Prints '-I' flags pointing to the installed header files. - gtk-config --libs + --libs Prints out the linker flags necessary to link a program against GTK - + + --prefix[=PREFIX] + If PREFIX is specified, overrides the configured value of $prefix. + (And of exec-prefix, unless --exec-prefix is also specified) + Otherwise, prints out the configured value of $prefix + + --exec-prefix[=PREFIX] + If PREFIX is specified, overrides the configured value of $exec_prefix. + Otherwise, prints out the configured value of $exec_prefix + + Example of using gtk-config --------------------------- @@ -88,6 +98,24 @@ the configure script. Notes: +* The directory where the GTK libraries are installed needs + to be found by your system's dynamic linker. + + This is generally done by + + editing /etc/ld.so.conf and running ldconfig + + Or by: + + setting the environment variable LD_LIBRARY_PATH, + + or, as a last resort, + + Giving a -R or -rpath flag (depending on your linker) when + running configure, for instance: + + LDFLAGS=-R/usr/home/owen/lib ./configure + * You can also specify a gtk-config not in your path by setting the GTK_CONFIG environment variable to the name of the executable @@ -96,9 +124,16 @@ Notes: you will need either need to modify gtk-config script manually to point to the new location or rebuild GTK. - [ As a future enhancement AM_PATH_GTK should support options - to override the default locations found in gtk-config ] +Advanced note: +* configure flags + + --with-gtk-prefix=PREFIX + --with-gtk-exec-prefix=PREFIX + + are provided to override the prefix and exec-prefix that were stored + in the gtk-config shell script by GTK's configure. You are generally + better off configuring GTK with the right path to begin with. Example of a package using AM_PATH_GTK -------------------------------------- diff --git a/gtk-config.in b/gtk-config.in index db0f4d3d7b..eb191f2e07 100644 --- a/gtk-config.in +++ b/gtk-config.in @@ -2,28 +2,55 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ -libdir=@libdir@ +exec_prefix_set=no usage="\ -Usage: gtk-config [--version] [--libs] [--cflags]" +Usage: gtk-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]" -if test $# -ne 1 ; then - echo "${usage}" 1>&2 - exit 1 +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 fi -case $1 in - --version) - echo @GTK_VERSION@ - ;; - --cflags) - echo -I$libdir/glib/include -I@includedir@ @x_cflags@ - ;; - --libs) - echo -L@libdir@ @x_ldflags@ -lgtk -lgdk -lglib @x_libs@ -lm - ;; - *) - echo "${usage}" 1>&2 - exit 1 - ;; -esac +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo $prefix + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo $exec_prefix + ;; + --version) + echo @GTK_VERSION@ + ;; + --cflags) + libdir=@libdir@ + echo -I$libdir/glib/include -I@includedir@ @x_cflags@ + ;; + --libs) + libdir=@libdir@ + echo -L@libdir@ @x_ldflags@ -lgtk -lgdk -lglib @x_libs@ -lm + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done + diff --git a/gtk.m4 b/gtk.m4 index f6f933cc4d..b51cd6feac 100644 --- a/gtk.m4 +++ b/gtk.m4 @@ -8,13 +8,31 @@ AC_DEFUN(AM_PATH_GTK, [dnl dnl Get the cflags and libraries from the gtk-config script dnl +AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], + gtk_config_prefix="$withval", gtk_config_prefix="") +AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], + gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") + + if test x$gtk_config_exec_prefix != x ; then + gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config + fi + fi + if test x$gtk_config_prefix != x ; then + gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_prefix/bin/gtk-config + fi + fi + AC_PATH_PROG(GTK_CONFIG, gtk-config, no) min_gtk_version=ifelse([$1], ,0.99.7,$1) 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` + GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` + GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS"