I couldn't find the time to look into Autotools before today, but I think I've found a working solution. Let me know if there's something that still needs fixing, but this works on my machine.

0001-*.patch contains the --enable-atril configure option, which is now the default and it looks for atril direcly, while --enable-evince only looks for evince and not atril. I think this is a bit more intuitive and needs a lot less configure.ac reading to figure out. If both are enabled, it's as if only --enable-atril was given (to avoid making a decision on test order).

0002-*.patch builds on the first one (they probably commute but I haven't tried, it should an easy fix anyway if they don't) and logs a deprecation warning every time GTK2 is used. I also disabled autodiscovery, so now Denemo doesn't compile if GTK3 is unavailable, unless GTK2 is explicitly enabled, which seems like a fair middle ground between breaking support in a single commit and not doing anything. With my changes people still stuck on GTK2 builds for no reason other than missing headers need to at least add a single build flag or install the GTK3 development libraries.

I tested with GTK3 and atril, also GTK3+evince, which gives me the same error about PDFs as before, so it works I guess but someone who has a working evince version should probably check.

sj

On 10/4/25 13:42, sj wrote:
I agree about GTK2 (not to mention that there's probably no one to test it anymore, which means additional maintenance overhead for no reason), also the atril switch. I'm no autotools wizard either, but I can try later tomorrow.

On 10/4/25 11:27, Richard Shann wrote:
On Thu, 2025-10-02 at 20:31 +0200, sj wrote:
I think --enable-atril isn't even a configure option, USE_ATRIL is
only defined if --enable-evince is true but the evince development
packages are missing so it falls back to Atril. Actually, USE_ATRIL
is defined in an if test "x$have_evince" != xno block (this is just
the configure option), if a use_atril variable is also on, which is
only set if the evince checks failed but it finds atril,

I think Denemo should default to atril and only use evince if it is not
available, as evince has failed to honor the point and click in PDF for
years now, which limits its usefulness in Denemo. Unfortunately I've
never managed to get my head around autotools so I'm unsure how to
arrange this.

  at least in the GTK3 branch. I think this is the same for GTK2 but I
haven't looked at it too much.

I think GTK2 is now old enough to be forgotten...

Richard



Ekkor: 2025. október 2. 19:13:49 CEST, Andreas Schneider
<[email protected]> írta:
Am 02.10.25 um 13:02 schrieb Richard Shann:
On Wed, 2025-10-01 at 19:49 +0200, Andreas Schneider wrote:
Am 01.10.25 um 14:05 schrieb Richard Shann:
On Tue, 2025-09-30 at 20:26 +0200, Andreas Schneider wrote:
Richard, can you please apply the patch from
http://deb.debian.org/debian/pool/main/d/denemo/ denemo_2.6.39-03.debian.tar.xz
    to make Denemo compile with recent libevince? You can
also find
it

Hmm, I get an error trying to build with this,

../src/source/proof.c:283: undefined reference to
`EV_DOCUMENT_ANNOTATIONS'

Is this something not in the atril headers or is it a version
matter?

Have you installed the libatrildocument-dev package?

well,
dpkg-query -l yields

ii  libatrildocument-dev                         1.26.0-
2+deb12u3                     amd64        MATE document
rendering library (development files)

and I see that the inclusion of
libdocument/ev-document-annotations.h
is missing in atril-document.h so this seems to be a bug in
libatrildocument.dev

To work around this bug I propose the attached patch. I'll apply
this
unless there are objections.

Thank you very much, the patch looks good, and it enables me to
compile successfully with libevince.

When I try to compile with --disable-evince --enable-atril, I get
the error

pageturner.c:28:10: fatal error: evince-view.h: Datei oder
Verzeichnis nicht gefunden
   28 | #include <evince-view.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.

It seems the constant USE_ATRIL is not defined correctly. What have
I made wrong?

Andreas






From 7f70969958f11cccc5c80e6731924552da52bb3b Mon Sep 17 00:00:00 2001
From: sj <[email protected]>
Date: Fri, 24 Oct 2025 17:35:57 +0200
Subject: [PATCH 2/2] Warn about GTK2 deprecation

---
 configure.ac | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index df6c89aa1..46d4f14e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,6 +252,7 @@ AC_ARG_ENABLE(
     if test "x$enableval" != "xno"; then
       usegtk2=yes
       PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.3)
+      AC_MSG_WARN([GTK2 support is deprecated and will be removed later.])
     fi
   ], [ usegtk2=no ])
 
@@ -261,6 +262,7 @@ AC_ARG_ENABLE(
   [
     if test "x$enableval" != "xno"; then
       usegtk3=yes
+      usegtk2=no
       PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.0.0)
     fi
   ], [ usegtk3=no ])
@@ -268,8 +270,9 @@ AC_ARG_ENABLE(
 if [test "x$usegtk2" = "xno"] && [test "x$usegtk3" = "xno"]; then
   PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.0.0, havegtk3=yes, havegtk3=no)
   if test "x$havegtk3" = "xno"; then
-    PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.3)
-    usegtk2=yes
+    AC_MSG_ERROR([GTK3 not found.
+                  For now, you can explicitly enable GTK2 support with --enable-gtk2.
+                  This will be removed later.])
   else
     usegtk3=yes
   fi
-- 
2.51.1

From 0b56f707a296acdc505e0ec3c7d99779be6b17fe Mon Sep 17 00:00:00 2001
From: sj <[email protected]>
Date: Fri, 24 Oct 2025 16:56:30 +0200
Subject: [PATCH 1/2] Add --enable-atril configure option

Previous behaviour needed one to enable evince but leave it missing from
the build environment. Now there is an explicit flag for using libatril,
which disables evince if enabled. By default evince is disabled and
atril is enabled.

Also fix typo in have_envince_3_0 variable name, luckily it was
previously unused.
---
 configure.ac | 82 +++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 59 insertions(+), 23 deletions(-)

diff --git a/configure.ac b/configure.ac
index abb46554d..df6c89aa1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -187,15 +187,41 @@ fi
 
 AC_ARG_ENABLE(
   evince,
-  AS_HELP_STRING([--enable-evince], [use EVINCE @<:@default=yes@:>@]),
+  AS_HELP_STRING([--enable-evince], [use EVINCE @<:@default=no@:>@]),
   [
-    if test "x$enableval" == "xno"; then
+    if test "x$enableval" = "xno"; then
       useevince=no
     else
       useevince=yes
     fi
-  ], [ useevince=yes ])
-AM_CONDITIONAL(HAVE_EVINCE, [test x$useevince = xyes])
+  ], [ useevince=auto ])
+
+AC_ARG_ENABLE(
+  atril,
+  AS_HELP_STRING([--enable-atril], [use ATRIL @<:@default=yes (unless explicitly enabling evince)@:>@]),
+  [
+    if test "x$enableval" = "xno"; then
+      useatril=no
+      if test x$useevince = xauto; then
+        useevince=no
+      fi
+    else
+      useatril=yes
+      if test x$useevince = xyes; then
+        AC_MSG_WARN([evince and atril both enabled, selecting atril])
+      fi
+      useevince=no
+    fi
+  ], [
+    useatril=yes
+    if test x$useevince = xauto; then
+      useevince=no
+    fi
+    if test x$useevince = xyes; then
+      useatril=no
+    fi
+  ])
+AM_CONDITIONAL(HAVE_EVINCE, [test x$useevince = xyes -o x$useatril = xyes])
 
 AC_ARG_ENABLE(
   aubio,
@@ -259,25 +285,36 @@ if test "x$usegtk2" = "xyes"; then
 
   if test "x$useevince" != "xno"; then
     PKG_CHECK_MODULES(EVINCE_2_0, evince-view-2.0 >= 2.0, have_evince2=yes, have_evince2=no)
-    CFLAGS="$CFLAGS $EVINCE_2_0_CFLAGS"
+    CFLAGS="$CFLAGS $EVINCE_2_0_CFLAGS -DUSE_EVINCE"
     LIBS="$LIBS $EVINCE_2_0_LIBS"
 
     if test "x$have_evince2" = "xno"; then
       PKG_CHECK_MODULES(EVINCE_2_30, evince-view-2.30 >= 2.0, have_evince2_3=yes, have_evince2_3=no)
-      CFLAGS="$CFLAGS $EVINCE_2_30_CFLAGS"
+      CFLAGS="$CFLAGS $EVINCE_2_30_CFLAGS -DUSE_EVINCE"
       LIBS="$LIBS $EVINCE_2_30_LIBS"
     fi
 
     if test "x$have_evince2_3" = "xno"; then
       PKG_CHECK_MODULES(EVINCE_2_32, evince-view-2.32 >= 2.0, have_evince2_32=yes, have_evince2_32=no)
-      CFLAGS="$CFLAGS $EVINCE_2_32_CFLAGS"
+      CFLAGS="$CFLAGS $EVINCE_2_32_CFLAGS -DUSE_EVINCE"
       LIBS="$LIBS $EVINCE_2_32_LIBS"
     fi
 
-    if test "x$have_evince2_32" = "xno"; then
-      PKG_CHECK_MODULES(ATRIL, atril-view-1.5.0 >= 1.5, have_atril=yes, have_atril=no)
-      CFLAGS="$CFLAGS $ATRIL_CFLAGS"
-      LIBS="$LIBS $ATRIL_LIBS"
+    if test "x$have_evince2" = "xno" -a \
+        "x$have_evince2_3" = "xno" -a \
+        "x$have_evince2_32" = "xno"
+    then
+      AC_MSG_ERROR([evince was requested but not found])
+    fi
+  fi
+
+  if test "x$useatril" != "xno"; then
+    PKG_CHECK_MODULES(ATRIL, atril-view-1.5.0 >= 1.5, have_atril=yes, have_atril=no)
+    CFLAGS="$CFLAGS $ATRIL_CFLAGS -DUSE_EVINCE -DUSE_ATRIL"
+    LIBS="$LIBS $ATRIL_LIBS"
+
+    if test "x$have_atril" = "xno"; then
+      AC_MSG_ERROR([atril was requested but not found])
     fi
   fi
 fi
@@ -291,24 +328,23 @@ if test "x$usegtk3" = "xyes"; then
   LIBS="$LIBS $GTKSOURCEVIEW_LIBS"
 
   if test "x$useevince" != "xno"; then
-    PKG_CHECK_MODULES(EVINCE, evince-view-3.0 >= 3.0, have_envince_3_0=yes, have_envince_3_0=no)
-    CFLAGS="$CFLAGS $EVINCE_CFLAGS"
+    PKG_CHECK_MODULES(EVINCE, evince-view-3.0 >= 3.0, have_evince_3_0=yes, have_evince_3_0=no)
+    CFLAGS="$CFLAGS $EVINCE_CFLAGS -DUSE_EVINCE"
     LIBS="$LIBS $EVINCE_LIBS"
+
+    if test "x$have_evince_3_0" = "xno"; then
+      AC_MSG_ERROR([evince was requested but not found])
+    fi
   fi
 
-  if test "x$have_envince_3_0" = "xno"; then
+  if test "x$useatril" != "xno"; then
     PKG_CHECK_MODULES(ATRIL, atril-view-1.5.0 >= 1.5, have_atril=yes, have_atril=no)
-    CFLAGS="$CFLAGS $ATRIL_CFLAGS"
+    CFLAGS="$CFLAGS $ATRIL_CFLAGS -DUSE_EVINCE -DUSE_ATRIL"
     LIBS="$LIBS $ATRIL_LIBS"
-  fi
-fi
 
-if test "x$useevince" = "xyes"; then
-  CFLAGS="$CFLAGS -DUSE_EVINCE"
-  LIBS="$LIBS -DUSE_EVINCE"
-  if test "x$have_atril" = "xyes"; then
-    CFLAGS="$CFLAGS -DUSE_ATRIL"
-    LIBS="$LIBS $ATRIL_LIBS"
+    if test "x$have_atril" = "xno"; then
+      AC_MSG_ERROR([atril was requested but not found])
+    fi
   fi
 fi
 
-- 
2.51.1

Reply via email to