unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* pkg-config support
@ 2008-04-28 21:33 Ludovic Courtès
  2008-04-29  9:44 ` Thien-Thi Nguyen
  2008-05-01  8:59 ` Neil Jerram
  0 siblings, 2 replies; 10+ messages in thread
From: Ludovic Courtès @ 2008-04-28 21:33 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

Hi,

Pkg-config support has been requested several times [0, 1], and I think
time has come to add it.  :-)  Marius once postponed it considering it
undesirable to maintain two configuration mechanisms [2], but I think
the maintenance overhead is really negligible.

Several patches [3, 4] have been posted and this one is vaguely based on
the one by Aaron VanDevender [4].  The rationale for doing it in
Automake rather than through `AC_CONFIG_FILES' is that `$pkgdatadir' is
not available in the latter.  I'm not sure whether that should be
`guile.pc' or `guile-1.8.pc'.  We can probably go for `guile.pc' and
change the name in future versions if need be.

The patch also reinstates `autoconf.texi', which was not included by
`guile.texi', and adds a few lines of (obvious) documentation.

OK to apply?

Thanks,
Ludovic.

[0] http://article.gmane.org/gmane.lisp.guile.user/6190
[1] http://thread.gmane.org/gmane.lisp.guile.devel/5212/focus=5213
[2] http://thread.gmane.org/gmane.lisp.guile.devel/1991/focus=2376

[3] http://thread.gmane.org/gmane.lisp.guile.devel/1991
[4] http://thread.gmane.org/gmane.lisp.guile.user/5337/focus=5339


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: The patch --]
[-- Type: text/x-patch, Size: 4666 bytes --]

diff --git a/.gitignore b/.gitignore
index fde5392..f1d8bbc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,3 +69,4 @@ guile-config/guile-config
 guile-readline/guile-readline-config.h
 guile-readline/guile-readline-config.h.in
 TAGS
+guile.pc
diff --git a/Makefile.am b/Makefile.am
index 7b4d0c3..3b3771d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,7 +31,7 @@ bin_SCRIPTS = guile-tools
 
 include_HEADERS = libguile.h
 
-EXTRA_DIST = LICENSE HACKING GUILE-VERSION FAQ
+EXTRA_DIST = LICENSE HACKING GUILE-VERSION FAQ guile.pc.in
 
 TESTS = check-guile
 
@@ -39,4 +39,21 @@ ACLOCAL_AMFLAGS = -I guile-config
 
 DISTCLEANFILES = check-guile.log
 
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = guile.pc
+
+# Note: `sitedir' must be kept in sync with `GUILE_SITE_DIR' in `guile.m4'.
+guile.pc: guile.pc.in
+	$(SED) -e 's,@prefix\@,$(prefix),g'				\
+	       -e 's,@exec_prefix\@,$(exec_prefix),g'			\
+	       -e 's,@libdir\@,$(libdir),g'				\
+	       -e 's,@datadir\@,$(datadir),g'				\
+	       -e 's,@sitedir\@,$(pkgdatadir)/site,g'			\
+	       -e 's,@libguileinterface\@,$(LIBGUILE_INTERFACE),g'	\
+	       -e 's,@GUILE_CFLAGS\@,$(GUILE_CFLAGS),g'			\
+	       -e 's,@GUILE_LIBS\@,$(GUILE_LIBS),g'			\
+	       -e 's,@GUILE_VERSION\@,$(GUILE_VERSION),g' $< > $@
+
+CLEANFILES = guile.pc
+
 # Makefile.am ends here
diff --git a/configure.in b/configure.in
index 390c33b..f7f6564 100644
--- a/configure.in
+++ b/configure.in
@@ -69,6 +69,7 @@ AC_LIBTOOL_WIN32_DLL
 AC_PROG_INSTALL
 AC_PROG_CC
 AC_PROG_CPP
+AC_PROG_SED
 AC_PROG_AWK
 
 AC_AIX
