loader: add Cygwin support

Cygwin libraries use the .dll extension and "cyg" prefix in place of "lib".

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
Yaakov Selkowitz 2012-03-29 02:18:41 -05:00
parent 0ce48729d3
commit 96186bc721
2 changed files with 19 additions and 1 deletions

View File

@ -212,9 +212,15 @@ static const char *stdSubdirs[] = {
* to port this DDX to, say, Darwin, we'll need to fix this.
*/
static PatternRec stdPatterns[] = {
#ifdef __CYGWIN__
{"^cyg(.*)\\.dll$",},
{"(.*)_drv\\.dll$",},
{"(.*)\\.dll$",},
#else
{"^lib(.*)\\.so$",},
{"(.*)_drv\\.so$",},
{"(.*)\\.so$",},
#endif
{NULL,}
};
@ -408,21 +414,33 @@ FindModuleInSubdir(const char *dirpath, const char *module)
continue;
}
#ifdef __CYGWIN__
snprintf(tmpBuf, PATH_MAX, "cyg%s.dll", module);
#else
snprintf(tmpBuf, PATH_MAX, "lib%s.so", module);
#endif
if (strcmp(direntry->d_name, tmpBuf) == 0) {
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
ret = NULL;
break;
}
#ifdef __CYGWIN__
snprintf(tmpBuf, PATH_MAX, "%s_drv.dll", module);
#else
snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module);
#endif
if (strcmp(direntry->d_name, tmpBuf) == 0) {
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
ret = NULL;
break;
}
#ifdef __CYGWIN__
snprintf(tmpBuf, PATH_MAX, "%s.dll", module);
#else
snprintf(tmpBuf, PATH_MAX, "%s.so", module);
#endif
if (strcmp(direntry->d_name, tmpBuf) == 0) {
if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
ret = NULL;

View File

@ -701,7 +701,7 @@ This instructs the server to load the module called
The module name given should be the module's standard name, not the
module file name.
The standard name is case\-sensitive, and does not include the \(lqlib\(rq
prefix, or the \(lq.a\(rq, \(lq.o\(rq, or \(lq.so\(rq suffixes.
or \(lqcyg\(rq prefixes, or the \(lq.so\(rq or \(lq.dll\(rq suffixes.
.PP
.RS 7
Example: the DRI extension module can be loaded with the following entry: