[libvirt] [PATCH] maint: use gnulib configmake rather than open-coding things

Eric Blake eblake at redhat.com
Tue Nov 16 17:53:03 UTC 2010


In some cases, we were just plain confusing (BINDIR expanded to
$(libexecdir), GETTEXT_PACKAGE redefined PACKAGE for no apparant
reason); in other cases, we might as well benefit from gnulib doing
the work for us (PKGDATADIR), sometimes with different spellings
(LOCAL_STATE_DIR vs. LOCALSTATEDIR).

* bootstrap.conf (gnulib_modules): Add configmake.
* daemon/Makefile.am (libvirtd_CFLAGS): Drop defines provided by
gnulib.
* src/Makefile.am (INCLUDES): Likewise.
* tests/Makefile.am (INCLUDES): Likewise.
* tools/Makefile.am (virsh_CFLAGS): Likewise.
* daemon/libvirtd.c (qemudInitPaths, usage, main): Update
clients.
* src/cpu/cpu_map.c (CPUMAPFILE): Likewise.
* src/driver.c (DEFAULT_DRIVER_DIR): Likewise.
* src/internal.h (_): Likewise.
* src/libvirt.c (virInitialize): Likewise.
* src/lxc/lxc_conf.h (LXC_CONFIG_DIR, LXC_STATE_DIR, LXC_LOG_DIR):
Likewise.
* src/lxc/lxc_conf.c (lxcCapsInit, lxcLoadDriverConfig):
Likewise.
* src/network/bridge_driver.c (NETWORK_PID_DIR)
(NETWORK_STATE_DIR, DNSMASQ_STATE_DIR, networkStartup): Likewise.
* src/nwfilter/nwfilter_driver.c (nwfilterDriverStartup):
Likewise.
* src/qemu/qemu_conf.c (qemudLoadDriverConfig): Likewise.
* src/qemu/qemu_driver.c (qemudStartup): Likewise.
* src/remote/remote_driver.h (LIBVIRTD_PRIV_UNIX_SOCKET)
(LIBVIRTD_PRIV_UNIX_SOCKET_RO, LIBVIRTD_CONFIGURATION_FILE)
(LIBVIRT_PKI_DIR): Likewise.
* src/secret/secret_driver.c (secretDriverStartup): Likewise.
* src/security/security_apparmor.c (VIRT_AA_HELPER): Likewise.
* src/security/virt-aa-helper.c (main): Likewise.
* src/storage/storage_backend_disk.c (PARTHELPER): Likewise.
* src/storage/storage_driver.c (storageDriverStartup): Likewise.
* src/uml/uml_driver.c (TEMPDIR, umlStartup): Likewise.
* src/util/hooks.c (LIBVIRT_HOOK_DIR): Likewise.
* tools/virsh.c (main): Likewise.
* docs/hooks.html.in: Likewise.
---
 bootstrap.conf                     |    1 +
 daemon/Makefile.am                 |    6 ++----
 daemon/libvirtd.c                  |   14 ++++++++------
 docs/hooks.html.in                 |    2 +-
 src/Makefile.am                    |    8 --------
 src/cpu/cpu_map.c                  |    4 ++--
 src/driver.c                       |    3 ++-
 src/internal.h                     |    2 +-
 src/libvirt.c                      |    3 ++-
 src/lxc/lxc_conf.c                 |    7 ++++---
 src/lxc/lxc_conf.h                 |    7 ++++---
 src/network/bridge_driver.c        |   11 ++++++-----
 src/nwfilter/nwfilter_driver.c     |    6 +++---
 src/qemu/qemu_conf.c               |    6 ++++--
 src/qemu/qemu_driver.c             |   16 ++++++++--------
 src/remote/remote_driver.h         |   12 +++++++-----
 src/secret/secret_driver.c         |    3 ++-
 src/security/security_apparmor.c   |    5 +++--
 src/security/virt-aa-helper.c      |    7 ++++---
 src/storage/storage_backend_disk.c |    3 ++-
 src/storage/storage_driver.c       |    5 +++--
 src/uml/uml_driver.c               |    9 +++++----
 src/util/hooks.c                   |    3 ++-
 tests/Makefile.am                  |    1 -
 tools/Makefile.am                  |    2 --
 tools/virsh.c                      |    5 +++--
 26 files changed, 79 insertions(+), 72 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index 12f64c8..2ad1957 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -25,6 +25,7 @@ c-ctype
 canonicalize-lgpl
 close
 connect
