]> git.meshlink.io Git - catta/commitdiff
gtk: build for both gtk2 and gtk3
authorLennart Poettering <lennart@poettering.net>
Fri, 25 Jun 2010 03:29:23 +0000 (05:29 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 25 Jun 2010 03:29:23 +0000 (05:29 +0200)
Makefile.am
avahi-discover-standalone/Makefile.am
avahi-ui-gtk3.pc.in [new file with mode: 0644]
avahi-ui.pc.in
avahi-ui/Makefile.am
configure.ac

index 02e3a9c4cb77ba2258fb89e42bfb904007214171..15a6cd8fe42d9560bcde12372bd4d749268bb709 100644 (file)
@@ -48,6 +48,7 @@ EXTRA_DIST = \
        avahi-compat-libdns_sd.pc.in \
        avahi-compat-howl.pc.in \
        avahi-ui.pc.in \
+       avahi-ui-gtk3.pc.in \
        doxygen_to_devhelp.xsl
 
 SUBDIRS = \
@@ -196,6 +197,13 @@ CLEANFILES += avahi-ui.pc
 endif
 endif
 
+if HAVE_GTK3
+if HAVE_DBUS
+pkgconfig_DATA += avahi-ui-gtk3.pc
+CLEANFILES += avahi-ui-gtk3.pc
+endif
+endif
+
 if HAVE_QT3
 pkgconfig_DATA += avahi-qt3.pc
 CLEANFILES += avahi-qt3.pc
index 1163575fedbb6ed27a2b86b37ccf0a394d83dc64..3995c0a6da08440a17be3160fda1646c5476e78e 100644 (file)
@@ -23,8 +23,8 @@ interfaces = \
 # This cool debug trap works on i386/gcc only
 AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
 
-if HAVE_GTK
-if  HAVE_GLIB
+if HAVE_GTK2OR3
+if HAVE_GLIB
 bin_PROGRAMS = \
        avahi-discover-standalone
 
@@ -33,15 +33,25 @@ avahi_discover_standalone_SOURCES = \
 
 avahi_discover_standalone_CFLAGS = \
        $(AM_CFLAGS) \
-       $(GLIB20_CFLAGS) $(GTK20_CFLAGS) \
        -DAVAHI_INTERFACES_DIR=\"$(interfacesdir)\"
 
 avahi_discover_standalone_LDADD = \
        $(AM_LDADD) \
        ../avahi-common/libavahi-common.la \
        ../avahi-glib/libavahi-glib.la \
-       ../avahi-core/libavahi-core.la  \
+       ../avahi-core/libavahi-core.la
+
+if HAVE_GTK3
+avahi_discover_standalone_CFLAGS += \
+       $(GLIB30_CFLAGS) $(GTK30_CFLAGS)
+avahi_discover_standalone_LDADD += \
+       $(GLIB30_LIBS) $(GTK30_LIBS)
+else
+avahi_discover_standalone_CFLAGS += \
+       $(GLIB20_CFLAGS) $(GTK20_CFLAGS)
+avahi_discover_standalone_LDADD += \
        $(GLIB20_LIBS) $(GTK20_LIBS)
+endif
 
 interfaces_DATA = $(interfaces)
 
diff --git a/avahi-ui-gtk3.pc.in b/avahi-ui-gtk3.pc.in
new file mode 100644 (file)
index 0000000..27c4322
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=${prefix}/include
+
+Name: avahi-ui
+Description: Avahi Multicast DNS Responder (Common GTK3 UI support)
+Requires: gtk+-3.0 avahi-client avahi-glib
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lavahi-ui-gtk3
+Cflags: -D_REENTRANT -I${includedir}
index ca9c2eff4e9fc639f1bc534fcb28fceaeaf517ca..9edeea96346142c9972eec4b009fd0252310b392 100644 (file)
@@ -4,7 +4,7 @@ libdir=@libdir@
 includedir=${prefix}/include
 
 Name: avahi-ui
-Description: Avahi Multicast DNS Responder (Common GTK UI support)
+Description: Avahi Multicast DNS Responder (Common GTK2 UI support)
 Requires: gtk+-2.0 avahi-client avahi-glib
 Version: @PACKAGE_VERSION@
 Libs: -L${libdir} -lavahi-ui
index 9d5a07ab271d4ee8379d787db816280dd2ef9fc5..72d60239a81a1488a3641364b0f91aef1d845735 100644 (file)
@@ -27,7 +27,7 @@ desktop_DATA_in_in = bssh.desktop.in.in bvnc.desktop.in.in
 
 EXTRA_DIST = $(desktop_DATA_in_in)
 
-if HAVE_GTK
+if HAVE_GTK2OR3
 AM_CFLAGS += -DGNOMELOCALEDIR=\"$(datadir)/locale\"
 if HAVE_DBUS
 if HAVE_GLIB
@@ -37,8 +37,17 @@ avahiincludedir=$(includedir)/avahi-ui
 avahiinclude_HEADERS = \
        avahi-ui.h
 
-lib_LTLIBRARIES = \
+lib_LTLIBRARIES =
+
+if HAVE_GTK
+lib_LTLIBRARIES += \
        libavahi-ui.la
+endif
+
+if HAVE_GTK3
+lib_LTLIBRARIES += \
+       libavahi-ui-gtk3.la
+endif
 
 libavahi_ui_la_SOURCES = \
        avahi-ui.h avahi-ui.c
@@ -46,15 +55,25 @@ libavahi_ui_la_CFLAGS = $(AM_CFLAGS) $(GTK20_CFLAGS)
 libavahi_ui_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la ../avahi-glib/libavahi-glib.la $(GTK20_LIBS)
 libavahi_ui_la_LDFLAGS = $(AM_LDFLAGS)  -version-info $(LIBAVAHI_UI_VERSION_INFO)
 
+libavahi_ui_gtk3_la_SOURCES = $(libavahi_ui_la_SOURCES)
+libavahi_ui_gtk3_la_CFLAGS = $(AM_CFLAGS) $(GTK30_CFLAGS)
+libavahi_ui_gtk3_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la ../avahi-glib/libavahi-glib.la $(GTK30_LIBS)
+libavahi_ui_gtk3_la_LDFLAGS = $(AM_LDFLAGS)  -version-info $(LIBAVAHI_UI_VERSION_INFO)
+
 if HAVE_GDBM
 libavahi_ui_la_SOURCES += ../avahi-utils/stdb.h ../avahi-utils/stdb.c
 libavahi_ui_la_CFLAGS += -DDATABASE_FILE=\"$(pkglibdir)/service-types.db\"
 libavahi_ui_la_LIBADD += -lgdbm
+
+libavahi_ui_gtk3_la_CFLAGS += -DDATABASE_FILE=\"$(pkglibdir)/service-types.db\"
+libavahi_ui_gtk3_la_LIBADD += -lgdbm
 endif
 
 if HAVE_DBM
 libavahi_ui_la_SOURCES += ../avahi-utils/stdb.h ../avahi-utils/stdb.c
 libavahi_ui_la_CFLAGS += -DDATABASE_FILE=\"$(pkglibdir)/service-types.db\"
+
+libavahi_ui_gtk3_la_CFLAGS += -DDATABASE_FILE=\"$(pkglibdir)/service-types.db\"
 endif
 
 bin_PROGRAMS = bssh
@@ -62,8 +81,14 @@ desktop_DATA += bssh.desktop bvnc.desktop
 @INTLTOOL_DESKTOP_RULE@
 
 bssh_SOURCES = bssh.c
+
+if HAVE_GTK3
+bssh_CFLAGS = $(AM_CFLAGS) $(GTK30_CFLAGS)
+bssh_LDADD = $(AM_LDADD) $(GTK30_LIBS) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la libavahi-ui-gtk3.la
+else
 bssh_CFLAGS = $(AM_CFLAGS) $(GTK20_CFLAGS)
 bssh_LDADD = $(AM_LDADD) $(GTK20_LIBS) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la libavahi-ui.la
+endif
 
 install-exec-local:
        cd $(DESTDIR)/$(bindir) && \
index 18ae214d78395c1091bc41376f258866985f4053..2366a009de57d8f0f38b3905d5bc42557c5a8a57 100644 (file)
@@ -518,10 +518,10 @@ fi
 AM_CONDITIONAL(HAVE_QT4, test "x$HAVE_QT4" = "xyes")
 
 #
-# Check for GTK+
+# Check for GTK+ 2.0
 #
 AC_ARG_ENABLE(gtk,
-        AS_HELP_STRING([--disable-gtk],[Disable use of GTK+]),
+        AS_HELP_STRING([--disable-gtk],[Disable use of GTK+ 2]),
         [case "${enableval}" in
                 yes) HAVE_GTK=yes ;;
                 no)  HAVE_GTK=no ;;
@@ -537,6 +537,28 @@ if test "x$HAVE_GTK" = "xyes" ; then
 fi
 AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
 
+#
+# Check for GTK+ 3.0
+#
+AC_ARG_ENABLE(gtk3,
+        AS_HELP_STRING([--disable-gtk3],[Disable use of GTK+ 3]),
+        [case "${enableval}" in
+                yes) HAVE_GTK3=yes ;;
+                no)  HAVE_GTK3=no ;;
+                *) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk3) ;;
+        esac],
+        [HAVE_GTK3=yes])
+
+if test "x$HAVE_GTK3" = "xyes" ; then
+        # Check for GTK 3.0
+        PKG_CHECK_MODULES(GTK30, [ gtk+-3.0 ])
+        AC_SUBST(GTK30_CFLAGS)
+        AC_SUBST(GTK30_LIBS)
+fi
+AM_CONDITIONAL(HAVE_GTK3, test "x$HAVE_GTK3" = "xyes")
+
+AM_CONDITIONAL(HAVE_GTK2OR3, test "x$HAVE_GTK3" = "xyes" -o "x$HAVE_GTK2" = "xyes" )
+
 #
 # D-Bus
 #
