From 297273e422ac2b382f6e289b9df5cf9c28b39fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 23 Sep 2009 22:45:07 +0200 Subject: [PATCH] Have `guile-config' close over `pkg-config' and $(pkgconfigdir). * meta/Makefile.am (guile-config): New target. (EXTRA_DIST): Add `guile-config.in'. * meta/guile-config.in: New, formerly `guile-config'. Use the right installed `guile', with the right $PKG_CONFIG_PATH. Disable auto-compilation. (%pkg-config-program): New variable. (pkg-config): Use it. --- .gitignore | 1 + meta/Makefile.am | 12 +++++++++++- meta/{guile-config => guile-config.in} | 12 +++++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) rename meta/{guile-config => guile-config.in} (95%) diff --git a/.gitignore b/.gitignore index 8754b488a..ffaebb456 100644 --- a/.gitignore +++ b/.gitignore @@ -113,3 +113,4 @@ INSTALL /GSYMS /GTAGS /meta/guile-tools +/meta/guile-config diff --git a/meta/Makefile.am b/meta/Makefile.am index 34e7f2cf3..8933287e4 100644 --- a/meta/Makefile.am +++ b/meta/Makefile.am @@ -24,7 +24,7 @@ bin_SCRIPTS = guile-config guile-tools EXTRA_DIST= $(bin_SCRIPTS) \ guile.m4 ChangeLog-2008 \ guile-2.0.pc.in guile-2.0-uninstalled.pc.in \ - guile-tools.in + guile-tools.in guile-config.in pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = guile-2.0.pc @@ -33,3 +33,13 @@ pkgconfig_DATA = guile-2.0.pc ## doing this. When that happens, switch over. aclocaldir = $(datadir)/aclocal aclocal_DATA = guile.m4 + +guile-config: guile-config.in + guile="@bindir@/`echo guile | $(SED) -e '$(program_transform_name)'`" ; \ + cat guile-config.in \ + | $(SED) -e "s,@pkgconfigdir@,$(pkgconfigdir),g ; \ + s,@""PKG_CONFIG@,$(PKG_CONFIG),g ; \ + s,@installed_guile@,$$guile,g" \ + > guile-config.out + mv guile-config.out guile-config + chmod +x guile-config diff --git a/meta/guile-config b/meta/guile-config.in similarity index 95% rename from meta/guile-config rename to meta/guile-config.in index 6c640c40c..0226f685e 100755 --- a/meta/guile-config +++ b/meta/guile-config.in @@ -1,5 +1,9 @@ #!/bin/sh -exec guile -e main -s $0 "$@" +PKG_CONFIG_PATH="@pkgconfigdir@:$PKG_CONFIG_PATH" +GUILE_AUTO_COMPILE=0 +export PKG_CONFIG_PATH GUILE_AUTO_COMPILE + +exec "@installed_guile@" -e main -s $0 "$@" !# ;;;; guile-config --- utility for linking programs with Guile ;;;; Jim Blandy --- September 1997 @@ -27,6 +31,8 @@ exec guile -e main -s $0 "$@" (ice-9 rdelim)) +(define %pkg-config-program "@PKG_CONFIG@") + ;;;; main function, command-line processing ;;; The script's entry point. @@ -74,7 +80,7 @@ exec guile -e main -s $0 "$@" (define guile-module "guile-2.0") (define (pkg-config . args) - (let* ((real-args (cons "pkg-config" args)) + (let* ((real-args (cons %pkg-config-program args)) (pipe (apply open-pipe* OPEN_READ real-args)) (output (read-delimited "" pipe)) (ret (close-pipe pipe))) @@ -82,7 +88,7 @@ exec guile -e main -s $0 "$@" ((0) (if (eof-object? output) "" output)) (else (display-line-error (format #f "error: ~s exited with non-zero error code ~A" - (cons "pkg-config" args) (status:exit-val ret))) + (cons %pkg-config-program args) (status:exit-val ret))) ;; assume pkg-config sent diagnostics to stdout (exit (status:exit-val ret))))))