aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2023-09-12 19:00:56 +0200
committerMihai Moldovan <ionic@ionic.de>2023-09-12 19:32:05 +0200
commit60a55ebbbd2e5656c436e2e469a0d627bb7ee13a (patch)
tree84f448123b0a73da3cf31390534d991085600d76 /configure.ac
parentb54bc7252b2587f9840e02c23b7035d37b0ebfd8 (diff)
downloadarctica-greeter-60a55ebbbd2e5656c436e2e469a0d627bb7ee13a.tar.gz
arctica-greeter-60a55ebbbd2e5656c436e2e469a0d627bb7ee13a.tar.bz2
arctica-greeter-60a55ebbbd2e5656c436e2e469a0d627bb7ee13a.zip
configure.ac: add --disable-gtk4 flag.
Previously, the HAVE_GTK_4_0 macro has been enabled whenever GTK 4 development files were found on the system. We keep that behavior, and actually modify the build system to actually build and link against GTK 4, but also add a new configure flag --disable-gtk4 that disables GTK 4 usage. The logic goes like that: - If --disable-gtk4 has not been provided, configure will first look for GTK 4 and use that if available, otherwise fall back to GTK+ 3. - If --disable-gtk4 has been provided, GTK 4 detection is skipped and only GTK+ 3 is detected. - If --enable-gtk4 has been provided, configure will check for GTK 4 and not fall back to GTK+ 3, but error out if GTK 4 has not been found. Note that making GTK 4 the default might not be the best option currently, because the greeter does not build against GTK 4, but is paving the way for the future. For now, users will have to use --disable-gtk4, up until all code has been fully ported to support GTK 4. Fixes: https://github.com/ArcticaProject/arctica-greeter/issues/56
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac67
1 files changed, 50 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac
index fdaa27f..7f0a76d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,8 +20,6 @@ dnl ###########################################################################
dnl #### removed from PKG_CHECK_MODULES: libido3-0.
PKG_CHECK_MODULES(ARCTICA_GREETER, [
- gtk+-3.0
- gdk-x11-3.0
libayatana-ido3-0.4 >= 0.4.0
ayatana-indicator3-0.4 >= 0.6.0
liblightdm-gobject-1 >= 1.12.0
@@ -33,6 +31,47 @@ PKG_CHECK_MODULES(ARCTICA_GREETER, [
xext
])
+dnl GTK version selection.
+AC_MSG_CHECKING([whether to enable GTK 4 support])
+AC_ARG_ENABLE([gtk4],
+ [AS_HELP_STRING([--disable-gtk4],
+ [disable support for GTK 4])],
+ [enable_gtk4=$enableval],
+ [enable_gtk4=auto])
+AC_MSG_RESULT([$enable_gtk4])
+with_gtk4=$enable_gtk4
+
+AS_IF([test "x$enable_gtk4" != 'xno'],
+ [PKG_CHECK_MODULES([GTK],
+ [gtk4
+ gtk4-x11],
+ [gtk4_modules=yes],
+ [gtk4_modules=no])
+ AC_MSG_CHECKING([for GTK 4 libraries])
+ AC_MSG_RESULT([$gtk4_modules])
+ AS_IF([test "x$gtk4_modules" = 'xno'],
+ [AS_IF([test "x$enable_gtk4" != 'xauto'],
+ [AC_MSG_ERROR([requested GTK 4, but not found])],
+ [with_gtk4=no])],
+ [with_gtk4=yes
+ AM_VALAFLAGS="$AM_VALAFLAGS -D HAVE_GTK_4_0"
+ AC_SUBST([AM_VALAFLAGS])])])
+AS_IF([test "x$with_gtk4" = 'xno'],
+ [PKG_CHECK_MODULES([GTK],
+ [gtk+-3.0
+ gdk-x11-3.0],
+ [gtk3_modules=yes],
+ [gtk3_modules=no])
+ AC_MSG_CHECKING([for GTK+ 3 libraries])
+ AC_MSG_RESULT([$gtk3_modules])
+ AS_IF([test "x$gtk3_modules" = 'xno'],
+ [AS_IF([test "x$enable_gtk4" = 'xauto'],
+ [AC_MSG_ERROR([fallback to GTK+ 3, but not found])],
+ [AC_MSG_ERROR([requested GTK+ 3, but not found])])])])
+AC_SUBST([GTK_CFLAGS])
+AC_SUBST([GTK_LIBS])
+AM_CONDITIONAL([HAVE_GTK4], [test "x$with_gtk4" != 'xno'])
+
AC_DEFINE_UNQUOTED([INDICATOR_FILE_DIR], ["${prefix}/share/ayatana/indicators"], [Indicator files are searched for in this directory])
INDICATORDIR=`$PKG_CONFIG --variable=indicatordir ayatana-indicator3-0.4`
@@ -86,21 +125,13 @@ dnl ###########################################################################
dnl Check for GTK version - 3.20
dnl ###########################################################################
-PKG_CHECK_MODULES(GTK_3_20_0, gtk+-3.0 >= 3.20.0 , gtk_check_pass=yes, gtk_check_pass=no)
-if test x$gtk_check_pass = xyes ; then
- AM_VALAFLAGS="$AM_VALAFLAGS -D HAVE_GTK_3_20_0"
- AC_SUBST([AM_VALAFLAGS])
-fi
-
-dnl ###########################################################################
-dnl Check for GTK version - 4.0
-dnl ###########################################################################
-
-PKG_CHECK_MODULES(GTK_4_0, gtk4 >= 4.0.0 , gtk4_check_pass=yes, gtk4_check_pass=no)
-if test x$gtk4_check_pass = xyes ; then
- AM_VALAFLAGS="$AM_VALAFLAGS -D HAVE_GTK_4_0"
- AC_SUBST([AM_VALAFLAGS])
-fi
+AS_IF([test "x$with_gtk4" != 'xno'],
+ [AM_VALAFLAGS="$AM_VALAFLAGS -D HAVE_GTK_3_20_0"
+ AC_SUBST([AM_VALAFLAGS])],
+ [PKG_CHECK_MODULES([GTK_3_20_0], [gtk+-3.0 >= 3.20.0], [gtk_check_pass=yes], [gtk_check_pass=no])
+ AS_IF([test "x$gtk_check_pass" = 'xyes'],
+ [AM_VALAFLAGS="$AM_VALAFLAGS -D HAVE_GTK_3_20_0"
+ AC_SUBST([AM_VALAFLAGS])])])
dnl ##########################################################################
dnl Remote Logon Dependencies
@@ -141,6 +172,8 @@ echo "
cflags: ${CFLAGS}
cppflags: ${CPPFLAGS}
+ GTK 4: ${with_gtk4}
+
GETTEXT_PACKAGE: ${GETTEXT_PACKAGE}
INDICATOR_FILE_DIR: ${prefix}/share/ayatana/indicators