[virt-tools-list] [virt-viewer] build-sys: Simplify setting of optional CFLAGS/LDFLAGS

Christophe Fergeau cfergeau at redhat.com
Fri Apr 12 19:22:08 UTC 2013


They don't need to be wrapped inside if HAVE_XXX blocks in Makefile.am
as when XXX is not available, XXX_CFLAGS and XXX_LIBS will expand to
the empty string, and thus we can carry them unconditionally in
our app_CFLAGS/app_LDFLAGS variables.
---
 configure.ac    |  1 -
 src/Makefile.am | 40 +++++++++++++++-------------------------
 2 files changed, 15 insertions(+), 26 deletions(-)

diff --git a/configure.ac b/configure.ac
index 32d5524..5102cea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -179,7 +179,6 @@ AS_IF([test "x$have_ovirt" = "xyes"],
              [AC_MSG_ERROR([oVirt support requested but libgovirt not found])
       ])
 ])
-AM_CONDITIONAL([HAVE_OVIRT], [test "x$have_ovirt" = "xyes"])
 
 dnl Decide if this platform can support the SSH tunnel feature.
 AC_CHECK_HEADERS([sys/socket.h sys/un.h windows.h])
diff --git a/src/Makefile.am b/src/Makefile.am
index 62cc606..12f71f3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -80,31 +80,25 @@ virt_viewer_LDFLAGS =				\
 	-lm					\
 	$(GLIB2_LIBS)				\
 	$(GTK_LIBS)				\
+	$(GTK_VNC_LIBS)				\
 	$(LIBXML2_LIBS)				\
 	$(LIBVIRT_LIBS)				\
+	$(OVIRT_LIBS)				\
+	$(SPICE_GTK_LIBS)			\
 	$(NULL)
 virt_viewer_CFLAGS = 				\
 	-DLOCALE_DIR=\""$(datadir)/locale"\"	\
 	-DG_LOG_DOMAIN=\"virt-viewer\"          \
 	$(GLIB2_CFLAGS) 			\
 	$(GTK_CFLAGS)				\
+	$(GTK_VNC_CFLAGS)			\
 	$(LIBXML2_CFLAGS)			\
 	$(LIBVIRT_CFLAGS)			\
+	$(OVIRT_CFLAGS)				\
+	$(SPICE_GTK_CFLAGS)			\
+	$(SPICE_CONTROLLER_CFLAGS)		\
 	$(WARN_CFLAGS)				\
 	$(NULL)
-
-if HAVE_GTK_VNC
-virt_viewer_LDFLAGS += $(GTK_VNC_LIBS)
-virt_viewer_CFLAGS += $(GTK_VNC_CFLAGS)
-endif
-if HAVE_OVIRT
-virt_viewer_LDFLAGS += $(OVIRT_LIBS)
-virt_viewer_CFLAGS += $(OVIRT_CFLAGS)
-endif
-if HAVE_SPICE_GTK
-virt_viewer_LDFLAGS += $(SPICE_GTK_LIBS)
-virt_viewer_CFLAGS += $(SPICE_GTK_CFLAGS)
-endif
 endif
 
 
@@ -118,29 +112,25 @@ remote_viewer_LDFLAGS =				\
 	-lm					\
 	$(GLIB2_LIBS)				\
 	$(GTK_LIBS)				\
+	$(GTK_VNC_LIBS)				\
 	$(LIBXML2_LIBS)				\
+	$(OVIRT_LIBS)				\
+	$(SPICE_GTK_LIBS)			\
+	$(SPICE_CONTROLLER_LIBS)		\
 	$(NULL)
 remote_viewer_CFLAGS =				\
 	-DLOCALE_DIR=\""$(datadir)/locale"\"	\
 	-DG_LOG_DOMAIN=\"remote-viewer\"        \
 	$(GLIB2_CFLAGS) 			\
 	$(GTK_CFLAGS)				\
+	$(GTK_VNC_CFLAGS)			\
 	$(LIBXML2_CFLAGS)			\
+	$(OVIRT_CFLAGS)				\
+	$(SPICE_GTK_CFLAGS)			\
+	$(SPICE_CONTROLLER_CFLAGS)		\
 	$(WARN_CFLAGS)				\
 	$(NULL)
 
-if HAVE_GTK_VNC
-remote_viewer_LDFLAGS += $(GTK_VNC_LIBS)
-remote_viewer_CFLAGS += $(GTK_VNC_CFLAGS)
-endif
-if HAVE_OVIRT
-remote_viewer_LDFLAGS += $(OVIRT_LIBS)
-remote_viewer_CFLAGS += $(OVIRT_CFLAGS)
-endif
-if HAVE_SPICE_GTK
-remote_viewer_LDFLAGS += $(SPICE_GTK_LIBS) $(SPICE_CONTROLLER_LIBS)
-remote_viewer_CFLAGS += $(SPICE_GTK_CFLAGS) $(SPICE_CONTROLLER_CFLAGS)
-endif
 if OS_WIN32
 remote_viewer_LDFLAGS += -Wl,--subsystem,windows
 endif
-- 
1.8.1.4




More information about the virt-tools-list mailing list