mirror of https://github.com/omar-polo/gmid.git
try to preserve as much as possible CFLAGS and LDFLAGS from env
but still try to autodetect with pkg-config if they aren't provided. Passing CFLAGS/LDFLAGS from the command line will still override the guessed ones.
This commit is contained in:
parent
eb877bffaa
commit
6edcfca97f
|
@ -1,3 +1,7 @@
|
|||
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!
|
||||
|
|
|
@ -32,13 +32,25 @@ echo "file config.log: writing..."
|
|||
|
||||
# --------
|
||||
# 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
|
||||
|
@ -53,15 +65,28 @@ BINDIR=
|
|||
|
||||
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
|
||||
|
@ -70,8 +95,8 @@ if which pkg-config 2>/dev/null 1>&2; then
|
|||
;;
|
||||
*)
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue