From 8289b3008886a77fb7f7f085f427f923367312bc Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Fri, 29 Jan 2021 09:54:52 +0100 Subject: [PATCH] BUILD: Add SDL2-image to the dependencies (--with-depends) --- CHANGELOG.md | 1 + configure | 3498 ++++++++++++++++++++++--------------------- configure.ac | 16 +- depends/depends.txt | 14 +- depends/rules.txt | 14 +- 5 files changed, 1782 insertions(+), 1761 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c6f0cc4..6fe0cdc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Add AppImage builds for lektord, lkt and klkt - Add basic controls to klkt (play, pause, next, previous, shuffle) - Remove archlinux package support (replaced by AppImage) +- Fix: the moveid was in fact a move command, no range supported - Bug fix: reduce libs to link to lkt (dear autoconf...) - Bug fix: fix #84, next and prev commands didn't worked correctly - Bug fix: fix deadlock on next kara (the new aerobrin...) diff --git a/configure b/configure index e1059a64..d7f162e5 100755 --- a/configure +++ b/configure @@ -634,6 +634,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +HAVE_CXX17 LKT_LIB_DIR LKT_LIB_LINK LKT_DEPENDS_ENABLE_FALSE @@ -676,7 +677,6 @@ PATCHELF LKT_APPIMAGE_FALSE LKT_APPIMAGE_TRUE LKT_DEBUG_ENABLED -HAVE_CXX17 CXXCPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE @@ -13565,6 +13565,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -17281,2144 +17282,2153 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test "$XXD" = ":"; then : + as_fn_error $? "xxd is required" "$LINENO" 5 +fi +if test "$MAN" = ":"; then : + as_fn_error $? "man is required" "$LINENO" 5 +fi +if test "$TEST_MAKE" = ":"; then : + as_fn_error $? "make is required" "$LINENO" 5 +fi +if test "$TEST_SQLITE" = ":"; then : + as_fn_error $? "sqlite3 is required" "$LINENO" 5 +fi - ax_cxx_compile_alternatives="17 1z" ax_cxx_compile_cxx17_required=true - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - ac_success=no +if ! test `sqlite3 --version | cut -f1 -d'.'` = 3 || \ + ! test `sqlite3 --version | cut -f2 -d'.'` -ge 30; then : + as_fn_error $? "sqlite in version >= 3.30 is needed" "$LINENO" 5 +fi +if test "$LKT_PATH_SOURCE" = "$LKT_PATH_BUILD"; then : + as_fn_error $? "The build directory can't be the same as the source directory" "$LINENO" 5 +fi +########### +# OPTIONS # +########### - if test x$ac_success = xno; then - for alternative in ${ax_cxx_compile_alternatives}; do - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=`$as_echo "ax_cv_cxx_compile_cxx17_$switch" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++17 features with $switch" >&5 -$as_echo_n "checking whether $CXX supports C++17 features with $switch... " >&6; } -if eval \${$cachevar+:} false; then : - $as_echo_n "(cached) " >&6 +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; LKT_DEBUG_ENABLED=$enableval else - ac_save_CXX="$CXX" - CXX="$CXX $switch" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" + LKT_DEBUG_ENABLED=no +fi -#elif __cplusplus < 201103L +if test "x${LKT_DEBUG_ENABLED}" = "xyes" ; then -#error "This is not a C++11 compiler" +cat >>confdefs.h <<_ACEOF +#define LKT_DEBUG_ENABLED "$LKT_DEBUG_ENABLED" +_ACEOF -#else -namespace cxx11 -{ +fi - namespace test_static_assert - { +# Check whether --enable-appimage was given. +if test "${enable_appimage+set}" = set; then : + enableval=$enable_appimage; LKT_APPIMAGE=$enableval +else + LKT_APPIMAGE=no +fi - template <typename T> - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; + if test "x${LKT_APPIMAGE}" = "xyes"; then + LKT_APPIMAGE_TRUE= + LKT_APPIMAGE_FALSE='#' +else + LKT_APPIMAGE_TRUE='#' + LKT_APPIMAGE_FALSE= +fi - } +if test "x${LKT_APPIMAGE}" = "xyes"; then : - namespace test_final_override - { + # Download tools for appimages + # Extract the first word of "patchelf", so it can be a program name with args. +set dummy patchelf; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PATCHELF+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PATCHELF in + [\\/]* | ?:[\\/]*) + ac_cv_path_PATCHELF="$PATCHELF" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PATCHELF="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - struct Base - { - virtual void f() {} - }; + test -z "$ac_cv_path_PATCHELF" && ac_cv_path_PATCHELF=":" + ;; +esac +fi +PATCHELF=$ac_cv_path_PATCHELF +if test -n "$PATCHELF"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATCHELF" >&5 +$as_echo "$PATCHELF" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - struct Derived : public Base - { - virtual void f() override {} - }; - } + # Extract the first word of "wget", so it can be a program name with args. +set dummy wget; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_WGET+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $WGET in + [\\/]* | ?:[\\/]*) + ac_cv_path_WGET="$WGET" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_WGET="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - namespace test_double_right_angle_brackets - { + test -z "$ac_cv_path_WGET" && ac_cv_path_WGET=":" + ;; +esac +fi +WGET=$ac_cv_path_WGET +if test -n "$WGET"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WGET" >&5 +$as_echo "$WGET" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - template < typename T > - struct check {}; - typedef check<void> single_type; - typedef check<check<void>> double_type; - typedef check<check<check<void>>> triple_type; - typedef check<check<check<check<void>>>> quadruple_type; + # Extract the first word of "chmod", so it can be a program name with args. +set dummy chmod; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_CHMOD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $CHMOD in + [\\/]* | ?:[\\/]*) + ac_cv_path_CHMOD="$CHMOD" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_CHMOD="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - } + test -z "$ac_cv_path_CHMOD" && ac_cv_path_CHMOD=":" + ;; +esac +fi +CHMOD=$ac_cv_path_CHMOD +if test -n "$CHMOD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHMOD" >&5 +$as_echo "$CHMOD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - namespace test_decltype - { - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } + if test "$PATCHELF" = ":"; then : + as_fn_error $? "patchelf is required for AppImage" "$LINENO" 5 +fi + if test "$WGET" = ":"; then : + as_fn_error $? "wget is required for AppImage" "$LINENO" 5 +fi + if test "$CHMOD" = ":"; then : + as_fn_error $? "chmod is required for AppImage" "$LINENO" 5 +fi - } + LKT_APPIMAGETOOL="$LKT_PATH_SOURCE/utils/appimagetool-`arch`.AppImage" + LKT_LINUXDEPLOY="$LKT_PATH_SOURCE/utils/linuxdeploy-`arch`.AppImage" - namespace test_type_deduction - { - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - template < typename T > - struct is_same<T, T> - { - static const bool value = true; - }; + # Download the AppImage creation tool, transforms the AppDir into an AppImage + { $as_echo "$as_me:${as_lineno-$LINENO}: checking AppImage creation tool" >&5 +$as_echo_n "checking AppImage creation tool... " >&6; } + if test ! -x "$LKT_APPIMAGETOOL" ; then + PRESENT_IN_PATH=`which $(basename $LKT_APPIMAGETOOL)` + if test $? -eq 0 ; then + cp $PRESENT_IN_PATH $LKT_APPIMAGETOOL + if test $? -eq 0 ; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: from path" >&5 +$as_echo "from path" >&6; } +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed from path +See \`config.log' for more details" "$LINENO" 5; } +fi + else + $WGET https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-`arch`.AppImage \ + -O "$LKT_APPIMAGETOOL" -o config.wget.log + $CHMOD 00700 $LKT_PATH_SOURCE/utils/appimagetool.AppImage + if test $? -eq 0 ; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed +See \`config.log' for more details" "$LINENO" 5; } +fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: already downloaded" >&5 +$as_echo "already downloaded" >&6; } + fi - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } + # Downlaod the AppDir management tool, create the AppDir + { $as_echo "$as_me:${as_lineno-$LINENO}: checking LinuxDeploy creation tool" >&5 +$as_echo_n "checking LinuxDeploy creation tool... " >&6; } + if test ! -x "$LKT_LINUXDEPLOY" ; then + PRESENT_IN_PATH=`which $(basename $LKT_LINUXDEPLOY)` + if test $? -eq 0 ; then + cp $PRESENT_IN_PATH $LKT_LINUXDEPLOY + if test $? -eq 0 ; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: from path" >&5 +$as_echo "from path" >&6; } +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed from path +See \`config.log' for more details" "$LINENO" 5; } +fi + else + $WGET https://martinm.iiens.net/linuxdeploy -O "$LKT_LINUXDEPLOY" -a config.wget.log + $CHMOD 00700 $LKT_LINUXDEPLOY + if test $? -eq 0 ; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed +See \`config.log' for more details" "$LINENO" 5; } +fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: already downloaded" >&5 +$as_echo "already downloaded" >&6; } + fi - int - test(const int c, volatile int v) - { - static_assert(is_same<int, decltype(0)>::value == true, ""); - static_assert(is_same<int, decltype(c)>::value == false, ""); - static_assert(is_same<int, decltype(v)>::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same<int, decltype(ac)>::value == true, ""); - static_assert(is_same<int, decltype(av)>::value == true, ""); - static_assert(is_same<int, decltype(sumi)>::value == true, ""); - static_assert(is_same<int, decltype(sumf)>::value == false, ""); - static_assert(is_same<int, decltype(add(c, v))>::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } +else - } + { $as_echo "$as_me:${as_lineno-$LINENO}: Don't build appimages for lektord, lkt and klkt" >&5 +$as_echo "$as_me: Don't build appimages for lektord, lkt and klkt" >&6;} - namespace test_noexcept - { +fi - int f() { return 0; } - int g() noexcept { return 0; } +# Check whether --enable-static-module was given. +if test "${enable_static_module+set}" = set; then : + enableval=$enable_static_module; LKT_STATIC_MODULE=$enableval +else + LKT_STATIC_MODULE=yes +fi - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); + if test "x${LKT_STATIC_MODULE}" = "xyes"; then + LKT_STATIC_MODULE_TRUE= + LKT_STATIC_MODULE_FALSE='#' +else + LKT_STATIC_MODULE_TRUE='#' + LKT_STATIC_MODULE_FALSE= +fi - } +if test "x${LKT_STATIC_MODULE}" = "xyes" ; then - namespace test_constexpr - { +$as_echo "#define LKT_STATIC_MODULE /**/" >>confdefs.h - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } +fi - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); +# Check whether --enable-klkt was given. +if test "${enable_klkt+set}" = set; then : + enableval=$enable_klkt; LKT_KLKT=$enableval +else + LKT_KLKT=no +fi - } + if test "x${LKT_KLKT}" = "xyes"; then + LKT_KLKT_TRUE= + LKT_KLKT_FALSE='#' +else + LKT_KLKT_TRUE='#' + LKT_KLKT_FALSE= +fi - namespace test_rvalue_references - { +if test "x${LKT_KLKT}" = "xyes" ; then + # Qt is C++, so we need a C++ compiler... and some other progs... + echo "$as_me: this is autotroll.m4 serial 4" >&5 - template < int N > - struct answer - { - static constexpr int value = N; - }; + test x"$TROLL" != x && echo 'ViM rox emacs.' - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } +# Check whether --with-qt was given. +if test "${with_qt+set}" = set; then : + withval=$with_qt; QT_PATH=$withval +fi - } - namespace test_uniform_initialization - { + # this is a hack to get decent flow control with 'break' + for _qt_ignored in once; do - struct test - { - static const int zero {}; - static const int one {1}; - }; + # Find Qt. - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); + if test -d /usr/local/Trolltech; then + # Try to find the latest version. + tmp_qt_paths=`echo /usr/local/Trolltech/*/bin | tr ' ' '\n' | sort -nr \ + | xargs | sed 's/ */:/g'` + fi + # Path to which recent MacPorts (~v1.7) install Qt4. + test -d /opt/local/libexec/qt4-mac/bin \ + && tmp_qt_paths="$tmp_qt_paths:/opt/local/libexec/qt4-mac/bin" - } + # Find qmake. - namespace test_lambdas - { + for ac_prog in qmake qmake-qt4 qmake-qt3 +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_QMAKE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $QMAKE in + [\\/]* | ?:[\\/]*) + ac_cv_path_QMAKE="$QMAKE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$QT_DIR:$QT_PATH:$PATH:$tmp_qt_paths" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_QMAKE="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } + ;; +esac +fi +QMAKE=$ac_cv_path_QMAKE +if test -n "$QMAKE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $QMAKE" >&5 +$as_echo "$QMAKE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - } - - namespace test_variadic_templates - { + test -n "$QMAKE" && break +done +test -n "$QMAKE" || QMAKE="missing" - template <int...> - struct sum; + if test x"$QMAKE" = xmissing; then + as_fn_error $? "Cannot find qmake in your PATH. Try using --with-qt." "$LINENO" 5 + break + fi - template <int N0, int... N1toN> - struct sum<N0, N1toN...> - { - static constexpr auto value = N0 + sum<N1toN...>::value; - }; + # Find moc (Meta Object Compiler). - template <> - struct sum<> - { - static constexpr auto value = 0; - }; + for ac_prog in moc moc-qt4 moc-qt3 +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MOC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MOC in + [\\/]* | ?:[\\/]*) + ac_cv_path_MOC="$MOC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$QT_PATH:$PATH:$tmp_qt_paths" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_MOC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + ;; +esac +fi +MOC=$ac_cv_path_MOC +if test -n "$MOC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MOC" >&5 +$as_echo "$MOC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - } - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { + test -n "$MOC" && break +done +test -n "$MOC" || MOC="missing" - struct foo {}; + if test x"$MOC" = xmissing; then + as_fn_error $? "Cannot find moc (Meta Object Compiler) in your PATH. Try using --with-qt." "$LINENO" 5 + break + fi - template<typename T> - using member = typename T::member_type; + # Find uic (User Interface Compiler). - template<typename T> - void func(...) {} + for ac_prog in uic uic-qt4 uic-qt3 uic3 +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_UIC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $UIC in + [\\/]* | ?:[\\/]*) + ac_cv_path_UIC="$UIC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$QT_PATH:$PATH:$tmp_qt_paths" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_UIC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - template<typename T> - void func(member<T>*) {} + ;; +esac +fi +UIC=$ac_cv_path_UIC +if test -n "$UIC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UIC" >&5 +$as_echo "$UIC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - void test(); - void test() { func<foo>(0); } + test -n "$UIC" && break +done +test -n "$UIC" || UIC="missing" - } + if test x"$UIC" = xmissing; then + as_fn_error $? "Cannot find uic (User Interface Compiler) in your PATH. Try using --with-qt." "$LINENO" 5 + break + fi -} // namespace cxx11 + # Find rcc (Qt Resource Compiler). -#endif // __cplusplus >= 201103L + for ac_prog in rcc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_RCC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $RCC in + [\\/]* | ?:[\\/]*) + ac_cv_path_RCC="$RCC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$QT_PATH:$PATH:$tmp_qt_paths" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_RCC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + ;; +esac +fi +RCC=$ac_cv_path_RCC +if test -n "$RCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RCC" >&5 +$as_echo "$RCC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + test -n "$RCC" && break +done +test -n "$RCC" || RCC="false" -// If the compiler admits that it is not ready for C++14, why torture it? -// Hopefully, this will speed up the test. + if test x"$UIC" = xfalse; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find rcc (Qt Resource Compiler) in your PATH.\ + Try using --with-qt." >&5 +$as_echo "$as_me: WARNING: Cannot find rcc (Qt Resource Compiler) in your PATH.\ + Try using --with-qt." >&2;} + fi -#ifndef __cplusplus + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether host operating system is Darwin" >&5 +$as_echo_n "checking whether host operating system is Darwin... " >&6; } + at_darwin=no + at_qmake_args= + case $host_os in + darwin*) + at_darwin=yes + at_qmake_args='-spec macx-g++' + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_darwin" >&5 +$as_echo "$at_darwin" >&6; } -#error "This is not a C++ compiler" + # If we don't know the path to Qt, guess it from the path to qmake. + if test x"$QT_PATH" = x; then + QT_PATH=`dirname "$QMAKE"` + fi + if test x"$QT_PATH" = x; then + as_fn_error $? "Cannot find the path to your Qt install. Use --with-qt." "$LINENO" 5 + break + fi -#elif __cplusplus < 201402L -#error "This is not a C++14 compiler" + # Get ready to build a test-app with Qt. + if mkdir conftest.dir && cd conftest.dir; then :; else + as_fn_error $? "Cannot mkdir conftest.dir or cd to that directory." "$LINENO" 5 + break + fi -#else + cat >conftest.h <<_ASEOF +#include <QObject> -namespace cxx14 +class Foo: public QObject { + Q_OBJECT; +public: + Foo(); + ~Foo() {} +public Q_SLOTS: + void setValue(int value); +Q_SIGNALS: + void valueChanged(int newValue); +private: + int value_; +}; +_ASEOF - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } + cat >conftest.cpp <<_ASEOF +#include "conftest.h" +Foo::Foo() + : value_ (42) +{ + connect(this, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); +} - } +void Foo::setValue(int value) +{ + value_ = value; +} - namespace test_binary_literals - { +int main() +{ + Foo f; +} +_ASEOF + if $QMAKE -project; then :; else + as_fn_error $? "Calling $QMAKE -project failed." "$LINENO" 5 + break + fi - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); + # Find the .pro file generated by qmake. + pro_file='conftest.dir.pro' + test -f $pro_file || pro_file=`echo *.pro` + if test -f "$pro_file"; then :; else + as_fn_error $? "Can't find the .pro file generated by Qmake." "$LINENO" 5 + break + fi - } - namespace test_generalized_constexpr - { - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - } - namespace test_lambda_init_capture - { - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } + echo "$as_me:$LINENO: Invoking $QMAKE on $pro_file" >&5 + sed 's/^/| /' "$pro_file" >&5 - } + if $QMAKE $at_qmake_args; then :; else + as_fn_error $? "Calling $QMAKE $at_qmake_args failed." "$LINENO" 5 + break + fi - namespace test_digit_separators - { + # QMake has a very annoying misfeature: sometimes it generates Makefiles + # where all the references to the files from the Qt installation are + # relative. We can't use them as-is because if we take, say, a + # -I../../usr/include/Qt from that Makefile, the flag is invalid as soon + # as we use it in another (sub) directory. So what this perl pass does is + # that it rewrite all relative paths to absolute paths. Another problem + # when building on Cygwin is that QMake mixes paths with blackslashes and + # forward slashes and paths must be handled with extra care because of the + # stupid Windows drive letters. + echo "$as_me:$LINENO: fixing the Makefiles:" Makefile* >&5 + cat >fixmk.pl <<\EOF +use strict; +use Cwd qw(cwd abs_path); +# This variable is useful on Cygwin for the following reason: Say that you are +# in `/' (that is, in fact you are in C:/cygwin, or something like that) if you +# `cd ..' then obviously you remain in `/' (that is in C:/cygwin). QMake +# generates paths that are relative to C:/ (or another driver letter, whatever) +# so the trick to get the `..' resolved properly is to prepend the absolute +# path of the current working directory in a Windows-style. C:/cygwin/../ will +# properly become C:/. +my $d = ""; +my $r2a = 0; +my $b2f = 0; - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); +my $cygwin = 0; +if ($^O eq "cygwin") { + $cygwin = 1; + $d = cwd(); + $d = `cygpath --mixed '$d'`; + chomp($d); + $d .= "/"; +} +sub rel2abs($) +{ + my $p = $d . shift; + # print "r2a p=$p"; + -e $p || return $p; + if ($cygwin) { + $p = `cygpath --mixed '$p'`; + chomp($p); } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same<T, T> - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same<int, decltype(f(x))>::value, ""); - static_assert(is_same<int&, decltype(g(x))>::value, ""); - return x; - } - + else { + # Do not use abs_path on Cygwin: it incorrectly resolves the paths that are + # relative to C:/ rather than `/'. + $p = abs_path($p); } + # print " -> $p\n"; + ++$r2a; + return $p; +} -} // namespace cxx14 - -#endif // __cplusplus >= 201402L - - - +# Only useful on Cygwin. +sub back2forward($) +{ + my $p = shift; + # print "b2f p=$p"; + -e $p || return $p; + $p = `cygpath --mixed '$p'`; + chomp($p); + # print " -> $p\n"; + ++$b2f; + return $p; +} -// If the compiler admits that it is not ready for C++17, why torture it? -// Hopefully, this will speed up the test. +foreach my $mk (@ARGV) +{ + next if $mk =~ /~$/; + open(MK, $mk) or die("open $mk: $!"); + # print "mk=$mk\n"; + my $file = join("", <MK>); + close(MK) or die("close $mk: $!"); + rename $mk, $mk . "~" or die("rename $mk: $!"); + $file =~ s{(?:\.\.[\\/])+(?:[^"'\s:]+)}{rel2abs($&)}gse; + $file =~ s{(?:[a-zA-Z]:[\\/])?(?:[^"\s]+\\[^"\s:]+)+} + {back2forward($&)}gse if $cygwin; + open(MK, ">", $mk) or die("open >$mk: $!"); + print MK $file; + close(MK) or die("close >$mk: $!"); + print "$mk: updated $r2a relative paths and $b2f backslash-style paths\n"; + $r2a = 0; + $b2f = 0; +} +EOF -#ifndef __cplusplus + perl >&5 -w fixmk.pl Makefile* || + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: failed to fix the Makefiles generated by $QMAKE" >&5 +$as_echo "$as_me: WARNING: failed to fix the Makefiles generated by $QMAKE" >&2;} + rm -f fixmk.pl -#error "This is not a C++ compiler" + # Try to compile a simple Qt app. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can build a simple Qt app" >&5 +$as_echo_n "checking whether we can build a simple Qt app... " >&6; } +if ${at_cv_qt_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + at_cv_qt_build=ko + : ${MAKE=make} -#elif __cplusplus < 201703L + if $MAKE >&5 2>&1; then + at_cv_qt_build='ok, looks like Qt 4' + else + echo "$as_me:$LINENO: Build failed, trying to #include <qobject.h> \ +instead" >&5 + sed 's/<QObject>/<qobject.h>/' conftest.h > tmp.h && mv tmp.h conftest.h + if $MAKE >&5 2>&1; then + at_cv_qt_build='ok, looks like Qt 3' + else + # Sometimes (such as on Debian) build will fail because Qt hasn't been + # installed in debug mode and qmake tries (by default) to build apps in + # debug mode => Try again in release mode. + echo "$as_me:$LINENO: Build failed, trying to enforce release mode" \ + >&5 -#error "This is not a C++17 compiler" + # Tweak the value of CONFIG in the .pro file for +release. -#else + qt_conf='' + for at_mod in +release; do + at_mod=`echo "$at_mod" | sed 's/^-//; tough + s/^+//; beef + :ough + s/^/CONFIG -= /;n + :eef + s/^/CONFIG += /'` + qt_conf="$qt_conf +$at_mod" + done + echo "$qt_conf" | sed 1d >>"$pro_file" -#include <initializer_list> -#include <utility> -#include <type_traits> -namespace cxx17 -{ - - namespace test_constexpr_lambdas - { + sed 's/<qobject.h>/<QObject>/' conftest.h > tmp.h && mv tmp.h conftest.h + if $MAKE >&5 2>&1; then + at_cv_qt_build='ok, looks like Qt 4, release mode forced' + else + echo "$as_me:$LINENO: Build failed, trying to #include <qobject.h> \ +instead" >&5 + sed 's/<QObject>/<qobject.h>/' conftest.h >tmp.h && mv tmp.h conftest.h + if $MAKE >&5 2>&1; then + at_cv_qt_build='ok, looks like Qt 3, release mode forced' + else + at_cv_qt_build=ko + echo "$as_me:$LINENO: failed program was:" >&5 + sed 's/^/| /' conftest.h >&5 + echo "$as_me:$LINENO: failed program was:" >&5 + sed 's/^/| /' conftest.cpp >&5 + fi # if make with Qt3-style #include and release mode forced. + fi # if make with Qt4-style #include and release mode forced. + fi # if make with Qt3-style #include. + fi # if make with Qt4-style #include. - constexpr int foo = [](){return 42;}(); +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_qt_build" >&5 +$as_echo "$at_cv_qt_build" >&6; } + if test x"$at_cv_qt_build" = xko; then + as_fn_error $? "Cannot build a test Qt program" "$LINENO" 5 + break + fi + QT_VERSION_MAJOR=`echo "$at_cv_qt_build" | sed 's/[^0-9]*//g'` - } - namespace test::nested_namespace::definitions - { + # This sed filter is applied after an expression of the form: /^FOO.*=/!d; + # It starts by removing the beginning of the line, removing references to + # SUBLIBS, removing unnecessary whitespaces at the beginning, and prefixes + # all variable uses by QT_. + qt_sed_filter='s///; + s/$(SUBLIBS)//g; + s/^ *//; + s/\$(\([A-Z_][A-Z_]*\))/$(QT_\1)/g' - } + # Find the Makefile (qmake happens to generate a fake Makefile which invokes + # a Makefile.Debug or Makefile.Release). We we have both, we'll pick the + # Makefile.Release. The reason is that the main difference is that release + # uses -Os and debug -g. We can override -Os by passing another -O but we + # usually don't override -g. + if test -f Makefile.Release; then + at_mfile='Makefile.Release' + else + at_mfile='Makefile' + fi + if test -f $at_mfile; then :; else + as_fn_error $? "Cannot find the Makefile generated by qmake." "$LINENO" 5 + break + fi - namespace test_fold_expression - { + # Find the DEFINES of Qt (should have been named CPPFLAGS). + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the DEFINES to use with Qt" >&5 +$as_echo_n "checking for the DEFINES to use with Qt... " >&6; } +if ${at_cv_env_QT_DEFINES+:} false; then : + $as_echo_n "(cached) " >&6 +else + at_cv_env_QT_DEFINES=`sed "/^DEFINES[^A-Z=]*=/!d;$qt_sed_filter" $at_mfile` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_DEFINES" >&5 +$as_echo "$at_cv_env_QT_DEFINES" >&6; } + QT_DEFINES=$at_cv_env_QT_DEFINES - template<typename... Args> - int multiply(Args... args) - { - return (args * ... * 1); - } - template<typename... Args> - bool all(Args... args) - { - return (args && ...); - } + # Find the CFLAGS of Qt (We can use Qt in C?!) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the CFLAGS to use with Qt" >&5 +$as_echo_n "checking for the CFLAGS to use with Qt... " >&6; } +if ${at_cv_env_QT_CFLAGS+:} false; then : + $as_echo_n "(cached) " >&6 +else + at_cv_env_QT_CFLAGS=`sed "/^CFLAGS[^A-Z=]*=/!d;$qt_sed_filter" $at_mfile` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_CFLAGS" >&5 +$as_echo "$at_cv_env_QT_CFLAGS" >&6; } + QT_CFLAGS=$at_cv_env_QT_CFLAGS - } - namespace test_extended_static_assert - { + # Find the CXXFLAGS of Qt. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the CXXFLAGS to use with Qt" >&5 +$as_echo_n "checking for the CXXFLAGS to use with Qt... " >&6; } +if ${at_cv_env_QT_CXXFLAGS+:} false; then : + $as_echo_n "(cached) " >&6 +else + at_cv_env_QT_CXXFLAGS=`sed "/^CXXFLAGS[^A-Z=]*=/!d;$qt_sed_filter" $at_mfile` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_CXXFLAGS" >&5 +$as_echo "$at_cv_env_QT_CXXFLAGS" >&6; } + QT_CXXFLAGS=$at_cv_env_QT_CXXFLAGS - static_assert (true); - } + # Find the INCPATH of Qt. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the INCPATH to use with Qt" >&5 +$as_echo_n "checking for the INCPATH to use with Qt... " >&6; } +if ${at_cv_env_QT_INCPATH+:} false; then : + $as_echo_n "(cached) " >&6 +else + at_cv_env_QT_INCPATH=`sed "/^INCPATH[^A-Z=]*=/!d;$qt_sed_filter" $at_mfile` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_INCPATH" >&5 +$as_echo "$at_cv_env_QT_INCPATH" >&6; } + QT_INCPATH=$at_cv_env_QT_INCPATH - namespace test_auto_brace_init_list - { - auto foo = {5}; - auto bar {5}; + QT_CPPFLAGS="$at_cv_env_QT_DEFINES $at_cv_env_QT_INCPATH" - static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value); - static_assert(std::is_same<int, decltype(bar)>::value); - } - namespace test_typename_in_template_template_parameter - { + # Find the LFLAGS of Qt (Should have been named LDFLAGS) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the LDFLAGS to use with Qt" >&5 +$as_echo_n "checking for the LDFLAGS to use with Qt... " >&6; } +if ${at_cv_env_QT_LDFLAGS+:} false; then : + $as_echo_n "(cached) " >&6 +else + at_cv_env_QT_LDFLAGS=`sed "/^LFLAGS[^A-Z=]*=/!d;$qt_sed_filter" $at_mfile` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_LDFLAGS" >&5 +$as_echo "$at_cv_env_QT_LDFLAGS" >&6; } + QT_LFLAGS=$at_cv_env_QT_LDFLAGS - template<template<typename> typename X> struct D; + QT_LDFLAGS=$at_cv_env_QT_LDFLAGS - } - namespace test_fallthrough_nodiscard_maybe_unused_attributes - { + # Find the LIBS of Qt. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the LIBS to use with Qt" >&5 +$as_echo_n "checking for the LIBS to use with Qt... " >&6; } +if ${at_cv_env_QT_LIBS+:} false; then : + $as_echo_n "(cached) " >&6 +else + at_cv_env_QT_LIBS=`sed "/^LIBS[^A-Z]*=/!d;$qt_sed_filter" $at_mfile` + if test x$at_darwin = xyes; then + # Fix QT_LIBS: as of today Libtool (GNU Libtool 1.5.23a) doesn't handle + # -F properly. The "bug" has been fixed on 22 October 2006 + # by Peter O'Gorman but we provide backward compatibility here. + at_cv_env_QT_LIBS=`echo "$at_cv_env_QT_LIBS" \ + | sed 's/^-F/-Wl,-F/;s/ -F/ -Wl,-F/g'` + fi - int f1() - { - return 42; - } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_LIBS" >&5 +$as_echo "$at_cv_env_QT_LIBS" >&6; } + QT_LIBS=$at_cv_env_QT_LIBS - [[nodiscard]] int f2() - { - [[maybe_unused]] auto unused = f1(); - switch (f1()) - { - case 17: - f1(); - [[fallthrough]]; - case 42: - f1(); - } - return f1(); - } + cd .. && rm -rf conftest.dir - } + # Run the user code - namespace test_extended_aggregate_initialization - { - struct base1 - { - int b1, b2 = 42; - }; + done # end hack (useless for to be able to use break) - struct base2 - { - base2() { - b3 = 42; - } - int b3; - }; - struct derived : base1, base2 - { - int d; - }; + # Check for Qt lybraries - derived d1 {{1, 2}, {}, 4}; // full initialization - derived d2 {{}, {}, 4}; // value-initialized bases - } - namespace test_general_range_based_for_loop - { - struct iter - { - int i; - int& operator* () - { - return i; - } - const int& operator* () const - { - return i; - } - iter& operator++() - { - ++i; - return *this; - } - }; +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - struct sentinel - { - int i; - }; + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - bool operator== (const iter& i, const sentinel& s) - { - return i.i == s.i; - } - bool operator!= (const iter& i, const sentinel& s) - { - return !(i == s); - } +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - struct range - { - iter begin() const - { - return {0}; - } + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - sentinel end() const - { - return {5}; - } - }; + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi - void f() - { - range r {}; +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi - for (auto i : r) - { - [[maybe_unused]] auto v = i; - } - } +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" >&5 +$as_echo_n "checking for Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify... " >&6; } - } +if test -n "$QT_CFLAGS"; then + pkg_cv_QT_CFLAGS="$QT_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify\""; } >&5 + ($PKG_CONFIG --exists --print-errors "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_QT_CFLAGS=`$PKG_CONFIG --cflags "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$QT_LIBS"; then + pkg_cv_QT_LIBS="$QT_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify\""; } >&5 + ($PKG_CONFIG --exists --print-errors "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_QT_LIBS=`$PKG_CONFIG --libs "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi - namespace test_lambda_capture_asterisk_this_by_value - { - struct t - { - int i; - int foo() - { - return [*this]() - { - return i; - }(); - } - }; - } +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } - namespace test_enum_class_construction - { +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + QT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" 2>&1` + else + QT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$QT_PKG_ERRORS" >&5 - enum class byte : unsigned char - {}; + as_fn_error $? "Qt libraries are required." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "Qt libraries are required." "$LINENO" 5 +else + QT_CFLAGS=$pkg_cv_QT_CFLAGS + QT_LIBS=$pkg_cv_QT_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } - byte foo {42}; +fi - } + QT_REQUIREMENTS="Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" + QT_LDFLAGS="`$PKG_CONFIG --libs-only-L $QT_REQUIREMENTS`" + QT_CPPFLAGS="`$PKG_CONFIG --cflags-only-I $QT_REQUIREMENTS` -DQT_DISABLE_DEPRECATED_BEFORE=0x060000" + QT_LIBS="`$PKG_CONFIG --libs-only-l $QT_REQUIREMENTS`" - namespace test_constexpr_if - { - template <bool cond> - int f () - { - if constexpr(cond) - { - return 13; - } - else - { - return 42; - } - } - } +fi - namespace test_selection_statement_with_initializer - { - int f() - { - return 13; - } +# Check whether --with-liblektor was given. +if test "${with_liblektor+set}" = set; then : + withval=$with_liblektor; LKT_STATIC_LIB=$withval +else + LKT_STATIC_LIB=shared +fi - int f2() - { - if (auto i = f(); i > 0) - { - return 3; - } + if test "x${LKT_STATIC_LIB}" = "xstatic"; then + LKT_STATIC_LIB_TRUE= + LKT_STATIC_LIB_FALSE='#' +else + LKT_STATIC_LIB_TRUE='#' + LKT_STATIC_LIB_FALSE= +fi - switch (auto i = f(); i + 4) - { - case 17: - return 2; +if ! test "x${LKT_STATIC_LIB}" = "xstatic" -o "x${LKT_STATIC_LIB}" = "xshared" ; then + as_fn_error $? "Please use \"static\" or \"shared\" for the --with-liblektor option" "$LINENO" 5 +fi - default: - return 1; - } - } - } +cat >>confdefs.h <<_ACEOF +#define LKT_PREFIX_PATH "$prefix" +_ACEOF - namespace test_template_argument_deduction_for_class_templates - { - template <typename T1, typename T2> - struct pair - { - pair (T1 p1, T2 p2) - : m1 {p1}, - m2 {p2} - {} - - T1 m1; - T2 m2; - }; - void f() - { - [[maybe_unused]] auto p = pair{13, 42u}; - } - } +cat >>confdefs.h <<_ACEOF +#define LKT_MAN_BINARY "$(which man)" +_ACEOF - namespace test_non_type_auto_template_parameters - { - template <auto n> - struct B - {}; - B<5> b1; - B<'a'> b2; - } +cat >>confdefs.h <<_ACEOF +#define LKT_COMPILER "$CC" +_ACEOF - namespace test_structured_bindings - { - int arr[2] = { 1, 2 }; - std::pair<int, int> pr = { 1, 2 }; - auto f1() -> int(&)[2] - { - return arr; - } +LKT_BUILD_STRING="$(basename $CC)/$(basename $CXX) $(uname -s) $(uname -p) $(uname -r) $(uname -m)" - auto f2() -> std::pair<int, int>& - { - return pr; - } +cat >>confdefs.h <<_ACEOF +#define LKT_BUILD_STRING "$LKT_BUILD_STRING" +_ACEOF - struct S - { - int x1 : 2; - volatile double y1; - }; - S f3() - { - return {}; - } - auto [ x1, y1 ] = f1(); - auto& [ xr1, yr1 ] = f1(); - auto [ x2, y2 ] = f2(); - auto& [ xr2, yr2 ] = f2(); - const auto [ x3, y3 ] = f3(); +LKT_ENDIANES_LITTLE="$(echo -n I | od -to2 | head -n1 | cut -f2 -d" " | cut -c6)" +if test "$LKT_ENDIANES_LITTLE" = "1" ; then - } +cat >>confdefs.h <<_ACEOF +#define LKT_ENDIANES_LITTLE 1 +_ACEOF - namespace test_exception_spec_type_system - { - struct Good {}; - struct Bad {}; +else - void g1() noexcept; - void g2(); +cat >>confdefs.h <<_ACEOF +#define LKT_ENDIANES_BIG 1 +_ACEOF - template<typename T> - Bad - f(T*, T*); - template<typename T1, typename T2> - Good - f(T1*, T2*); +fi - static_assert (std::is_same_v<Good, decltype(f(g1, g2))>); +########## +# CFLAGS # +########## - } +BASEFLAGS=`test "x${LKT_DEBUG_ENABLED}" = 'xyes' && echo "-g" || echo "-O3"` +CFLAGS="-Werror -Wall -Wextra ${BASEFLAGS} -std=c11" +LDFLAGS="-rdynamic" +ARFLAGS="cr" +AR_FLAGS=$ARFLAGS - namespace test_inline_variables - { +################################# +# BUILD WITH THE DEPENDS SCRIPT # +################################# - template<class T> void f(T) - {} - template<class T> inline T g(T) - { - return T{}; - } +# Check whether --with-depends was given. +if test "${with_depends+set}" = set; then : + withval=$with_depends; LKT_BUILD_DEPENDS=$withval +else + LKT_BUILD_DEPENDS=no +fi - template<> inline void f<>(int) - {} + if test "x${LKT_BUILD_DEPENDS}" = "xyes"; then + LKT_DEPENDS_ENABLE_TRUE= + LKT_DEPENDS_ENABLE_FALSE='#' +else + LKT_DEPENDS_ENABLE_TRUE='#' + LKT_DEPENDS_ENABLE_FALSE= +fi - template<> int g<>(int) - { - return 5; - } +if test "x$LKT_BUILD_DEPENDS" = "xyes" ; then + LKT_LIB_DIR="$PWD/depends_install/lib" + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + enable_shared=no +fi - } -} // namespace cxx17 -#endif // __cplusplus < 201703L -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - eval $cachevar=yes -else - eval $cachevar=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXX="$ac_save_CXX" -fi -eval ac_res=\$$cachevar - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - if test x$ac_success = xyes; then - break - fi - done - fi - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu + CFLAGS="${CFLAGS} -I$PWD/depends_install/include" + LDFLAGS="-L$PWD/depends_install/lib ${LDFLAGS}" - if test x$ax_cxx_compile_cxx17_required = xtrue; then - if test x$ac_success = xno; then - as_fn_error $? "*** A compiler with support for C++17 language features is required." "$LINENO" 5 + # Download and build dependencies + cd $LKT_PATH_SOURCE + ./utils/scripts/depends.bash $LKT_PATH_BUILD + if test $? -ne 0 ; then + as_fn_error 1 "\"Failed to download and build dependencies\"" "$LINENO" 5 fi - fi - if test x$ac_success = xno; then - HAVE_CXX17=0 - { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++17 support was found" >&5 -$as_echo "$as_me: No compiler with C++17 support was found" >&6;} - else - HAVE_CXX17=1 - -$as_echo "#define HAVE_CXX17 1" >>confdefs.h + cd $LKT_PATH_BUILD - fi + LKT_LIB_LINK="" + for lib in $LKT_LIB_DIR/*.a; do + LKT_LIB_LINK="$lib $LKT_LIB_LINK" + done -if test "$XXD" = ":"; then : - as_fn_error $? "xxd is required" "$LINENO" 5 -fi -if test "$MAN" = ":"; then : - as_fn_error $? "man is required" "$LINENO" 5 -fi -if test "$TEST_MAKE" = ":"; then : - as_fn_error $? "make is required" "$LINENO" 5 -fi -if test "$TEST_SQLITE" = ":"; then : - as_fn_error $? "sqlite3 is required" "$LINENO" 5 + # Update path + PATH="$PWD/depends_install/bin:$PATH" fi -if ! test `sqlite3 --version | cut -f1 -d'.'` = 3 || \ - ! test `sqlite3 --version | cut -f2 -d'.'` -ge 30; then : - as_fn_error $? "sqlite in version >= 3.30 is needed" "$LINENO" 5 -fi +############################################ +# Check C++ compiler support for standards # +############################################ -if test "$LKT_PATH_SOURCE" = "$LKT_PATH_BUILD"; then : - as_fn_error $? "The build directory can't be the same as the source directory" "$LINENO" 5 -fi -########### -# OPTIONS # -########### + ax_cxx_compile_alternatives="17 1z" ax_cxx_compile_cxx17_required=true + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + ac_success=no -# Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then : - enableval=$enable_debug; LKT_DEBUG_ENABLED=$enableval -else - LKT_DEBUG_ENABLED=no -fi -if test "x${LKT_DEBUG_ENABLED}" = "xyes" ; then -cat >>confdefs.h <<_ACEOF -#define LKT_DEBUG_ENABLED "$LKT_DEBUG_ENABLED" -_ACEOF + if test x$ac_success = xno; then + for alternative in ${ax_cxx_compile_alternatives}; do + for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do + cachevar=`$as_echo "ax_cv_cxx_compile_cxx17_$switch" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++17 features with $switch" >&5 +$as_echo_n "checking whether $CXX supports C++17 features with $switch... " >&6; } +if eval \${$cachevar+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_CXX="$CXX" + CXX="$CXX $switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -fi +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. -# Check whether --enable-appimage was given. -if test "${enable_appimage+set}" = set; then : - enableval=$enable_appimage; LKT_APPIMAGE=$enableval -else - LKT_APPIMAGE=no -fi +#ifndef __cplusplus - if test "x${LKT_APPIMAGE}" = "xyes"; then - LKT_APPIMAGE_TRUE= - LKT_APPIMAGE_FALSE='#' -else - LKT_APPIMAGE_TRUE='#' - LKT_APPIMAGE_FALSE= -fi +#error "This is not a C++ compiler" -if test "x${LKT_APPIMAGE}" = "xyes"; then : +#elif __cplusplus < 201103L - # Download tools for appimages - # Extract the first word of "patchelf", so it can be a program name with args. -set dummy patchelf; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PATCHELF+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PATCHELF in - [\\/]* | ?:[\\/]*) - ac_cv_path_PATCHELF="$PATCHELF" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PATCHELF="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS +#error "This is not a C++11 compiler" - test -z "$ac_cv_path_PATCHELF" && ac_cv_path_PATCHELF=":" - ;; -esac -fi -PATCHELF=$ac_cv_path_PATCHELF -if test -n "$PATCHELF"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATCHELF" >&5 -$as_echo "$PATCHELF" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +#else +namespace cxx11 +{ - # Extract the first word of "wget", so it can be a program name with args. -set dummy wget; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_WGET+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $WGET in - [\\/]* | ?:[\\/]*) - ac_cv_path_WGET="$WGET" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_WGET="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + namespace test_static_assert + { - test -z "$ac_cv_path_WGET" && ac_cv_path_WGET=":" - ;; -esac -fi -WGET=$ac_cv_path_WGET -if test -n "$WGET"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WGET" >&5 -$as_echo "$WGET" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + template <typename T> + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + } - # Extract the first word of "chmod", so it can be a program name with args. -set dummy chmod; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CHMOD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $CHMOD in - [\\/]* | ?:[\\/]*) - ac_cv_path_CHMOD="$CHMOD" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_CHMOD="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + namespace test_final_override + { - test -z "$ac_cv_path_CHMOD" && ac_cv_path_CHMOD=":" - ;; -esac -fi -CHMOD=$ac_cv_path_CHMOD -if test -n "$CHMOD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHMOD" >&5 -$as_echo "$CHMOD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + struct Base + { + virtual void f() {} + }; + struct Derived : public Base + { + virtual void f() override {} + }; - if test "$PATCHELF" = ":"; then : - as_fn_error $? "patchelf is required for AppImage" "$LINENO" 5 -fi - if test "$WGET" = ":"; then : - as_fn_error $? "wget is required for AppImage" "$LINENO" 5 -fi - if test "$CHMOD" = ":"; then : - as_fn_error $? "chmod is required for AppImage" "$LINENO" 5 -fi + } - LKT_APPIMAGETOOL="$LKT_PATH_SOURCE/utils/appimagetool-`arch`.AppImage" - LKT_LINUXDEPLOY="$LKT_PATH_SOURCE/utils/linuxdeploy-`arch`.AppImage" + namespace test_double_right_angle_brackets + { + template < typename T > + struct check {}; + typedef check<void> single_type; + typedef check<check<void>> double_type; + typedef check<check<check<void>>> triple_type; + typedef check<check<check<check<void>>>> quadruple_type; - # Download the AppImage creation tool, transforms the AppDir into an AppImage - { $as_echo "$as_me:${as_lineno-$LINENO}: checking AppImage creation tool" >&5 -$as_echo_n "checking AppImage creation tool... " >&6; } - if test ! -x "$LKT_APPIMAGETOOL" ; then - PRESENT_IN_PATH=`which $(basename $LKT_APPIMAGETOOL)` - if test $? -eq 0 ; then - cp $PRESENT_IN_PATH $LKT_APPIMAGETOOL - if test $? -eq 0 ; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: from path" >&5 -$as_echo "from path" >&6; } -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed from path -See \`config.log' for more details" "$LINENO" 5; } -fi - else - $WGET https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-`arch`.AppImage \ - -O "$LKT_APPIMAGETOOL" -o config.wget.log - $CHMOD 00700 $LKT_PATH_SOURCE/utils/appimagetool.AppImage - if test $? -eq 0 ; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed -See \`config.log' for more details" "$LINENO" 5; } -fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: already downloaded" >&5 -$as_echo "already downloaded" >&6; } - fi + } - # Downlaod the AppDir management tool, create the AppDir - { $as_echo "$as_me:${as_lineno-$LINENO}: checking LinuxDeploy creation tool" >&5 -$as_echo_n "checking LinuxDeploy creation tool... " >&6; } - if test ! -x "$LKT_LINUXDEPLOY" ; then - PRESENT_IN_PATH=`which $(basename $LKT_LINUXDEPLOY)` - if test $? -eq 0 ; then - cp $PRESENT_IN_PATH $LKT_LINUXDEPLOY - if test $? -eq 0 ; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: from path" >&5 -$as_echo "from path" >&6; } -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed from path -See \`config.log' for more details" "$LINENO" 5; } -fi - else - $WGET https://martinm.iiens.net/linuxdeploy -O "$LKT_LINUXDEPLOY" -a config.wget.log - $CHMOD 00700 $LKT_LINUXDEPLOY - if test $? -eq 0 ; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed -See \`config.log' for more details" "$LINENO" 5; } -fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: already downloaded" >&5 -$as_echo "already downloaded" >&6; } - fi + namespace test_decltype + { -else + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } - { $as_echo "$as_me:${as_lineno-$LINENO}: Don't build appimages for lektord, lkt and klkt" >&5 -$as_echo "$as_me: Don't build appimages for lektord, lkt and klkt" >&6;} + } -fi + namespace test_type_deduction + { -# Check whether --enable-static-module was given. -if test "${enable_static_module+set}" = set; then : - enableval=$enable_static_module; LKT_STATIC_MODULE=$enableval -else - LKT_STATIC_MODULE=yes -fi + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same<T, T> + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same<int, decltype(0)>::value == true, ""); + static_assert(is_same<int, decltype(c)>::value == false, ""); + static_assert(is_same<int, decltype(v)>::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same<int, decltype(ac)>::value == true, ""); + static_assert(is_same<int, decltype(av)>::value == true, ""); + static_assert(is_same<int, decltype(sumi)>::value == true, ""); + static_assert(is_same<int, decltype(sumf)>::value == false, ""); + static_assert(is_same<int, decltype(add(c, v))>::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } - if test "x${LKT_STATIC_MODULE}" = "xyes"; then - LKT_STATIC_MODULE_TRUE= - LKT_STATIC_MODULE_FALSE='#' -else - LKT_STATIC_MODULE_TRUE='#' - LKT_STATIC_MODULE_FALSE= -fi + } -if test "x${LKT_STATIC_MODULE}" = "xyes" ; then + namespace test_variadic_templates + { -$as_echo "#define LKT_STATIC_MODULE /**/" >>confdefs.h + template <int...> + struct sum; + template <int N0, int... N1toN> + struct sum<N0, N1toN...> + { + static constexpr auto value = N0 + sum<N1toN...>::value; + }; -fi + template <> + struct sum<> + { + static constexpr auto value = 0; + }; -# Check whether --enable-klkt was given. -if test "${enable_klkt+set}" = set; then : - enableval=$enable_klkt; LKT_KLKT=$enableval -else - LKT_KLKT=no -fi + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - if test "x${LKT_KLKT}" = "xyes"; then - LKT_KLKT_TRUE= - LKT_KLKT_FALSE='#' -else - LKT_KLKT_TRUE='#' - LKT_KLKT_FALSE= -fi + } -if test "x${LKT_KLKT}" = "xyes" ; then - # Qt is C++, so we need a C++ compiler... and some other progs... - echo "$as_me: this is autotroll.m4 serial 4" >&5 + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { - test x"$TROLL" != x && echo 'ViM rox emacs.' + struct foo {}; + template<typename T> + using member = typename T::member_type; -# Check whether --with-qt was given. -if test "${with_qt+set}" = set; then : - withval=$with_qt; QT_PATH=$withval -fi + template<typename T> + void func(...) {} + template<typename T> + void func(member<T>*) {} - # this is a hack to get decent flow control with 'break' - for _qt_ignored in once; do + void test(); - # Find Qt. + void test() { func<foo>(0); } - if test -d /usr/local/Trolltech; then - # Try to find the latest version. - tmp_qt_paths=`echo /usr/local/Trolltech/*/bin | tr ' ' '\n' | sort -nr \ - | xargs | sed 's/ */:/g'` - fi - # Path to which recent MacPorts (~v1.7) install Qt4. - test -d /opt/local/libexec/qt4-mac/bin \ - && tmp_qt_paths="$tmp_qt_paths:/opt/local/libexec/qt4-mac/bin" + } - # Find qmake. +} // namespace cxx11 - for ac_prog in qmake qmake-qt4 qmake-qt3 -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_QMAKE+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $QMAKE in - [\\/]* | ?:[\\/]*) - ac_cv_path_QMAKE="$QMAKE" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$QT_DIR:$QT_PATH:$PATH:$tmp_qt_paths" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_QMAKE="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS +#endif // __cplusplus >= 201103L - ;; -esac -fi -QMAKE=$ac_cv_path_QMAKE -if test -n "$QMAKE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $QMAKE" >&5 -$as_echo "$QMAKE" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - test -n "$QMAKE" && break -done -test -n "$QMAKE" || QMAKE="missing" - if test x"$QMAKE" = xmissing; then - as_fn_error $? "Cannot find qmake in your PATH. Try using --with-qt." "$LINENO" 5 - break - fi +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. - # Find moc (Meta Object Compiler). +#ifndef __cplusplus - for ac_prog in moc moc-qt4 moc-qt3 -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_MOC+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MOC in - [\\/]* | ?:[\\/]*) - ac_cv_path_MOC="$MOC" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$QT_PATH:$PATH:$tmp_qt_paths" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_MOC="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS +#error "This is not a C++ compiler" - ;; -esac -fi -MOC=$ac_cv_path_MOC -if test -n "$MOC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MOC" >&5 -$as_echo "$MOC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +#elif __cplusplus < 201402L +#error "This is not a C++14 compiler" - test -n "$MOC" && break -done -test -n "$MOC" || MOC="missing" +#else - if test x"$MOC" = xmissing; then - as_fn_error $? "Cannot find moc (Meta Object Compiler) in your PATH. Try using --with-qt." "$LINENO" 5 - break - fi +namespace cxx14 +{ - # Find uic (User Interface Compiler). + namespace test_polymorphic_lambdas + { - for ac_prog in uic uic-qt4 uic-qt3 uic3 -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_UIC+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $UIC in - [\\/]* | ?:[\\/]*) - ac_cv_path_UIC="$UIC" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$QT_PATH:$PATH:$tmp_qt_paths" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_UIC="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } - ;; -esac -fi -UIC=$ac_cv_path_UIC -if test -n "$UIC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UIC" >&5 -$as_echo "$UIC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + } + namespace test_binary_literals + { - test -n "$UIC" && break -done -test -n "$UIC" || UIC="missing" + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); - if test x"$UIC" = xmissing; then - as_fn_error $? "Cannot find uic (User Interface Compiler) in your PATH. Try using --with-qt." "$LINENO" 5 - break - fi + } + + namespace test_generalized_constexpr + { - # Find rcc (Qt Resource Compiler). + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } - for ac_prog in rcc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_RCC+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $RCC in - [\\/]* | ?:[\\/]*) - ac_cv_path_RCC="$RCC" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$QT_PATH:$PATH:$tmp_qt_paths" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_RCC="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); - ;; -esac -fi -RCC=$ac_cv_path_RCC -if test -n "$RCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RCC" >&5 -$as_echo "$RCC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + } + namespace test_lambda_init_capture + { - test -n "$RCC" && break -done -test -n "$RCC" || RCC="false" + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } - if test x"$UIC" = xfalse; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find rcc (Qt Resource Compiler) in your PATH.\ - Try using --with-qt." >&5 -$as_echo "$as_me: WARNING: Cannot find rcc (Qt Resource Compiler) in your PATH.\ - Try using --with-qt." >&2;} - fi + } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether host operating system is Darwin" >&5 -$as_echo_n "checking whether host operating system is Darwin... " >&6; } - at_darwin=no - at_qmake_args= - case $host_os in - darwin*) - at_darwin=yes - at_qmake_args='-spec macx-g++' - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_darwin" >&5 -$as_echo "$at_darwin" >&6; } + namespace test_digit_separators + { - # If we don't know the path to Qt, guess it from the path to qmake. - if test x"$QT_PATH" = x; then - QT_PATH=`dirname "$QMAKE"` - fi - if test x"$QT_PATH" = x; then - as_fn_error $? "Cannot find the path to your Qt install. Use --with-qt." "$LINENO" 5 - break - fi + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + } - # Get ready to build a test-app with Qt. - if mkdir conftest.dir && cd conftest.dir; then :; else - as_fn_error $? "Cannot mkdir conftest.dir or cd to that directory." "$LINENO" 5 - break - fi + namespace test_return_type_deduction + { - cat >conftest.h <<_ASEOF -#include <QObject> + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } -class Foo: public QObject -{ - Q_OBJECT; -public: - Foo(); - ~Foo() {} -public Q_SLOTS: - void setValue(int value); -Q_SIGNALS: - void valueChanged(int newValue); -private: - int value_; -}; -_ASEOF + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; - cat >conftest.cpp <<_ASEOF -#include "conftest.h" -Foo::Foo() - : value_ (42) -{ - connect(this, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); -} + template < typename T > + struct is_same<T, T> + { + static constexpr auto value = true; + }; -void Foo::setValue(int value) -{ - value_ = value; -} + int + test() + { + auto x = 0; + static_assert(is_same<int, decltype(f(x))>::value, ""); + static_assert(is_same<int&, decltype(g(x))>::value, ""); + return x; + } -int main() -{ - Foo f; -} -_ASEOF - if $QMAKE -project; then :; else - as_fn_error $? "Calling $QMAKE -project failed." "$LINENO" 5 - break - fi + } - # Find the .pro file generated by qmake. - pro_file='conftest.dir.pro' - test -f $pro_file || pro_file=`echo *.pro` - if test -f "$pro_file"; then :; else - as_fn_error $? "Can't find the .pro file generated by Qmake." "$LINENO" 5 - break - fi +} // namespace cxx14 +#endif // __cplusplus >= 201402L +// If the compiler admits that it is not ready for C++17, why torture it? +// Hopefully, this will speed up the test. +#ifndef __cplusplus - echo "$as_me:$LINENO: Invoking $QMAKE on $pro_file" >&5 - sed 's/^/| /' "$pro_file" >&5 +#error "This is not a C++ compiler" - if $QMAKE $at_qmake_args; then :; else - as_fn_error $? "Calling $QMAKE $at_qmake_args failed." "$LINENO" 5 - break - fi +#elif __cplusplus < 201703L - # QMake has a very annoying misfeature: sometimes it generates Makefiles - # where all the references to the files from the Qt installation are - # relative. We can't use them as-is because if we take, say, a - # -I../../usr/include/Qt from that Makefile, the flag is invalid as soon - # as we use it in another (sub) directory. So what this perl pass does is - # that it rewrite all relative paths to absolute paths. Another problem - # when building on Cygwin is that QMake mixes paths with blackslashes and - # forward slashes and paths must be handled with extra care because of the - # stupid Windows drive letters. - echo "$as_me:$LINENO: fixing the Makefiles:" Makefile* >&5 - cat >fixmk.pl <<\EOF -use strict; -use Cwd qw(cwd abs_path); -# This variable is useful on Cygwin for the following reason: Say that you are -# in `/' (that is, in fact you are in C:/cygwin, or something like that) if you -# `cd ..' then obviously you remain in `/' (that is in C:/cygwin). QMake -# generates paths that are relative to C:/ (or another driver letter, whatever) -# so the trick to get the `..' resolved properly is to prepend the absolute -# path of the current working directory in a Windows-style. C:/cygwin/../ will -# properly become C:/. -my $d = ""; -my $r2a = 0; -my $b2f = 0; +#error "This is not a C++17 compiler" -my $cygwin = 0; -if ($^O eq "cygwin") { - $cygwin = 1; - $d = cwd(); - $d = `cygpath --mixed '$d'`; - chomp($d); - $d .= "/"; -} +#else -sub rel2abs($) -{ - my $p = $d . shift; - # print "r2a p=$p"; - -e $p || return $p; - if ($cygwin) { - $p = `cygpath --mixed '$p'`; - chomp($p); - } - else { - # Do not use abs_path on Cygwin: it incorrectly resolves the paths that are - # relative to C:/ rather than `/'. - $p = abs_path($p); - } - # print " -> $p\n"; - ++$r2a; - return $p; -} +#include <initializer_list> +#include <utility> +#include <type_traits> -# Only useful on Cygwin. -sub back2forward($) +namespace cxx17 { - my $p = shift; - # print "b2f p=$p"; - -e $p || return $p; - $p = `cygpath --mixed '$p'`; - chomp($p); - # print " -> $p\n"; - ++$b2f; - return $p; -} -foreach my $mk (@ARGV) -{ - next if $mk =~ /~$/; - open(MK, $mk) or die("open $mk: $!"); - # print "mk=$mk\n"; - my $file = join("", <MK>); - close(MK) or die("close $mk: $!"); - rename $mk, $mk . "~" or die("rename $mk: $!"); - $file =~ s{(?:\.\.[\\/])+(?:[^"'\s:]+)}{rel2abs($&)}gse; - $file =~ s{(?:[a-zA-Z]:[\\/])?(?:[^"\s]+\\[^"\s:]+)+} - {back2forward($&)}gse if $cygwin; - open(MK, ">", $mk) or die("open >$mk: $!"); - print MK $file; - close(MK) or die("close >$mk: $!"); - print "$mk: updated $r2a relative paths and $b2f backslash-style paths\n"; - $r2a = 0; - $b2f = 0; -} -EOF + namespace test_constexpr_lambdas + { + + constexpr int foo = [](){return 42;}(); + + } - perl >&5 -w fixmk.pl Makefile* || - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: failed to fix the Makefiles generated by $QMAKE" >&5 -$as_echo "$as_me: WARNING: failed to fix the Makefiles generated by $QMAKE" >&2;} - rm -f fixmk.pl + namespace test::nested_namespace::definitions + { - # Try to compile a simple Qt app. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can build a simple Qt app" >&5 -$as_echo_n "checking whether we can build a simple Qt app... " >&6; } -if ${at_cv_qt_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - at_cv_qt_build=ko - : ${MAKE=make} + } - if $MAKE >&5 2>&1; then - at_cv_qt_build='ok, looks like Qt 4' - else - echo "$as_me:$LINENO: Build failed, trying to #include <qobject.h> \ -instead" >&5 - sed 's/<QObject>/<qobject.h>/' conftest.h > tmp.h && mv tmp.h conftest.h - if $MAKE >&5 2>&1; then - at_cv_qt_build='ok, looks like Qt 3' - else - # Sometimes (such as on Debian) build will fail because Qt hasn't been - # installed in debug mode and qmake tries (by default) to build apps in - # debug mode => Try again in release mode. - echo "$as_me:$LINENO: Build failed, trying to enforce release mode" \ - >&5 + namespace test_fold_expression + { - # Tweak the value of CONFIG in the .pro file for +release. + template<typename... Args> + int multiply(Args... args) + { + return (args * ... * 1); + } - qt_conf='' - for at_mod in +release; do - at_mod=`echo "$at_mod" | sed 's/^-//; tough - s/^+//; beef - :ough - s/^/CONFIG -= /;n - :eef - s/^/CONFIG += /'` - qt_conf="$qt_conf -$at_mod" - done - echo "$qt_conf" | sed 1d >>"$pro_file" + template<typename... Args> + bool all(Args... args) + { + return (args && ...); + } + } - sed 's/<qobject.h>/<QObject>/' conftest.h > tmp.h && mv tmp.h conftest.h - if $MAKE >&5 2>&1; then - at_cv_qt_build='ok, looks like Qt 4, release mode forced' - else - echo "$as_me:$LINENO: Build failed, trying to #include <qobject.h> \ -instead" >&5 - sed 's/<QObject>/<qobject.h>/' conftest.h >tmp.h && mv tmp.h conftest.h - if $MAKE >&5 2>&1; then - at_cv_qt_build='ok, looks like Qt 3, release mode forced' - else - at_cv_qt_build=ko - echo "$as_me:$LINENO: failed program was:" >&5 - sed 's/^/| /' conftest.h >&5 - echo "$as_me:$LINENO: failed program was:" >&5 - sed 's/^/| /' conftest.cpp >&5 - fi # if make with Qt3-style #include and release mode forced. - fi # if make with Qt4-style #include and release mode forced. - fi # if make with Qt3-style #include. - fi # if make with Qt4-style #include. + namespace test_extended_static_assert + { -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_qt_build" >&5 -$as_echo "$at_cv_qt_build" >&6; } - if test x"$at_cv_qt_build" = xko; then - as_fn_error $? "Cannot build a test Qt program" "$LINENO" 5 - break - fi - QT_VERSION_MAJOR=`echo "$at_cv_qt_build" | sed 's/[^0-9]*//g'` + static_assert (true); + } - # This sed filter is applied after an expression of the form: /^FOO.*=/!d; - # It starts by removing the beginning of the line, removing references to - # SUBLIBS, removing unnecessary whitespaces at the beginning, and prefixes - # all variable uses by QT_. - qt_sed_filter='s///; - s/$(SUBLIBS)//g; - s/^ *//; - s/\$(\([A-Z_][A-Z_]*\))/$(QT_\1)/g' + namespace test_auto_brace_init_list + { - # Find the Makefile (qmake happens to generate a fake Makefile which invokes - # a Makefile.Debug or Makefile.Release). We we have both, we'll pick the - # Makefile.Release. The reason is that the main difference is that release - # uses -Os and debug -g. We can override -Os by passing another -O but we - # usually don't override -g. - if test -f Makefile.Release; then - at_mfile='Makefile.Release' - else - at_mfile='Makefile' - fi - if test -f $at_mfile; then :; else - as_fn_error $? "Cannot find the Makefile generated by qmake." "$LINENO" 5 - break - fi + auto foo = {5}; + auto bar {5}; - # Find the DEFINES of Qt (should have been named CPPFLAGS). - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the DEFINES to use with Qt" >&5 -$as_echo_n "checking for the DEFINES to use with Qt... " >&6; } -if ${at_cv_env_QT_DEFINES+:} false; then : - $as_echo_n "(cached) " >&6 -else - at_cv_env_QT_DEFINES=`sed "/^DEFINES[^A-Z=]*=/!d;$qt_sed_filter" $at_mfile` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_DEFINES" >&5 -$as_echo "$at_cv_env_QT_DEFINES" >&6; } - QT_DEFINES=$at_cv_env_QT_DEFINES + static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value); + static_assert(std::is_same<int, decltype(bar)>::value); + } + namespace test_typename_in_template_template_parameter + { - # Find the CFLAGS of Qt (We can use Qt in C?!) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the CFLAGS to use with Qt" >&5 -$as_echo_n "checking for the CFLAGS to use with Qt... " >&6; } -if ${at_cv_env_QT_CFLAGS+:} false; then : - $as_echo_n "(cached) " >&6 -else - at_cv_env_QT_CFLAGS=`sed "/^CFLAGS[^A-Z=]*=/!d;$qt_sed_filter" $at_mfile` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_CFLAGS" >&5 -$as_echo "$at_cv_env_QT_CFLAGS" >&6; } - QT_CFLAGS=$at_cv_env_QT_CFLAGS + template<template<typename> typename X> struct D; + } - # Find the CXXFLAGS of Qt. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the CXXFLAGS to use with Qt" >&5 -$as_echo_n "checking for the CXXFLAGS to use with Qt... " >&6; } -if ${at_cv_env_QT_CXXFLAGS+:} false; then : - $as_echo_n "(cached) " >&6 -else - at_cv_env_QT_CXXFLAGS=`sed "/^CXXFLAGS[^A-Z=]*=/!d;$qt_sed_filter" $at_mfile` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_CXXFLAGS" >&5 -$as_echo "$at_cv_env_QT_CXXFLAGS" >&6; } - QT_CXXFLAGS=$at_cv_env_QT_CXXFLAGS + namespace test_fallthrough_nodiscard_maybe_unused_attributes + { + int f1() + { + return 42; + } - # Find the INCPATH of Qt. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the INCPATH to use with Qt" >&5 -$as_echo_n "checking for the INCPATH to use with Qt... " >&6; } -if ${at_cv_env_QT_INCPATH+:} false; then : - $as_echo_n "(cached) " >&6 -else - at_cv_env_QT_INCPATH=`sed "/^INCPATH[^A-Z=]*=/!d;$qt_sed_filter" $at_mfile` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_INCPATH" >&5 -$as_echo "$at_cv_env_QT_INCPATH" >&6; } - QT_INCPATH=$at_cv_env_QT_INCPATH + [[nodiscard]] int f2() + { + [[maybe_unused]] auto unused = f1(); + switch (f1()) + { + case 17: + f1(); + [[fallthrough]]; + case 42: + f1(); + } + return f1(); + } - QT_CPPFLAGS="$at_cv_env_QT_DEFINES $at_cv_env_QT_INCPATH" + } + namespace test_extended_aggregate_initialization + { - # Find the LFLAGS of Qt (Should have been named LDFLAGS) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the LDFLAGS to use with Qt" >&5 -$as_echo_n "checking for the LDFLAGS to use with Qt... " >&6; } -if ${at_cv_env_QT_LDFLAGS+:} false; then : - $as_echo_n "(cached) " >&6 -else - at_cv_env_QT_LDFLAGS=`sed "/^LFLAGS[^A-Z=]*=/!d;$qt_sed_filter" $at_mfile` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_LDFLAGS" >&5 -$as_echo "$at_cv_env_QT_LDFLAGS" >&6; } - QT_LFLAGS=$at_cv_env_QT_LDFLAGS + struct base1 + { + int b1, b2 = 42; + }; - QT_LDFLAGS=$at_cv_env_QT_LDFLAGS + struct base2 + { + base2() { + b3 = 42; + } + int b3; + }; + struct derived : base1, base2 + { + int d; + }; - # Find the LIBS of Qt. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the LIBS to use with Qt" >&5 -$as_echo_n "checking for the LIBS to use with Qt... " >&6; } -if ${at_cv_env_QT_LIBS+:} false; then : - $as_echo_n "(cached) " >&6 -else - at_cv_env_QT_LIBS=`sed "/^LIBS[^A-Z]*=/!d;$qt_sed_filter" $at_mfile` - if test x$at_darwin = xyes; then - # Fix QT_LIBS: as of today Libtool (GNU Libtool 1.5.23a) doesn't handle - # -F properly. The "bug" has been fixed on 22 October 2006 - # by Peter O'Gorman but we provide backward compatibility here. - at_cv_env_QT_LIBS=`echo "$at_cv_env_QT_LIBS" \ - | sed 's/^-F/-Wl,-F/;s/ -F/ -Wl,-F/g'` - fi + derived d1 {{1, 2}, {}, 4}; // full initialization + derived d2 {{}, {}, 4}; // value-initialized bases -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $at_cv_env_QT_LIBS" >&5 -$as_echo "$at_cv_env_QT_LIBS" >&6; } - QT_LIBS=$at_cv_env_QT_LIBS + } + namespace test_general_range_based_for_loop + { - cd .. && rm -rf conftest.dir + struct iter + { + int i; - # Run the user code + int& operator* () + { + return i; + } + const int& operator* () const + { + return i; + } - done # end hack (useless for to be able to use break) + iter& operator++() + { + ++i; + return *this; + } + }; + struct sentinel + { + int i; + }; - # Check for Qt lybraries + bool operator== (const iter& i, const sentinel& s) + { + return i.i == s.i; + } + bool operator!= (const iter& i, const sentinel& s) + { + return !(i == s); + } + struct range + { + iter begin() const + { + return {0}; + } + sentinel end() const + { + return {5}; + } + }; + void f() + { + range r {}; + for (auto i : r) + { + [[maybe_unused]] auto v = i; + } + } + } -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + namespace test_lambda_capture_asterisk_this_by_value + { - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + struct t + { + int i; + int foo() + { + return [*this]() + { + return i; + }(); + } + }; + } -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + namespace test_enum_class_construction + { - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + enum class byte : unsigned char + {}; - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKG_CONFIG=$ac_pt_PKG_CONFIG - fi -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi + byte foo {42}; -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG="" - fi -fi + } -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" >&5 -$as_echo_n "checking for Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify... " >&6; } + namespace test_constexpr_if + { -if test -n "$QT_CFLAGS"; then - pkg_cv_QT_CFLAGS="$QT_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify\""; } >&5 - ($PKG_CONFIG --exists --print-errors "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_QT_CFLAGS=`$PKG_CONFIG --cflags "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$QT_LIBS"; then - pkg_cv_QT_LIBS="$QT_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify\""; } >&5 - ($PKG_CONFIG --exists --print-errors "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_QT_LIBS=`$PKG_CONFIG --libs "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi + template <bool cond> + int f () + { + if constexpr(cond) + { + return 13; + } + else + { + return 42; + } + } + } + namespace test_selection_statement_with_initializer + { -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + int f() + { + return 13; + } -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - QT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" 2>&1` - else - QT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$QT_PKG_ERRORS" >&5 + int f2() + { + if (auto i = f(); i > 0) + { + return 3; + } - as_fn_error $? "Qt libraries are required." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "Qt libraries are required." "$LINENO" 5 -else - QT_CFLAGS=$pkg_cv_QT_CFLAGS - QT_LIBS=$pkg_cv_QT_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + switch (auto i = f(); i + 4) + { + case 17: + return 2; -fi + default: + return 1; + } + } - QT_REQUIREMENTS="Qt5Core Qt5Gui Qt5Network Qt5Widgets glib-2.0 libnotify" - QT_LDFLAGS="`$PKG_CONFIG --libs-only-L $QT_REQUIREMENTS`" - QT_CPPFLAGS="`$PKG_CONFIG --cflags-only-I $QT_REQUIREMENTS` -DQT_DISABLE_DEPRECATED_BEFORE=0x060000" - QT_LIBS="`$PKG_CONFIG --libs-only-l $QT_REQUIREMENTS`" + } + namespace test_template_argument_deduction_for_class_templates + { + template <typename T1, typename T2> + struct pair + { + pair (T1 p1, T2 p2) + : m1 {p1}, + m2 {p2} + {} -fi + T1 m1; + T2 m2; + }; + void f() + { + [[maybe_unused]] auto p = pair{13, 42u}; + } -# Check whether --with-liblektor was given. -if test "${with_liblektor+set}" = set; then : - withval=$with_liblektor; LKT_STATIC_LIB=$withval -else - LKT_STATIC_LIB=shared -fi + } - if test "x${LKT_STATIC_LIB}" = "xstatic"; then - LKT_STATIC_LIB_TRUE= - LKT_STATIC_LIB_FALSE='#' -else - LKT_STATIC_LIB_TRUE='#' - LKT_STATIC_LIB_FALSE= -fi + namespace test_non_type_auto_template_parameters + { -if ! test "x${LKT_STATIC_LIB}" = "xstatic" -o "x${LKT_STATIC_LIB}" = "xshared" ; then - as_fn_error $? "Please use \"static\" or \"shared\" for the --with-liblektor option" "$LINENO" 5 -fi + template <auto n> + struct B + {}; + B<5> b1; + B<'a'> b2; -cat >>confdefs.h <<_ACEOF -#define LKT_PREFIX_PATH "$prefix" -_ACEOF + } + namespace test_structured_bindings + { + int arr[2] = { 1, 2 }; + std::pair<int, int> pr = { 1, 2 }; + auto f1() -> int(&)[2] + { + return arr; + } -cat >>confdefs.h <<_ACEOF -#define LKT_MAN_BINARY "$(which man)" -_ACEOF + auto f2() -> std::pair<int, int>& + { + return pr; + } + struct S + { + int x1 : 2; + volatile double y1; + }; + S f3() + { + return {}; + } + auto [ x1, y1 ] = f1(); + auto& [ xr1, yr1 ] = f1(); + auto [ x2, y2 ] = f2(); + auto& [ xr2, yr2 ] = f2(); + const auto [ x3, y3 ] = f3(); -cat >>confdefs.h <<_ACEOF -#define LKT_COMPILER "$CC" -_ACEOF + } + namespace test_exception_spec_type_system + { + struct Good {}; + struct Bad {}; -LKT_BUILD_STRING="$(basename $CC)/$(basename $CXX) $(uname -s) $(uname -p) $(uname -r) $(uname -m)" + void g1() noexcept; + void g2(); -cat >>confdefs.h <<_ACEOF -#define LKT_BUILD_STRING "$LKT_BUILD_STRING" -_ACEOF + template<typename T> + Bad + f(T*, T*); + template<typename T1, typename T2> + Good + f(T1*, T2*); + static_assert (std::is_same_v<Good, decltype(f(g1, g2))>); -LKT_ENDIANES_LITTLE="$(echo -n I | od -to2 | head -n1 | cut -f2 -d" " | cut -c6)" -if test "$LKT_ENDIANES_LITTLE" = "1" ; then + } -cat >>confdefs.h <<_ACEOF -#define LKT_ENDIANES_LITTLE 1 -_ACEOF + namespace test_inline_variables + { + template<class T> void f(T) + {} -else + template<class T> inline T g(T) + { + return T{}; + } -cat >>confdefs.h <<_ACEOF -#define LKT_ENDIANES_BIG 1 -_ACEOF + template<> inline void f<>(int) + {} + template<> int g<>(int) + { + return 5; + } -fi + } -########## -# CFLAGS # -########## +} // namespace cxx17 -BASEFLAGS=`test "x${LKT_DEBUG_ENABLED}" = 'xyes' && echo "-g" || echo "-O3"` -CFLAGS="-Werror -Wall -Wextra ${BASEFLAGS} -std=c11" -LDFLAGS="-rdynamic" -ARFLAGS="cr" -AR_FLAGS=$ARFLAGS +#endif // __cplusplus < 201703L -################################# -# BUILD WITH THE DEPENDS SCRIPT # -################################# -# Check whether --with-depends was given. -if test "${with_depends+set}" = set; then : - withval=$with_depends; LKT_BUILD_DEPENDS=$withval +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval $cachevar=yes else - LKT_BUILD_DEPENDS=no + eval $cachevar=no fi - - if test "x${LKT_BUILD_DEPENDS}" = "xyes"; then - LKT_DEPENDS_ENABLE_TRUE= - LKT_DEPENDS_ENABLE_FALSE='#' -else - LKT_DEPENDS_ENABLE_TRUE='#' - LKT_DEPENDS_ENABLE_FALSE= +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CXX="$ac_save_CXX" fi - -if test "x$LKT_BUILD_DEPENDS" = "xyes" ; then - LKT_LIB_DIR="$PWD/depends_install/lib" - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi +eval ac_res=\$$cachevar + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi done - IFS=$lt_save_ifs - ;; - esac -else - enable_shared=no -fi - - - - + if test x$ac_success = xyes; then + break + fi + done + fi + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test x$ax_cxx_compile_cxx17_required = xtrue; then + if test x$ac_success = xno; then + as_fn_error $? "*** A compiler with support for C++17 language features is required." "$LINENO" 5 + fi + fi + if test x$ac_success = xno; then + HAVE_CXX17=0 + { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++17 support was found" >&5 +$as_echo "$as_me: No compiler with C++17 support was found" >&6;} + else + HAVE_CXX17=1 - CFLAGS="${CFLAGS} -I$PWD/depends_install/include" - LDFLAGS="-L$PWD/depends_install/lib ${LDFLAGS}" +$as_echo "#define HAVE_CXX17 1" >>confdefs.h - # Download and build dependencies - cd $LKT_PATH_SOURCE - ./utils/scripts/depends.bash $LKT_PATH_BUILD - if test $? -ne 0 ; then - as_fn_error 1 "\"Failed to download and build dependencies\"" "$LINENO" 5 - fi - cd $LKT_PATH_BUILD + fi - LKT_LIB_LINK="" - for lib in $LKT_LIB_DIR/*.a; do - LKT_LIB_LINK="$lib $LKT_LIB_LINK" - done - # Update path - PATH="$PWD/depends_install/bin:$PATH" -fi +###################### +# Check for dev libs # +###################### LKT_SDL2_VERSION="sdl2 `sdl2-config --version`" if test $? -ne 0 ; then diff --git a/configure.ac b/configure.ac index 58208196..2c749669 100644 --- a/configure.ac +++ b/configure.ac @@ -66,10 +66,8 @@ AC_ENABLE_SHARED AC_ENABLE_STATIC AC_PROG_CC -AC_PROG_CXX AC_PROG_INSTALL - -AX_CXX_COMPILE_STDCXX_17([noext], [mandatory]) +AC_PROG_CXX AS_IF([test "$XXD" = ":"], [AC_MSG_ERROR([xxd is required]) ]) AS_IF([test "$MAN" = ":"], [AC_MSG_ERROR([man is required]) ]) @@ -264,6 +262,18 @@ if test "x$LKT_BUILD_DEPENDS" = "xyes" ; then PATH="$PWD/depends_install/bin:$PATH" fi +############################################ +# Check C++ compiler support for standards # +############################################ + +LT_LANG([C++]) +AX_CXX_COMPILE_STDCXX_17([noext], [mandatory]) +LT_LANG([C]) + +###################### +# Check for dev libs # +###################### + LKT_SDL2_VERSION="sdl2 `sdl2-config --version`" if test $? -ne 0 ; then AC_MSG_ERROR([Faield to get sdl2 version, is sdl2 installed?]) diff --git a/depends/depends.txt b/depends/depends.txt index 4d80e86e..e4c52c58 100644 --- a/depends/depends.txt +++ b/depends/depends.txt @@ -1,7 +1,7 @@ -curl sqlite3 https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release sqlite3.tar.gz -wget sdl2 https://www.libsdl.org/release/SDL2-2.0.12.tar.gz sdl2.tar.gz -wget libcurl https://curl.haxx.se/download/curl-7.72.0.tar.gz libcurl.tar.gz -wget zlib https://zlib.net/zlib-1.2.11.tar.gz zlib.tar.gz -wget iconv https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz iconv.tar.gz -wget openssl https://www.openssl.org/source/openssl-1.1.1h.tar.gz openssl.tar.gz -git json-c https://github.com/json-c/json-c.git json-c +curl sqlite3 https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release sqlite3.tar.gz +wget sdl2 https://www.libsdl.org/release/SDL2-2.0.12.tar.gz sdl2.tar.gz +wget sdl2-image https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.5.tar.gz sdl2-image.tar.gz +wget libcurl https://curl.haxx.se/download/curl-7.72.0.tar.gz libcurl.tar.gz +wget zlib https://zlib.net/zlib-1.2.11.tar.gz zlib.tar.gz +wget iconv https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz iconv.tar.gz +wget openssl https://www.openssl.org/source/openssl-1.1.1h.tar.gz openssl.tar.gz diff --git a/depends/rules.txt b/depends/rules.txt index fee92de3..26e8b057 100644 --- a/depends/rules.txt +++ b/depends/rules.txt @@ -1,7 +1,7 @@ -zlib zconfigure --static --64 -iconv configure --disable-shared -openssl sslconfigure no-shared -fPIC no-hw -sqlite3 configure --disable-shared --disable-tcl CFLAGS=-fPIC --enable-update-limit --with-zlib=__BUILD_DIR__ -sdl2 configure --disable-shared --enable-fcitx --enable-input-tslib=no CFLAGS=-fPIC -libcurl configure --disable-shared --without-zlib --enable-optimize --disable-rt --disable-pop3 --disable-imap --disable-rtsp --disable-smtp --disable-smb --disable-smbs --disable-dict --disable-tftp --enable-https --enable-http --enable-mime --disable-threaded-resolver --without-zsh-functions-dir --without-fish-functions-dir --with-ssl=__BUILD_DIR__ --with-zlib=__BUILD_DIR__ -json-c cmake -DCMAKE_INSTALL_PREFIX=__BUILD_DIR__ -DBUILD_SHARED_LIBS=OFF -DDISABLE_STATIC_FPIC=OFF -DDISABLE_THREAD_LOCAL_STORAGE=OFF -DENABLE_THREADING=OFF -DDISABLE_WERROR=OFF +zlib zconfigure --static --64 +iconv configure --disable-shared +openssl sslconfigure no-shared -fPIC no-hw +sqlite3 configure --disable-shared --disable-tcl CFLAGS=-fPIC --enable-update-limit --with-zlib=__BUILD_DIR__ +sdl2 configure --disable-shared --enable-fcitx --enable-input-tslib=no CFLAGS=-fPIC +sdl2-image configure --disable-shared --with-sdl-prefix=__BUILD_DIR__ +libcurl configure --disable-shared --without-zlib --enable-optimize --disable-rt --disable-pop3 --disable-imap --disable-rtsp --disable-smtp --disable-smb --disable-smbs --disable-dict --disable-tftp --enable-https --enable-http --enable-mime --disable-threaded-resolver --without-zsh-functions-dir --without-fish-functions-dir --with-ssl=__BUILD_DIR__ --with-zlib=__BUILD_DIR__ -- GitLab