Commit Graph

239 Commits

Author SHA1 Message Date
Enrico Forestieri
41e409f8f7 Use std::call_once only if it is actually available 2016-08-07 04:58:41 +02:00
Jean-Marc Lasgouttes
c58967a5ff autoconf: Check for C++11 and std::regex soon in LYX_PROG_CXX
This makes the test for std::regex a bit faster.
2016-07-18 11:53:30 +02:00
Jean-Marc Lasgouttes
14a6a4723f Use a proper test for detecting usable std::regex
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.
2016-07-06 15:12:53 +02:00
Jean-Marc Lasgouttes
23dbcb59d2 New test to determine correct -std option for CXX compiler
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.
2016-07-06 14:21:49 +02:00
Jean-Marc Lasgouttes
67ac031a33 Gcc 6+ use C++14 as default, so there is no need to enforce C++11
Also, use gnu++11 unconditionnally with gcc as we used to do before 67385e69.
2016-07-04 12:15:01 +02:00
Enrico Forestieri
6863fe9606 Fix build with autotools and gcc 6 2016-06-26 19:45:50 +02:00
Georg Baum
e307944d18 Require gcc 4.6
See also 5de30b1210
2016-06-15 22:04:51 +02:00
Jean-Marc Lasgouttes
e8655e9a70 Detect clang version in autoconf (and use it a bit)
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.
2016-06-13 11:25:23 +02:00
Georg Baum
20a00903b1 Fix linking with std::regex and included boost 2016-06-11 10:10:20 +02:00
Georg Baum
cf1e08f7f7 Skip boost linking test if not needed
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.
2016-06-11 09:20:16 +02:00
Georg Baum
7293fc7b66 Get rid of boost signals in multithreading test
Test for regex instead since this is the only boost library we are linking against.
2016-06-11 09:04:50 +02:00
Jean-Marc Lasgouttes
6f585055d9 Allow to disable std::regex manually with autoconf
Update INSTALL and remove mention of --disable-cxx11.
2016-06-10 12:01:53 +02:00
Georg Baum
2047ea5eb4 Replace Boost.Signals with Boost.Signals2
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.
2016-06-09 22:25:34 +02:00
Guillaume Munch
a73f2e6eb6 Autotools: restore deprecation warning
-Wno-deprecated-declarations was added at 314a121c.
2016-06-09 15:21:39 +01:00
Georg Baum
273c67d8aa Require a C++11 compiler
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.
2016-06-07 20:34:52 +02:00
Georg Baum
ad63374e26 Require at least gcc 4.3
This is a prerequisite for mandatory C++11 support.
I could not find a cmake gcc version check btw.
2016-06-05 15:40:00 +02:00
Georg Baum
c8619110ff Fix packaging for mingw crosscompilation
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.
2016-05-29 17:55:44 -04:00
Georg Baum
08afc52c4c Configure included iconv with autotools
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.
2016-05-29 17:55:43 -04:00
Georg Baum
041bcbed74 Fix include path for zconf.h
I forgot that in the previous commit, and compilation seemed to work because
I had another zconf.h lying around.
2016-05-29 17:55:43 -04:00
Georg Baum
ee13c5b7e2 Fix packaging for mingw-64
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.
2016-05-29 17:55:43 -04:00
Georg Baum
78e17b1579 Configure included zlib with autotools
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.
2016-05-29 17:55:43 -04:00
Jean-Marc Lasgouttes
3c2d3caf27 Do not add -std=c++11 to CPPFLAGS (because objc does not like it)
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.
2016-02-23 15:01:16 +01:00
Jean-Marc Lasgouttes
39717adfda Fix the logic of selection of std::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.
2016-01-11 10:40:12 +01:00
Peter Kümmel
a8d78905b6 3rdparty/boost: build with autotools 2015-12-20 13:06:59 +01:00
Jean-Marc Lasgouttes
314a121c9e Autotools: use -Wno-deprecated-declarations also with --disable-warnings
-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.
2015-12-11 10:31:46 +01:00
Jean-Marc Lasgouttes
26b3674240 Fix syntax error whe testing old compilers 2015-12-07 22:51:36 +01:00
Jean-Marc Lasgouttes
a0b9b9b678 Disable warning for deprecated functions in autoconf builds
This gets rid in particular of warnings on auto_ptr. This flag should be removed when 2.3 development start and we switch to unique_ptr.
2015-11-02 16:14:43 +01:00
Jean-Marc Lasgouttes
e1938aa240 Fix some compilation problems in C++11 mode
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.
2015-09-25 14:12:30 +02:00
Jean-Marc Lasgouttes
b7909e7e6c Remove support for precompiled headers for autotools
This was turned off by default for a long time, and it does not seem
to have any use these days.
2015-09-25 12:05:40 +02:00
Jean-Marc Lasgouttes
7f4101a556 Change --enable-cxx11 configure option to --disable-cxx11 2015-09-25 10:47:42 +02:00
Jean-Marc Lasgouttes
d95c187b5a Give a warning when system boost and stdlib-debug are used together
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.
2015-09-22 14:38:31 +02:00
Jean-Marc
a22f7b7001 Do not use -Wfloat-conversion with recent gcc versions 2015-09-10 18:12:35 +02:00
Enrico Forestieri
864a4db26b On cygwin, use -std=gnu++11 instead of -std=c++11
This allows compiling without monkeying with compiler guards.
2015-09-09 02:34:18 +02:00
Enrico Forestieri
bde1bee24e Make it compile on cygwin in c++11 mode
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.
2015-09-09 01:54:49 +02:00
Jean-Marc Lasgouttes
893ae612e4 Use C++11 by default when possible
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.
2015-09-07 11:42:39 +02:00
Jean-Marc Lasgouttes
67385e69fc Improve detection of C++11 mode
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
2015-09-03 10:22:56 +02:00
Jean-Marc Lasgouttes
ba13a832d6 Do not require libm when searching for system boost
Doing so breaks building under Haiku, which does not have libm.

