From 40dc608f1fa19319e07a762a416073d6c9b5e2c2 Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Wed, 27 Jan 2021 16:05:55 +0000 Subject: adjust CFLAGS detection --- configure | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'configure') diff --git a/configure b/configure index d87a56d..c01d4d1 100755 --- a/configure +++ b/configure @@ -31,10 +31,13 @@ exec 3> config.log echo "file config.log: writing..." # -------- -# default settings: initialize all vars here +# default settings: initialize all vars here such that nothing is +# leaked from the environment except for CC and CFLAGS -CC=cc -CFLAGS= +CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make ${MAKE_FLAGS} -sf -` +CFLAGS=`printf "all:\\n\\t@echo \\\$(CFLAGS)\\n" | make ${MAKE_FLAGS} -sf -` +CFLAGS="${CFLAGS} -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes" +CFLAGS="${CFLAGS} -Wwrite-strings -Wno-unused-parameter" LDFLAGS=-ltls YACC=yacc LEX=lex @@ -192,31 +195,12 @@ runtest() { # -------- # compiler options -DEFCFLAGS="-g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter" +COMP="${CC} ${CFLAGS} -Wno-unused -Werror" -if [ -n "${CFLAGS}" ]; then - COMP="${CC} ${CFLAGS} -Wno-unused -Werror" -else - COMP="${CC} ${CDEFCFLAGS} -Wno-unused -Werror" -fi -echo -n "testing ${CC} -W: " 1>&2 -echo -n "testing ${CC} -W: " 1>&3 -runtest noop WFLAG || true - -if [ -n "${CFLAGS}" ]; then - echo "CFLAGS specified manually:" 1>&3 -elif [ ${HAVE_WFLAG} -eq 0 ]; then - CFLAGS="-g" -else - CFLAGS="${DEFCFLAGS}" -fi echo "selected CFLAGS=\"${CFLAGS}\"" 1>&2 echo "selected CFLAGS=\"${CFLAGS}\"" 1>&3 echo 1>&3 -COMP="${CC} ${CFLAGS}" -[ ${HAVE_WFLAG} -eq 0 ] || COMP="${COMP} -Wno-unused -Werror" - if [ -n "${STATIC}" ]; then echo "selected STATIC=\"${STATIC}\" (manual)" 1>&2 echo "selected STATIC=\"${STATIC}\" (manual)" 1>&3 -- cgit v1.2.3