commit - eb877bffaa6b188caf0f8fc75a89f8e4721cc167
commit + 6edcfca97fb01418cfdb8a2595060a63b7471d48
blob - ec62a4673ef7c34f742d9f68bdcd0afa582cf5a1
blob + 1b4b649070c2f364030aad0c49b2015f0023dcaf
--- ChangeLog
+++ ChangeLog
+2021-07-06 Omar Polo <op@omarpolo.com>
+
+ * configure (guessing_cflags): try to preserve CFLAGS/LDFLAGS
+
2021-07-02 Omar Polo <op@omarpolo.com>
* sandbox.c (filter): seccomp filter reworked: now it should work on x86 and possibly other arches too!
blob - b2016559f0f3a24fbce5cce38c46e2182fafc469
blob + 2cfcff2238759a428e3adb09f53b86ffb4d4af6d
--- configure
+++ configure
# --------
# default settings: initialize all vars here such that nothing is
-# leaked from the environment except for CC and CFLAGS
+# leaked from the environment except for CC, CFLAGS and LDFLAGS
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 -levent"
+
+guessing_cflags=0
+if [ -z "${CFLAGS}" ]; then
+ guessing_cflags=1
+ CFLAGS=`printf "all:\\n\\t@echo \\\$(CFLAGS)\\n" | make ${MAKE_FLAGS} -sf -`
+ CFLAGS="${CFLAGS} -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes"
+ CFLAGS="${CFLAGS} -Wwrite-strings -Wno-unused-parameter"
+fi
+
+guessing_ldflags=0
+if [ -z "${LDFLAGS}" ]; then
+ guessing_ldflags=1
+ LDFLAGS=`printf "all:\\n\\t@echo \\\$(LDFLAGS)\\n" | make ${MAKE_FLAGS} -sf -`
+ LDFLAGS="-ltls -levent -lcrypto"
+fi
+
LD_IMSG=
STATIC=
YACC=yacc
INSTALL="install"
+add_cflags() {
+ if [ $guessing_cflags = 1 ]; then
+ CFLAGS="${CFLAGS} $1"
+ fi
+}
+
+add_ldflags() {
+ if [ $guessing_ldflags = 1 ]; then
+ LDFLAGS="${LDFLAGS} $1"
+ fi
+}
+
# try to auto detect CFLAGS and LDFLAGS
if which pkg-config 2>/dev/null 1>&2; then
if pkg-config libtls; then
- CFLAGS="${CFLAGS} $(pkg-config --cflags libtls)"
- LDFLAGS="$(pkg-config --libs libtls)"
+ add_cflags "$(pkg-config --cflags libtls)"
+ add_ldflags "$(pkg-config --libs libtls)"
fi
+
if pkg-config openssl; then
- CFLAGS="${CFLAGS} $(pkg-config --cflags openssl)"
- LDFLAGS="${LDFLAGS} $(pkg-config --libs openssl)"
+ add_cflags "$(pkg-config --cflags openssl)"
+ add_ldflags "$(pkg-config --libs openssl)"
fi
case "$(uname)" in
;;
*)
if pkg-config libevent; then
- CFLAGS="${CFLAGS} $(pkg-config --cflags libevent)"
- LDFLAGS="${LDFLAGS} $(pkg-config --libs libevent)"
+ add_cflags "$(pkg-config --cflags libevent)"
+ add_ldflags "$(pkg-config --libs libevent)"
fi
;;
esac