require pkg-config and use it to determine cflags and libs.

2007-05-25  Sven Neumann  <sven@gimp.org>

	* gimptool-2.0.in: require pkg-config and use it to determine
	cflags and libs.

	* docs/gimptool.1.in: document that pkg-config is used and
	recommend to use pkg-config directly.

svn path=/trunk/; revision=22612
This commit is contained in:
Sven Neumann 2007-05-25 10:45:53 +00:00 committed by Sven Neumann
parent 0eb4df784b
commit 07240ed1f9
3 changed files with 33 additions and 44 deletions

View file

@ -1,3 +1,11 @@
2007-05-25 Sven Neumann <sven@gimp.org>
* gimptool-2.0.in: require pkg-config and use it to determine
cflags and libs.
* docs/gimptool.1.in: document that pkg-config is used and
recommend to use pkg-config directly.
2007-05-25 Sven Neumann <sven@gimp.org>
* gimptool-2.0.in: synced --libs output with the pkg-config files.

View file

@ -33,8 +33,9 @@ plug-ins or scripts and install them if they are distributed in one
source file.
.PP
\fIgimptool\-2.0\fP can also be used by programs that need to know what
libraries and include-paths \fIGIMP\fP was compiled with. This is
especially useful in Makefiles.
libraries and include-paths \fIGIMP\fP was compiled with. \fIgimptool\-2.0\fP
uses \fIpkg-config\fP for this task. For use in Makefiles, it is recommended
that you use \fIpkg-config\fP directly instead of calling \fIgimptool\-2.0\fP.
.SH OPTIONS
@ -169,14 +170,14 @@ Print the linker flags that are necessary to link a \fIGIMP\fP plug-in.
.TP 8
.B \-\-libs-noui
Print the linker flags that are necessary to link a \fIGIMP\fP plug-in, for
plug-ins that do not require the GTK libs.
plug-ins that do not require the GTK+ libraries.
.TP 8
.B \-\-cflags
Print the compiler flags that are necessary to compile a \fIGIMP\fP plug-in.
.TP 8
.B \-\-clags-noui
Print the compiler flags that are necessary to compile a \fIGIMP\fP plug-in
for plug-ins that do not require the GTK libs.
for plug-ins that do not require the GTK+ libraries.
.TP 8
.B \-\-prefix=PREFIX
If specified, use PREFIX instead of the installation prefix that \fIGIMP\fP
@ -212,8 +213,8 @@ for passing extra libs that may be needed in the build process. For example,
LIBS=-lintl .
.TP 8
.B PKG_CONFIG
to get the location of the pkg-config program used to determine details
about your glib, pango and gtk+ installation.
to get the location of the \fIpkg-config\fP program that is used to determine
details about your glib, pango, gtk+ and gimp installation.
.SH SEE ALSO

View file

@ -96,17 +96,11 @@ if test x${PKG_CONFIG+set} != xset ; then
PKG_CONFIG=pkg-config
fi
if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
gtk_cflags=`$PKG_CONFIG --cflags gtk+-2.0`
gtk_libs=`$PKG_CONFIG --libs gtk+-2.0`
glib_cflags=`$PKG_CONFIG --cflags glib-2.0`
glib_libs=`$PKG_CONFIG --libs glib-2.0`
if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then
:
else
echo "*** pkg-config not found or too old; using paths from gimp compilation." 1>&2
gtk_cflags='@GTK_CFLAGS@'
gtk_libs='@GTK_LIBS@'
glib_cflags='@GLIB_CFLAGS@'
glib_libs='@GLIB_LIBS@'
echo "*** pkg-config is required but wasn't found or is too old ***" 1>&2
exit 1
fi
if test x${INSTALL+set} != xset ; then
@ -184,37 +178,23 @@ while test $# -gt 0; do
echo $dirname
exit 0
;;
--cflags | --cflags-noui | --cflags-nogimpui)
case $1 in
--cflags | --cflags-nogimpui)
my_gtk_cflags=$gtk_cflags ;;
--cflags-noui)
my_gtk_cflags=$glib_cflags ;;
esac
includes=-I@includedir@/gimp-@GIMP_API_VERSION@
echo $includes $my_gtk_cflags
--cflags)
$PKG_CONFIG --cflags gimpui-2.0
;;
--libs | --libs-nogimpui)
my_gtk_libs=
libdirs=-L@libdir@
for i in $gtk_libs ; do
if test $i != -L@libdir@ ; then
if test -z "$my_gtk_libs" ; then
my_gtk_libs="$i"
else
my_gtk_libs="$my_gtk_libs $i"
fi
fi
done
case $1 in
--libs)
echo $libdirs -lgimpui-@GIMP_API_VERSION@ -lgimpwidgets-@GIMP_API_VERSION@ -lgimpmodule-@GIMP_API_VERSION@ -lgimp-@GIMP_API_VERSION@ -lgimpmath-@GIMP_API_VERSION@ -lgimpconfig-@GIMP_API_VERSION@ -lgimpcolor-@GIMP_API_VERSION@ -lgimpbase-@GIMP_API_VERSION@ $my_gtk_libs $rt_libs ;;
--libs-nogimpui)
echo $libdirs -lgimp-@GIMP_API_VERSION@ -lgimpmath-@GIMP_API_VERSION@ -lgimpconfig-@GIMP_API_VERSION@ -lgimpcolor-@GIMP_API_VERSION@ -lgimpbase-@GIMP_API_VERSION@ $my_gtk_libs $rt_libs ;;
esac
--cflags-noui)
$PKG_CONFIG --cflags gimp-2.0
;;
--cflags-nogimpui)
$PKG_CONFIG --cflags gimp-2.0 gtk+-2.0
;;
--libs)
$PKG_CONFIG --libs gimpui-2.0
;;
--libs-noui)
echo -L@libdir@ -lgimp-@GIMP_API_VERSION@ -lgimpcolor-@GIMP_API_VERSION@ -lgimpmath-@GIMP_API_VERSION@ -lgimpbase-@GIMP_API_VERSION@ $glib_libs $rt_libs
$PKG_CONFIG --libs gimp-2.0
;;
--libs-nogimpui)
$PKG_CONFIG --libs gimp-2.0 gtk+-2.0
;;
--install-bin | --install-admin-bin \
| --install-bin-strip | --install-admin-bin-strip \