3 MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"}
6 ;;; GNU Mes --- Maxwell Equations of Software
7 ;;; Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
9 ;;; configure: This file is part of GNU Mes.
11 ;;; GNU Mes is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Mes is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (configure)
25 #:use-module (srfi srfi-1)
26 #:use-module (srfi srfi-9)
27 #:use-module (srfi srfi-9 gnu)
28 #:use-module (srfi srfi-26)
29 #:use-module (ice-9 getopt-long)
30 #:use-module (ice-9 optargs)
31 #:use-module (ice-9 popen)
32 #:use-module (ice-9 rdelim)
36 (define PACKAGE "mes")
37 (define PACKAGE-NAME "GNU Mes")
38 (define PACKAGE-BUGREPORT "bug-mes@gnu.org")
39 (define VERSION "0.19")
43 (mes (mes-use-module (srfi srfi-1))
44 (mes-use-module (srfi srfi-9))
45 (mes-use-module (srfi srfi-9 gnu))
46 (mes-use-module (srfi srfi-26))
47 (mes-use-module (mes getopt-long))
48 (mes-use-module (mes guile))
49 (mes-use-module (mes misc))
50 (mes-use-module (mes optargs))
51 (define %host-type "x86_64-unknown-linux-gnu")
52 (define OPEN_READ "r")
53 (define (canonicalize-path o)
54 (if (string-prefix? "/" o) o
55 (string-append (getcwd) "/" o)))
56 (define (sort lst less)
58 (define (close-pipe o) 0)
59 (define (open-pipe* OPEN_READ . commands)
60 (let ((fake-pipe ".pipe"))
61 (with-output-to-file fake-pipe
63 (let ((status (apply system* (append commands))))
64 (set! close-pipe (lambda _ status)))))
65 (open-input-file fake-pipe)))))
67 (define* (PATH-search-path name #:key (default name) warn?)
68 (or (search-path (string-split (getenv "PATH") #\:) name)
69 (and (and warn? (format (current-error-port) "warning: not found: ~a\n" name))
73 (define (logf port string . rest)
74 (apply format (cons* port string rest))
78 (define (stderr string . rest)
79 (apply logf (cons* (current-error-port) string rest)))
81 (define (stdout string . rest)
82 (apply logf (cons* (current-output-port) string rest)))
86 (define (verbose string . rest)
87 (if %verbose? (apply stderr (cons string rest))))
89 (define (gulp-pipe* . command)
90 (let* ((err (current-error-port))
91 (foo (set-current-error-port (open-output-file ".error")))
92 (port (apply open-pipe* OPEN_READ command))
93 (output (read-string port))
94 (status (close-pipe port))
95 (error (with-input-from-file ".error" read-string)))
96 (when (file-exists? ".error")
97 (delete-file ".error"))
98 (set-current-error-port err)
99 (verbose "command[~a]: ~s => ~a [~a]\n" status command output error)
100 (if (not (zero? status)) ""
101 (string-trim-right (string-append output error)))))
105 ((and (null? a) (null? b)) #t)
106 ((null? a) (not (null? b)))
108 ((and (not (< (car a) (car b)))
109 (not (< (car b) (car a))))
110 (tuple< (cdr a) (cdr b)))
111 (else (< (car a) (car b)))))
113 (define (tuple<= a b)
114 (or (equal? a b) (tuple< a b)))
116 (define (conjoin . predicates)
117 (lambda (. arguments)
118 (every (cut apply <> arguments) predicates)))
120 (define (char->char from to char)
121 (if (eq? char from) to char))
123 (define (string-replace-char string from to)
124 (string-map (cut char->char from to <>) string))
126 (define (string-replace-string string from to)
127 (cond ((string-contains string from)
128 => (lambda (i) (string-replace string to i (+ i (string-length from)))))
131 (define (string-replace-string/all string from to)
132 (or (and=> (string-contains string from)
135 (substring string 0 i)
137 (string-replace-string/all
138 (substring string (+ i (string-length from))) from to))))
143 (define-immutable-record-type <dependency>
144 (make-dependency name version-expected optional? version-option commands file-name data version-found)
146 (name dependency-name)
147 (version-expected dependency-version-expected)
148 (optional? dependency-optional?)
149 (version-option dependency-version-option)
150 (commands dependency-commands)
151 (file-name dependency-file-name)
152 (data dependency-data)
153 (version-found dependency-version-found))
155 (define* (make-dep name #:key (version '(0)) optional? (version-option "--version") (commands (list name)) file-name data)
156 (let* ((env-var (getenv (name->shell-name name)))
157 (commands (if env-var (cons env-var commands) commands)))
158 (make-dependency name version optional? version-option commands file-name data #f)))
160 (define (find-dep name deps)
161 (find (compose (cut equal? <> name) dependency-name) deps))
163 (define (file-name name deps)
164 (and=> (find-dep name deps) dependency-file-name))
166 (define (variable-name dependency)
168 (dependency-name dependency)
171 (define (name->shell-name name)
172 (string-upcase (string-replace-char name #\- #\_)))
175 (cond ((number? o) (number->string o))
177 (else (format #f "~a" o))))
179 (define (version->string version)
180 (and version (string-join (map ->string version) ".")))
182 (define (string->version string)
183 (let ((split (string-tokenize string
184 (char-set-adjoin char-set:digit #\.))))
186 (let* ((version (sort split (lambda (a b) (> (string-length a) (string-length b)))))
187 (version (car version))
188 (version (string-tokenize version
189 (char-set-complement (char-set #\.)))))
190 (map string->number version)))))
192 (define (check-program-version dependency)
193 (let ((name (dependency-name dependency))
194 (expected (dependency-version-expected dependency))
195 (version-option (dependency-version-option dependency))
196 (commands (dependency-commands dependency)))
197 (let loop ((commands commands))
198 (if (null? commands) dependency
199 (let ((command (car commands)))
200 (stdout "checking for ~a~a... " name
201 (if (null? expected) ""
202 (format #f " [~a]" (version->string expected))))
203 (let* ((output (gulp-pipe* command version-option))
204 ;;(foo (stderr "output=~s\n" output))
205 (actual (string->version output))
206 ;;(foo (stderr "actual=~s\n" actual))
207 ;;(foo (stderr "expected=~s\n" expected))
208 (pass? (and actual (tuple< expected actual)))
209 ;;(foo (stderr "PASS?~s\n" pass?))
210 (dependency (set-field dependency (dependency-version-found) actual)))
211 (stdout "~a ~a\n" (if pass? (if (pair? actual) "" " yes")
212 (if actual " no, found" "no"))
213 (or (version->string actual) ""))
214 (if pass? (let ((file-name (or (PATH-search-path command)
215 (dependency-file-name dependency))))
216 (set-field dependency (dependency-file-name) file-name))
217 (loop (cdr commands)))))))))
219 (define (check-file dependency)
220 (stdout "checking for ~a... " (dependency-name dependency))
221 (let ((file-name (and (file-exists? (dependency-file-name dependency))
222 (dependency-file-name dependency))))
223 (stdout "~a\n" (or file-name ""))
224 (set-field dependency (dependency-file-name) file-name)))
226 (define* (check-header-c cc dependency #:optional (check check-preprocess-header-c))
227 (let ((name (dependency-name dependency)))
228 (stderr "checking for ~a..." name)
229 (let ((result (check cc name)))
230 (when (file-exists? ".config.c")
231 (delete-file ".config.c"))
232 (stderr " ~a\n" (if result "yes" "no"))
233 (if result (set-field dependency (dependency-file-name) name)
236 (define* (check-compile-c cc dependency #:optional (check check-compile-string-c))
237 (let ((name (dependency-name dependency)))
238 (stderr "checking for ~a..." name)
239 (let ((result (check cc (dependency-data dependency))))
240 (when (file-exists? ".config.c")
241 (delete-file ".config.c"))
242 (stderr " ~a\n" (if result "yes" "no"))
243 (if result (set-field dependency (dependency-file-name) name)
246 (define* (check-link-c cc dependency #:optional (check check-link-string-c))
247 (let ((name (dependency-name dependency)))
248 (stderr "checking for ~a..." name)
249 (let ((result (check cc (dependency-data dependency))))
250 (when (file-exists? ".config.c")
251 (delete-file ".config.c"))
252 (stderr " ~a\n" (if result "yes" "no"))
253 (if result (set-field dependency (dependency-file-name) name)
256 (define (check-preprocess-header-c cc header)
257 (with-output-to-file ".config.c"
258 (cut format #t "#include \"~a\"" header))
259 (with-error-to-file "/dev/null"
260 (cut zero? (system* cc "-E" "-o" ".config.E" ".config.c"))))
262 (define (check-compile-string-c cc string)
263 (with-output-to-file ".config.c"
264 (cut display string))
265 (with-error-to-file "/dev/null"
266 (cut zero? (system* cc "--std=gnu99" "-c" "-o" ".config.o" ".config.c"))))
268 (define (check-link-string-c cc string)
269 (with-output-to-file ".config.c"
270 (cut display string))
271 (with-error-to-file "/dev/null"
272 (cut zero? (system* cc "--std=gnu99" "-o" ".config" ".config.c"))))
274 (define (parse-opts args)
280 (program-prefix (value #t))
284 (includedir (value #t))
287 (sysconfdir (value #t))
290 (help (single-char #\h))
291 (verbose (single-char #\v))
298 (disable-silent-rules)
299 (enable-silent-rules)
302 (enable-fast-install) ; Ignored for Guix
303 (mandir (value #t)) ; Ignored for Debian
304 (localstatedir (value #t)) ; Ignored for Debian
305 (libexecdir (value #t)) ; Ignored for Debian
306 (runstatedir (value #t)) ; Ignored for Debian
307 (disable-maintainer-mode) ; Ignored for Debian
308 (disable-dependency-tracking) ; Ignored for Debian
311 (getopt-long args option-spec)))
313 (define* (print-help #:optional (port (current-output-port)))
315 `configure' configures ~a ~a to adapt to many kinds of systems.
317 Usage: ./configure [OPTION]... [VAR=VALUE]
319 To assign environment variables (e.g., CC, CFLAGS...), specify them as
320 VAR=VALUE. See below for descriptions of some of the useful variables.
322 Defaults for the options are specified in brackets.
325 -h, --help display this help
326 --build=BUILD configure for building on BUILD [guessed]
327 --colors no colorized output
328 --disable-silent-rules
329 verbose build output [V=1]
330 --host=HOST cross-compile to build programs to run on HOST [BUILD]
331 -v, --verbose be verbose
332 --with-courage Assert that even if this platform is unsupported,
333 you will be courageous and port GNU Mes to it
334 (see \"Porting GNU Mes\" in the manual.)
335 --with-cheating cheat using Guile instead of Mes
336 --with-system-libc use system libc
338 Installation directories:
339 --prefix=DIR install in prefix DIR [~a]
341 --bindir=DIR user executables [PREFIX/bin]
342 --includedir=DIR C header files [PREFIX/include]
343 --infodir=DIR info documentation [PREFIX/share/info]
344 --libdir=DIR object code libraries [EPREFIX/lib]
345 --mandir=DIR man pages [PREFIX/share/man]
348 --program-prefix=PREFIX prepend PREFIX to installed program names
349 --program-suffix=SUFFIX append SUFFIX to installed program names
352 --enable-fast-install
355 --disable-dependency-tracking
356 --disable-maintainer-mode
361 Some influential environment variables:
362 CC C compiler command
363 CFLAGS C compiler flags
366 MES_FOR_BUILD build system MES [can be mes or guile]
367 MES_SEED location of mes-seed
368 " PACKAGE VERSION (getenv "prefix")))
371 (let* ((options (parse-opts args))
372 (build-type (option-ref options 'build %host-type))
373 (host-type (option-ref options 'host build-type))
375 (prefix "/usr/local")
376 (prefix (option-ref options 'prefix prefix))
377 (program-prefix (option-ref options 'program-prefix ""))
378 (program-suffix (option-ref options 'program-suffix ""))
379 (infodir (option-ref options 'infodir "${prefix}/share/info"))
380 (mandir (option-ref options 'mandir "${prefix}/share/man"))
381 (sysconfdir (option-ref options 'sysconfdir "${prefix}/etc"))
383 (bindir (option-ref options 'bindir "${prefix}/bin"))
384 (datadir (option-ref options 'datadir "${prefix}/share"))
385 (docdir (option-ref options 'docdir "${datadir}/doc/mes-${VERSION}"))
386 (includedir (option-ref options 'libdir "${prefix}/include"))
387 (libdir (option-ref options 'libdir "${prefix}/lib"))
388 (pkgdatadir (string-append datadir "/mes"))
389 (guile-effective-version (effective-version))
390 (guile-site-dir (if (equal? prefix ".") (canonicalize-path ".")
391 (string-append prefix "/share/guile/site/" guile-effective-version)))
392 (guile-site-ccache-dir (if (equal? prefix ".") (canonicalize-path ".")
393 (string-append prefix "/lib/guile/" guile-effective-version "/site-ccache")))
395 (srcdir (dirname (car (command-line))))
396 (srcdest (if (equal? srcdir ".") ""
397 (string-append srcdir "/")))
398 (abs-top-srcdir (canonicalize-path srcdir))
399 (abs-top-builddir (canonicalize-path (getcwd)))
400 (top-builddir (if (equal? srcdir ".") "."
403 (with-cheating? (option-ref options 'with-cheating #f))
404 (with-courage? (option-ref options 'with-courage #f))
405 (disable-colors? (option-ref options 'disable-colors #f))
406 (enable-colors? (option-ref options 'enable-colors #f))
407 (disable-silent-rules? (option-ref options 'disable-silent-rules #f))
408 (enable-silent-rules? (option-ref options 'enable-silent-rules #f))
409 (with-system-libc? (option-ref options 'with-system-libc #f))
410 (vars (filter (cut string-index <> #\=) (option-ref options '() '())))
411 (help? (option-ref options 'help #f))
412 (mes? (option-ref options 'mes #f)))
416 (set! %verbose? (option-ref options 'verbose #f))
418 (stderr "configure args=~s\n" args))
419 (for-each (lambda (v) (apply setenv (string-split v #\=))) vars)
420 (let* ((mes-seed (or (getenv "MES_SEED")
421 (string-append srcdest "../mes-seed")))
422 (mes-seed (and mes-seed
423 (file-exists? (string-append mes-seed "/x86-mes/mes.S"))
425 (tinycc-prefix (or (getenv "TINYCC_PREFIX")
426 (string-append srcdest "../tinycc-prefix")))
427 (gcc (or (getenv "CC") "gcc"))
428 (tcc (or (getenv "TCC") "tcc"))
429 (mescc (or (getenv "MESCC") "mescc"))
430 (deps (fold (lambda (program results)
431 (cons (check-program-version program) results))
433 (list (make-dep "hex2" #:version '(0 3))
434 (make-dep "M1" #:version '(0 3))
435 (make-dep "blood-elf" #:version '(0 1))
436 (make-dep "diff" #:optional? #t)
437 (make-dep "guile" #:version '(2 0) #:commands '("guile-2.2" "guile-2.0" "guile-2" "guile") #:optional? #t)
438 (make-dep "mes" #:version '(0 18) #:optional? #t)
439 (make-dep "guix" #:version '(0 13) #:optional? #t)
440 (make-dep "ar" #:version '(2 10) #:optional? #t)
441 (make-dep "sh" #:version '(0) #:optional? #t)
442 (make-dep "bash" #:version '(2 0) #:optional? #t)
443 (make-dep "guild" #:version '(2 0) #:commands '("guild" "guile-tools"))
444 (make-dep "cc" #:commands (list gcc tcc mescc) #:optional? #t)
445 (make-dep "make" #:optional? #t)
446 (make-dep "makeinfo" #:optional? #t)
447 (make-dep "dot" #:version-option "-V" #:optional? #t)
448 (make-dep "help2man" #:version '(1 47) #:optional? #t)
449 (make-dep "perl" #:version '(5) #:optional? #t)
450 (make-dep "git" #:version '(2) #:optional? #t))))
451 (guile (file-name "guile" deps))
452 (deps (if guile (cons (check-program-version (make-dep "nyacc" #:version '(0 86 0) #:commands (list (string-append guile " -c '(use-modules (nyacc lalr)) (display *nyacc-version*)'")) #:file-name #t))
455 (guile (or guile "guile"))
456 (cc (file-name "cc" deps))
458 (cons* (check-header-c cc (make-dep "limits.h"))
459 (check-header-c cc (make-dep "stdio.h" #:optional? #t))
462 (deps (cons (check-file (make-dep "tinycc-prefix" #:optional? #t
463 #:file-name tinycc-prefix))
465 (missing (filter (conjoin (negate dependency-file-name)
466 (negate dependency-optional?)) deps))
468 (cons (check-compile-c cc (make-dep "cc is GNU C" #:data "#if !defined (__GNUC__)
474 (gcc? (file-name "cc is GNU C" deps))
476 (cons (check-compile-c cc (make-dep "cc is Mes C" #:data "#if !defined (__MESC__)
482 (mesc? (file-name "cc is Mes C" deps))
484 (cons (check-compile-c cc (make-dep "cc is Tiny CC" #:data "#if !defined (__TINYCC__)
490 (tcc? (file-name "cc is Tiny CC" deps))
492 (cons (check-link-c cc (make-dep "if cc can create executables" #:data "int main () {return 0;}"))
495 (system-libc? (and with-system-libc? (file-name "if cc can create executables" deps)))
496 (build-type (or (and cc (gulp-pipe* cc "-dumpmachine")) build-type))
497 (build-type-list (string-split build-type #\-))
498 (mes-cpu (car build-type-list))
499 (mes-cpu (cond ((member mes-cpu '("i386" "i486" "i586" "i686")) "x86")
500 ((member mes-cpu '("arm" "armv4" "armv7l")) "arm")
502 (mes-bits (if (member mes-cpu '("x86_64")) "64"
504 (mes-libc (if system-libc? "system" "mes"))
506 (kernel-list (filter (compose not (cut equal? <> "unknown")) (cdr build-type-list)))
507 (mes-kernel (cond ((or (equal? '("linux" "gnu") kernel-list)
508 (equal? "linux" (car kernel-list))) "linux")
509 ((equal? '( "gnu") kernel-list) "gnu")
511 (compiler (if gcc? "gcc" "mescc"))
512 (mes-system (string-join (list mes-cpu mes-kernel "mes") "-")))
514 (define* (substitute file-name pairs
515 #:key (target (if (string-suffix? ".in" file-name)
516 (string-drop-right file-name 3) file-name)))
517 (system* "mkdir" "-p" (dirname target))
518 (with-output-to-file target
520 (let ((in (open-input-file file-name)))
521 (let loop ((line (read-line in 'concat)))
522 (when (not (eof-object? line))
523 (display (fold (lambda (o result)
524 (string-replace-string/all result (car o) (cdr o)))
526 (loop (read-line in 'concat))))))))
528 (when (and (not (member mes-system '("arm-linux-mes"
530 "x86_64-linux-mes")))
532 (stderr "platform not supported: ~a
533 See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
535 (when (pair? missing)
536 (stderr "\nMissing dependencies: ~a\n" (string-join (map dependency-name missing)))
538 (let ((git (find-dep "git" deps)))
540 (not (file-exists? ".git")))
541 ;; Debian wants to run `make clean' from a tarball
542 (and (zero? (system* "git" "init"))
543 (zero? (system* "git" "add" "."))
544 (zero? (system* "git" "commit" "--allow-empty" "-m" "Import mes")))))
546 (let ((pairs `(("@PACKAGE@" . ,PACKAGE)
547 ("@PACKAGE_NAME@" . ,PACKAGE-NAME)
548 ("@PACKAGE_BUGREPORT@" . ,PACKAGE-BUGREPORT)
549 ("@VERSION@" . ,VERSION)
551 ("@build@" . ,build-type)
552 ("@host@" . ,host-type)
554 ("@courageous@" . ,(if with-courage? "true" "false"))
555 ("@compiler@" . ,compiler)
556 ("@mes_bits@" . ,mes-bits)
557 ("@mes_kernel@" . ,mes-kernel)
558 ("@mes_cpu@" . ,mes-cpu)
559 ("@mes_libc@" . ,mes-libc)
560 ("@mes_system@" . ,mes-system)
562 ("@abs_top_srcdir@" . ,abs-top-srcdir)
563 ("@abs_top_builddir@" . ,abs-top-builddir)
564 ("@top_builddir@" . ,top-builddir)
566 ("@srcdest@" . ,srcdest)
567 ("@srcdir@" . ,srcdir)
569 ("@prefix@" . ,prefix)
570 ("@program_prefix@" . ,program-prefix)
571 ("@bindir@" . ,bindir)
572 ("@datadir@" . ,datadir)
573 ("@pkgdatadir@" . ,pkgdatadir)
574 ("@docdir@" . ,docdir)
575 ("@guile_site_ccache_dir@" . ,guile-site-ccache-dir)
576 ("@guile_site_dir@" . ,guile-site-dir)
577 ("@infodir@" . ,infodir)
578 ("@includedir@" . ,includedir)
579 ("@libdir@" . ,libdir)
580 ("@mandir@" . ,mandir)
581 ("@sysconfdir@" . ,sysconfdir)
583 ("@GUILE_EFFECTIVE_VERSION@" . ,(effective-version))
584 ("@colors@" . ,(if disable-colors? "no" "yes"))
585 ("@V@" . ,(if disable-silent-rules? "1" "0"))
587 ("@AR@" . ,(or (file-name "ar" deps) ""))
588 ("@BASH@" . ,(or (file-name "bash" deps) ""))
589 ("@CC@" . ,(or (file-name "cc" deps) ""))
590 ("@DIFF@" . ,(or (file-name "diff" deps) (string-append abs-top-builddir "/pre-inst-env diff.scm")))
591 ("@DOT@" . ,(or (file-name "dot" deps) ""))
592 ("@GIT@" . ,(or (file-name "git" deps) ""))
594 ("@GUIX@" . ,(or (file-name "guix" deps) ""))
595 ("@HELP2MAN@" . ,(or (file-name "help2man" deps) ""))
596 ("@MAKEINFO@" . ,(or (file-name "makeinfo" deps) ""))
597 ("@MES_FOR_BUILD@" . ,(or (file-name "mes" deps)
599 ("@MES_SEED@" . ,(or mes-seed ""))
600 ("@PERL@" . ,(or (file-name "perl" deps) ""))
601 ("#SCHEME=\"@SCHEME@\"" . ,(if with-cheating? (string-append "\nSCHEME=\"" guile "\"") ""))
602 ("@SCHEME@" . ,(if with-cheating? guile ""))
603 ("@SHELL@" . ,(or (file-name "bash" deps)
604 (file-name "sh" deps)
607 ("@CFLAGS@" . ,(or (getenv "CFLAGS") ""))
608 ("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
609 ("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
613 (cons (string-append "@" (variable-name o) "@") (or (format #f "~a" (dependency-file-name o)) "")))
618 (format (current-error-port) "must supply C compiler or MES_SEED/x86-mes/mes.S\n")
620 (for-each (lambda (o)
621 (let* ((src (string-append srcdest o))
622 (target (string-drop-right o 3))
623 (target (if (not (string-prefix? "build-aux/" target)) target
624 (string-drop target (string-length "build-aux/")))))
625 (substitute src pairs #:target target)))
627 "build-aux/GNUmakefile.in"
628 "build-aux/config.sh.in"
629 "build-aux/build.sh.in"
630 "build-aux/check.sh.in"
631 "build-aux/install.sh.in"
632 "build-aux/pre-inst-env.in"
633 "build-aux/uninstall.sh.in"
635 "scripts/mescc.scm.in"
638 (chmod "pre-inst-env" #o755)
639 (chmod "scripts/ar" #o755)
640 (chmod "scripts/mescc" #o755)
641 (chmod "scripts/mescc.scm" #o755)
642 (chmod "build.sh" #o755)
643 (chmod "check.sh" #o755)
644 (chmod "install.sh" #o755)
645 (chmod "uninstall.sh" #o755)
647 (system* "mkdir" "-p" "include/mes")
648 (let ((pkgdatadir (gulp-pipe* "sh" "-c" (string-append "prefix=" prefix
650 ";echo ${datadir}/mes"))))
651 (with-output-to-file "include/mes/config.h"
654 (display "#define SYSTEM_LIBC 1
656 (display "#undef SYSTEM_LIBC
658 (display (string-append "
659 #define MES_VERSION \"" VERSION "\"
660 #define MES_PKGDATADIR \"" pkgdatadir "\"
662 (substitute (string-append srcdest "build-aux/config.make.in") pairs #:target ".config.make"))
664 (let ((make (and=> (file-name "make" deps) basename)))
665 (display (string-append "
666 GNU Mes is configured for
667 compiler: " compiler "
671 kernel: " mes-kernel "
672 system: " mes-system "
675 " (or make "./build.sh") " to build mes
676 " (or make "./build.sh") " help for help on other targets\n"))))))