enable gtk4 configure option newapi

Sat, 15 Apr 2023 15:40:31 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 15 Apr 2023 15:40:31 +0200
branch
newapi
changeset 170
ad9edb497857
parent 169
fe49cff3c571
child 171
5065d0d52680

enable gtk4 configure option

configure file | annotate | diff | comparison | revisions
make/project.xml file | annotate | diff | comparison | revisions
--- a/configure	Sun May 23 09:44:43 2021 +0200
+++ b/configure	Sat Apr 15 15:40:31 2023 +0200
@@ -55,7 +55,7 @@
   --mandir=DIR            man documentation [DATAROOTDIR/man]
 
 Options:
-  --toolkit=(gtk3|gtk2|gtk2legacy|qt5|qt4|motif)
+  --toolkit=(gtk4|gtk3|gtk2|gtk2legacy|qt5|qt4|motif)
 
 __EOF__
 }
@@ -376,6 +376,30 @@
 	echo no
 	return 1
 }
+dependency_gtk4()
+{
+    printf "checking for gtk4... "
+    # dependency gtk4 
+    while true
+    do
+        if [ -z "$PKG_CONFIG" ]; then
+        	break
+        fi
+		$PKG_CONFIG gtk+-4.0
+        if [ $? -ne 0 ] ; then
+            break
+        fi
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-4.0`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-4.0`"
+        CFLAGS="$CFLAGS -DUI_GTK3"    
+        LDFLAGS="$LDFLAGS -lpthread"    
+		echo yes
+        return 0
+    done
+	
+	echo no
+	return 1
+}
 dependency_motif()
 {
     printf "checking for motif... "
@@ -491,6 +515,23 @@
 #
 # OPTION VALUES
 #
+checkopt_toolkit_gtk4()
+{
+	VERR=0
+	dependency_gtk4
+	if [ $? -ne 0 ]; then
+		VERR=1
+	fi
+	if [ $VERR -ne 0 ]; then
+		return 1
+	fi
+	cat >> $TEMP_DIR/make.mk << __EOF__
+TOOLKIT = gtk
+GTKOBJ = draw_cairo.o
+
+__EOF__
+	return 0
+}
 checkopt_toolkit_gtk3()
 {
 	VERR=0
@@ -671,6 +712,12 @@
 else
 	if false; then
 		false
+	elif [ $OPT_TOOLKIT = "gtk4" ]; then
+		echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
+		checkopt_toolkit_gtk4
+		if [ $? -ne 0 ]; then
+			ERROR=1
+		fi
 	elif [ $OPT_TOOLKIT = "gtk3" ]; then
 		echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
 		checkopt_toolkit_gtk3
--- a/make/project.xml	Sun May 23 09:44:43 2021 +0200
+++ b/make/project.xml	Sat Apr 15 15:40:31 2023 +0200
@@ -1,12 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project>
-	<!--
 	<dependency name="gtk4">
 		<pkgconfig>gtk+-4.0</pkgconfig>
 		<cflags>-DUI_GTK3</cflags>
 		<ldflags>-lpthread</ldflags>
 	</dependency>
-	-->
 	<dependency name="gtk3">
 		<pkgconfig>gtk+-3.0</pkgconfig>
 		<cflags>-DUI_GTK3</cflags>
@@ -60,13 +58,11 @@
 	
 	<target name="tk">
 		<option arg="toolkit">
-			<!--
 			<value str="gtk4">
 				<dependencies>gtk4</dependencies>
 				<make>TOOLKIT = gtk</make>
 				<make>GTKOBJ = draw_cairo.o</make>
 			</value>
-			-->
 			<value str="gtk3">
 				<dependencies>gtk3</dependencies>
 				<make>TOOLKIT = gtk</make>

mercurial