Imported Debian patch 2:1.15.1-0ubuntu2.6
[deb_xorg-server.git] / debian / patches / 191-Xorg-add-an-extra-module-path.patch
1 diff --git a/configure.ac b/configure.ac
2 index 2693ce7..44780a2 100644
3 --- a/configure.ac
4 +++ b/configure.ac
5 @@ -467,6 +467,10 @@ AC_ARG_WITH(module-dir, AS_HELP_STRING([--with-module-dir=DIR],
6 [Directory where modules are installed (default: $libdir/xorg/modules)]),
7 [ moduledir="$withval" ],
8 [ moduledir="${libdir}/xorg/modules" ])
9 +AC_ARG_WITH(extra-module-dir,AS_HELP_STRING([--with-extra-module-dir=DIR],
10 + [Extra module directory to search for modules before the default one (default: empty)]),
11 + [ extra_moduledir="$withval" ],
12 + [ extra_moduledir="" ])
13 AC_ARG_WITH(log-dir, AS_HELP_STRING([--with-log-dir=DIR],
14 [Directory where log files are kept (default: $localstatedir/log)]),
15 [ logdir="$withval" ],
16 @@ -1751,6 +1755,7 @@ if test "x$XORG" = xyes; then
17 AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
18 AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
19 AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
20 + AC_DEFINE_DIR(EXTRA_MODULE_PATH, extra_moduledir, [Extra module search path, searched before the default one])
21 AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
22 AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
23 AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
24 diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
25 index ec679df..8ae85ab 100644
26 --- a/hw/xfree86/common/xf86Config.c
27 +++ b/hw/xfree86/common/xf86Config.c
28 @@ -647,11 +647,22 @@ configFiles(XF86ConfFilesPtr fileconf)
29
30 /* ModulePath */
31
32 - if (fileconf) {
33 - if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
34 + if (xf86ModPathFrom != X_CMDLINE) {
35 + if (fileconf && fileconf->file_modulepath) {
36 xf86ModulePath = fileconf->file_modulepath;
37 xf86ModPathFrom = X_CONFIG;
38 }
39 + else if (strcmp(xf86ExtraModulePath, "") != 0) {
40 + char *newpath = malloc(strlen(xf86ExtraModulePath)
41 + + strlen(xf86ModulePath)
42 + + 2);
43 +
44 + strcpy(newpath, xf86ExtraModulePath);
45 + strcat(newpath, ",");
46 + strcat(newpath, xf86ModulePath);
47 +
48 + xf86ModulePath = newpath;
49 + }
50 }
51
52 xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
53 diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
54 index 0071004..13c403f 100644
55 --- a/hw/xfree86/common/xf86Globals.c
56 +++ b/hw/xfree86/common/xf86Globals.c
57 @@ -136,6 +136,7 @@ xf86InfoRec xf86Info = {
58 const char *xf86ConfigFile = NULL;
59 const char *xf86ConfigDir = NULL;
60 const char *xf86ModulePath = DEFAULT_MODULE_PATH;
61 +const char *xf86ExtraModulePath = EXTRA_MODULE_PATH;
62 MessageType xf86ModPathFrom = X_DEFAULT;
63 const char *xf86LogFile = DEFAULT_LOGPREFIX;
64 MessageType xf86LogFileFrom = X_DEFAULT;
65 diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
66 index 8d9cb55..fc057b3 100644
67 --- a/hw/xfree86/common/xf86Priv.h
68 +++ b/hw/xfree86/common/xf86Priv.h
69 @@ -77,6 +77,7 @@ extern _X_EXPORT const char *xf86ServerName;
70
71 extern _X_EXPORT xf86InfoRec xf86Info;
72 extern _X_EXPORT const char *xf86ModulePath;
73 +extern _X_EXPORT const char *xf86ExtraModulePath;
74 extern _X_EXPORT MessageType xf86ModPathFrom;
75 extern _X_EXPORT const char *xf86LogFile;
76 extern _X_EXPORT MessageType xf86LogFileFrom;
77 diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
78 index 2cc416a..4722023 100644
79 --- a/include/xorg-config.h.in
80 +++ b/include/xorg-config.h.in
81 @@ -42,6 +42,9 @@
82 /* Path to loadable modules. */
83 #undef DEFAULT_MODULE_PATH
84
85 +/* Path to extra loadable modules. */
86 +#undef EXTRA_MODULE_PATH
87 +
88 /* Path to installed libraries. */
89 #undef DEFAULT_LIBRARY_PATH
90