build: Update configure.

* configure: Update.
This commit is contained in:
Jan Nieuwenhuizen 2018-05-21 00:06:39 +02:00
parent 98ccaceb25
commit c6d666bd67
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 19 additions and 15 deletions

34
configure vendored
View File

@ -2,13 +2,12 @@
# -*- scheme -*- # -*- scheme -*-
unset LANG LC_ALL unset LANG LC_ALL
echo -n "checking for guile..." echo -n "checking for guile..."
GUILE=$(command -v ${GUILE-guile} 2>/dev/null|tail -n 1|sed 's,^.* ,,') GUILE=$(command -v ${GUILE-guile})
GUIX=$(command -v ${GUIX-guix} 2>/dev/null|tail -n 1|sed 's,^.* ,,') GUIX=$(command -v ${GUIX-guix})
export GUILE GUIX export GUILE GUIX
if [ -x "$GUILE" ]; then if [ -x "$GUILE" ]; then
echo " $GUILE" echo " $GUILE"
elif [ -x "$GUIX" ]; then elif [ -x "$GUIX" ]; then
pm=$({ guix --help || dpkg --help; }|head -n 1|sed 's,.*Usage: \([^ ]*\).*,\1,g')
cat <<EOF cat <<EOF
not found not found
Missing dependencies, run Missing dependencies, run
@ -25,7 +24,7 @@ Missing dependencies, run
EOF EOF
exit 1 exit 1
fi fi
exec ${GUILE} --no-auto-compile -L $(pwd) -C $(pwd) -e 'main' -s "$0" ${1+"$@"} exec ${GUILE-guile} --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"}
!# !#
;;; Mes --- Maxwell Equations of Software ;;; Mes --- Maxwell Equations of Software
@ -46,9 +45,6 @@ exec ${GUILE} --no-auto-compile -L $(pwd) -C $(pwd) -e 'main' -s "$0" ${1+"$@"}
;;; You should have received a copy of the GNU General Public License ;;; You should have received a copy of the GNU General Public License
;;; along with Mes. If not, see <http://www.gnu.org/licenses/>. ;;; along with Mes. If not, see <http://www.gnu.org/licenses/>.
(define (main args)
((@@ (configure) main) args))
(define-module (configure) (define-module (configure)
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (ice-9 and-let-star) #: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 match)
#:use-module (ice-9 optargs) #:use-module (ice-9 optargs)
#:use-module (ice-9 popen) #:use-module (ice-9 popen)
#:use-module (ice-9 rdelim)) #:use-module (ice-9 rdelim)
#:export (main))
(define *shell* "sh") (define *shell* "sh")
(define PACKAGE "mes") (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 #\.))))) (char-set-complement (char-set #\.)))))
(map string->number version))) (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 optional '())
(define required '()) (define required '())
(define* (check-version name expected (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) (version-option '--version)
(compare tuple<=) (compare tuple<=)
(command name)) (command name))
(stderr "checking for ~a~a..." name (stderr "checking for ~a~a..." (basename name)
(if (null? expected) "" (if (null? expected) ""
(format #f " [~a]" (version->string expected)))) (format #f " [~a]" (version->string expected))))
(let* ((output (gulp-pipe (format #f "~a ~a 2>&1" command version-option))) (let* ((output (gulp-pipe (format #f "~a ~a 2>&1" command version-option)))
(actual (string->version output)) (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") (stderr "~a ~a\n" (if pass? (if (pair? actual) "" " yes")
(if actual " no, found" "")) (version->string actual)) (if actual " no, found" "")) (version->string actual))
(or pass? (or pass?
@ -247,12 +251,12 @@ Some influential environment variables:
(print-help) (print-help)
(exit 0)) (exit 0))
(set! *verbose?* verbose?) (set! *verbose?* verbose?)
(check-version 'guile '(2 0)) (check-version "guile" '(2 0))
(check-version HEX2 '(0 1)) (check-version HEX2 '(0 1))
(check-version M1 '(0 2)) (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?)) (when (and (not (member ARCH '("i686" "x86_64"))) (not with-courage?))
(stderr "platform not supported: ~a, try --with-courage\n" ARCH) (stderr "platform not supported: ~a, try --with-courage\n" ARCH)
(exit 1)) (exit 1))
@ -263,8 +267,8 @@ Some influential environment variables:
(check-header-c "limits.h" "linux-headers")) (check-header-c "limits.h" "linux-headers"))
(if (not (check-version CC32 '(4 8) #:optional? #t)) (if (not (check-version CC32 '(4 8) #:optional? #t))
(set! CC32 #f)) (set! CC32 #f))
(set! make? (check-version 'make '(4 0) #:optional? #t)) (set! make? (check-version "make" '(4 0) #:optional? #t))
(check-version 'perl '(5)) (check-version "perl" '(5))
(when (pair? required) (when (pair? required)
(stderr "\nMissing dependencies [~a], run\n\n" ((->string ", ") required)) (stderr "\nMissing dependencies [~a], run\n\n" ((->string ", ") required))