Skip to content

Commit 123e4f8

Browse files
committed
Bugfix: configure: Allow user-provided CXXFLAGS to override default optimisation, debug, and warning flags
1 parent 490d6a3 commit 123e4f8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

configure.ac

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ m4_include([pkg.m4])
2424
dnl faketime breaks configure and is only needed for make. Disable it here.
2525
unset FAKETIME
2626

27+
if test "x${CXXFLAGS+set}" = "xset"; then
28+
CXXFLAGS_overridden=yes
29+
else
30+
CXXFLAGS_overridden=no
31+
fi
32+
2733
dnl ==============================================================
2834
dnl Setup for automake
2935
dnl ==============================================================
@@ -134,7 +140,9 @@ PKG_PROG_PKG_CONFIG
134140
## TODO: Remove these hard-coded paths and flags. They are here for the sake of
135141
## compatibility with the legacy buildsystem.
136142
##
137-
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter"
143+
if test "x$CXXFLAGS_overridden" = "xno"; then
144+
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter"
145+
fi
138146
CPPFLAGS="$CPPFLAGS -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS"
139147

140148
AC_LANG_PUSH([C++])
@@ -182,7 +190,9 @@ case $host in
182190

183191
CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -D__USE_MINGW_ANSI_STDIO"
184192
LEVELDB_TARGET_FLAGS="TARGET_OS=OS_WINDOWS_CROSSCOMPILE"
185-
CXXFLAGS="$CXXFLAGS -w"
193+
if test "x$CXXFLAGS_overridden" = "xno"; then
194+
CXXFLAGS="$CXXFLAGS -w"
195+
fi
186196
;;
187197
*darwin*)
188198
TARGET_OS=darwin

0 commit comments

Comments
 (0)