aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-11-01 18:39:12 +0100
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-11-24 17:15:09 +0100
commit53fb37ae030c294e29e820cc4c34bca4d0ac2e27 (patch)
treebe5e3ed184e4ef8c8b3245d99f32d85941b4ab66
parent1baacd434046adcdf7cace66750f34ba3fc78b52 (diff)
Print version of libraries and features
When reporting the version of Dillo with -v, print also the version of the libraries it is currently using, as well as the features that were enabled at build time. Notice the versions are reported by reading them at runtime, so we can detect the version loaded at run time, regardless of which version was used at link time. All features are always printed, but prefixes with + if enabled or - if disabled. This allows checking if the feature was disabled at configure time or if it is missing in that version of Dillo.
-rw-r--r--ChangeLog1
-rw-r--r--src/Makefile.am2
-rw-r--r--src/dillo.cc3
-rw-r--r--src/version.cc106
-rw-r--r--src/version.hh25
5 files changed, 136 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index adfe6b26..844ec17c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,7 @@ dillo-3.2.0 [Not released yet]
- Fix GET requests over HTTPS via a proxy.
- Improve image resize logic to always try to preserve the aspect ratio.
- Reload current page on SIGUSR1 signal
+ - Print library versions and enabled features with dillo -v.
Patches: Rodrigo Arias Mallo
+- Add primitive support for SVG using the nanosvg.h library.
- Add support for ch, rem, vw, vh, vmin and vmax CSS units.
diff --git a/src/Makefile.am b/src/Makefile.am
index 2f33c049..bb1f6fc3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,6 +25,8 @@ dillo_LDADD = \
dillo_SOURCES = \
dillo.cc \
+ version.cc \
+ version.hh \
paths.cc \
paths.hh \
tipwin.cc \
diff --git a/src/dillo.cc b/src/dillo.cc
index e49dc1a3..2a65e12c 100644
--- a/src/dillo.cc
+++ b/src/dillo.cc
@@ -47,6 +47,7 @@
#include "bw.h"
#include "misc.h"
#include "history.h"
+#include "version.hh"
#include "dns.h"
#include "web.hh"
@@ -441,7 +442,7 @@ int main(int argc, char **argv)
}
break;
case DILLO_CLI_VERSION:
- puts("Dillo version " VERSION);
+ a_Version_print_info();
return 0;
case DILLO_CLI_HELP:
printHelp(argv[0], Options);
diff --git a/src/version.cc b/src/version.cc
new file mode 100644
index 00000000..417a1807
--- /dev/null
+++ b/src/version.cc
@@ -0,0 +1,106 @@
+/*
+ * Dillo web browser
+ *
+ * Copyright 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include "djpeg.h"
+#include "dpng.h"
+#include "IO/tls.h"
+
+#include <FL/Fl.H>
+#include <zlib.h>
+
+#include <stdio.h>
+
+static void print_libs()
+{
+ char buf[256];
+
+ printf("Libraries:");
+
+ /* FLTK only offers a single number */
+ {
+ int fltkver = Fl::api_version();
+ int fltk_maj = fltkver / 10000;
+ int fltk_min = (fltkver / 100) % 100;
+ int fltk_pat = fltkver % 100;
+ printf(" fltk/%d.%d.%d", fltk_maj, fltk_min, fltk_pat);
+ }
+
+ printf(" zlib/%s", zlibVersion());
+
+#ifdef ENABLE_JPEG
+ printf(" jpeg/%s", a_Jpeg_version());
+#endif
+
+#ifdef ENABLE_PNG
+ printf(" png/%s", a_Png_version());
+#endif
+
+#ifdef ENABLE_TLS
+ /* TLS prints the name/version format, as it determines which SSL
+ * library is in use */
+ printf(" %s", a_Tls_version(buf, 256));
+#endif
+
+ printf("\n");
+}
+
+static void print_features()
+{
+ printf("Features:"
+#ifdef ENABLE_GIF
+ " +GIF"
+#else
+ " -GIF"
+#endif
+#ifdef ENABLE_JPEG
+ " +JPEG"
+#else
+ " -JPEG"
+#endif
+#ifdef ENABLE_PNG
+ " +PNG"
+#else
+ " -PNG"
+#endif
+#ifdef ENABLE_SVG
+ " +SVG"
+#else
+ " -SVG"
+#endif
+#if !( defined(DISABLE_XEMBED) || defined(WIN32) || defined(__APPLE__) )
+ " +XEMBED"
+#else
+ " -XEMBED"
+#endif
+#ifdef ENABLE_TLS
+ " +TLS"
+#else
+ " -TLS"
+#endif
+ "\n");
+}
+
+void a_Version_print_info(void)
+{
+ printf("Dillo version " VERSION "\n");
+ print_libs();
+ print_features();
+}
diff --git a/src/version.hh b/src/version.hh
new file mode 100644
index 00000000..481c5e08
--- /dev/null
+++ b/src/version.hh
@@ -0,0 +1,25 @@
+/*
+ * Dillo web browser
+ *
+ * Copyright 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef VERSION_HH
+#define VERSION_HH
+
+void a_Version_print_info();
+
+#endif /* VERSION_HH */