1 | /* -*-C-*- */ |
2 | |
3 | /* |
4 | * This Source Code Form is subject to the terms of the Mozilla Public |
5 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
7 | * |
8 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
9 | */ |
10 | |
11 | #include "monetdb_config.h" |
12 | #include "mal.h" |
13 | #include "monet_version.h" |
14 | #include "mutils.h" |
15 | #ifdef HAVE_LIBPCRE |
16 | #include <pcre.h> |
17 | #endif |
18 | #ifdef HAVE_OPENSSL |
19 | #include <openssl/opensslconf.h> |
20 | #include <openssl/opensslv.h> |
21 | #include <openssl/crypto.h> |
22 | #endif |
23 | #ifdef HAVE_LIBXML |
24 | #include <libxml/xmlversion.h> |
25 | #endif |
26 | |
27 | #define STRING(a) # a |
28 | #define XSTRING(s) STRING(s) |
29 | |
30 | #if defined(HAVE_LIBPCRE) || defined(HAVE_OPENSSL) |
31 | static void |
32 | print_libversion(const char *lib, const char *rtvers, const char *cmvers) |
33 | { |
34 | printf(" %s: %s" , lib, rtvers); |
35 | if (strcmp(rtvers, cmvers) != 0) |
36 | printf(" (compiled with %s)" , cmvers); |
37 | printf("\n" ); |
38 | } |
39 | #endif |
40 | |
41 | void |
42 | monet_version(void) |
43 | { |
44 | dbl sz_mem_gb; |
45 | int cores; |
46 | |
47 | MT_init(); /* for MT_pagesize */ |
48 | sz_mem_gb = (dbl)(MT_npages() * MT_pagesize()) / (1024.0 * 1024.0 * 1024.0); |
49 | cores = MT_check_nr_cores(); |
50 | |
51 | printf("MonetDB 5 server %s" , GDKversion()); |
52 | #ifdef MONETDB_RELEASE |
53 | printf(" (%s)" , MONETDB_RELEASE); |
54 | #else |
55 | const char *rev = mercurial_revision(); |
56 | if (strcmp(rev, "Unknown" ) != 0) |
57 | printf(" (hg id: %s)" , rev); |
58 | #endif |
59 | printf(" (%zu-bit%s)\n" , |
60 | (size_t) (sizeof(ptr) * 8), |
61 | #ifdef HAVE_HGE |
62 | ", 128-bit integers" |
63 | #else |
64 | "" |
65 | #endif |
66 | ); |
67 | #ifndef MONETDB_RELEASE |
68 | printf("This is an unreleased version\n" ); |
69 | #endif |
70 | printf("Copyright (c) 1993 - July 2008 CWI\n" |
71 | "Copyright (c) August 2008 - 2019 MonetDB B.V., all rights reserved\n" ); |
72 | printf("Visit https://www.monetdb.org/ for further information\n" ); |
73 | printf("Found %.1fGiB available memory, %d available cpu core%s\n" , |
74 | sz_mem_gb, cores, cores != 1 ? "s" : "" ); |
75 | /* don't want to GDKinit just for this |
76 | "using %d thread%s\n", |
77 | GDKnr_threads, GDKnr_threads != 1 ? "s" : ""); */ |
78 | printf("Libraries:\n" ); |
79 | #ifdef HAVE_LIBPCRE |
80 | /* PCRE_PRERELEASE may be defined as an empty value. In order |
81 | * to get the proper amount of white space between various |
82 | * parts of the version string on different compilers (none |
83 | * between minor and prerelease, a single one between that |
84 | * combination and the date), we need to resort to some |
85 | * run-time trickery since we can't do it with the |
86 | * preprocessor */ |
87 | print_libversion("libpcre" , |
88 | pcre_version(), |
89 | XSTRING(Z PCRE_PRERELEASE)[1] == 0 |
90 | ? XSTRING(PCRE_MAJOR.PCRE_MINOR PCRE_DATE) |
91 | : XSTRING(PCRE_MAJOR.PCRE_MINOR) |
92 | XSTRING(PCRE_PRERELEASE PCRE_DATE)); |
93 | #endif |
94 | #ifdef HAVE_OPENSSL |
95 | print_libversion("openssl" , |
96 | #if OPENSSL_VERSION_NUMBER < 0x10100000 |
97 | OPENSSL_VERSION_TEXT, |
98 | #else |
99 | OpenSSL_version(OPENSSL_VERSION), |
100 | #endif |
101 | OPENSSL_VERSION_TEXT); |
102 | #endif |
103 | #ifdef HAVE_LIBXML |
104 | /* no run-time version available, so only compile time */ |
105 | printf(" libxml2: %s\n" , LIBXML_DOTTED_VERSION); |
106 | #endif |
107 | printf("Compiled by: %s (%s)\n" , "root@goorm" , HOST); |
108 | printf("Compilation: %s\n" , "gcc -g -g3 -Werror -Wall -Wextra -W -Werror-implicit-function-declaration -Wpointer-arith -Wundef -Wformat=2 -Wformat-overflow=1 -Wno-format-truncation -Wno-format-nonliteral -Wno-cast-function-type -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wno-missing-field-initializers -Wold-style-definition -Wpacked -Wunknown-pragmas -Wvariadic-macros -fstack-protector-all -Wstack-protector -Wpacked-bitfield-compat -Wsync-nand -Wjump-misses-init -Wmissing-include-dirs -Wlogical-op -Wduplicated-cond -Wduplicated-branches -Wrestrict -Wnested-externs -Wno-char-subscripts -Wunreachable-code" ); |
109 | printf("Linking : %s\n" , "/usr/bin/ld -m elf_x86_64 -Wl,-Bsymbolic-functions" ); |
110 | } |
111 | |