Browse Source

Merge pull request #10037 from Chocobo1/configure

Enforce C++14 requirement
adaptive-webui-19844
Mike Tzou 6 years ago committed by GitHub
parent
commit
94998b5da0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 68
      configure
  2. 51
      configure.ac
  3. 10
      m4/qbittorrent.m4
  4. 6
      macxconf.pri
  5. 9
      unixconf.pri

68
configure vendored

@ -5590,16 +5590,16 @@ $as_echo "yes" >&6; }
LIBS="$zlib_LIBS $LIBS" LIBS="$zlib_LIBS $LIBS"
fi fi
# Check if already in >= C++11 mode because of the flags returned by one of the above packages # Check if already in >= C++14 mode because of the flags returned by one of the above packages
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is using C++11 or later mode" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is using C++14 or later mode" >&5
$as_echo_n "checking if compiler is using C++11 or later mode... " >&6; } $as_echo_n "checking if compiler is using C++14 or later mode... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#ifndef __cplusplus #ifndef __cplusplus
#error "This is not a C++ compiler" #error "This is not a C++ compiler"
#elif __cplusplus < 201103L #elif __cplusplus < 201402L
#error "This is not a C++11 compiler" #error "This is not a C++14 compiler"
#endif #endif
int int
main () main ()
@ -5613,28 +5613,28 @@ _ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then : if ac_fn_cxx_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
QBT_CXX11_FOUND="yes" QBT_CXX14_FOUND="yes"
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }
QBT_CXX11_FOUND="no" QBT_CXX14_FOUND="no"
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# In case of no, check if the compiler can support at least C++11 # In case of no, check if the compiler can support at least C++14
# and if yes, enable it leaving a warning to the user # and if yes, enable it leaving a warning to the user
if test "x$QBT_CXX11_FOUND" = "xno"; then : if test "x$QBT_CXX14_FOUND" = "xno"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports C++11" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports C++14" >&5
$as_echo_n "checking if compiler supports C++11... " >&6; } $as_echo_n "checking if compiler supports C++14... " >&6; }
TMP_CXXFLAGS="$CXXFLAGS" TMP_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -std=c++11" CXXFLAGS="$CXXFLAGS -std=c++14"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#ifndef __cplusplus #ifndef __cplusplus
#error "This is not a C++ compiler" #error "This is not a C++ compiler"
#elif __cplusplus < 201103L #elif __cplusplus < 201402L
#error "This is not a C++11 compiler" #error "This is not a C++14 compiler"
#endif #endif
int int
main () main ()
@ -5648,17 +5648,17 @@ _ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then : if ac_fn_cxx_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if C++11 is disabled by the set compiler flags" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if C++14 is disabled by the set compiler flags" >&5
$as_echo_n "checking if C++11 is disabled by the set compiler flags... " >&6; } $as_echo_n "checking if C++14 is disabled by the set compiler flags... " >&6; }
# prepend the flag so it won't override conflicting user defined flags # prepend the flag so it won't override conflicting user defined flags
CXXFLAGS="-std=c++11 $TMP_CXXFLAGS" CXXFLAGS="-std=c++14 $TMP_CXXFLAGS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#ifndef __cplusplus #ifndef __cplusplus
#error "This is not a C++ compiler" #error "This is not a C++ compiler"
#elif __cplusplus < 201103L #elif __cplusplus < 201402L
#error "This is not a C++11 compiler" #error "This is not a C++14 compiler"
#endif #endif
int int
main () main ()
@ -5672,25 +5672,25 @@ _ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then : if ac_fn_cxx_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }
CXXFLAGS="$TMP_CXXFLAGS -std=c++11" CXXFLAGS="$TMP_CXXFLAGS -std=c++14"
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C++11 mode is now force enabled. { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C++14 mode is now force enabled.
Make sure you use the same C++ mode for qBittorrent and its dependencies. Make sure you use the same C++ mode for qBittorrent and its dependencies.
To explicitly set qBittorrent to a later mode use CXXFLAGS. To explicitly set qBittorrent to a later mode use CXXFLAGS.
Example: \`CXXFLAGS=\"\$CXXFLAGS -std=c++14\" ./configure\`" >&5 Example: \`CXXFLAGS=\"\$CXXFLAGS -std=c++14\" ./configure\`" >&5
$as_echo "$as_me: WARNING: C++11 mode is now force enabled. $as_echo "$as_me: WARNING: C++14 mode is now force enabled.
Make sure you use the same C++ mode for qBittorrent and its dependencies. Make sure you use the same C++ mode for qBittorrent and its dependencies.
To explicitly set qBittorrent to a later mode use CXXFLAGS. To explicitly set qBittorrent to a later mode use CXXFLAGS.
Example: \`CXXFLAGS=\"\$CXXFLAGS -std=c++14\" ./configure\`" >&2;} Example: \`CXXFLAGS=\"\$CXXFLAGS -std=c++14\" ./configure\`" >&2;}
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
as_fn_error $? "The compiler supports C++11 but the user or a dependency has explicitly enabled a lower mode." "$LINENO" 5 as_fn_error $? "The compiler supports C++14 but the user or a dependency has explicitly enabled a lower mode." "$LINENO" 5
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }
as_fn_error $? "A compiler supporting C++11 is required." "$LINENO" 5 as_fn_error $? "A compiler supporting C++14 is required." "$LINENO" 5
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@ -8433,21 +8433,17 @@ fi
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: Running qmake to generate the makefile..." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: Running qmake to generate the makefile..." >&5
$as_echo "$as_me: Running qmake to generate the makefile..." >&6;} $as_echo "$as_me: Running qmake to generate the makefile..." >&6;}
CONFDIR="$( cd "$( dirname "$0" )" && pwd )" TOPDIR="$(cd "$(dirname "$0")" && pwd)"
$QT_QMAKE -r "$TOPDIR/qbittorrent.pro" "QMAKE_LRELEASE=$QMAKE_LRELEASE"
$QT_QMAKE -r $CONFDIR/qbittorrent.pro "QMAKE_LRELEASE=$QMAKE_LRELEASE" qmake_ret="$?"
ret="$?"
$as_echo $as_echo
if test "x$ret" = "x0"; then : if test "x$qmake_ret" != "x0"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: Good, your configure finished." >&5 as_fn_error $? "$QT_QMAKE failed to generate the makefile" "$LINENO" 5
$as_echo "$as_me: Good, your configure finished." >&6;}
else
as_fn_error $? "Failed running $QT_QMAKE to generate the makefile" "$LINENO" 5
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: Good, the configure finished." >&5
$as_echo "$as_me: Good, the configure finished." >&6;}
$as_echo $as_echo

51
configure.ac

@ -209,36 +209,36 @@ PKG_CHECK_MODULES(zlib,
[CXXFLAGS="$zlib_CFLAGS $CXXFLAGS" [CXXFLAGS="$zlib_CFLAGS $CXXFLAGS"
LIBS="$zlib_LIBS $LIBS"]) LIBS="$zlib_LIBS $LIBS"])
# Check if already in >= C++11 mode because of the flags returned by one of the above packages # Check if already in >= C++14 mode because of the flags returned by one of the above packages
AC_MSG_CHECKING([if compiler is using C++11 or later mode]) AC_MSG_CHECKING([if compiler is using C++14 or later mode])
AC_COMPILE_IFELSE([DETECT_CPP11_PROGRAM()], AC_COMPILE_IFELSE([DETECT_CPP14_PROGRAM()],
[AC_MSG_RESULT([yes]) [AC_MSG_RESULT([yes])
QBT_CXX11_FOUND="yes"], QBT_CXX14_FOUND="yes"],
[AC_MSG_RESULT([no]) [AC_MSG_RESULT([no])
QBT_CXX11_FOUND="no"]) QBT_CXX14_FOUND="no"])
# In case of no, check if the compiler can support at least C++11 # In case of no, check if the compiler can support at least C++14
# and if yes, enable it leaving a warning to the user # and if yes, enable it leaving a warning to the user
AS_IF([test "x$QBT_CXX11_FOUND" = "xno"], AS_IF([test "x$QBT_CXX14_FOUND" = "xno"],
[AC_MSG_CHECKING([if compiler supports C++11]) [AC_MSG_CHECKING([if compiler supports C++14])
TMP_CXXFLAGS="$CXXFLAGS" TMP_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -std=c++11" CXXFLAGS="$CXXFLAGS -std=c++14"
AC_COMPILE_IFELSE([DETECT_CPP11_PROGRAM()], AC_COMPILE_IFELSE([DETECT_CPP14_PROGRAM()],
[AC_MSG_RESULT([yes]) [AC_MSG_RESULT([yes])
AC_MSG_CHECKING([if C++11 is disabled by the set compiler flags]) AC_MSG_CHECKING([if C++14 is disabled by the set compiler flags])
# prepend the flag so it won't override conflicting user defined flags # prepend the flag so it won't override conflicting user defined flags
CXXFLAGS="-std=c++11 $TMP_CXXFLAGS" CXXFLAGS="-std=c++14 $TMP_CXXFLAGS"
AC_COMPILE_IFELSE([DETECT_CPP11_PROGRAM()], AC_COMPILE_IFELSE([DETECT_CPP14_PROGRAM()],
[AC_MSG_RESULT([no]) [AC_MSG_RESULT([no])
CXXFLAGS="$TMP_CXXFLAGS -std=c++11" CXXFLAGS="$TMP_CXXFLAGS -std=c++14"
AC_MSG_WARN([C++11 mode is now force enabled. AC_MSG_WARN([C++14 mode is now force enabled.
Make sure you use the same C++ mode for qBittorrent and its dependencies. Make sure you use the same C++ mode for qBittorrent and its dependencies.
To explicitly set qBittorrent to a later mode use CXXFLAGS. To explicitly set qBittorrent to a later mode use CXXFLAGS.
Example: `CXXFLAGS="\$CXXFLAGS -std=c++14" ./configure`])], Example: `CXXFLAGS="\$CXXFLAGS -std=c++14" ./configure`])],
[AC_MSG_RESULT([yes]) [AC_MSG_RESULT([yes])
AC_MSG_ERROR([The compiler supports C++11 but the user or a dependency has explicitly enabled a lower mode.])])], AC_MSG_ERROR([The compiler supports C++14 but the user or a dependency has explicitly enabled a lower mode.])])],
[AC_MSG_RESULT([no]) [AC_MSG_RESULT([no])
AC_MSG_ERROR([A compiler supporting C++11 is required.])]) AC_MSG_ERROR([A compiler supporting C++14 is required.])])
]) ])
# These are required because autoconf doesn't expand these **particular** # These are required because autoconf doesn't expand these **particular**
@ -292,17 +292,14 @@ AC_OUTPUT(conf.pri)
AS_IF([test "x$enable_systemd" = "xyes"], AS_IF([test "x$enable_systemd" = "xyes"],
[AC_OUTPUT(dist/unix/systemd/qbittorrent-nox@.service)]) [AC_OUTPUT(dist/unix/systemd/qbittorrent-nox@.service)])
AC_MSG_NOTICE([Running qmake to generate the makefile...]) AC_MSG_NOTICE([Running qmake to generate the makefile...])
CONFDIR="$( cd "$( dirname "$0" )" && pwd )" TOPDIR="$(cd "$(dirname "$0")" && pwd)"
$QT_QMAKE -r "$TOPDIR/qbittorrent.pro" "QMAKE_LRELEASE=$QMAKE_LRELEASE"
$QT_QMAKE -r [$CONFDIR]/qbittorrent.pro "QMAKE_LRELEASE=$QMAKE_LRELEASE" qmake_ret="$?"
ret="$?"
AS_ECHO() AS_ECHO()
AS_IF([test "x$ret" = "x0"], AS_IF([test "x$qmake_ret" != "x0"],
[AC_MSG_NOTICE([Good, your configure finished.])], [AC_MSG_ERROR([$QT_QMAKE failed to generate the makefile])])
[AC_MSG_ERROR([Failed running $QT_QMAKE to generate the makefile])])
AC_MSG_NOTICE([Good, the configure finished.])
AS_ECHO() AS_ECHO()

10
m4/qbittorrent.m4

@ -37,15 +37,15 @@ AC_DEFUN([FIND_QTDBUS],
HAVE_QTDBUS=[false]]) HAVE_QTDBUS=[false]])
]) ])
# DETECT_CPP11_PROGRAM() # DETECT_CPP14_PROGRAM()
# Detects if at least C++11 mode is enabled. # Detects if at least C++14 mode is enabled.
# -------------------------------------- # --------------------------------------
AC_DEFUN([DETECT_CPP11_PROGRAM], AC_DEFUN([DETECT_CPP14_PROGRAM],
[AC_LANG_PROGRAM([[ [AC_LANG_PROGRAM([[
#ifndef __cplusplus #ifndef __cplusplus
#error "This is not a C++ compiler" #error "This is not a C++ compiler"
#elif __cplusplus < 201103L #elif __cplusplus < 201402L
#error "This is not a C++11 compiler" #error "This is not a C++14 compiler"
#endif]], #endif]],
[[]]) [[]])
]) ])

6
macxconf.pri

@ -1,11 +1,9 @@
# Generated by the configure file
# Ignore any WARNING about 'conf.pri' missing during configure. The file should be found during make.
# If not there will be a WARNING again.
# The first path is used when the source is being build by packagers (pbuilder/sbuild/etc) # The first path is used when the source is being build by packagers (pbuilder/sbuild/etc)
# The second path is used when you manually run the configure script in the root folder (eg when using qt creator) # The second path is used when you manually run the configure script in the root folder (eg when using qt creator)
exists($$OUT_PWD/../conf.pri) { exists($$OUT_PWD/../conf.pri) {
include($$OUT_PWD/../conf.pri) include($$OUT_PWD/../conf.pri)
} else { }
else {
include(conf.pri) include(conf.pri)
} }

9
unixconf.pri

@ -1,11 +1,9 @@
# Generated by the configure file
# Ignore any WARNING about 'conf.pri' missing during configure. The file should be found during make.
# If not there will be a WARNING again.
# The first path is used when the source is being build by packagers (pbuilder/sbuild/etc) # The first path is used when the source is being build by packagers (pbuilder/sbuild/etc)
# The second path is used when you manually run the configure script in the root folder (eg when using qt creator) # The second path is used when you manually run the configure script in the root folder (eg when using qt creator)
exists($$OUT_PWD/../conf.pri) { exists($$OUT_PWD/../conf.pri) {
include($$OUT_PWD/../conf.pri) include($$OUT_PWD/../conf.pri)
} else { }
else {
include(conf.pri) include(conf.pri)
} }
@ -18,7 +16,8 @@ QMAKE_CXXFLAGS += -Wall -Wextra -Wpedantic -Wformat-security
# Man page # Man page
nogui { nogui {
man.files = ../doc/qbittorrent-nox.1 man.files = ../doc/qbittorrent-nox.1
} else { }
else {
man.files = ../doc/qbittorrent.1 man.files = ../doc/qbittorrent.1
} }

Loading…
Cancel
Save