Files
pvxs/configure/toolchain.c
T
Michael Davidsaver 099aa166d5 MSVC build fixes
2020-03-31 13:07:50 -07:00

44 lines
1.1 KiB
C

#ifdef _COMMENT_
/* Compiler inspection
*
* expanded as configure/CONFIG_SITE.Common.*
*/
/* GCC preprocessor drops C comments from output.
* MSVC preprocessor emits C comments in output
*/
#endif
#define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P))
CONFIG_LOADED=YES
#if __GNUC__
/* also true for clang */
GNUISH=YES
USR_CXXFLAGS += -std=c++11
#endif
#if __GNUC__ && !__clang__
#define GCC_VERSION VERSION_INT(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, 0)
/* LTO takes a nice chunk out of the .so text size, but blows up the .a size */
/* native mingw builds using the MS ar doesn't understand LTO */
#if !defined(_WIN32) && GCC_VERSION>=VERSION_INT(4,9,0,0)
OPT_CFLAGS_YES += -flto
OPT_CXXFLAGS_YES += -flto
USR_LDFLAGS += -flto
#endif
/* Compress debug information on ELF targets for ~25%-50% reduction in .so and .a file size
* (C++ debug info is Huuuge!)
*/
#if __ELF__ && GCC_VERSION>=VERSION_INT(5,0,0,0)
USR_CFLAGS += -gz=zlib
USR_CXXFLAGS += -gz=zlib
/* Actually a binutils feature, which we can't detect.
* Assume binutils upgrade follow gcc
*/
USR_LDFLAGS += -Wl,--compress-debug-sections=zlib
#endif
#endif /* __GNUC__ */