summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/etc/etc.c3
-rw-r--r--ext/etc/extconf.rb6
2 files changed, 6 insertions, 3 deletions
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index 46857c62c7..d5197eb566 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -628,7 +628,8 @@ VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc);
*
* This is typically "/etc", but is modified by the prefix used when Ruby was
* compiled. For example, if Ruby is built and installed in /usr/local, returns
- * "/usr/local/etc".
+ * "/usr/local/etc" on other than Windows. On Windows, this returns system
+ * provided directory always.
*/
static VALUE
etc_sysconfdir(VALUE obj)
diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb
index 1e679b5d0b..20a7dd00d6 100644
--- a/ext/etc/extconf.rb
+++ b/ext/etc/extconf.rb
@@ -12,8 +12,10 @@ have_func("uname((struct utsname *)NULL)", headers)
have_func("getlogin")
have_func("getpwent")
have_func("getgrent")
-sysconfdir = RbConfig.expand(RbConfig::CONFIG["sysconfdir"].dup, "prefix"=>"", "DESTDIR"=>"")
-$defs.push("-DSYSCONFDIR=#{Shellwords.escape(sysconfdir.dump)}")
+if (sysconfdir = RbConfig::CONFIG["sysconfdir"] and
+ !RbConfig.expand(sysconfdir.dup, "prefix"=>"", "DESTDIR"=>"").empty?)
+ $defs.push("-DSYSCONFDIR=#{Shellwords.escape(sysconfdir.dump)}")
+end
have_func("sysconf")
have_func("confstr")