Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-updates-src > by-pkgid > 054cef8d7f016ac9fb831856b7968669 > files > 6

x11-server-1.16.4-2.1.mga5.src.rpm

From a57bbbeeadaf6f525011881762e0a29e9b3ac1b2 Mon Sep 17 00:00:00 2001
From: Ander Conselvan de Oliveira <ander@localhost.(none)>
Date: Thu, 12 Mar 2009 09:45:57 -0300
Subject: [PATCH 905/908] Xorg: add an extra module path

If the extra module path is not an empty string (the default value),
module path will be searched first in the extra module path and then in
the default module path. This should simplify the alternatives system
used on Mandriva's fglrx package.
---
 configure.ac                    |    5 +++++
 hw/xfree86/common/xf86Config.c  |   14 ++++++++++++--
 hw/xfree86/common/xf86Globals.c |    1 +
 hw/xfree86/common/xf86Priv.h    |    1 +
 include/xorg-config.h.in        |    3 +++
 5 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 43d521d..0621b5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -465,6 +465,10 @@
 				  [Directory where modules are installed (default: $libdir/xorg/modules)]),
 				[ moduledir="$withval" ],
 				[ moduledir="${libdir}/xorg/modules" ])
+AC_ARG_WITH(extra-module-dir,AS_HELP_STRING([--with-extra-module-dir=DIR],
+				  [Extra module directory to search for modules before the default one (default: empty)]),
+				[ extra_moduledir="$withval" ],
+				[ extra_moduledir="" ])
 AC_ARG_WITH(log-dir,         AS_HELP_STRING([--with-log-dir=DIR],
 				  [Directory where log files are kept (default: $localstatedir/log)]),
 				[ logdir="$withval" ],
@@ -2072,6 +2076,7 @@
 	AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
 	AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
 	AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
+	AC_DEFINE_DIR(EXTRA_MODULE_PATH, extra_moduledir, [Extra module search path, searched before the default one])
 	AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
 	AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
 	AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default logfile prefix])
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index ecdbdb2..9951ba4 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -647,11 +647,22 @@ configFiles(XF86ConfFilesPtr fileconf)
 
     /* ModulePath */
 
-    if (fileconf) {
-        if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
-            xf86ModulePath = fileconf->file_modulepath;
-            xf86ModPathFrom = X_CONFIG;
-        }
+    if (xf86ModPathFrom != X_CMDLINE) {
+      if (fileconf && fileconf->file_modulepath) {
+          if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
+              xf86ModulePath = fileconf->file_modulepath;
+              xf86ModPathFrom = X_CONFIG;
+          }
+      } else if (strcmp(xf86ExtraModulePath, "") != 0) {
+        char *newpath = malloc(strlen(xf86ExtraModulePath)
+  			     + strlen(xf86ModulePath)
+  			     + 2);
+        strcpy(newpath, xf86ExtraModulePath);
+        strcat(newpath, ",");
+        strcat(newpath, xf86ModulePath);
+  
+        xf86ModulePath = newpath;
+      }
     }
 
     xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 84ac29c..d70a125 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -142,6 +142,7 @@
 const char *xf86ConfigFile = NULL;
 const char *xf86ConfigDir = NULL;
 const char *xf86ModulePath = DEFAULT_MODULE_PATH;
+const char *xf86ExtraModulePath = EXTRA_MODULE_PATH;
 MessageType xf86ModPathFrom = X_DEFAULT;
 const char *xf86LogFile = DEFAULT_LOGDIR "/" DEFAULT_LOGPREFIX;
 MessageType xf86LogFileFrom = X_DEFAULT;
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 1fe3d7e..4902c5d 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -77,6 +77,7 @@ extern _X_EXPORT const char *xf86ServerN
 
 extern _X_EXPORT xf86InfoRec xf86Info;
 extern _X_EXPORT const char *xf86ModulePath;
+extern _X_EXPORT  const char *xf86ExtraModulePath;
 extern _X_EXPORT MessageType xf86ModPathFrom;
 extern _X_EXPORT const char *xf86LogFile;
 extern _X_EXPORT MessageType xf86LogFileFrom;
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index 56ffda2..c8b56e5 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -42,6 +42,9 @@
 /* Path to loadable modules. */
 #undef DEFAULT_MODULE_PATH
 
+/* Path to extra loadable modules. */
+#undef EXTRA_MODULE_PATH
+
 /* Path to installed libraries. */
 #undef DEFAULT_LIBRARY_PATH
 
-- 
1.7.6