[PATCH xorg-gtest 2/3] Install configuration file in /etc/X11 instead of /ush/share/xorg/gtest

Daniel d'Andrada daniel.dandrada at canonical.com
Mon Jan 30 09:32:19 PST 2012


This is another enabler for making it possible to run Xorg without
root privileges.

The -config parameter in Xorg doesn't accept files in paths outside
Xorg's standard search path for config files when run as non-root.
See -config in "man Xorg" for more info.

You have to run configure with "--sysconfdir=/etc" so that our conf
file lands in Xorg's standard path for configuration files, namely /etc/X11

Signed-off-by: Daniel d'Andrada <daniel.dandrada at canonical.com>

diff --git a/Makefile.am b/Makefile.am
index d10bca8..24f6f7b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,13 +20,12 @@ library_include_HEADERS = \
      include/xorg/gtest/process.h \
      include/xorg/gtest/test.h

-library_datadir = $(datadir)/xorg/gtest
-library_data_DATA = conf/dummy.conf
+library_datadir = $(sysconfdir)/X11
+library_data_DATA = conf/gtest-dummy.conf

  libxorg_gtest_main_la_CPPFLAGS = \
      $(AM_CPPFLAGS) \
-    $(GTEST_CPPFLAGS) \
-    -DDUMMY_CONF_PATH="\"$(library_datadir)/dummy.conf\""
+    $(GTEST_CPPFLAGS)

  libxorg_gtest_la_LDFLAGS = $(X11_LIBS)
  libxorg_gtest_main_la_LDFLAGS = $(X11_LIBS)
diff --git a/configure.ac b/configure.ac
index 9d7b36b..d7d1682 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,7 +36,7 @@ AS_IF([test "x$ac_cv_lib_gtest_main" != xyes],

  AC_SUBST([GTEST_CPPFLAGS])

-AC_SUBST(DUMMY_CONF_PATH, "$datadir/xorg/gtest/dummy.conf")
+AC_SUBST(DUMMY_CONF_PATH, "$sysconfdir/X11/gtest-dummy.conf")

  AC_CONFIG_FILES([Makefile
                   xorg-gtest.pc])
diff --git a/src/main.cpp b/src/main.cpp
index eb6e728..2d45468 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -26,6 +26,7 @@
  #include "xorg/gtest/environment.h"

  #define DEFAULT_XORG_LOGFILE "/tmp/Xorg.GTest.log"
+#define DEFAULT_XORG_CONFIG "gtest-dummy.conf"

  namespace {

@@ -50,7 +51,7 @@ const struct option longopts[] = {

  int main(int argc, char *argv[]) {
    /* Default Xorg dummy conf path. */
-  std::string xorg_conf_path(DUMMY_CONF_PATH);
+  std::string xorg_conf_path(DEFAULT_XORG_CONFIG);

    std::string xorg_logfile_path(DEFAULT_XORG_LOGFILE);

@@ -102,7 +103,8 @@ int main(int argc, char *argv[]) {
      std::cout << "\nAdditional options:\n";
      std::cout << "    --no-dummy-server: Use the currently running X 
server "
          "for testing\n";
-    std::cout << "    --xorg-conf: Path to xorg dummy configuration 
file\n";
+    std::cout << "    --xorg-conf: Path to xorg dummy configuration 
file. See -config in \"man Xorg\".\n"
+                 "                 Its default value is 
"DEFAULT_XORG_CONFIG".\n";
      std::cout << "    --server: Path to X server executable\n";
      std::cout << "    --xorg-display: xorg dummy display port\n";
      std::cout << "    --xorg-logfile: xorg logfile filename. See 
-logfile in \"man Xorg\".\n"


More information about the xorg-devel mailing list