~ chicken-core (chicken-5) 8c3681ca0ee605430b5254348f6fd1700b3f77d4


commit 8c3681ca0ee605430b5254348f6fd1700b3f77d4
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sat May 1 23:37:58 2010 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Sat May 1 23:37:58 2010 +0200

    use TARGET_DESTDIR only if not in host mode

diff --git a/chicken-install.scm b/chicken-install.scm
index 9bcb7c6e..8995a724 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -86,11 +86,17 @@
   (define *deploy* #f)
   (define *trunk* #f)
   (define *csc-features* '())
-
-  (define *prefix* 
-    (let ((p (foreign-value "C_TARGET_DESTDIR" c-string)))
-      (and (not (string=? p ""))
-	   p)))
+  (define *prefix* #f)
+  (define *target-destdir* (foreign-value "C_TARGET_DESTDIR" c-string))
+
+  (define (get-prefix)
+    (cond ((and (feature? #:cross-chicken)
+		(not *host-extension*))
+	   *prefix*)
+	  ((and *target-destdir*
+		(not (string=? *target-destdir* "")))
+	   *target-destdir*)
+	  (else #f)))
 
   (define-constant +module-db+ "modules.db")
   (define-constant +defaults-file+ "setup.defaults")
@@ -365,10 +371,11 @@
      (if *keep* " -e \"(keep-intermediates #t)\"" "")
      (if (and *no-install* (not dep?)) " -e \"(setup-install-mode #f)\"" "")
      (if *host-extension* " -e \"(host-extension #t)\"" "")
-     (if *prefix* 
-	 (sprintf " -e \"(destination-prefix \\\"~a\\\")\"" 
-	   (normalize-pathname *prefix* 'unix))
-	 "")
+     (let ((prefix (get-prefix)))
+       (if prefix
+	   (sprintf " -e \"(destination-prefix \\\"~a\\\")\"" 
+	     (normalize-pathname *prefix* 'unix))
+	   ""))
      (sprintf " -e \"(extra-features '~s)\"" *csc-features*)
      (if *deploy* " -e \"(deployment-mode #t)\"" "")
      #\space
diff --git a/csc.scm b/csc.scm
index 94a159e0..685efcfe 100644
--- a/csc.scm
+++ b/csc.scm
@@ -926,7 +926,8 @@ EOF
 
 (define (target-lib-path)
   (let ((tdir TARGET_DESTDIR))
-    (if (not (string=? tdir ""))
+    (if (and (not (string=? tdir ""))
+	     (or (not cross-chicken) host-mode))
 	(make-pathname tdir "lib")
 	(lib-path))))
 
Trap