Skip to content

Commit efe50ba

Browse files
committed
Add c++14 to QBT_ADD_CONFIG when appropriate
1 parent 05b6265 commit efe50ba

2 files changed

Lines changed: 16 additions & 21 deletions

File tree

configure

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5591,8 +5591,10 @@ $as_echo "yes" >&6; }
55915591
fi
55925592

55935593
# Check if already in >= C++14 mode because of the flags returned by one of the above packages
5594-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is using C++14 or later mode" >&5
5595-
$as_echo_n "checking if compiler is using C++14 or later mode... " >&6; }
5594+
TMP_CXXFLAGS="$CXXFLAGS"
5595+
CXXFLAGS=""
5596+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler defaults to C++14 or later mode" >&5
5597+
$as_echo_n "checking if compiler defaults to C++14 or later mode... " >&6; }
55965598
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
55975599
/* end confdefs.h. */
55985600
@@ -5626,8 +5628,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
56265628
if test "x$QBT_CXX14_FOUND" = "xno"; then :
56275629
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports C++14" >&5
56285630
$as_echo_n "checking if compiler supports C++14... " >&6; }
5629-
TMP_CXXFLAGS="$CXXFLAGS"
5630-
CXXFLAGS="$CXXFLAGS -std=c++14"
5631+
CXXFLAGS="-std=c++14"
56315632
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
56325633
/* end confdefs.h. */
56335634
@@ -5672,15 +5673,9 @@ _ACEOF
56725673
if ac_fn_cxx_try_compile "$LINENO"; then :
56735674
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
56745675
$as_echo "no" >&6; }
5675-
CXXFLAGS="$TMP_CXXFLAGS -std=c++14"
5676-
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C++14 mode is now force enabled.
5677-
Make sure you use the same C++ mode for qBittorrent and its dependencies.
5678-
To explicitly set qBittorrent to a later mode use CXXFLAGS.
5679-
Example: \`CXXFLAGS=\"\$CXXFLAGS -std=c++14\" ./configure\`" >&5
5680-
$as_echo "$as_me: WARNING: C++14 mode is now force enabled.
5681-
Make sure you use the same C++ mode for qBittorrent and its dependencies.
5682-
To explicitly set qBittorrent to a later mode use CXXFLAGS.
5683-
Example: \`CXXFLAGS=\"\$CXXFLAGS -std=c++14\" ./configure\`" >&2;}
5676+
QBT_ADD_CONFIG="$QBT_ADD_CONFIG c++14"
5677+
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C++14 mode is now force enabled. The C++ mode should match the mode that other libraries were built with, otherwise you'll likely get linking errors." >&5
5678+
$as_echo "$as_me: WARNING: C++14 mode is now force enabled. The C++ mode should match the mode that other libraries were built with, otherwise you'll likely get linking errors." >&2;}
56845679
else
56855680
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
56865681
$as_echo "yes" >&6; }
@@ -5695,6 +5690,7 @@ fi
56955690
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
56965691

56975692
fi
5693+
CXXFLAGS="$TMP_CXXFLAGS"
56985694

56995695
# These are required because autoconf doesn't expand these **particular**
57005696
# vars automatically. And qmake cannot autoexpand them.

configure.ac

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ PKG_CHECK_MODULES(zlib,
210210
LIBS="$zlib_LIBS $LIBS"])
211211

212212
# Check if already in >= C++14 mode because of the flags returned by one of the above packages
213-
AC_MSG_CHECKING([if compiler is using C++14 or later mode])
213+
TMP_CXXFLAGS="$CXXFLAGS"
214+
CXXFLAGS=""
215+
AC_MSG_CHECKING([if compiler defaults to C++14 or later mode])
214216
AC_COMPILE_IFELSE([DETECT_CPP14_PROGRAM()],
215217
[AC_MSG_RESULT([yes])
216218
QBT_CXX14_FOUND="yes"],
@@ -221,25 +223,22 @@ AC_COMPILE_IFELSE([DETECT_CPP14_PROGRAM()],
221223
# and if yes, enable it leaving a warning to the user
222224
AS_IF([test "x$QBT_CXX14_FOUND" = "xno"],
223225
[AC_MSG_CHECKING([if compiler supports C++14])
224-
TMP_CXXFLAGS="$CXXFLAGS"
225-
CXXFLAGS="$CXXFLAGS -std=c++14"
226+
CXXFLAGS="-std=c++14"
226227
AC_COMPILE_IFELSE([DETECT_CPP14_PROGRAM()],
227228
[AC_MSG_RESULT([yes])
228229
AC_MSG_CHECKING([if C++14 is disabled by the set compiler flags])
229230
# prepend the flag so it won't override conflicting user defined flags
230231
CXXFLAGS="-std=c++14 $TMP_CXXFLAGS"
231232
AC_COMPILE_IFELSE([DETECT_CPP14_PROGRAM()],
232233
[AC_MSG_RESULT([no])
233-
CXXFLAGS="$TMP_CXXFLAGS -std=c++14"
234-
AC_MSG_WARN([C++14 mode is now force enabled.
235-
Make sure you use the same C++ mode for qBittorrent and its dependencies.
236-
To explicitly set qBittorrent to a later mode use CXXFLAGS.
237-
Example: `CXXFLAGS="\$CXXFLAGS -std=c++14" ./configure`])],
234+
QBT_ADD_CONFIG="$QBT_ADD_CONFIG c++14"
235+
AC_MSG_WARN([C++14 mode is now force enabled. The C++ mode should match the mode that other libraries were built with, otherwise you'll likely get linking errors.])],
238236
[AC_MSG_RESULT([yes])
239237
AC_MSG_ERROR([The compiler supports C++14 but the user or a dependency has explicitly enabled a lower mode.])])],
240238
[AC_MSG_RESULT([no])
241239
AC_MSG_ERROR([A compiler supporting C++14 is required.])])
242240
])
241+
CXXFLAGS="$TMP_CXXFLAGS"
243242

244243
# These are required because autoconf doesn't expand these **particular**
245244
# vars automatically. And qmake cannot autoexpand them.

0 commit comments

Comments
 (0)