Merge branch 'master' into jgrpp
# Conflicts: # config.lib # src/linkgraph/demands.cpp # src/linkgraph/mcf.cpp # src/linkgraph/refresh.cpp # src/linkgraph/refresh.h # src/smallmap_gui.cpp
This commit is contained in:
44
config.lib
44
config.lib
@@ -1356,9 +1356,11 @@ make_compiler_cflags() {
|
||||
ldflags="$ldflags -rdynamic"
|
||||
else
|
||||
# Enable some things only for certain GCC versions
|
||||
cc_version=`$1 -dumpversion | cut -c 1,3`
|
||||
# cc_version = major_version * 100 + minor_version
|
||||
# For example: "3.3" -> 303, "4.9.2" -> 409, "6" -> 600, "23.5" -> 2305
|
||||
cc_version=`$1 -dumpversion | $awk -F . '{printf "%d%02d", $1, $2}'`
|
||||
|
||||
if [ $cc_version -lt 33 ]; then
|
||||
if [ $cc_version -lt 303 ]; then
|
||||
log 1 "configure: error: gcc older than 3.3 can't compile OpenTTD because of its poor template support"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1371,20 +1373,20 @@ make_compiler_cflags() {
|
||||
if [ $enable_assert -eq 0 ]; then
|
||||
# Do not warn about unused variables when building without asserts
|
||||
flags="$flags -Wno-unused-variable"
|
||||
if [ $cc_version -ge 46 ]; then
|
||||
if [ $cc_version -ge 406 ]; then
|
||||
# GCC 4.6 gives more warnings, disable them too
|
||||
flags="$flags -Wno-unused-but-set-variable"
|
||||
flags="$flags -Wno-unused-but-set-parameter"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $cc_version -ge 34 ]; then
|
||||
if [ $cc_version -ge 304 ]; then
|
||||
# Warn when a variable is used to initialise itself:
|
||||
# int a = a;
|
||||
flags="$flags -Winit-self"
|
||||
fi
|
||||
|
||||
if [ $cc_version -ge 40 ]; then
|
||||
if [ $cc_version -ge 400 ]; then
|
||||
# GCC 4.0+ complains about that we break strict-aliasing.
|
||||
# On most places we don't see how to fix it, and it doesn't
|
||||
# break anything. So disable strict-aliasing to make the
|
||||
@@ -1395,7 +1397,7 @@ make_compiler_cflags() {
|
||||
flags="$flags -Wcast-qual"
|
||||
fi
|
||||
|
||||
if [ $cc_version -ge 42 ]; then
|
||||
if [ $cc_version -ge 402 ]; then
|
||||
# GCC 4.2+ automatically assumes that signed overflows do
|
||||
# not occur in signed arithmetics, whereas we are not
|
||||
# sure that they will not happen. It furthermore complains
|
||||
@@ -1406,21 +1408,21 @@ make_compiler_cflags() {
|
||||
flags="$flags -Wnon-virtual-dtor"
|
||||
fi
|
||||
|
||||
if [ $cc_version -ge 47 ]; then
|
||||
cxxflags="$cxxflags -std=gnu++11"
|
||||
elif [ $cc_version -ge 43 ]; then
|
||||
if [ $cc_version -ge 403 ] && [ $cc_version -lt 407 ]; then
|
||||
# Use gnu++0x mode so static_assert() is available.
|
||||
# Don't use c++0x, it breaks mingw (with gcc 4.4.0).
|
||||
cxxflags="$cxxflags -std=gnu++0x -DDISABLE_OVERRIDE"
|
||||
elif [ $cc_version -ge 407 ] && [ $cc_version -lt 600 ]; then
|
||||
cxxflags="$cxxflags -std=gnu++11"
|
||||
fi
|
||||
|
||||
if [ $cc_version -eq 45 ]; then
|
||||
if [ $cc_version -eq 405 ]; then
|
||||
# Prevent optimisation supposing enums are in a range specified by the standard
|
||||
# For details, see http://gcc.gnu.org/PR43680
|
||||
flags="$flags -fno-tree-vrp"
|
||||
fi
|
||||
|
||||
if [ $cc_version -ge 47 ]; then
|
||||
if [ $cc_version -ge 407 ]; then
|
||||
# Disable -Wnarrowing which gives many warnings, such as:
|
||||
# warning: narrowing conversion of '...' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
|
||||
# They are valid according to the C++ standard, but useless.
|
||||
@@ -1429,15 +1431,15 @@ make_compiler_cflags() {
|
||||
flags="$flags -Wno-free-nonheap-object"
|
||||
fi
|
||||
|
||||
if [ $cc_version -ge 49 ]; then
|
||||
if [ $cc_version -ge 409 ]; then
|
||||
# Enable use of C++11 custom allocators
|
||||
CFLAGS="$CFLAGS -DCUSTOM_ALLOCATOR"
|
||||
fi
|
||||
|
||||
if [ $cc_version -ge 60 ]; then
|
||||
if [ $cc_version -ge 600 ]; then
|
||||
# -flifetime-dse=2 (default since GCC 6) doesn't play
|
||||
# well with our custom pool item allocator
|
||||
cxxflags="$cxxflags -flifetime-dse=1"
|
||||
cxxflags="$cxxflags -flifetime-dse=1 -std=gnu++14"
|
||||
fi
|
||||
|
||||
if [ "$enable_lto" != "0" ]; then
|
||||
@@ -1445,7 +1447,7 @@ make_compiler_cflags() {
|
||||
has_lto=`$1 -dumpspecs | grep '\%{flto'`
|
||||
if [ -n "$has_lto" ]; then
|
||||
# Use LTO only if we see LTO exists and is requested
|
||||
if [ $cc_version -lt 46 ]; then
|
||||
if [ $cc_version -lt 406 ]; then
|
||||
flags="$flags -flto"
|
||||
else
|
||||
flags="$flags -flto=jobserver"
|
||||
@@ -1578,7 +1580,7 @@ make_cflags_and_ldflags() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$os" = "OSX" ] && [ $cc_version -eq 40 ]; then
|
||||
if [ "$os" = "OSX" ] && [ $cc_version -eq 400 ]; then
|
||||
# Apple's GCC 4.0 has a compiler bug for x86_64 with (higher) optimization,
|
||||
# wrongly optimizing ^= in loops. This disables the failing optimisation.
|
||||
CFLAGS="$CFLAGS -fno-expensive-optimizations"
|
||||
@@ -1602,7 +1604,7 @@ make_cflags_and_ldflags() {
|
||||
LDFLAGS="$LDFLAGS -mwin32"
|
||||
fi
|
||||
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
|
||||
if [ $cc_version -lt 46 ]; then
|
||||
if [ $cc_version -lt 406 ]; then
|
||||
flags="$flags -mno-cygwin"
|
||||
LDFLAGS="$LDFLAGS -mno-cygwin"
|
||||
fi
|
||||
@@ -1615,10 +1617,10 @@ make_cflags_and_ldflags() {
|
||||
|
||||
LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 -limm32"
|
||||
|
||||
if [ $cc_version -ge 44 ]; then
|
||||
if [ $cc_version -ge 404 ]; then
|
||||
LDFLAGS_BUILD="$LDFLAGS_BUILD -static-libgcc -static-libstdc++"
|
||||
fi
|
||||
if [ $cc_version -ge 47 ]; then
|
||||
if [ $cc_version -ge 407 ]; then
|
||||
CFLAGS="$CFLAGS -mno-ms-bitfields"
|
||||
fi
|
||||
fi
|
||||
@@ -1872,7 +1874,7 @@ EOL
|
||||
LDFLAGS="$OSX_LD_SYSROOT $LDFLAGS"
|
||||
fi
|
||||
|
||||
if [ "$enable_universal" = "0" ] && [ $cc_version -gt 40 ]; then
|
||||
if [ "$enable_universal" = "0" ] && [ $cc_version -gt 400 ]; then
|
||||
# Only set the min version when not doing an universal build.
|
||||
# Universal builds set the version elsewhere.
|
||||
if [ "$cpu_type" = "64" ]; then
|
||||
@@ -2050,7 +2052,7 @@ EOL
|
||||
# GCC 4.0+ doesn't like the DirectX includes (gives tons of
|
||||
# warnings on it we won't be able to fix). For now just
|
||||
# suppress those warnings.
|
||||
if [ $cc_version -ge 40 ]; then
|
||||
if [ $cc_version -ge 400 ]; then
|
||||
CFLAGS="$CFLAGS -Wno-non-virtual-dtor"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user