#!/usr/bin/guile \
-e "(scripts guile-config-data)" -s
!#
;;; guile-config-data --- Display Guile's build-time config.status vars

;; 	Copyright (C) 2002,2003,2004 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this software; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;
;; As a special exception, the Free Software Foundation gives permission
;; for additional uses of the text contained in its release of GUILE.
;;
;; The exception is that, if you link the GUILE library with other files
;; to produce an executable, this does not by itself cause the
;; resulting executable to be covered by the GNU General Public License.
;; Your use of that executable is in no way restricted on account of
;; linking the GUILE library code into it.
;;
;; This exception does not however invalidate any other reasons why
;; the executable file might be covered by the GNU General Public License.
;;
;; This exception applies only to the code released by the
;; Free Software Foundation under the name GUILE.  If you copy
;; code from other Free Software Foundation releases into a copy of
;; GUILE, as the General Public License permits, the exception does
;; not apply to the code that you add in this way.  To avoid misleading
;; anyone as to the status of such modified files, you must delete
;; this exception notice from them.
;;
;; If you write modifications of your own for GUILE, it is your choice
;; whether to permit this exception to apply to your modifications.
;; If you do not wish that, delete this exception notice.

;;; Author: Thien-Thi Nguyen <ttn@gnu.org>

;;; Commentary:

;; Usage: guile-config-data [VAR ...]
;;
;; Display recorded config.status vars as VAR="VALUE",
;; or just VAL (one per line) if VAR ... is given.
;; The special var `scmconfig' is derived from libguile/scmconfig.h
;; (uninstalled header) symbols that have been #define'd.
;;
;;
;; Usage from a Scheme program:
;;   (use-modules (scripts guile-config-data))
;;
;; Then look at `guile-config-data', an alist.  Note that the value for key
;; `scmconfig' is a list of symbols, in contrast to its representation when
;; guile-config-data is invoked from the shell.
;;
;; See also var `%guile-build-info'.

;;; Code:

