/* $Id: version-info.h 152383 2022-10-03 08:46:06Z vinc17/zira $ * * Written by Vincent Lefevre in 2012-2020. * This file is in the public domain. * * Use it by writing * * #include "version-info.h" * * at the beginning of the main() function. Possibly define * VERSION_INFO_NONL and/or VERSION_INFO_STREAM first. */ #ifndef VERSION_INFO_STREAM # define VERSION_INFO_STREAM stdout #endif #define VERSION_INFO_STRINGIZE(S) #S #define VERSION_INFO_MAKE_STR(S) VERSION_INFO_STRINGIZE(S) #define VERSION_INFO_OUTPUT_ID(S) \ do \ { \ static char s[] = S; \ char *p = s; \ while (*++p && (p[0] != ' ' || p[1] != '$')) \ putc (p[0], VERSION_INFO_STREAM); \ putc ('\n', VERSION_INFO_STREAM); \ } \ while (0) #ifdef SVNID VERSION_INFO_OUTPUT_ID(SVNID); #endif #ifdef SIPE_SVNID VERSION_INFO_OUTPUT_ID(SIPE_SVNID); fprintf (VERSION_INFO_STREAM, "with SIPE_MINSIZE = %s, SIPE_USE_FMA = %s, SIPE_PREC_MAX = %d, ", VERSION_INFO_MAKE_STR (SIPE_MINSIZE), VERSION_INFO_MAKE_STR (SIPE_USE_FMA), (int) SIPE_PREC_MAX); #ifdef SIPE_FLOAT fprintf (VERSION_INFO_STREAM, "SIPE_FLOAT = %s\n", VERSION_INFO_MAKE_STR (SIPE_FLOAT)); #ifdef SIPE_USE_LDEXP fprintf (VERSION_INFO_STREAM, " and SIPE_NATIVE_PREC = %d, SIPE_USE_LDEXP = %s\n", (int) SIPE_NATIVE_PREC, VERSION_INFO_MAKE_STR (SIPE_USE_LDEXP)); #endif #else fprintf (VERSION_INFO_STREAM, "SIPE_TRUNC = %s\n", VERSION_INFO_MAKE_STR (SIPE_TRUNC)); fprintf (VERSION_INFO_STREAM, " and SIPE_SIZE = %d, SIPE_ROUND_ZOPT = %s\n", (int) SIPE_SIZE, VERSION_INFO_MAKE_STR (SIPE_ROUND_ZOPT)); #endif #endif #ifdef __GNU_MP_VERSION fprintf (VERSION_INFO_STREAM, "GMP ..... Library: %-12s Header: %d.%d.%d\n", gmp_version, __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL); #endif #ifdef MPFR_VERSION_STRING fprintf (VERSION_INFO_STREAM, "MPFR .... Library: %-12s Header: %s (based on %d.%d.%d)\n", mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR, MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL); fprintf (VERSION_INFO_STREAM, "MPFR features: TLS = %s, decimal = %s, GMP internals = %s\n", mpfr_buildopt_tls_p () ? "yes" : "no", mpfr_buildopt_decimal_p () ? "yes" : "no", mpfr_buildopt_gmpinternals_p () ? "yes" : "no"); # if MPFR_VERSION >= MPFR_VERSION_NUM(4,0,0) fprintf (VERSION_INFO_STREAM, " (new in 4.0) float128 = %s, shared cache = %s\n", mpfr_buildopt_float128_p () ? "yes" : "no", mpfr_buildopt_sharedcache_p () ? "yes" : "no"); # endif # if MPFR_VERSION >= MPFR_VERSION_NUM(3,1,0) fprintf (VERSION_INFO_STREAM, "MPFR tuning: %s", mpfr_buildopt_tune_case ()); # endif putc ('\n', VERSION_INFO_STREAM); { const char *p = mpfr_get_patches (); fprintf (VERSION_INFO_STREAM, "MPFR patches: %s\n", p[0] ? p : "[none]"); } #endif #ifdef __GLIBC__ # include fprintf (VERSION_INFO_STREAM, "glibc version: %s\n", gnu_get_libc_version ()); #endif /* https://sourceforge.net/p/predef/wiki/Compilers/ * https://web.archive.org/web/20191011050717/http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros */ #if defined(__TINYC__) fprintf (VERSION_INFO_STREAM, "Compiler: TCC %d.%d.%d\n", (int) (__TINYC__ / 10000), (int) ((__TINYC__ / 100) % 100), (int) (__TINYC__ % 100)); #elif defined(__VERSION__) /* For ICC, the __ICC macro is obsolete and not always defined (in particular, on MS Windows). */ # if defined(__INTEL_COMPILER) # define VERSION_ICCV __INTEL_COMPILER / 100, __INTEL_COMPILER % 100, \ __INTEL_COMPILER_UPDATE # if defined(__INTEL_COMPILER_BUILD_DATE) # define VERSION_COMPFMT " [ICC %d.%d.%d %d]" # define VERSION_COMPILER VERSION_ICCV, __INTEL_COMPILER_BUILD_DATE # else # define VERSION_COMPFMT " [ICC %d.%d.%d]" # define VERSION_COMPILER VERSION_ICCV # endif # elif defined(__GNUC__) && ! defined(__clang__) # if defined(__GNUC_PATCHLEVEL__) # define VERSION_COMPFMT " [GCC %d.%d.%d]" # define VERSION_COMPILER __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__ # else # define VERSION_COMPFMT " [GCC %d.%d]" # define VERSION_COMPILER __GNUC__, __GNUC_MINOR__ # endif # else # define VERSION_COMPFMT "%s" # define VERSION_COMPILER "" # endif fprintf (VERSION_INFO_STREAM, "Compiler: %s" VERSION_COMPFMT "\n", __VERSION__, VERSION_COMPILER); #endif fprintf (VERSION_INFO_STREAM, "ABI: sizeof(long) = %d", (int) sizeof(long)); #ifdef __GNU_MP_VERSION fprintf (VERSION_INFO_STREAM, ", sizeof(mp_limb_t) = %d", (int) sizeof(mp_limb_t)); #endif putc ('\n', VERSION_INFO_STREAM); #ifndef VERSION_INFO_NONL putc ('\n', VERSION_INFO_STREAM); #endif