def self.apache2_module_cflags(with_apr_flags = true)
flags = ["-fPIC"]
if compiler_supports_visibility_flag?
flags << "-fvisibility=hidden -DVISIBILITY_ATTRIBUTE_SUPPORTED"
if compiler_visibility_flag_generates_warnings? && compiler_supports_wno_attributes_flag?
flags << "-Wno-attributes"
end
end
if with_apr_flags
flags << apr_flags
flags << apu_flags
end
if !apxs2.nil?
apxs2_flags = `#{apxs2} -q CFLAGS`.strip << " -I" << `#{apxs2} -q INCLUDEDIR`.strip
apxs2_flags.gsub!(/-O\d? /, '')
if RUBY_PLATFORM =~ /solaris/
options = apxs2_flags.split
options.reject! { |f| f =~ /^\-x/ }
options.reject! { |f| f =~ /^\-Xa/ }
options.reject! { |f| f =~ /^\-fast/ }
options.reject! { |f| f =~ /^\-mt/ }
apxs2_flags = options.join(' ')
end
apxs2_flags.strip!
flags << apxs2_flags
end
if !httpd.nil? && RUBY_PLATFORM =~ /darwin/
output = `file "#{httpd}"`.strip
if output =~ /Mach-O fat file/ && output !~ /for architecture/
architectures = ["i386", "ppc", "x86_64", "ppc64"]
else
architectures = []
output.split("\n").grep(/for architecture/).each do |line|
line =~ /for architecture (.*?)\)/
architectures << $1
end
end
architectures.reject! do |arch|
!compiler_supports_architecture?(arch)
end
architectures.map! do |arch|
"-arch #{arch}"
end
flags << architectures.compact.join(' ')
end
return flags.compact.join(' ').strip
end