+configmake
 count-one-bits
 crypto/md5
 dirname-lgpl
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 8808226..72778e5 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -85,12 +85,10 @@ libvirtd_CFLAGS = \
 	-I$(top_srcdir)/src/remote \
 	$(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
 	$(POLKIT_CFLAGS) \
-	$(WARN_CFLAGS) -DLOCAL_STATE_DIR="\"$(localstatedir)\"" \
+	$(WARN_CFLAGS) \
 	$(COVERAGE_CFLAGS) \
-	-DSYSCONF_DIR="\"$(sysconfdir)\"" \
 	-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\"" \
-	-DREMOTE_PID_FILE="\"$(REMOTE_PID_FILE)\"" \
-	-DGETTEXT_PACKAGE=\"$(PACKAGE)\"
+	-DREMOTE_PID_FILE="\"$(REMOTE_PID_FILE)\""

 libvirtd_LDFLAGS = 					\
 	$(WARN_CFLAGS) 					\
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 9446638..aab7667 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -137,6 +137,8 @@ static int unix_sock_ro_mask = 0777; /* Allow world */

 #endif /* __sun */

+#include "configmake.h"
+
 static int godaemon = 0;        /* -d: Be a daemon */
 static int verbose = 0;         /* -v: Verbose mode */
 static int timeout = -1;        /* -t: Shutdown timeout */
@@ -745,7 +747,7 @@ static int qemudInitPaths(struct qemud_server *server,
     /* The base_dir_prefix is the base under which all libvirtd
      * files live */
     if (server->privileged) {
-        if (!(base_dir_prefix = strdup (LOCAL_STATE_DIR)))
+        if (!(base_dir_prefix = strdup (LOCALSTATEDIR)))
             goto no_memory;
     } else {
         uid_t uid = geteuid();
@@ -3038,9 +3040,9 @@ libvirt management daemon:\n\
       %s\n\
 \n"),
                argv0,
-               SYSCONF_DIR,
-               LOCAL_STATE_DIR,
-               LOCAL_STATE_DIR,
+               SYSCONFDIR,
+               LOCALSTATEDIR,
+               LOCALSTATEDIR,
                LIBVIRT_CACERT,
                LIBVIRT_SERVERCERT,
                LIBVIRT_SERVERKEY,
@@ -3137,7 +3139,7 @@ int main(int argc, char **argv) {

     if (remote_config_file == NULL) {
         static const char *default_config_file
-            = SYSCONF_DIR "/libvirt/libvirtd.conf";
+            = SYSCONFDIR "/libvirt/libvirtd.conf";
         remote_config_file =
             (access(default_config_file, R_OK) == 0
              ? default_config_file
@@ -3169,7 +3171,7 @@ int main(int argc, char **argv) {

     /* Ensure the rundir exists (on tmpfs on some systems) */
     if (geteuid() == 0) {
-        const char *rundir = LOCAL_STATE_DIR "/run/libvirt";
+        const char *rundir = LOCALSTATEDIR "/run/libvirt";

         if (mkdir (rundir, 0755)) {
             if (errno != EEXIST) {
diff --git a/docs/hooks.html.in b/docs/hooks.html.in
index 2ce785f..3503f8c 100644
--- a/docs/hooks.html.in
+++ b/docs/hooks.html.in
@@ -19,7 +19,7 @@

     <h2><a name="location">Script location</a></h2>
     <p>The libvirt hook scripts are located in the directory
-       <code>$SYSCONF_DIR/libvirt/hooks/</code>.</p>
+       <code>$SYSCONFDIR/libvirt/hooks/</code>.</p>
     <ul>
       <li>In Linux distributions such as Fedora and RHEL, this is
           <code>/etc/libvirt/hooks/</code>.  Other Linux distributions may do
diff --git a/src/Makefile.am b/src/Makefile.am
index 20c0c9f..a9a1986 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,14 +11,6 @@ INCLUDES =							\
 		-I at top_srcdir@/include				\
 		$(DRIVER_MODULE_CFLAGS)				\
 		$(LIBXML_CFLAGS)				\
-		-DLIBDIR=\""$(libdir)"\"			\
-		-DBINDIR=\""$(libexecdir)"\"			\
-		-DSBINDIR=\""$(sbindir)"\"			\
-		-DSYSCONF_DIR="\"$(sysconfdir)\""		\
-		-DLOCALEBASEDIR=\""$(datadir)/locale"\"		\
-		-DPKGDATADIR=\""$(pkgdatadir)"\"		\
-		-DLOCAL_STATE_DIR=\""$(localstatedir)"\"	\
-		-DGETTEXT_PACKAGE=\"$(PACKAGE)\"		\
 		$(WARN_CFLAGS)					\
 		$(LOCK_CHECKING_CFLAGS)			\
 		-DIN_LIBVIRT				\
diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c
index 263bb9e..0c5ff8a 100644
--- a/src/cpu/cpu_map.c
+++ b/src/cpu/cpu_map.c
@@ -1,7 +1,7 @@
 /*
  * cpu_map.c: internal functions for handling CPU mapping configuration
  *
- * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -26,7 +26,7 @@
 #include "memory.h"
 #include "cpu.h"
 #include "cpu_map.h"
-
+#include "configmake.h"

 #define VIR_FROM_THIS VIR_FROM_CPU

diff --git a/src/driver.c b/src/driver.c
index a6f5558..d83b1fd 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -1,7 +1,7 @@
 /*
  * driver.c: Helpers for loading drivers
  *
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -28,6 +28,7 @@
 #include "memory.h"
 #include "logging.h"
 #include "util.h"
+#include "configmake.h"

 #define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/drivers"

diff --git a/src/internal.h b/src/internal.h
index fab3e11..a98daa3 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -52,7 +52,7 @@
 #  define INET_ADDRSTRLEN 16
 # endif

-# define _(str) dgettext(GETTEXT_PACKAGE, (str))
+# define _(str) dgettext(PACKAGE, (str))
 # define N_(str) str

 /* String equality tests, suggested by Jim Meyering. */
diff --git a/src/libvirt.c b/src/libvirt.c
index 3c8bf30..eba0dee 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -39,6 +39,7 @@
 #include "uuid.h"
 #include "util.h"
 #include "memory.h"
+#include "configmake.h"

 #ifndef WITH_DRIVER_MODULES
 # ifdef WITH_TEST
@@ -342,7 +343,7 @@ virInitialize(void)
     if (winsock_init () == -1) return -1;
 #endif

-    if (!bindtextdomain(GETTEXT_PACKAGE, LOCALEBASEDIR))
+    if (!bindtextdomain(PACKAGE, LOCALEDIR))
         return (-1);

     /*
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index f4479e6..59d1161 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright (C) 2010 Red Hat, Inc.
  * Copyright IBM Corp. 2008
  *
  * lxc_conf.c: config functions for managing linux containers
@@ -34,7 +35,7 @@
 #include "memory.h"
 #include "logging.h"
 #include "uuid.h"
-
+#include "configmake.h"

 #define VIR_FROM_THIS VIR_FROM_LXC

@@ -73,7 +74,7 @@ virCapsPtr lxcCapsInit(void)
                                          "exe",
                                          utsname.machine,
                                          sizeof(int) == 4 ? 32 : 8,
-                                         BINDIR "/libvirt_lxc",
+                                         LIBEXECDIR "/libvirt_lxc",
                                          NULL,
                                          0,
                                          NULL)) == NULL)
@@ -114,7 +115,7 @@ int lxcLoadDriverConfig(lxc_driver_t *driver)
         goto no_memory;


-    if ((filename = strdup(SYSCONF_DIR "/libvirt/lxc.conf")) == NULL)
+    if ((filename = strdup(SYSCONFDIR "/libvirt/lxc.conf")) == NULL)
         goto no_memory;

     /* Avoid error from non-existant or unreadable file. */
diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h
index e4c2c52..f820d6d 100644
--- a/src/lxc/lxc_conf.h
+++ b/src/lxc/lxc_conf.h
@@ -33,10 +33,11 @@
 # include "capabilities.h"
 # include "threads.h"
 # include "cgroup.h"
+# include "configmake.h"

-# define LXC_CONFIG_DIR SYSCONF_DIR "/libvirt/lxc"
-# define LXC_STATE_DIR LOCAL_STATE_DIR "/run/libvirt/lxc"
-# define LXC_LOG_DIR LOCAL_STATE_DIR "/log/libvirt/lxc"
+# define LXC_CONFIG_DIR SYSCONFDIR "/libvirt/lxc"
+# define LXC_STATE_DIR LOCALSTATEDIR "/run/libvirt/lxc"
+# define LXC_LOG_DIR LOCALSTATEDIR "/log/libvirt/lxc"
 # define LXC_AUTOSTART_DIR LXC_CONFIG_DIR "/autostart"

 typedef struct __lxc_driver lxc_driver_t;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 631fbf1..54890f9 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -58,11 +58,12 @@
 #include "logging.h"
 #include "dnsmasq.h"
 #include "util/network.h"
+#include "configmake.h"

-#define NETWORK_PID_DIR LOCAL_STATE_DIR "/run/libvirt/network"
-#define NETWORK_STATE_DIR LOCAL_STATE_DIR "/lib/libvirt/network"
+#define NETWORK_PID_DIR LOCALSTATEDIR "/run/libvirt/network"
+#define NETWORK_STATE_DIR LOCALSTATEDIR "/lib/libvirt/network"

-#define DNSMASQ_STATE_DIR LOCAL_STATE_DIR "/lib/libvirt/dnsmasq"
+#define DNSMASQ_STATE_DIR LOCALSTATEDIR "/lib/libvirt/dnsmasq"

 #define VIR_FROM_THIS VIR_FROM_NETWORK

@@ -209,10 +210,10 @@ networkStartup(int privileged) {

     if (privileged) {
         if (virAsprintf(&driverState->logDir,
-                        "%s/log/libvirt/qemu", LOCAL_STATE_DIR) == -1)
+                        "%s/log/libvirt/qemu", LOCALSTATEDIR) == -1)
             goto out_of_memory;

-        if ((base = strdup (SYSCONF_DIR "/libvirt")) == NULL)
+        if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
             goto out_of_memory;
     } else {
         char *userdir = virGetUserDirectory(uid);
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 4efeb3a..a305de6 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -2,7 +2,7 @@
  * nwfilter_driver.c: core driver for network filter APIs
  *                    (based on storage_driver.c)
  *
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  * Copyright (C) 2010 IBM Corporation
  * Copyright (C) 2010 Stefan Berger
@@ -37,7 +37,7 @@
 #include "nwfilter_conf.h"
 #include "nwfilter_driver.h"
 #include "nwfilter_gentech_driver.h"
-
+#include "configmake.h"

 #include "nwfilter_learnipaddr.h"

@@ -83,7 +83,7 @@ nwfilterDriverStartup(int privileged) {
     nwfilterDriverLock(driverState);

     if (privileged) {
-        if ((base = strdup (SYSCONF_DIR "/libvirt")) == NULL)
+        if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
             goto out_of_memory;
     } else {
         uid_t uid = geteuid();
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 83a117a..35caccc 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -56,6 +56,7 @@
 #include "cpu/cpu.h"
 #include "domain_nwfilter.h"
 #include "files.h"
+#include "configmake.h"

 #define VIR_FROM_THIS VIR_FROM_QEMU

@@ -112,7 +113,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
         virReportOOMError();
         return -1;
     }
-    if (!(driver->vncTLSx509certdir = strdup(SYSCONF_DIR "/pki/libvirt-vnc"))) {
+    if (!(driver->vncTLSx509certdir = strdup(SYSCONFDIR "/pki/libvirt-vnc"))) {
         virReportOOMError();
         return -1;
     }
@@ -121,7 +122,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
         virReportOOMError();
         return -1;
     }
-    if (!(driver->spiceTLSx509certdir = strdup(SYSCONF_DIR "/pki/libvirt-spice"))) {
+    if (!(driver->spiceTLSx509certdir
+          = strdup(SYSCONFDIR "/pki/libvirt-spice"))) {
         virReportOOMError();
         return -1;
     }
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 772fd50..f3b158a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -84,7 +84,7 @@
 #include "virtaudit.h"
 #include "files.h"
 #include "fdstream.h"
-
+#include "configmake.h"

 #define VIR_FROM_THIS VIR_FROM_QEMU

@@ -1762,28 +1762,28 @@ qemudStartup(int privileged) {

     if (privileged) {
         if (virAsprintf(&qemu_driver->logDir,
-                        "%s/log/libvirt/qemu", LOCAL_STATE_DIR) == -1)
+                        "%s/log/libvirt/qemu", LOCALSTATEDIR) == -1)
             goto out_of_memory;

-        if ((base = strdup (SYSCONF_DIR "/libvirt")) == NULL)
+        if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
             goto out_of_memory;

         if (virAsprintf(&qemu_driver->stateDir,
-                      "%s/run/libvirt/qemu", LOCAL_STATE_DIR) == -1)
+                      "%s/run/libvirt/qemu", LOCALSTATEDIR) == -1)
             goto out_of_memory;

         if (virAsprintf(&qemu_driver->libDir,
-                      "%s/lib/libvirt/qemu", LOCAL_STATE_DIR) == -1)
+                      "%s/lib/libvirt/qemu", LOCALSTATEDIR) == -1)
             goto out_of_memory;

         if (virAsprintf(&qemu_driver->cacheDir,
-                      "%s/cache/libvirt/qemu", LOCAL_STATE_DIR) == -1)
+                      "%s/cache/libvirt/qemu", LOCALSTATEDIR) == -1)
             goto out_of_memory;
         if (virAsprintf(&qemu_driver->saveDir,
-                      "%s/lib/libvirt/qemu/save", LOCAL_STATE_DIR) == -1)
+                      "%s/lib/libvirt/qemu/save", LOCALSTATEDIR) == -1)
             goto out_of_memory;
         if (virAsprintf(&qemu_driver->snapshotDir,
-                        "%s/lib/libvirt/qemu/snapshot", LOCAL_STATE_DIR) == -1)
+                        "%s/lib/libvirt/qemu/snapshot", LOCALSTATEDIR) == -1)
             goto out_of_memory;
     } else {
         uid_t uid = geteuid();
diff --git a/src/remote/remote_driver.h b/src/remote/remote_driver.h
index 49a63bd..1504eec 100644
--- a/src/remote/remote_driver.h
+++ b/src/remote/remote_driver.h
@@ -2,7 +2,7 @@
  * remote_internal.h: driver to provide access to libvirtd running
  *   on a remote machine
  *
- * Copyright (C) 2006-2007 Red Hat, Inc.
+ * Copyright (C) 2006-2007, 2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -26,6 +26,8 @@

 # include "libvirt/virterror.h"

+# include "configmake.h"
+
 int remoteRegister (void);

 unsigned long remoteVersion(void);
@@ -33,13 +35,13 @@ unsigned long remoteVersion(void);
 # define LIBVIRTD_LISTEN_ADDR NULL
 # define LIBVIRTD_TLS_PORT "16514"
 # define LIBVIRTD_TCP_PORT "16509"
-# define LIBVIRTD_PRIV_UNIX_SOCKET LOCAL_STATE_DIR "/run/libvirt/libvirt-sock"
-# define LIBVIRTD_PRIV_UNIX_SOCKET_RO LOCAL_STATE_DIR "/run/libvirt/libvirt-sock-ro"
+# define LIBVIRTD_PRIV_UNIX_SOCKET LOCALSTATEDIR "/run/libvirt/libvirt-sock"
+# define LIBVIRTD_PRIV_UNIX_SOCKET_RO LOCALSTATEDIR "/run/libvirt/libvirt-sock-ro"
 # define LIBVIRTD_USER_UNIX_SOCKET "/.libvirt/libvirt-sock"
-# define LIBVIRTD_CONFIGURATION_FILE SYSCONF_DIR "/libvirtd.conf"
+# define LIBVIRTD_CONFIGURATION_FILE SYSCONFDIR "/libvirtd.conf"

 /* Defaults for PKI directory. */
-# define LIBVIRT_PKI_DIR SYSCONF_DIR "/pki"
+# define LIBVIRT_PKI_DIR SYSCONFDIR "/pki"
 # define LIBVIRT_CACERT LIBVIRT_PKI_DIR "/CA/cacert.pem"
 # define LIBVIRT_CLIENTKEY LIBVIRT_PKI_DIR "/libvirt/private/clientkey.pem"
 # define LIBVIRT_CLIENTCERT LIBVIRT_PKI_DIR "/libvirt/clientcert.pem"
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 2b5a7c6..c5a876b 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -42,6 +42,7 @@
 #include "uuid.h"
 #include "virterror_internal.h"
 #include "files.h"
+#include "configmake.h"

 #define VIR_FROM_THIS VIR_FROM_SECRET

@@ -994,7 +995,7 @@ secretDriverStartup(int privileged)
     secretDriverLock(driverState);

     if (privileged) {
-        base = strdup(SYSCONF_DIR "/libvirt");
+        base = strdup(SYSCONFDIR "/libvirt");
         if (base == NULL)
             goto out_of_memory;
     } else {
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index be39f75..b43c4ac 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -38,11 +38,12 @@
 #include "pci.h"
 #include "hostusb.h"
 #include "files.h"
+#include "configmake.h"

 #define VIR_FROM_THIS VIR_FROM_SECURITY
 #define SECURITY_APPARMOR_VOID_DOI      "0"
 #define SECURITY_APPARMOR_NAME          "apparmor"
-#define VIRT_AA_HELPER BINDIR "/virt-aa-helper"
+#define VIRT_AA_HELPER LIBEXECDIR "/virt-aa-helper"

 /* Data structure to pass to *FileIterate so we have everything we need */
 struct SDPDOP {
@@ -561,7 +562,7 @@ AppArmorRestoreSecurityAllLabel(virSecurityDriverPtr drv ATTRIBUTE_UNUSED,
 }

 /* Called via virExecWithHook. Output goes to
- * LOCAL_STATE_DIR/log/libvirt/qemu/<vm name>.log
+ * LOCALSTATEDIR/log/libvirt/qemu/<vm name>.log
  */
 static int
 AppArmorSetSecurityProcessLabel(virSecurityDriverPtr drv, virDomainObjPtr vm)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 5708cd8..0f94fe4 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -38,6 +38,7 @@
 #include "hostusb.h"
 #include "pci.h"
 #include "files.h"
+#include "configmake.h"

 static char *progname;

@@ -1179,11 +1180,11 @@ main(int argc, char **argv)
                 goto clean;
         } else {
             virBufferVSprintf(&buf, "  \"%s/log/libvirt/**/%s.log\" w,\n",
-                              LOCAL_STATE_DIR, ctl->def->name);
+                              LOCALSTATEDIR, ctl->def->name);
             virBufferVSprintf(&buf, "  \"%s/lib/libvirt/**/%s.monitor\" rw,\n",
-                              LOCAL_STATE_DIR, ctl->def->name);
+                              LOCALSTATEDIR, ctl->def->name);
             virBufferVSprintf(&buf, "  \"%s/run/libvirt/**/%s.pid\" rwk,\n",
-                              LOCAL_STATE_DIR, ctl->def->name);
+                              LOCALSTATEDIR, ctl->def->name);
             if (ctl->files)
                 virBufferVSprintf(&buf, "%s", ctl->files);
         }
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index a8864dd..c7ade6b 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -31,10 +31,11 @@
 #include "storage_backend_disk.h"
 #include "util.h"
 #include "memory.h"
