configure: Honor CFLAGS, LDFLAGS.
* configure (cflags-list, ldflags-list): New function. check-preprocess-header-c, check-compile-string-c, check-link-string-c): Use them. Be verbose when %verbose?. (CFLAGS, LDFLAGS): Initialize to "-static -g".
This commit is contained in:
parent
0db1e888f9
commit
6b0ff3f322
|
@ -30,22 +30,22 @@ MES_PREFIX=${MES_PREFIX-$PWD}
|
||||||
. build-aux/configure-lib.sh
|
. build-aux/configure-lib.sh
|
||||||
|
|
||||||
CPPFLAGS="-D HAVE_CONFIG_H=1 -I include"
|
CPPFLAGS="-D HAVE_CONFIG_H=1 -I include"
|
||||||
CFLAGS=""
|
AM_CFLAGS=""
|
||||||
mkdir -p mescc-lib
|
mkdir -p mescc-lib
|
||||||
cp config.sh mescc-lib/config.sh
|
cp config.sh mescc-lib/config.sh
|
||||||
cd mescc-lib
|
cd mescc-lib
|
||||||
srcdest=../
|
srcdest=../
|
||||||
CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu"
|
AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu"
|
||||||
|
|
||||||
mkdir $mes_cpu-mes
|
mkdir $mes_cpu-mes
|
||||||
$CC -c $CPPFLAGS $CFLAGS ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c
|
||||||
cp crt1.o $mes_cpu-mes
|
cp crt1.o $mes_cpu-mes
|
||||||
cp crt1.s $mes_cpu-mes
|
cp crt1.s $mes_cpu-mes
|
||||||
|
|
||||||
objects=
|
objects=
|
||||||
for c in $libc_mini_SOURCES; do
|
for c in $libc_mini_SOURCES; do
|
||||||
echo "CC $c"
|
echo "CC $c"
|
||||||
$CC -c $CPPFLAGS $CFLAGS ${srcdest}$c
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
||||||
o=$(basename $c .c).o
|
o=$(basename $c .c).o
|
||||||
objects="$objects $o"
|
objects="$objects $o"
|
||||||
done
|
done
|
||||||
|
@ -55,7 +55,7 @@ $AR crD $mes_cpu-mes/libc-mini.a $objects
|
||||||
objects=
|
objects=
|
||||||
for c in $libc_SOURCES; do
|
for c in $libc_SOURCES; do
|
||||||
echo "CC $c"
|
echo "CC $c"
|
||||||
$CC -c $CPPFLAGS $CFLAGS ${srcdest}$c
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
||||||
o=$(basename $c .c).o
|
o=$(basename $c .c).o
|
||||||
objects="$objects $o"
|
objects="$objects $o"
|
||||||
done
|
done
|
||||||
|
@ -65,7 +65,7 @@ $AR crD $mes_cpu-mes/libc.a $objects
|
||||||
objects=
|
objects=
|
||||||
for c in $libc_tcc_SOURCES; do
|
for c in $libc_tcc_SOURCES; do
|
||||||
echo "CC $c"
|
echo "CC $c"
|
||||||
$CC -c $CPPFLAGS $CFLAGS ${srcdest}$c
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
||||||
o=$(basename $c .c).o
|
o=$(basename $c .c).o
|
||||||
objects="$objects $o"
|
objects="$objects $o"
|
||||||
done
|
done
|
||||||
|
@ -79,7 +79,7 @@ CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kern
|
||||||
objects=
|
objects=
|
||||||
for c in $mes_SOURCES; do
|
for c in $mes_SOURCES; do
|
||||||
echo "CC $c"
|
echo "CC $c"
|
||||||
$CC -c $CPPFLAGS $CFLAGS ${srcdest}$c
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
||||||
o=$(basename $c .c).o
|
o=$(basename $c .c).o
|
||||||
objects="$objects $o"
|
objects="$objects $o"
|
||||||
done
|
done
|
||||||
|
|
|
@ -48,14 +48,12 @@ if test -n "$GUILE" -a "$GUILE" != true; then
|
||||||
${SHELL} ${srcdest}build-aux/build-guile.sh
|
${SHELL} ${srcdest}build-aux/build-guile.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
debug=${debug--g}
|
AM_CFLAGS=
|
||||||
|
|
||||||
AM_CFLAGS="
|
|
||||||
-static
|
|
||||||
$debug
|
|
||||||
"
|
|
||||||
|
|
||||||
if test $mes_libc = mes; then
|
if test $mes_libc = mes; then
|
||||||
|
AM_CFLAGS="
|
||||||
|
-static
|
||||||
|
"
|
||||||
AM_CFLAGS="$AM_CFLAGS
|
AM_CFLAGS="$AM_CFLAGS
|
||||||
-nostdinc
|
-nostdinc
|
||||||
-nostdlib
|
-nostdlib
|
||||||
|
@ -71,7 +69,6 @@ AM_CPPFLAGS="
|
||||||
"
|
"
|
||||||
|
|
||||||
AM_LDFLAGS="
|
AM_LDFLAGS="
|
||||||
$debug
|
|
||||||
-L .
|
-L .
|
||||||
"
|
"
|
||||||
if test $mes_libc = mes; then
|
if test $mes_libc = mes; then
|
||||||
|
|
26
configure
vendored
26
configure
vendored
|
@ -252,23 +252,39 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
|
||||||
(if result (set-field dependency (dependency-file-name) name)
|
(if result (set-field dependency (dependency-file-name) name)
|
||||||
dependency))))
|
dependency))))
|
||||||
|
|
||||||
|
(define (cflags-list)
|
||||||
|
(let ((cflags (getenv "CFLAGS")))
|
||||||
|
(if cflags (list cflags)
|
||||||
|
'())))
|
||||||
|
|
||||||
|
(define (ldflags-list)
|
||||||
|
(let ((ldflags (getenv "LDFLAGS")))
|
||||||
|
(if ldflags (list ldflags)
|
||||||
|
'())))
|
||||||
|
|
||||||
(define (check-preprocess-header-c cc header)
|
(define (check-preprocess-header-c cc header)
|
||||||
(with-output-to-file ".config.c"
|
(with-output-to-file ".config.c"
|
||||||
(cut format #t "#include \"~a\"" header))
|
(cut format #t "#include \"~a\"" header))
|
||||||
|
(let ((test (lambda _ (apply system* `(,cc "-E" "-o" ".config.E" ,@(cflags-list) ".config.c")))))
|
||||||
|
(zero? (if %verbose? (test)
|
||||||
(with-error-to-file "/dev/null"
|
(with-error-to-file "/dev/null"
|
||||||
(cut zero? (system* cc "-E" "-o" ".config.E" ".config.c"))))
|
test)))))
|
||||||
|
|
||||||
(define (check-compile-string-c cc string)
|
(define (check-compile-string-c cc string)
|
||||||
(with-output-to-file ".config.c"
|
(with-output-to-file ".config.c"
|
||||||
(cut display string))
|
(cut display string))
|
||||||
|
(let ((test (lambda _ (apply system* `(,cc "--std=gnu99" "-c" "-o" ".config.o" ,@(cflags-list) ".config.c")))))
|
||||||
|
(zero? (if %verbose? (test)
|
||||||
(with-error-to-file "/dev/null"
|
(with-error-to-file "/dev/null"
|
||||||
(cut zero? (system* cc "--std=gnu99" "-c" "-o" ".config.o" ".config.c"))))
|
test)))))
|
||||||
|
|
||||||
(define (check-link-string-c cc string)
|
(define (check-link-string-c cc string)
|
||||||
(with-output-to-file ".config.c"
|
(with-output-to-file ".config.c"
|
||||||
(cut display string))
|
(cut display string))
|
||||||
|
(let ((test (lambda _ (apply system* `(,cc "--std=gnu99" "-o" ".config" ,@(cflags-list) ,@(ldflags-list) ".config.c")))))
|
||||||
|
(zero? (if %verbose? (test)
|
||||||
(with-error-to-file "/dev/null"
|
(with-error-to-file "/dev/null"
|
||||||
(cut zero? (system* cc "--std=gnu99" "-o" ".config" ".config.c"))))
|
test)))))
|
||||||
|
|
||||||
(define (parse-opts args)
|
(define (parse-opts args)
|
||||||
(let* ((option-spec
|
(let* ((option-spec
|
||||||
|
@ -600,9 +616,9 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
|
||||||
("@SCHEME@" . ,(if with-cheating? guile ""))
|
("@SCHEME@" . ,(if with-cheating? guile ""))
|
||||||
("@SHELL@" . ,shell)
|
("@SHELL@" . ,shell)
|
||||||
|
|
||||||
("@CFLAGS@" . ,(or (getenv "CFLAGS") ""))
|
("@CFLAGS@" . ,(or (getenv "CFLAGS") "-static -g"))
|
||||||
("@CPPFLAGS@" . ,(or (getenv "CPPFLAGS") ""))
|
("@CPPFLAGS@" . ,(or (getenv "CPPFLAGS") ""))
|
||||||
("@LDFLAGS@" . ,(or (getenv "LDFLAGS") ""))
|
("@LDFLAGS@" . ,(or (getenv "LDFLAGS") "-static -g"))
|
||||||
("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
|
("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
|
||||||
("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
|
("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue