From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: pkg-config support Date: Mon, 28 Apr 2008 23:33:34 +0200 Message-ID: <87lk2xd5qp.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1209418456 14427 80.91.229.12 (28 Apr 2008 21:34:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Apr 2008 21:34:16 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Apr 28 23:34:52 2008 connect(): Connection refused Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jqazc-0003JN-63 for guile-devel@m.gmane.org; Mon, 28 Apr 2008 23:34:36 +0200 Original-Received: from localhost ([127.0.0.1]:47272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jqayv-0007tD-TS for guile-devel@m.gmane.org; Mon, 28 Apr 2008 17:33:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jqayq-0007sY-NZ for guile-devel@gnu.org; Mon, 28 Apr 2008 17:33:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jqayp-0007sL-Vq for guile-devel@gnu.org; Mon, 28 Apr 2008 17:33:48 -0400 Original-Received: from [199.232.76.173] (port=53384 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jqayp-0007sI-Rs for guile-devel@gnu.org; Mon, 28 Apr 2008 17:33:47 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jqayo-0003bM-R8 for guile-devel@gnu.org; Mon, 28 Apr 2008 17:33:47 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Jqaym-00008d-7U for guile-devel@gnu.org; Mon, 28 Apr 2008 21:33:44 +0000 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Apr 2008 21:33:44 +0000 Original-Received: from ludo by reverse-83.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Apr 2008 21:33:44 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 196 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: reverse-83.fdn.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 10 =?iso-8859-1?Q?Flor=E9al?= an 216 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: i686-pc-linux-gnu User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:XCFcwU16FzDwmYatSr6dDW2Huag= X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:7195 Archived-At: --=-=-= 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 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename*=us-ascii''%2c%2cpkg-config.diff Content-Description: The patch 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@ --=-=-=--