build: Support for non-Guix[SD]: make CC/CC32 optional in configure too.
* configure (optional): New global. (BUILD_TRIPLET): Use Guile value. (check-version): Add keyword argument #:optional. (main): Make CC optional (--with-courage). Only check for stdio.h, limits.h if CC is found. Make CC32 check optional. * scripts/scripts.make: Skip if CC is not set.
This commit is contained in:
parent
86b891ecb6
commit
19bed9b466
27
configure
vendored
27
configure
vendored
|
@ -9,7 +9,7 @@ if [ -x "$GUILE" ]; then
|
||||||
else
|
else
|
||||||
pm=$({ guix --help || dpkg --help; }|head -n 1|sed 's,.*Usage: \([^ ]*\).*,\1,g')
|
pm=$({ guix --help || dpkg --help; }|head -n 1|sed 's,.*Usage: \([^ ]*\).*,\1,g')
|
||||||
#-paredit:'})(
|
#-paredit:'})(
|
||||||
case "$pm" in dpkg) message="sudo apt-get install guile-2.0";; *) message="guix package -i guile";; esac
|
case "$pm" in dpkg) message="sudo apt-get install guile-2.0";; *) message="guix environment guix.scm";; esac
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Missing dependencies, run
|
Missing dependencies, run
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ Missing dependencies, run
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
exec ${GUILE} --no-auto-compile -L $(pwd) -e '(@@ (configure) main)' -s "$0" ${1+"$@"}
|
exec ${GUILE} --no-auto-compile -L $(pwd) -C $(pwd) -e 'main' -s "$0" ${1+"$@"}
|
||||||
!#
|
!#
|
||||||
|
|
||||||
;;; Mes --- Maxwell Equations of Software
|
;;; Mes --- Maxwell Equations of Software
|
||||||
|
@ -38,6 +38,8 @@ exec ${GUILE} --no-auto-compile -L $(pwd) -e '(@@ (configure) 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 (ice-9 and-let-star)
|
#:use-module (ice-9 and-let-star)
|
||||||
|
@ -117,9 +119,11 @@ exec ${GUILE} --no-auto-compile -L $(pwd) -e '(@@ (configure) main)' -s "$0" ${1
|
||||||
(char-set-complement (char-set #\.)))))
|
(char-set-complement (char-set #\.)))))
|
||||||
(map string->number version)))
|
(map string->number version)))
|
||||||
|
|
||||||
|
(define optional '())
|
||||||
(define required '())
|
(define required '())
|
||||||
(define* (check-version name expected
|
(define* (check-version name expected
|
||||||
#:key
|
#:key
|
||||||
|
optional?
|
||||||
(deb #f)
|
(deb #f)
|
||||||
(version-option '--version)
|
(version-option '--version)
|
||||||
(compare tuple<=)
|
(compare tuple<=)
|
||||||
|
@ -133,7 +137,9 @@ exec ${GUILE} --no-auto-compile -L $(pwd) -e '(@@ (configure) main)' -s "$0" ${1
|
||||||
(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?
|
||||||
(if (not (pair? name)) (begin (set! required (cons (or deb name) required)) pass?)
|
(if (not (pair? name)) (begin (if optional? (set! optional (cons (or deb name) optional))
|
||||||
|
(set! required (cons (or deb name) required)))
|
||||||
|
pass?)
|
||||||
(check-version (cdr name) expected deb version-option compare)))))
|
(check-version (cdr name) expected deb version-option compare)))))
|
||||||
|
|
||||||
(define* (check-pkg-config package expected #:optional (deb #f))
|
(define* (check-pkg-config package expected #:optional (deb #f))
|
||||||
|
@ -162,7 +168,7 @@ exec ${GUILE} --no-auto-compile -L $(pwd) -e '(@@ (configure) main)' -s "$0" ${1
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
(define CC (or (getenv "CC") "gcc"))
|
(define CC (or (getenv "CC") "gcc"))
|
||||||
(define BUILD_TRIPLET (gulp-pipe (string-append CC " -dumpmachine 2>/dev/null")))
|
(define BUILD_TRIPLET %host-type)
|
||||||
(define ARCH (car (string-split BUILD_TRIPLET #\-)))
|
(define ARCH (car (string-split BUILD_TRIPLET #\-)))
|
||||||
(define CC32 (or (getenv "CC32")
|
(define CC32 (or (getenv "CC32")
|
||||||
(if (member ARCH '("i686" "arm")) (string-append BUILD_TRIPLET "-" CC)
|
(if (member ARCH '("i686" "arm")) (string-append BUILD_TRIPLET "-" CC)
|
||||||
|
@ -213,10 +219,13 @@ Usage: ./configure [OPTION]...
|
||||||
(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))
|
||||||
(check-version CC '(4 8))
|
(if (not (check-version CC '(4 8) #:optional? #t))
|
||||||
|
(set! CC #f))
|
||||||
|
(when CC
|
||||||
(check-header-c "stdio.h" "libc-dev")
|
(check-header-c "stdio.h" "libc-dev")
|
||||||
(check-header-c "limits.h" "linux-headers")
|
(check-header-c "limits.h" "linux-headers"))
|
||||||
(check-version CC32 '(4 8))
|
(if (not (check-version CC32 '(4 8) #:optional? #t))
|
||||||
|
(set! CC32 #f))
|
||||||
(check-version 'guile '(2 0))
|
(check-version 'guile '(2 0))
|
||||||
(check-version 'make '(4 0))
|
(check-version 'make '(4 0))
|
||||||
(check-version 'perl '(5))
|
(check-version 'perl '(5))
|
||||||
|
@ -234,8 +243,8 @@ Usage: ./configure [OPTION]...
|
||||||
(stdout "host:=~a\n" host-triplet)
|
(stdout "host:=~a\n" host-triplet)
|
||||||
(stdout "srcdir:=.\n")
|
(stdout "srcdir:=.\n")
|
||||||
(stdout "ARCH:=~a\n" ARCH)
|
(stdout "ARCH:=~a\n" ARCH)
|
||||||
(stdout "CC:=~a\n" CC)
|
(stdout "CC:=~a\n" (or CC ""))
|
||||||
(stdout "CC32:=~a\n" CC32)
|
(stdout "CC32:=~a\n" (or CC32 ""))
|
||||||
(stdout "GUILE:=~a\n" GUILE)
|
(stdout "GUILE:=~a\n" GUILE)
|
||||||
(stdout "GUILE_FOR_BUILD:=~a\n" GUILE)
|
(stdout "GUILE_FOR_BUILD:=~a\n" GUILE)
|
||||||
(stdout "GUILE_EFFECTIVE_VERSION:=~a\n" GUILE_EFFECTIVE_VERSION)
|
(stdout "GUILE_EFFECTIVE_VERSION:=~a\n" GUILE_EFFECTIVE_VERSION)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
ifneq ($(CC),)
|
||||||
CLEAN+=$(DIR)/mes
|
CLEAN+=$(DIR)/mes
|
||||||
|
|
||||||
$(DIR)/mes: $(OUT)/mes
|
$(DIR)/mes: $(OUT)/mes
|
||||||
ln -sf ../$< $@
|
ln -sf ../$< $@
|
||||||
|
endif
|
||||||
|
|
Loading…
Reference in a new issue