File: config.scm.in

package info (click to toggle)
gauche-c-wrapper 0.6.1-18
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,440 kB
  • sloc: ansic: 17,899; sh: 14,025; asm: 6,456; lisp: 5,485; yacc: 2,109; makefile: 520; exp: 194; cpp: 157; objc: 144; perl: 2
file content (57 lines) | stat: -rw-r--r-- 1,733 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
;; -*- coding: utf-8; mode: scheme -*-

(define-module c-wrapper.config
  (use gauche.process)
  (use file.util)
  (use srfi-13)
  
  (export GCC
          DYLIBEXT
          libname-prefix-list
          ignore-libname-list
          ignore-library-list
          force-load-library-when-compiledlib-exists?
          ld-library-paths
          sys-library-paths
          search-library-with-ldconfig
          ))

(select-module c-wrapper.config)

(define GCC "@CC@")

(define DYLIBEXT "@DYLIBEXT@")

(define libname-prefix-list '("lib"))
(define ignore-libname-list '())
(define ignore-library-list '())
(define force-load-library-when-compiledlib-exists? #f)

(when @CYGWIN_FLAG@
  (set! libname-prefix-list (append libname-prefix-list (list "cyg" "")))
  (set! ignore-libname-list (append ignore-libname-list '("c" "m")))
  (set! ignore-library-list (append ignore-library-list '("libc" "libm")))
  (set! force-load-library-when-compiledlib-exists? #t))

(define sys-library-paths
  (let ((paths (string-split "@SYS_LIBRARY_PATHS@" #[\s])))
    (lambda ()
      paths)))

(define (ld-library-paths)
  (apply append (map (lambda (env)
                       (or (and-let* ((paths (sys-getenv env)))
                             (string-split paths ":"))
                           '()))
                     '(@LD_LIBRARY_PATH_ENVS@))))

(define (search-library-with-ldconfig lib)
  (let ((ldconfig-cmd "@LDCONFIG_CMD@"))
    (and (< 0 (string-length ldconfig-cmd))
         (find (lambda (pathname)
                 (string-prefix? (path-swap-extension lib DYLIBEXT)
                                 (sys-basename pathname)))
               (process-output->string-list ldconfig-cmd)))))
        
(provide "c-wrapper/config")