aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-01-27 16:05:55 +0000
committerOmar Polo <op@omarpolo.com>2021-01-27 16:05:55 +0000
commit40dc608f1fa19319e07a762a416073d6c9b5e2c2 (patch)
tree367caf085e77cb533285c0eb062c0bc02e015b88 /configure
parentfe5967cd02fce0a3b5db0dc4f05ff342083ba1d0 (diff)
adjust CFLAGS detection
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure30
1 files changed, 7 insertions, 23 deletions
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