Skip to content

Commit 3e4b45c

Browse files
committed
Use recorded top_srcdir to find gauche.h in in-place test
1 parent 0b1795c commit 3e4b45c

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

lib/gauche/cgen/dyncomp.scm

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,22 @@
4343
;; and dynamically load on-the-fly.
4444

4545
;; Extra cppflags needed when running in a build tree (not installed).
46-
;; The headers are next to libgauche, so we derive the include path from it.
4746
(define dyncomp-extra-cppflags
4847
(cond-expand
4948
[gauche.in-place
50-
(let1 in-place-path
51-
(sys-dirname ((with-module gauche.internal %gauche-libgauche-path)))
52-
#"-I~|in-place-path|")]
49+
(let1 top-srcdir-file
50+
(sys-normalize-pathname
51+
(build-path (sys-dirname (current-load-path)) ".." ".." ".."
52+
"top_srcdir")
53+
:canonicalize #t)
54+
(unless (file-exists? top-srcdir-file)
55+
[error "Can't find top_srcdir file at:" top-srcdir-file])
56+
(let1 top-src-path
57+
(regexp-replace #/\s*$/ (file->string top-srcdir-file) "")
58+
(unless (file-exists? (build-path top-src-path "src" "gauche.h"))
59+
(error "Can't get path of gauche.h for in-place execution at:"
60+
top-src-path))
61+
#"-I~(build-path top-src-path \"src\")"))]
5362
[else #f]))
5463

5564
;; Entry point

0 commit comments

Comments
 (0)