+#include "configmake.h"

 #define VIR_FROM_THIS VIR_FROM_STORAGE

-#define PARTHELPER BINDIR "/libvirt_parthelper"
+#define PARTHELPER LIBEXECDIR "/libvirt_parthelper"

 #define SECTOR_SIZE 512

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index f6672d9..6df706b 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1,7 +1,7 @@
 /*
  * storage_driver.c: core driver for storage APIs
  *
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -46,6 +46,7 @@
 #include "storage_backend.h"
 #include "logging.h"
 #include "files.h"
+#include "configmake.h"

 #define VIR_FROM_THIS VIR_FROM_STORAGE

@@ -125,7 +126,7 @@ storageDriverStartup(int privileged) {
     storageDriverLock(driverState);

     if (privileged) {
-        if ((base = strdup (SYSCONF_DIR "/libvirt")) == NULL)
+        if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
             goto out_of_memory;
     } else {
         uid_t uid = geteuid();
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 3588894..77610d4 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -61,11 +61,12 @@
 #include "domain_nwfilter.h"
 #include "files.h"
 #include "fdstream.h"
+#include "configmake.h"

 #define VIR_FROM_THIS VIR_FROM_UML

 /* For storing short-lived temporary files. */
-#define TEMPDIR LOCAL_STATE_DIR "/cache/libvirt"
+#define TEMPDIR LOCALSTATEDIR "/cache/libvirt"

 typedef struct _umlDomainObjPrivate umlDomainObjPrivate;
 typedef umlDomainObjPrivate *umlDomainObjPrivatePtr;