See ticket #7568 for details.
2015-06-11 18:08:19 +02:00
Jessica Hamilton
dcfb918f15 Add packaging support for Haiku
See bug #7568 for details.
2015-06-08 17:18:14 +02:00
Jean-Marc Lasgouttes
329eae5605 Use explicit macro to declare that we want to use C++11
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
2015-05-20 10:19:19 +02:00
Georg Baum
7b0485dbb2 Remove gcc 3 traces
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.
2015-05-10 10:01:33 +02:00
Georg Baum
51cc8aa9f6 Fix build with GNU libstdc++ C++11 ABI
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.
2015-05-08 21:12:42 +02:00
Scott Kostyshak
36c3495a3a Correct the spelling of "occured" to "occurred" 2015-02-09 18:44:02 -05:00
Jean-Marc Lasgouttes
33ff0f276a More tweaks to C++ compiler detection
Now CXXFLAGS is left alone by autoconf: only the user can override it.

Properly set -g and -O options, which were overriden.

Try to put the arguments in a more reasonable ordering.
2015-01-13 15:59:30 +01:00
Jean-Marc Lasgouttes
3fca2b557b Fixup commit ff42fe
It looks like bash pattern matching does not work as I think it does. Play safe for now.
2015-01-13 12:38:55 +01:00
Jean-Marc Lasgouttes
ff42fea8ab Cleanup autoconf compiler support
Get rid of some old useless compiler checking code

Do not touch CXXFLAGS and friends, only the AM_* version

Let the gcc-related options for latest known version be the default (assume they will still be fine in future versions)

Try to take clang in account in a better way (to be continued):
 * use proper option for C++11,
 * use -Wno-deprecated-register in this case because Qt has a lot of these
 * define version as being clang for internal testing (there is no real way to get the clang version)
2015-01-13 12:06:55 +01:00
Georg Baum
be22665ceb Fix autotools config for gcc < 4.9
Since LYX_USE_STD_REGEX is used in Makefile.am, it must always be defined, not
only if C++11 support is enabled.
2015-01-06 19:48:27 +01:00
Jean-Marc Lasgouttes
41405babc5 Cleanup support for std::regex with autotools
Do not link against system boost regex lib or build included boost regex when not needed.
2015-01-06 18:47:00 +01:00
Enrico Forestieri
dd2a8b616e Adjust autotools default configure options for Qt5.
* Disable concept-checks unless explicitly required (errors out with Qt5).
* Add -fPIC to CPPFLAGS for elf targets (required with Qt5).
2015-01-04 18:07:11 +01:00
Georg Baum
7796ad3a36 Improve llvm libc++ detection
The old detection did only work if CFLAGS contained -std=c++11, since ciso646
was only included for __cplusplus > 199711.
Thanks to Koernel for the cmake part.
2014-12-21 17:26:21 +01:00
Jean-Marc Lasgouttes
385f3e8abd Check for string COW by checking for library, not compiler
Note in particular that clang++ uses libstdc++ (GNU) by default, and not libc++.
Therefore, it suffers from the string COW bug too.
2014-12-19 08:54:07 +01:00