From c6d666bd67b1bde8affce16e4392ffea5854d49e Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 21 May 2018 00:06:39 +0200 Subject: [PATCH] build: Update configure. * configure: Update. --- configure | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/configure b/configure index 3aa750ed..17a168de 100755 --- a/configure +++ b/configure @@ -2,13 +2,12 @@ # -*- scheme -*- unset LANG LC_ALL echo -n "checking for guile..." -GUILE=$(command -v ${GUILE-guile} 2>/dev/null|tail -n 1|sed 's,^.* ,,') -GUIX=$(command -v ${GUIX-guix} 2>/dev/null|tail -n 1|sed 's,^.* ,,') +GUILE=$(command -v ${GUILE-guile}) +GUIX=$(command -v ${GUIX-guix}) export GUILE GUIX if [ -x "$GUILE" ]; then echo " $GUILE" elif [ -x "$GUIX" ]; then - pm=$({ guix --help || dpkg --help; }|head -n 1|sed 's,.*Usage: \([^ ]*\).*,\1,g') cat <. -(define (main args) - ((@@ (configure) main) args)) - (define-module (configure) #:use-module (srfi srfi-26) #:use-module (ice-9 and-let-star) @@ -57,7 +53,8 @@ exec ${GUILE} --no-auto-compile -L $(pwd) -C $(pwd) -e 'main' -s "$0" ${1+"$@"} #:use-module (ice-9 match) #:use-module (ice-9 optargs) #:use-module (ice-9 popen) - #:use-module (ice-9 rdelim)) + #:use-module (ice-9 rdelim) + #:export (main)) (define *shell* "sh") (define PACKAGE "mes") @@ -128,6 +125,11 @@ exec ${GUILE} --no-auto-compile -L $(pwd) -C $(pwd) -e 'main' -s "$0" ${1+"$@"} (char-set-complement (char-set #\.))))) (map string->number version))) +(define* (PATH-search-path name #:key (default name) warn?) + (or (search-path (string-split (getenv "PATH") #\:) name) + (and (and warn? (format (current-error-port) "warning: not found: ~a\n" name)) + default))) + (define optional '()) (define required '()) (define* (check-version name expected @@ -137,12 +139,14 @@ exec ${GUILE} --no-auto-compile -L $(pwd) -C $(pwd) -e 'main' -s "$0" ${1+"$@"} (version-option '--version) (compare tuple<=) (command name)) - (stderr "checking for ~a~a..." name + (stderr "checking for ~a~a..." (basename name) (if (null? expected) "" (format #f " [~a]" (version->string expected)))) (let* ((output (gulp-pipe (format #f "~a ~a 2>&1" command version-option))) (actual (string->version output)) - (pass? (and actual (compare expected actual)))) + (pass? (and actual (compare expected actual))) + ;(pass? (PATH-search-path command)) + ) (stderr "~a ~a\n" (if pass? (if (pair? actual) "" " yes") (if actual " no, found" "")) (version->string actual)) (or pass? @@ -247,12 +251,12 @@ Some influential environment variables: (print-help) (exit 0)) (set! *verbose?* verbose?) - (check-version 'guile '(2 0)) + (check-version "guile" '(2 0)) (check-version HEX2 '(0 1)) (check-version M1 '(0 2)) - (check-version 'nyacc '(0 80 3) #:command (string-append GUILE " -c '(use-modules (nyacc lalr)) (display *nyacc-version*)'")) + (check-version "nyacc" '(0 80 41) #:command (string-append GUILE " -c '(use-modules (nyacc lalr)) (display *nyacc-version*)'")) - (check-version 'bash '(4 0)) + (check-version "bash" '(4 0)) (when (and (not (member ARCH '("i686" "x86_64"))) (not with-courage?)) (stderr "platform not supported: ~a, try --with-courage\n" ARCH) (exit 1)) @@ -263,8 +267,8 @@ Some influential environment variables: (check-header-c "limits.h" "linux-headers")) (if (not (check-version CC32 '(4 8) #:optional? #t)) (set! CC32 #f)) - (set! make? (check-version 'make '(4 0) #:optional? #t)) - (check-version 'perl '(5)) + (set! make? (check-version "make" '(4 0) #:optional? #t)) + (check-version "perl" '(5)) (when (pair? required) (stderr "\nMissing dependencies [~a], run\n\n" ((->string ", ") required))