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 -*-
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 <<EOF
not found
Missing dependencies, run
@ -25,7 +24,7 @@ Missing dependencies, run
EOF
exit 1
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
@ -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
;;; along with Mes. If not, see <http://www.gnu.org/licenses/>.
(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))