@@ -371,14 +372,14 @@ umlStartup(int privileged) {

     if (privileged) {
         if (virAsprintf(&uml_driver->logDir,
-                        "%s/log/libvirt/uml", LOCAL_STATE_DIR) == -1)
+                        "%s/log/libvirt/uml", LOCALSTATEDIR) == -1)
             goto out_of_memory;

-        if ((base = strdup (SYSCONF_DIR "/libvirt")) == NULL)
+        if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
             goto out_of_memory;

         if (virAsprintf(&uml_driver->monitorDir,
-                        "%s/run/libvirt/uml-guest", LOCAL_STATE_DIR) == -1)
+                        "%s/run/libvirt/uml-guest", LOCALSTATEDIR) == -1)
             goto out_of_memory;
     } else {

diff --git a/src/util/hooks.c b/src/util/hooks.c
index 6e4e2b9..8e24564 100644
--- a/src/util/hooks.c
+++ b/src/util/hooks.c
@@ -37,6 +37,7 @@
 #include "logging.h"
 #include "memory.h"
 #include "files.h"
+#include "configmake.h"

 #define VIR_FROM_THIS VIR_FROM_HOOK

@@ -44,7 +45,7 @@
     virReportErrorHelper(NULL, VIR_FROM_HOOK, code, __FILE__,      \
                          __FUNCTION__, __LINE__, __VA_ARGS__)

-#define LIBVIRT_HOOK_DIR SYSCONF_DIR "/libvirt/hooks"
+#define LIBVIRT_HOOK_DIR SYSCONFDIR "/libvirt/hooks"

 VIR_ENUM_DECL(virHookDriver)
 VIR_ENUM_DECL(virHookDaemonOp)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 20b6805..77b6fb9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -17,7 +17,6 @@ INCLUDES = \
 	$(SASL_CFLAGS) \
 	$(SELINUX_CFLAGS) \
 	$(APPARMOR_CFLAGS) \
-        -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
          $(COVERAGE_CFLAGS) \
          $(WARN_CFLAGS)

diff --git a/tools/Makefile.am b/tools/Makefile.am
index 921d621..376ffa8 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -55,8 +55,6 @@ virsh_CFLAGS =							\
 		-I$(top_srcdir)/src				\
 		-I$(top_srcdir)/src/util			\
 		-I$(top_srcdir)					\
-		-DGETTEXT_PACKAGE=\"$(PACKAGE)\"		\
-		-DLOCALEBASEDIR=\""$(datadir)/locale"\"		\
 		$(WARN_CFLAGS)					\
 		$(COVERAGE_CFLAGS)				\
 		$(LIBXML_CFLAGS)				\
diff --git a/tools/virsh.c b/tools/virsh.c
index 3a74053..743d5a1 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -53,6 +53,7 @@
 #include "libvirt/libvirt-qemu.h"
 #include "files.h"
 #include "../daemon/event.h"
+#include "configmake.h"

 static char *progname;

@@ -11786,11 +11787,11 @@ main(int argc, char **argv)
         perror("setlocale");
         /* failure to setup locale is not fatal */
     }
-    if (!bindtextdomain(GETTEXT_PACKAGE, LOCALEBASEDIR)) {
+    if (!bindtextdomain(PACKAGE, LOCALEDIR)) {
         perror("bindtextdomain");
         return -1;
     }
-    if (!textdomain(GETTEXT_PACKAGE)) {
+    if (!textdomain(PACKAGE)) {
         perror("textdomain");
         return -1;
     }
-- 
1.7.3.2




More information about the libvir-list mailing list