diff --git a/doc/ref/autoconf.texi b/doc/ref/autoconf.texi
index 828155c..8622fde 100644
--- a/doc/ref/autoconf.texi
+++ b/doc/ref/autoconf.texi
@@ -8,10 +8,10 @@
 @node Autoconf Support
 @chapter Autoconf Support
 
-When Guile is installed, a set of autoconf macros is also installed as
-PREFIX/share/aclocal/guile.m4.  This chapter documents the macros provided in
-that file, as well as the high-level guile-tool Autofrisk.  @xref{Top,The GNU
-Autoconf Manual,,autoconf}, for more info.
+When Guile is installed, a pkg-config description file and a set of
+Autoconf macros is installed.  This chapter documents pkg-config and
+Autoconf support, as well as the high-level guile-tool Autofrisk.
+@xref{Top,The GNU Autoconf Manual,,autoconf}, for more info.
 
 @menu
 * Autoconf Background::         Why use autoconf?
@@ -45,7 +45,38 @@ checks.
 @node Autoconf Macros
 @section Autoconf Macros
 
-The macro names all begin with "GUILE_".
+@cindex pkg-config
+@cindex autoconf
+
+GNU Guile provides a @dfn{pkg-config} description file, installed as
+@file{@var{prefix}/lib/pkgconfig/guile.pc}, which contains all the
+information necessary to compile and link C applications that use Guile.
+The @code{pkg-config} program is able to read this file and provide this
+information to application programmers; it can be obtained at
+@url{http://pkg-config.freedesktop.org/}.
+
+The following command lines give respectively the C compilation and link
+flags needed to build Guile-using programs:
+
+@example
+pkg-config guile --cflags
+pkg-config guile --libs
+@end example
+
+To ease use of pkg-config with Autoconf, pkg-config comes with a
+convenient Autoconf macro.  The following example looks for Guile and
+sets the @code{GUILE_CFLAGS} and @code{GUILE_LIBS} variables
+accordingly, or prints an error and exits if Guile was not found:
+
+@findex PKG_CHECK_MODULES
+
+@example
+PKG_CHECK_MODULES([GUILE], [guile])
+@end example
+
+Guile comes with additional Autoconf macros providing more information,
+installed as @file{@var{prefix}/share/aclocal/guile.m4}.  Their names
+all begin with @code{GUILE_}.
 
 @c see Makefile.am
 @include autoconf-macros.texi
diff --git a/doc/ref/guile.texi b/doc/ref/guile.texi
index 9e742f4..7c17b36 100644
--- a/doc/ref/guile.texi
+++ b/doc/ref/guile.texi
@@ -176,6 +176,8 @@ x
 
 * Guile Modules::
 
+* Autoconf Support::
+
 Appendices
 
 * Data Representation::             All the details.
@@ -361,6 +363,8 @@ available through both Scheme and C interfaces.
 @include scsh.texi
 @include scheme-debugging.texi
 
+@include autoconf.texi
+
 @include data-rep.texi
 @include fdl.texi
 
diff --git a/guile.pc.in b/guile.pc.in
new file mode 100644
index 0000000..cefde96
--- /dev/null
+++ b/guile.pc.in
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+datadir=@datadir@
+
+sitedir=@sitedir@
+libguileinterface=@libguileinterface@
+
+Name: GNU Guile
+Description: GNU's Ubiquitous Intelligent Language for Extension
+Version: @GUILE_VERSION@
+Libs: -L${libdir} -lguile @GUILE_LIBS@
+Cflags: -I${includedir} @GUILE_CFLAGS@

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-05-25 18:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-28 21:33 pkg-config support Ludovic Courtès
2008-04-29  9:44 ` Thien-Thi Nguyen
2008-04-30 11:49   ` Ludovic Courtès
2008-04-30 13:24     ` Thien-Thi Nguyen
2008-05-04 20:06       ` Ludovic Courtès
2008-05-25 18:17         ` Thien-Thi Nguyen
2008-05-01 16:21     ` Andy Wingo
2008-05-05  7:28       ` Ludovic Courtès
2008-05-01  8:59 ` Neil Jerram
2008-05-04 20:36   ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).