# File lib/phusion_passenger/platform_info/apache.rb, line 175
        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? /, '')

                        # Remove flags not supported by GCC
                        if RUBY_PLATFORM =~ /solaris/ # TODO: Add support for people using SunStudio
                                # The big problem is Coolstack apxs includes a bunch of solaris -x directives.
                                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/
                        # The default Apache install on OS X is a universal binary.
                        # Figure out which architectures it's compiled for and do the same
                        # thing for mod_passenger. We use the 'file' utility to do this.
                        #
                        # Running 'file' on the Apache executable usually outputs something
                        # like this:
                        #
                        #   /usr/sbin/httpd: Mach-O universal binary with 4 architectures
                        #   /usr/sbin/httpd (for architecture ppc7400):     Mach-O executable ppc
                        #   /usr/sbin/httpd (for architecture ppc64):       Mach-O 64-bit executable ppc64
                        #   /usr/sbin/httpd (for architecture i386):        Mach-O executable i386
                        #   /usr/sbin/httpd (for architecture x86_64):      Mach-O 64-bit executable x86_64
                        #
                        # But on some machines, it may output just:
                        #
                        #   /usr/sbin/httpd: Mach-O fat file with 4 architectures
                        #
                        # (http://code.google.com/p/phusion-passenger/issues/detail?id=236)
                        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
                        # The compiler may not support all architectures in the binary.
                        # XCode 4 seems to have removed support for the PPC architecture
                        # even though there are still plenty of Apache binaries around
                        # containing PPC components.
                        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