(define-module (scripts guile-config-data)
  #:autoload (scripts PROGRAM) (HVQC-MAIN)
  #:export (guile-config-data))

(define scmconfig
  (quote (
  ;; scmconfig.h scan data
  DEBUG_EXTENSIONS
  DYNAMIC_LINKING
  GETGROUPS_T
  GUILE_ISELECT
  GUILE_PTHREAD_COMPAT
  HAVE_ALLOCA
  HAVE_ALLOCA_H
  HAVE_ARRAYS
  HAVE_ATEXIT
  HAVE_BZERO
  HAVE_CONNECT
  HAVE_CTERMID
  HAVE_DIRENT_H
  HAVE_DLFCN_H
  HAVE_ENDHOSTENT
  HAVE_ENDNETENT
  HAVE_ENDPROTOENT
  HAVE_ENDSERVENT
  HAVE_FCHOWN
  HAVE_FTIME
  HAVE_GETCWD
  HAVE_GETEUID
  HAVE_GETGROUPS
  HAVE_GETHOSTBYNAME
  HAVE_GETHOSTENT
  HAVE_GETNETBYADDR
  HAVE_GETNETBYNAME
  HAVE_GETNETENT
  HAVE_GETPROTOENT
  HAVE_GETSERVENT
  HAVE_GETTIMEOFDAY
  HAVE_HSTRERROR
  HAVE_INET_ATON
  HAVE_INET_LNAOF
  HAVE_INET_MAKEADDR
  HAVE_INET_NETOF
  HAVE_INTTYPES_H
  HAVE_LIBM
  HAVE_LIBPTHREAD
  HAVE_LIMITS_H
  HAVE_LONG_LONGS
  HAVE_LSTAT
  HAVE_MALLOC_H
  HAVE_MEMMOVE
  HAVE_MEMORY_H
  HAVE_MKDIR
  HAVE_MKNOD
  HAVE_NETWORKING
  HAVE_NICE
  HAVE_ON_EXIT
  HAVE_PAUSE
  HAVE_POSIX
  HAVE_PUTENV
  HAVE_READLINK
  HAVE_REGCOMP
  HAVE_REGEX_H
  HAVE_RENAME
  HAVE_RESTARTABLE_SYSCALLS
  HAVE_RMDIR
  HAVE_RXPOSIX_H
  HAVE_SELECT
  HAVE_SETEGID
  HAVE_SETEUID
  HAVE_SETHOSTENT
  HAVE_SETLOCALE
  HAVE_SETNETENT
  HAVE_SETPGID
  HAVE_SETPROTOENT
  HAVE_SETPWENT
  HAVE_SETSERVENT
  HAVE_SETSID
  HAVE_SIGACTION
  HAVE_SIGINTERRUPT
  HAVE_SOCKETPAIR
  HAVE_STDINT_H
  HAVE_STDLIB_H
  HAVE_STRDUP
  HAVE_STRERROR
  HAVE_STRFTIME
  HAVE_STRINGS_H
  HAVE_STRING_H
  HAVE_STRPTIME
  HAVE_STRUCT_LINGER
  HAVE_STRUCT_STAT_ST_BLKSIZE
  HAVE_STRUCT_STAT_ST_BLOCKS
  HAVE_STRUCT_STAT_ST_RDEV
  HAVE_STRUCT_TIMESPEC
  HAVE_STRUCT_TM_TM_ZONE
  HAVE_ST_BLOCKS
  HAVE_SYMLINK
  HAVE_SYNC
  HAVE_SYSTEM
  HAVE_SYS_IOCTL_H
  HAVE_SYS_SELECT_H
  HAVE_SYS_STAT_H
  HAVE_SYS_TIMEB_H
  HAVE_SYS_TIMES_H
  HAVE_SYS_TIME_H
  HAVE_SYS_TYPES_H
  HAVE_SYS_WAIT_H
  HAVE_S_ISLNK
  HAVE_TCGETPGRP
  HAVE_TCSETPGRP
  HAVE_TIMES
  HAVE_TIME_H
  HAVE_TM_ZONE
  HAVE_TZSET
  HAVE_UNAME
  HAVE_UNISTD_H
  HAVE_UNIX_DOMAIN_SOCKETS
  HAVE_USLEEP
  HAVE_UTIME_H
  HAVE_WAITPID
  MISSING_STRPTIME_DECL
  READER_EXTENSIONS
  RETSIGTYPE
  SIZEOF_DOUBLE
  SIZEOF_FLOAT
  SIZEOF_INT
  SIZEOF_LONG
  STDC_HEADERS
  TIME_WITH_SYS_TIME
  USE_COOP_THREADS
  USE_THREADS
  )))

(define guile-config-data
  (acons 'scmconfig scmconfig
  (quote (
  ;; config.status scan data
  (SHELL . "/bin/sh")
  (PATH_SEPARATOR . ":")
  (exec_prefix . "/usr")
  (prefix . "/usr")
  (program_transform_name . "s,x,x,")
  (bindir . "/usr/bin")
  (sbindir . "/usr/sbin")
  (libexecdir . "/usr/lib")
  (datadir . "/usr/share")
  (sysconfdir . "/etc")
  (sharedstatedir . "/usr/com")
  (localstatedir . "/var/lib")
  (libdir . "/usr/lib")
  (includedir . "/usr/include")
  (infodir . "/usr/share/info")
  (mandir . "/usr/share/man")
  (build_alias . "i586-alt-linux")
  (host_alias . "i586-alt-linux")
  (target_alias . "")
  (DEFS . "-DHAVE_CONFIG_H")
  (ECHO_C . "")
  (ECHO_N . "-n")
  (ECHO_T . "")
  (LIBS . "-lpthread -lm ")
  (CYGPATH_W . "echo")
  (PACKAGE . "guile")
  (VERSION . "1.4.1.106")
  (STRIP . "strip")
  (AWK . "gawk")
  (SET_MAKE . "")
  (CC . "i586-alt-linux-gcc")
  (CFLAGS . "-pipe -Wall -O2 -march=i586 -mcpu=i686 -Wall -Wmissing-prototypes -pipe")
  (LDFLAGS . "")
  (CPPFLAGS . "")
  (EXEEXT . "")
  (OBJEXT . "o")
  (DEPDIR . ".deps")
  (CCDEPMODE . "depmode=none")
  (subdirs . " libltdl qt guile-readline")
  (CPP . "i586-alt-linux-gcc -E")
  (have_vcg . "no")
  (vcg_can_write_stdout . "false")
  (EGREP . "grep -E")
  (build . "i586-alt-linux-gnu")
  (build_cpu . "i586")
  (build_vendor . "alt")
  (build_os . "linux-gnu")
  (host . "i586-alt-linux-gnu")
  (host_cpu . "i586")
  (host_vendor . "alt")
  (host_os . "linux-gnu")
  (LN_S . "ln -s")
  (ECHO . "echo")
  (AR . "ar")
  (RANLIB . "ranlib")
  (CXX . "i586-alt-linux-g++")
  (CXXFLAGS . "-pipe -Wall -O2 -march=i586 -mcpu=i686")
  (CXXDEPMODE . "depmode=none")
  (CXXCPP . "i586-alt-linux-g++ -E")
  (F77 . "")
  (FFLAGS . "-pipe -Wall -O2 -march=i586 -mcpu=i686")
  (ALLOCA . "")
  (scheme_site_dir . "/usr/share/guile/site")
  (INCLTDL . "")
  (LIBLTDL . "-lltdl")
  (DLPREOPEN . "-dlpreopen force")
  (OPTDIR_qt_TRUE . "")
  (OPTDIR_qt_FALSE . "#")
  (OPTDIR_readline_TRUE . "")
  (OPTDIR_readline_FALSE . "#")
  (htmldir . "")
  (HTMLDOC_TRUE . "#")
  (HTMLDOC_FALSE . "")
  (GUILE_MAJOR_VERSION . "1")
  (GUILE_MINOR_VERSION . "4.1")
  (GUILE_VERSION . "1.4.1.106")
  (LIBGUILE_INTERFACE_CURRENT . "11")
  (LIBGUILE_INTERFACE_REVISION . "0")
  (LIBGUILE_INTERFACE_AGE . "2")
  (LIBGUILE_INTERFACE . "11:0:2")
  (GUILE_LIBS . " -lpthread -lm ")
  ))))

(define (maybe-list->stubby-string val)
  (if (list? val)
      (let ((s (simple-format #f "~A" val)))
        (substring s 1 (1- (string-length s))))
      val))

(define (guile-config-data-main . args)
  (if (null? args)
      (for-each (lambda (pair)
                  (simple-format #t "~A=~S\n" (car pair)
                                 (maybe-list->stubby-string (cdr pair))))
                guile-config-data)
      (for-each (lambda (var)
                  (simple-format #t "~A\n"
                                 (or (maybe-list->stubby-string
                                      (assq-ref guile-config-data
                                                (string->symbol var)))
                                     "")))
                args))
  #t)

(define (main args)
  (HVQC-MAIN args (lambda (args)
                    (apply guile-config-data-main (cdr args)))
             '(usage . commentary)
             '(package . "Guile")))

;;; guile-config-data ends here
