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
|
||||
|
||||
CPPFLAGS="-D HAVE_CONFIG_H=1 -I include"
|
||||
CFLAGS=""
|
||||
AM_CFLAGS=""
|
||||
mkdir -p mescc-lib
|
||||
cp config.sh mescc-lib/config.sh
|
||||
cd mescc-lib
|
||||
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
|
||||
$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.s $mes_cpu-mes
|
||||
|
||||
objects=
|
||||
for c in $libc_mini_SOURCES; do
|
||||
echo "CC $c"
|
||||
$CC -c $CPPFLAGS $CFLAGS ${srcdest}$c
|
||||
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
||||
o=$(basename $c .c).o
|
||||
objects="$objects $o"
|
||||
done
|
||||
|
@ -55,7 +55,7 @@ $AR crD $mes_cpu-mes/libc-mini.a $objects
|
|||
objects=
|
||||
for c in $libc_SOURCES; do
|
||||
echo "CC $c"
|
||||
$CC -c $CPPFLAGS $CFLAGS ${srcdest}$c
|
||||
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
||||
o=$(basename $c .c).o
|
||||
objects="$objects $o"
|
||||
done
|
||||
|
@ -65,7 +65,7 @@ $AR crD $mes_cpu-mes/libc.a $objects
|
|||
objects=
|
||||
for c in $libc_tcc_SOURCES; do
|
||||
echo "CC $c"
|
||||
$CC -c $CPPFLAGS $CFLAGS ${srcdest}$c
|
||||
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
||||
o=$(basename $c .c).o
|
||||
objects="$objects $o"
|
||||
done
|
||||
|
@ -79,7 +79,7 @@ CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kern
|
|||
objects=
|
||||
for c in $mes_SOURCES; do
|
||||
echo "CC $c"
|
||||
$CC -c $CPPFLAGS $CFLAGS ${srcdest}$c
|
||||
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
||||
o=$(basename $c .c).o
|
||||
objects="$objects $o"
|
||||
done
|
||||
|
|
|
@ -48,14 +48,12 @@ if test -n "$GUILE" -a "$GUILE" != true; then
|
|||
${SHELL} ${srcdest}build-aux/build-guile.sh
|
||||
fi
|
||||
|
||||
debug=${debug--g}
|
||||
|
||||
AM_CFLAGS="
|
||||
-static
|
||||
$debug
|
||||
"
|
||||
AM_CFLAGS=
|
||||
|
||||
if test $mes_libc = mes; then
|
||||
AM_CFLAGS="
|
||||
-static
|
||||
"
|
||||
AM_CFLAGS="$AM_CFLAGS
|
||||
-nostdinc
|
||||
-nostdlib
|
||||
|
@ -71,7 +69,6 @@ AM_CPPFLAGS="
|
|||
"
|
||||
|
||||
AM_LDFLAGS="
|
||||
$debug
|
||||
-L .
|
||||
"
|
||||
if test $mes_libc = mes; then
|
||||
|
|
32
configure
vendored
32
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)
|
||||
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)
|
||||
(with-output-to-file ".config.c"
|
||||
(cut format #t "#include \"~a\"" header))
|
||||
(with-error-to-file "/dev/null"
|
||||
(cut zero? (system* cc "-E" "-o" ".config.E" ".config.c"))))
|
||||
(let ((test (lambda _ (apply system* `(,cc "-E" "-o" ".config.E" ,@(cflags-list) ".config.c")))))
|
||||
(zero? (if %verbose? (test)
|
||||
(with-error-to-file "/dev/null"
|
||||
test)))))
|
||||
|
||||
(define (check-compile-string-c cc string)
|
||||
(with-output-to-file ".config.c"
|
||||
(cut display string))
|
||||
(with-error-to-file "/dev/null"
|
||||
(cut zero? (system* cc "--std=gnu99" "-c" "-o" ".config.o" ".config.c"))))
|
||||
(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"
|
||||
test)))))
|
||||
|
||||
(define (check-link-string-c cc string)
|
||||
(with-output-to-file ".config.c"
|
||||
(cut display string))
|
||||
(with-error-to-file "/dev/null"
|
||||
(cut zero? (system* cc "--std=gnu99" "-o" ".config" ".config.c"))))
|
||||
(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"
|
||||
test)))))
|
||||
|
||||
(define (parse-opts args)
|
||||
(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 ""))
|
||||
("@SHELL@" . ,shell)
|
||||
|
||||
("@CFLAGS@" . ,(or (getenv "CFLAGS") ""))
|
||||
("@CFLAGS@" . ,(or (getenv "CFLAGS") "-static -g"))
|
||||
("@CPPFLAGS@" . ,(or (getenv "CPPFLAGS") ""))
|
||||
("@LDFLAGS@" . ,(or (getenv "LDFLAGS") ""))
|
||||
("@LDFLAGS@" . ,(or (getenv "LDFLAGS") "-static -g"))
|
||||
("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
|
||||
("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
|
||||
|
||||
|
|
Loading…
Reference in a new issue