summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@slbdata.se>2012-04-06 11:40:09 +0200
committerSamuel Lidén Borell <samuel@slbdata.se>2012-04-06 11:40:09 +0200
commita5154c4b505d2db5464206fc79b782efc6bbc9a9 (patch)
tree4afd8f993af874d17dca47121928306aced4ccc6
parentdeb651c6e5b4740c5c039dc60f00fc1b44c90f61 (diff)
downloadfribid-a5154c4b505d2db5464206fc79b782efc6bbc9a9.tar.gz
fribid-a5154c4b505d2db5464206fc79b782efc6bbc9a9.tar.bz2
fribid-a5154c4b505d2db5464206fc79b782efc6bbc9a9.zip
Make the GTK version configurable with ./configure --with-gtk=2|3
-rw-r--r--client/Makefile4
-rwxr-xr-xconfigure39
2 files changed, 40 insertions, 3 deletions
diff --git a/client/Makefile b/client/Makefile
index eeb32a8..2529cec 100644
--- a/client/Makefile
+++ b/client/Makefile
@@ -22,7 +22,7 @@
CFLAGS ?= -O2 -g
COMMONCFLAGS=$(CFLAGS) -Wall -Wextra -std=c99 -pedantic -Wno-unused-parameter
-PKG_DEPS='gtk+-2.0 >= 2.18' gdk-2.0 glib-2.0 gthread-2.0 $(if $(ENABLE_PKCS11),libp11) libcrypto
+PKG_DEPS=$(if $(WITH_GTK2),'gtk+-2.0 >= 2.18' gdk-2.0) $(if $(WITH_GTK3),gtk+-3.0) glib-2.0 gthread-2.0 $(if $(ENABLE_PKCS11),libp11) libcrypto
CCFLAGS=$(COMMONCFLAGS) -I../npapi/include `pkg-config --cflags $(PKG_DEPS)` -DGTK_DISABLE_DEPRECATED=1 -DGDK_DISABLE_DEPRECATED=1 -DG_DISABLE_DEPRECATED=1 -DGSEAL_ENABLE -DFRIBID_CLIENT
# You may have to add -lpthread after $(LDFLAGS) on OpenBSD
LINKFLAGS=$(CFLAGS) $(LDFLAGS) -Wl,--as-needed
@@ -35,6 +35,8 @@ UI_PATH=`../configure --internal--get-define=UI_PATH`
SIGNING_EXECUTABLE=`../configure --internal--get-define=SIGNING_EXECUTABLE`
UI_GTK_XML=`../configure --internal--get-define=UI_GTK_XML`
ENABLE_PKCS11=$(shell ../configure --internal--get-define=ENABLE_PKCS11|grep 1)
+WITH_GTK2=$(shell ../configure --internal--get-define=WITH_GTK2|grep 1)
+WITH_GTK3=$(shell ../configure --internal--get-define=WITH_GTK3|grep 1)
OBJECTS=backend.o bankid.o certutil.o $(if $(ENABLE_PKCS11),pkcs11.o) pkcs12.o request.o main.o misc.o pipe.o posix.o prefs.o glibconfig.o gtk.o xmldsig.o secmem.o
diff --git a/configure b/configure
index 508e2db..934d615 100755
--- a/configure
+++ b/configure
@@ -48,6 +48,8 @@ enable_pkcs11=""
optional_pkcs11="0"
pkcs11Module="/usr/$multilib/opensc-pkcs11.so"
+gtkversion="auto"
+
error=""
basedir=`dirname "$0"`
@@ -82,6 +84,7 @@ Options:
--disable-pkcs11 Disable building PKCS#11 smartcard support
--enable-pkcs11 Force building PKCS#11 smartcard support
--optional-pkcs11 Detect PKCS#11 module availability at runtime
+ --with-gtk=VERSION Selects between GTK version 2 and 3.
--current-user Selects a per-user installation. Equivalent to:
--prefix=$userPrefix
--plugin-path=$userPluginPath
@@ -136,6 +139,13 @@ Options:
--optional-pkcs11)
optional_pkcs11="1"
;;
+ --with-gtk=*)
+ gtkversion=${flag#--with-gtk=}
+ if [ "x$gtkversion" != xauto -a "x$gtkversion" != x2 -a "x$gtkversion" != x3 ]; then
+ echo "Invalid GTK version: $flag. Must be 2, 3 or auto."
+ error=1
+ fi
+ ;;
--current-user)
if [ -z "$prefixSet" ]; then
prefix="$userPrefix"
@@ -253,9 +263,32 @@ if [ -z "$enable_pkcs11" ] && pkg-config --exists libp11; then
enable_pkcs11=1
fi
-# Check that the PKCS#11 module exists
+### Detect GTK version
+if [ $gtkversion = auto ]; then
+ if pkg-config --exists "gtk+-3.0"; then
+ gtkversion=3
+ else
+ gtkversion=2
+ fi
+fi
+
+echo " GTK version: $gtkversion"
+if [ $gtkversion = 2 ]; then
+ with_gtk2=1
+ with_gtk3=0
+else
+ with_gtk2=0
+ with_gtk3=1
+fi
+echo
+
+### Check that the PKCS#11 module exists
depError=""
-pkgconfigDeps="gtk+-2.0 >= 2.12;gdk-2.0;glib-2.0;libcrypto;x11"
+if [ $with_gtk3 = 1 ]; then
+ pkgconfigDeps="gtk+-3.0;glib-2.0;libcrypto;x11"
+else
+ pkgconfigDeps="gtk+-2.0 >= 2.12;gdk-2.0;glib-2.0;libcrypto;x11"
+fi
if [ "$enable_pkcs11" = 1 ]; then
if [ "$optional_pkcs11" = 0 ]; then
echo " PKCS#11 smartcard support enabled"
@@ -345,6 +378,8 @@ cat <<EOT >"$CONFFILE"
#define ENABLE_PKCS11 ${enable_pkcs11:-0}
#define OPTIONAL_PKCS11 ${optional_pkcs11:-0}
+#define WITH_GTK2 ${with_gtk2}
+#define WITH_GTK3 ${with_gtk3}
EOT
### Display success message