Complier centric options are hardcoded. #4

Open
jprondak opened this Issue Jan 11, 2011 · 0 comments

Comments

Projects
None yet
1 participant

The forcing of some compiler options can be bad. In the case of -Wall. This is GCC centric and would cause compilation on other platforms to fail (i.e. Solaris and Windows). The following patch might be a solution.


--- ext/xslt_lib/extconf.rb     2011-01-11 10:16:12.424617000 -0600
+++ ext/xslt_lib/extconf.rb.new 2011-01-11 10:07:10.048251000 -0600
@@ -54,7 +54,14 @@
   $CFLAGS += " -DUSE_EXSLT"
 end

-$CFLAGS = '-g -Wall ' + `xml2-config --cflags`.chomp + " " + `xslt-config --cflags`.chomp + " " + $CFLAGS
+# Allow for custom compiler to be specified.
+RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
+
+# NOTE: use GCC flags unless Visual C compiler is used
+$CFLAGS << '-Wall ' if (RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/ && RUBY_PLATFORM !~ /mswin/ )
+
+$CFLAGS << '-g ' + `xml2-config --cflags`.chomp + " " + `xslt-config --cflags`.chomp
+

 create_header()
 create_makefile("xml/xslt_lib")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment