guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pkg-config support


From: Ludovic Courtès
Subject: pkg-config support
Date: Mon, 28 Apr 2008 23:33:34 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

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

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.
address@hidden,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_".
address@hidden pkg-config
address@hidden autoconf
+
+GNU Guile provides a @dfn{pkg-config} description file, installed as
address@hidden@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
address@hidden://pkg-config.freedesktop.org/}.
+
+The following command lines give respectively the C compilation and link
+flags needed to build Guile-using programs:
+
address@hidden
+pkg-config guile --cflags
+pkg-config guile --libs
address@hidden 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:
+
address@hidden PKG_CHECK_MODULES
+
address@hidden
+PKG_CHECK_MODULES([GUILE], [guile])
address@hidden example
+
+Guile comes with additional Autoconf macros providing more information,
+installed as @address@hidden/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
 
address@hidden 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 @@
address@hidden@
address@hidden@
address@hidden@
address@hidden@
address@hidden@
+
address@hidden@
address@hidden@
+
+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@

reply via email to

[Prev in Thread] Current Thread [Next in Thread]