@@ -1104,7 +1126,8 @@ echo "
     CFLAGS:                                    ${CFLAGS}
     Enable GLIB:                               ${HAVE_GLIB}
     Enable GLIB GObject:                       ${HAVE_GOBJECT}
-    Enable GTK:                                ${HAVE_GTK}
+    Enable GTK 2.0:                            ${HAVE_GTK}
+    Enable GTK 3.0:                            ${HAVE_GTK3}
     Enable D-Bus:                              ${HAVE_DBUS}
     With XML:                                  ${with_xml}
     Enable GDBM:                               ${HAVE_GDBM}
@@ -1156,8 +1179,13 @@ if test "x$ENABLE_AUTOIPD" = "xyes" -a "x$HAVE_LIBDAEMON" != "xyes" ; then
    ENABLE_AUTOIPD="no   (You need libdaemon!)"
 fi
 
+HAVE_GTK2OR3=no
+if test "x$HAVE_GTK" = "xyes" -o "x$HAVE_GTK3" = "xyes" ; then
+   HAVE_GTK2OR3=yes
+fi
+
 BUILD_UI="no"
-if test "x$HAVE_GTK" = "xyes" -a "x$BUILD_CLIENT" = "xyes" ; then
+if test "x$HAVE_GTK2OR3" = "xyes" -a "x$BUILD_CLIENT" = "xyes" ; then
    BUILD_UI="yes"
 fi
 
@@ -1175,7 +1203,7 @@ echo "\
     Building avahi-python:              ${BUILD_PYTHON}
     Building libavahi-glib:             ${HAVE_GLIB}
     Building libavahi-gobject:          ${BUILD_GOBJECT}
-    Building avahi-discover-standalone: ${HAVE_GTK}
+    Building avahi-discover-standalone: ${HAVE_GTK2OR3}
     Building libavahi-qt3:              ${HAVE_QT3}
     Building libavahi-qt4:              ${HAVE_QT4}
     Building avahi-sharp:               ${HAVE_MONO}