The full path of the tools is retained only if the Qt directory is
specified using --with-qt-dir. Now, when qtchooser was detected it
was blindly assumed that the corresponding system tools were being
used. These tools discriminate between Qt4 and Qt5 through the
option -qt=qt4 or -qt=qt5. However, the original Qt tools don't
understand these options, so that if they come first in the PATH,
configuration fails. So, only use those options if we are reasonably
sure that the system Qt is wanted. This is achieved by comparing the
paths of qtchooser and tools as, typically, they are located in the
same directory. In this way, if one prepends the bin directory of a
custom Qt build to PATH (and accordingly adjusts PKG_CONFIG_PATH),
configuration succeeds even if --with-qt-dir is not specified.
With both Qt4 and Qt5, when using a click-to-focus policy, the first
attempt to paste a selection by middle mouse in an external application
which has no focus may fail. It is not clear why this succeeds for some
applications and fails for others, but refreshing the timestamp of the
selection request cures the issue. The cmake part is by Kornel.
See also this thread:
http://thread.gmane.org/gmane.editors.lyx.devel/162491
If the Qt directory is specified by --with-qt-dir, the full path
of the tools is retained. Otherwise, if qtchooser is detected,
the generic names are attempted with proper arguments to select
the desired Qt version. Otherwise, the generic names with and without
proper suffixes (either -qt5 or -qt4) are checked in the PATH.
This means that --with-qt-dir=qtdir should be used only if the tools
are not in the PATH, or qtdir/bin/{moc,rcc,uic} are the right versions
for the desired Qt. In any case, it is later checked that the selected
tools are the right ones and a warning is issued if there is a mismatch.
The test is stolen from cmake code.
Tested on:
* ubuntu 12.04 with g++ 4.6, clang 3.3 (with libstdc++)
* ubuntu 16.04 with g++ 5.3, clang 3.7 (with libstdc++) and clang 3.7
(with libc++)
The last combination fails, but it seems to be related to real bugs
(reported for debian), so this is OK.
The test file is stolen from cmake. The options tested are, from the
most desirable to the least desirable:
-std=c++14 -std=c++11 "" -std=c++0x -std=gnu++14 -std=gnu++11 -std=gnu++0x
It is expected that the result will not be correct for cygwin, but
this is fixable.
With this change, it is now possible to configure with --enable-qt5
and have make use "moc -qt=qt5" automatically.
This is done when the command qtchooser is available nd the desired Qt
version (qt4/qt5) is available.
This means that it is now possible to have qt4 and qt5 builds easily
on a same linux system.
The version is read by checking the macros __clang_major__,
__clang_minor__ and __clang_patchlevel__. Hopefully they will have
coherent values everywhere.
For now, the version is used to set warnings a bit more reasonably for
older clang versions, which do not support -Wdeprecated-register and
some others that are used in pragmas in boost.
This removes many warnings when compiling with clang 3.3.
We only link against boost libraries if we do not use std::regex.
Therefore, we do not need to test how to link against boost libs unconditionally.
Also, the warning regarding stdlib-debug is only needed if we link against boost.
Boost.Signals is deprecated. This fixes bug #9943.
The only thing left to do is to rewrite (or get rid of) the boost -mt test
in config/lyxinclude.m4 not to use signals anymore.
As discussed on the list. If no C++11 compiler is found configuration stops
with an error. There are now unneeded parts of boost, the will be removed in
a second commit.
The standard host triplet for mingw tools is is something like
x86_64-w64-mingw32 on debian and something like x86-64-w64-mingw32.shared for
mxe (http://mxe.cc). Detect windows packaging correctly for these build types.
The included hunspell should not be used on Linux or OS X, but (depending on
local configuration) it might be needed for crosscompiling a mingw target
from Linux. Now the user can choose whether to use the included hunspell or not.
cmake does already support that.
Now the only other dependency you need to cross-compile for mingw on debian
or ubuntu is qt.
The included iconv should not be used on Linux or OS X, but (depending on
local configuration) it might be needed for crosscompiling a mingw target
from Linux. Now the user can choose whether to use the included iconv or not.
cmake does already support that.
eilseq.m4 was taken from the original libiconv 1.14 package.
See bug 10053 for details. Without this, the package is only set correctly
for 32bit mingw.
Thanks Enrico for suggesting this fix and Shankar Giri Venkita Giri for
testing it.
The included zlib should not be used on Linux or OS X, but (depending on
local configuration) it might be needed for crosscompiling a mingw target
from Linux. Now the user can choose whether to use the included zlib or not.
cmake does already support that.
zconf.h.in was taken from the original zlib 1.2.8 package. The generation of
zconf.h was made equivalent to the one generated by cmake.
Since at least gcc 4.6 requires it, -std=c++11 has been passed to CPPFLAGS at 39717adfd. This was deemed necessary so that tests that use the preprocessor directly (AC_CHECK_HEADER) can have the right information.
It turns out that CPPFLAGS gets passed to objc compilation too (on Mac OS X) and this create compile-time errors.
Therefore we remove the -std flag from CPPFLAGS and re-add it to a separate variable cxx11_flags that is passed to LYX_CXX_USE_REGEX.
This amends commit e1938aa2, which introduced some logic
errors: regex would be enabled for gcc versions which have unusable
<regex> header.
The new code separates better special gcc handling from special C++11
handling and should be more readable.
* set -std=c++11 in AM_CPPFLAGS instead of AM_CXXFLAGS, since the
preprocessor uses this setting too.
* Before checking for header <regex>, set language to C++ and update
value of AM_CPPFLAGS too.
* Separate code that checks for regex in its own macro.
* now unknown compiler which have the <regex> header, will use std::regex in C++11 mode.
-Wno-deprecated-declarations is needed to avoid warnings about auto_ptr being obsolete.
The old code meant that the warnings would be suppressed for development builds, but active for release builds. The new code avoids that.
Only enable std::regex when the header <regex> is present (fix Mac OS X issue).
Remove support for concept checks. The page
https://gcc.gnu.org/onlinedocs/libstdc++/manual/concept_checking.html
says about concept checking:
Please note that the checks are based on the requirements in the
original C++ standard, many of which were relaxed in the C++11
standard and so valid C++11 code may be incorrectly rejected by the
concept checks. Additionally, some correct C++03 code might be
rejected by the concept checks, for example template argument types
may need to be complete when used in a template definition, rather
than at the point of instantiation. There are no plans to address
these shortcomings.
Therefore it seems reasonable to remove our support for this.
In general this would lead to an immediate runtime crash because the
runtime checks of libstdc++ change the layout of some STL objects.
Therefore, this will only work when the boost libraries have been
compiled with this same flag. At this time, it is not known whether
any linux distribution contains such libraries.
Fixes bug #9736.
When using -std=c++11, the cygwin compiler automatically defines
__STRICT_ANSI__ which is used as a guard for not declaring essential
unix standard calls such as setenv, popen, etc. As a result,
compilation stops with errors such as "xxxx has not been declared".
By undefining the guard, compilation succeeds and lyx works Ok.
Compiler that are known to support C++11 (gcc >= 4.3 and clang) are
now used in this mode by default. It is still possible to override
this choice using --(en|dis)able-cxx11.
Moreover, c++11 mode is detected from the compiler itself, not from
the use of --enable-cxx11. This allows to support compilers other
than gcc or clang.
Update INSTALL file accordingly and clean it a little bit.
This replaces commit 329eae56 with a better solution. Indeed, while
__cpluplus is useless with g++ 4.[3-6] because its value is always 1,
these compilers define __GXX_EXPERIMENTAL_CXX0X__ when "-std c++0x" is used.
Therefore the code now relies on both macros to detect C++11 mode
instead of setting it when --enable-cxx11 is used.
Also, use pure c++ mode instead of gnu++ extensions on gcc
This replaces tests for __cplusplus >= 201103L, which are wrong with gcc 4.6 and earlier. Indeed these versions of gcc define __cplusplus = 1.
Reference:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773
We claim that gcc 4.x is needed in INSTALL, so it does not make sense to keep
this old stuff. Instead, I made configure output an error if gcc is too old.
The GNU libstdc++ that ships witch gcc 5 can be used with the same ABI as
older versions, or with a new ABI which is conformant to the C++11 standard.
LyX did not build if the latter was used:
https://kojipkgs.fedoraproject.org//work/tasks/1267/9651267/build.log
This is now fixed by detecting the ABI version and disabling the wrong forward
declarations. At the same time, STD_STRING_USES_COW is switched off for the
C++11 ABI version, because the std::basic_string implementation is now C++11
conformant. Since the GNU libstdc++ can also used by other compilers such as
clang, we must not test for the compiler version.