From 41a3e0fcfb79c3da9aa5e82b0028450464d215e3 Mon Sep 17 00:00:00 2001 From: mainzelm Date: Thu, 16 May 2002 14:51:10 +0000 Subject: [PATCH] First version of scsh-config. --- configure.in | 6 ++-- scsh-config.in | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 scsh-config.in diff --git a/configure.in b/configure.in index 6a61c80..d690f95 100644 --- a/configure.in +++ b/configure.in @@ -405,6 +405,6 @@ fail AC_SUBST(TMPDIR) -AC_OUTPUT(Makefile scsh/endian.scm scsh/static.scm) -chmod +x scsh/static.scm - +AC_OUTPUT([Makefile scsh/endian.scm scsh/static.scm scsh-config], +[chmod +x scsh/static.scm], +[chmod +x scsh-config]) diff --git a/scsh-config.in b/scsh-config.in new file mode 100644 index 0000000..9743734 --- /dev/null +++ b/scsh-config.in @@ -0,0 +1,76 @@ +#!@prefix@/bin/scsh \ +-e main -s +!# +;;; This file is part of scsh. +;;; Copyright (c) 2002 Martin Gasbichler. See file COPYING. + +(define (main prog+args) + (let ((args (cdr prog+args))) + (if (null? args) + (help) + (case (string->symbol (car args)) + ((--help) (help)) + ((--version) (version)) + ((--ccflags) (ccflags)) + ((--libs) (libs)) + (else (help)))))) + +(define (help) + (let* ((display-newline-indent + (lambda (s) (display " ") (display-newline s)))) + (display-newline "Usage: scsh-config [options]") + (display-newline "Options:") + (display-newline-indent "--help") + (display-newline-indent "--version") + (display-newline-indent "--ccflags") + (display-newline-indent "--libs"))) + +(define (version) + (display-newline scsh-version-string)) + +(define (libs) + (display-w/space "-L") + (display-w/space (libdir)) + (display-w/space "@LIBS@ ") + (display-w/space "-lscsh") + (newline)) + +(define (ccflags) + (display-w/space "-I") + (display-w/space (incdir)) + (display-w/space (defs)) + (display-w/space (cflags)) + (newline)) + +(define (libdir) + (subst-exec-prefix "@libdir@")) + +(define (incdir) + (subst-exec-prefix "@includedir@")) + +(define (defs) + "@DEFS@") + +(define (cflags) + "@CFLAGS@") + +(define (subst-exec-prefix string) + (let ((match (regexp-search (rx "${exec_prefix}") string))) + (subst-prefix + (if match + (regexp-substitute #f match 'pre "@exec_prefix@" 'post) + string)))) + +(define (subst-prefix string) + (let ((match (regexp-search (rx "${prefix}") string))) + (if match + (regexp-substitute #f match 'pre "@prefix@" 'post) + string))) + +(define (display-w/space string) + (display #\space) + (display string)) + +(define (display-newline string) + (display string) + (newline)) \ No newline at end of file