mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Implement proper C++11 mode detection
Newer compilers have C++14 mode as default and package maintainers tend to not specifying a C++ version when building a package, this causes compatibility issues when (for example) qbt is compiled in C++11 and dependency lib is in C++14. See issue #9485. What this commit does: 1. Checks if compiler supports at least C++11 2. Checks if compiler is set in at least C++11 mode
This commit is contained in:
parent
019da6a98c
commit
819a84eb7a
4 changed files with 251 additions and 159 deletions
28
configure.ac
28
configure.ac
|
@ -8,8 +8,6 @@ AC_LANG(C++)
|
|||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
|
||||
|
||||
# Define --wth-* and --enable-* arguments
|
||||
|
||||
AC_ARG_WITH(qtsingleapplication,
|
||||
|
@ -204,6 +202,32 @@ PKG_CHECK_MODULES(zlib,
|
|||
[CPPFLAGS="$zlib_CFLAGS $CPPFLAGS"
|
||||
LIBS="$zlib_LIBS $LIBS"])
|
||||
|
||||
# Check compiler C++11 support
|
||||
AC_LANG_PUSH(C++)
|
||||
m4_define([DETECT_CPP11_PROGRAM],
|
||||
[AC_LANG_PROGRAM([[
|
||||
#ifndef __cplusplus
|
||||
#error "This is not a C++ compiler"
|
||||
#elif __cplusplus < 201103L
|
||||
#error "This is not a C++11 compiler"
|
||||
#endif]],
|
||||
[[]])])
|
||||
|
||||
_tmp="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -std=c++11"
|
||||
AC_COMPILE_IFELSE([DETECT_CPP11_PROGRAM()],
|
||||
[],
|
||||
[AC_MSG_ERROR([A compiler supporting C++11 is required.])])
|
||||
|
||||
CXXFLAGS="$_tmp $libtorrent_CFLAGS"
|
||||
AC_COMPILE_IFELSE([DETECT_CPP11_PROGRAM()],
|
||||
[],
|
||||
[AC_MSG_ERROR([Compiler is not working in C++11 or later mode.
|
||||
Make sure you use the same C++ mode for qBittorrent and its dependencies.
|
||||
Example: `CXXFLAGS="\$CXXFLAGS -std=c++11" ./configure`])])
|
||||
CXXFLAGS="$_tmp"
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
# These are required because autoconf doesn't expand these **particular**
|
||||
# vars automatically. And qmake cannot autoexpand them.
|
||||
AX_DEFINE_DIR([EXPAND_PREFIX], [prefix])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue