1 |
From 675b7fdf7a3aa6535d052613d72b713361f13858 Mon Sep 17 00:00:00 2001 |
2 |
From: Ander Conselvan de Oliveira <ander@localhost.(none)> |
3 |
Date: Thu, 12 Mar 2009 09:45:57 -0300 |
4 |
Subject: [PATCH 906/908] Xorg: add an extra module path |
5 |
|
6 |
If the extra module path is not an empty string (the default value), |
7 |
module path will be searched first in the extra module path and then in |
8 |
the default module path. This should simplify the alternatives system |
9 |
used on Mandriva's fglrx package. |
10 |
--- |
11 |
configure.ac | 5 +++++ |
12 |
hw/xfree86/common/xf86Config.c | 14 ++++++++++++-- |
13 |
hw/xfree86/common/xf86Globals.c | 1 + |
14 |
hw/xfree86/common/xf86Priv.h | 1 + |
15 |
include/xorg-config.h.in | 3 +++ |
16 |
5 files changed, 22 insertions(+), 2 deletions(-) |
17 |
|
18 |
diff --git a/configure.ac b/configure.ac |
19 |
index 86965d2..1d4fe3e 100644 |
20 |
--- a/configure.ac |
21 |
+++ b/configure.ac |
22 |
@@ -493,6 +493,10 @@ |
23 |
[Directory where modules are installed (default: $libdir/xorg/modules)]), |
24 |
[ moduledir="$withval" ], |
25 |
[ moduledir="${libdir}/xorg/modules" ]) |
26 |
+AC_ARG_WITH(extra-module-dir,AS_HELP_STRING([--with-extra-module-dir=DIR], |
27 |
+ [Extra module directory to search for modules before the default one (default: empty)]), |
28 |
+ [ extra_moduledir="$withval" ], |
29 |
+ [ extra_moduledir="" ]) |
30 |
AC_ARG_WITH(log-dir, AS_HELP_STRING([--with-log-dir=DIR], |
31 |
[Directory where log files are kept (default: $localstatedir/log)]), |
32 |
[ logdir="$withval" ], |
33 |
@@ -1819,6 +1823,7 @@ |
34 |
AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file]) |
35 |
AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory]) |
36 |
AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path]) |
37 |
+ AC_DEFINE_DIR(EXTRA_MODULE_PATH, extra_moduledir, [Extra module search path, searched before the default one]) |
38 |
AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path]) |
39 |
AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location]) |
40 |
AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support]) |
41 |
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c |
42 |
index 22d9e46..52e5506 100644 |
43 |
--- a/hw/xfree86/common/xf86Config.c |
44 |
+++ b/hw/xfree86/common/xf86Config.c |
45 |
@@ -646,11 +646,21 @@ configFiles(XF86ConfFilesPtr fileconf) |
46 |
|
47 |
/* ModulePath */ |
48 |
|
49 |
- if (fileconf) { |
50 |
- if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) { |
51 |
+ if (xf86ModPathFrom != X_CMDLINE) { |
52 |
+ if (fileconf && fileconf->file_modulepath) { |
53 |
xf86ModulePath = fileconf->file_modulepath; |
54 |
xf86ModPathFrom = X_CONFIG; |
55 |
} |
56 |
+ else if (strcmp(xf86ExtraModulePath, "") != 0) { |
57 |
+ char *newpath = malloc(strlen(xf86ExtraModulePath) |
58 |
+ + strlen(xf86ModulePath) |
59 |
+ + 2); |
60 |
+ strcpy(newpath, xf86ExtraModulePath); |
61 |
+ strcat(newpath, ","); |
62 |
+ strcat(newpath, xf86ModulePath); |
63 |
+ |
64 |
+ xf86ModulePath = newpath; |
65 |
+ } |
66 |
} |
67 |
|
68 |
xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath); |
69 |
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c |
70 |
index 3a6be4c..ed81757 100644 |
71 |
--- a/hw/xfree86/common/xf86Globals.c |
72 |
+++ b/hw/xfree86/common/xf86Globals.c |
73 |
@@ -141,6 +141,7 @@ |
74 |
const char *xf86ConfigFile = NULL; |
75 |
const char *xf86ConfigDir = NULL; |
76 |
const char *xf86ModulePath = DEFAULT_MODULE_PATH; |
77 |
+const char *xf86ExtraModulePath = EXTRA_MODULE_PATH; |
78 |
MessageType xf86ModPathFrom = X_DEFAULT; |
79 |
const char *xf86LogFile = DEFAULT_LOGPREFIX; |
80 |
MessageType xf86LogFileFrom = X_DEFAULT; |
81 |
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h |
82 |
index 3bb1571..fcd2a38 100644 |
83 |
--- a/hw/xfree86/common/xf86Priv.h |
84 |
+++ b/hw/xfree86/common/xf86Priv.h |
85 |
@@ -77,6 +77,7 @@ extern _X_EXPORT struct pci_slot_match xf86IsolateDevice; |
86 |
|
87 |
extern _X_EXPORT xf86InfoRec xf86Info; |
88 |
extern _X_EXPORT const char *xf86ModulePath; |
89 |
+extern _X_EXPORT const char *xf86ExtraModulePath; |
90 |
extern _X_EXPORT MessageType xf86ModPathFrom; |
91 |
extern _X_EXPORT const char *xf86LogFile; |
92 |
extern _X_EXPORT MessageType xf86LogFileFrom; |
93 |
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in |
94 |
index 794de7a..e0894c4 100644 |
95 |
--- a/include/xorg-config.h.in |
96 |
+++ b/include/xorg-config.h.in |
97 |
@@ -39,6 +39,9 @@ |
98 |
/* Path to loadable modules. */ |
99 |
#undef DEFAULT_MODULE_PATH |
100 |
|
101 |
+/* Path to extra loadable modules. */ |
102 |
+#undef EXTRA_MODULE_PATH |
103 |
+ |
104 |
/* Path to installed libraries. */ |
105 |
#undef DEFAULT_LIBRARY_PATH |
106 |
|
107 |
-- |
108 |
1.6.4.4 |
109 |
|