Dillo v3.2.0-88-g47ab7c70
Loading...
Searching...
No Matches
version.cc
Go to the documentation of this file.
1/*
2 * Dillo web browser
3 *
4 * Copyright 2024-2025 Rodrigo Arias Mallo <rodarima@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "config.h"
21#include "commit.h"
22
23#include "djpeg.h"
24#include "dpng.h"
25#include "dwebp.h"
26#include "IO/tls.h"
27
28#include <FL/Fl.H>
29#include <zlib.h>
30
31#ifdef ENABLE_BROTLI
32#include <brotli/decode.h>
33#endif
34
35#include <stdio.h>
36
37static void print_libs()
38{
39 char buf[256];
40
41 printf("Libraries:");
42
43 /* FLTK only offers a single number */
44 {
45#if FL_MAJOR_VERSION == 1 && FL_MINOR_VERSION == 3 && FL_PATCH_VERSION <= 3
46 /* The version comes in a double like this 1.0302 (1.3.3), so we
47 * transform it to a integer as Fl::api_version(): 1.0303 -> 10303 */
48 int fltkver = (int) (Fl::version() * 10000.0);
49#else
50 int fltkver = Fl::api_version();
51#endif
52 int fltk_maj = fltkver / 10000;
53 int fltk_min = (fltkver / 100) % 100;
54 int fltk_pat = fltkver % 100;
55 printf(" fltk/%d.%d.%d", fltk_maj, fltk_min, fltk_pat);
56 }
57
58#ifdef ENABLE_JPEG
59 printf(" jpeg/%s", a_Jpeg_version());
60#endif
61
62#ifdef ENABLE_PNG
63 printf(" png/%s", a_Png_version());
64#endif
65
66#ifdef ENABLE_WEBP
67 printf(" webp/%s", a_Webp_version(buf, 256));
68#endif
69
70 printf(" zlib/%s", zlibVersion());
71
72#ifdef ENABLE_BROTLI
73 /* From brotli:
74 *
75 * Compose 3 components into a single number. In a hexadecimal
76 * representation B and C components occupy exactly 3 digits:
77 *
78 * #define BROTLI_MAKE_HEX_VERSION(A, B, C) ((A << 24) | (B << 12) | C)
79 */
80 {
81 /* Decode the version into each component */
82 uint32_t br_ver = BrotliDecoderVersion();
83 int br_maj = (br_ver >> 24) & 0x7ff;
84 int br_min = (br_ver >> 12) & 0x7ff;
85 int br_pat = (br_ver >> 0) & 0x7ff;
86
87 printf(" brotli/%d.%d.%d", br_maj, br_min, br_pat);
88 }
89#endif
90
91
92#ifdef ENABLE_TLS
93 /* TLS prints the name/version format, as it determines which SSL
94 * library is in use */
95 printf(" %s", a_Tls_version(buf, 256));
96#endif
97
98 printf("\n");
99}
100
101static void print_features()
102{
103 printf("Features:"
104#ifdef ENABLE_GIF
105 " +GIF"
106#else
107 " -GIF"
108#endif
109#ifdef ENABLE_JPEG
110 " +JPEG"
111#else
112 " -JPEG"
113#endif
114#ifdef ENABLE_PNG
115 " +PNG"
116#else
117 " -PNG"
118#endif
119#ifdef ENABLE_SVG
120 " +SVG"
121#else
122 " -SVG"
123#endif
124#ifdef ENABLE_WEBP
125 " +WEBP"
126#else
127 " -WEBP"
128#endif
129#ifdef ENABLE_BROTLI
130 " +BROTLI"
131#else
132 " -BROTLI"
133#endif
134#if !( defined(DISABLE_XEMBED) || defined(WIN32) || defined(__APPLE__) )
135 " +XEMBED"
136#else
137 " -XEMBED"
138#endif
139#ifdef ENABLE_TLS
140 " +TLS"
141#else
142 " -TLS"
143#endif
144#ifdef ENABLE_IPV6
145 " +IPV6"
146#else
147 " -IPV6"
148#endif
149 "\n");
150}
151
153{
154 const char *version = "v" VERSION;
155
156#ifdef GIT_COMMIT
157 version = GIT_COMMIT;
158#endif
159
160 printf("Dillo %s\n", version);
161 print_libs();
163}
const char * a_Jpeg_version(void)
Definition jpeg.c:424
const char * a_Png_version(void)
Definition png.c:440
const char * a_Webp_version(char *buf, int n)
Definition webp.c:218
const char * a_Tls_version(char *buf, int n)
Get the version of the TLS library.
Definition tls.c:31
static void print_libs()
Definition version.cc:37
void a_Version_print_info(void)
Definition version.cc:152
static void print_features()
Definition version.cc:101