# File lib/phusion_passenger/platform_info/apache.rb, line 427
        def self.apache2_module_cflags(with_apr_flags = true)
                flags = [""]
                if cc_is_sun_studio?
                        flags << "-KPIC"
                else
                        flags << "-fPIC"
                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 os_name =~ /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

                        if os_name == "linux" &&
                           linux_distro_tags.include?(:redhat) &&
                           apxs2 == "/usr/sbin/apxs" &&
                           httpd_architecture_bits == 64
                                # The Apache package in CentOS 5 x86_64 is broken.
                                # 'apxs -q CFLAGS' contains directives for compiling
                                # the module as 32-bit, even though httpd itself
                                # is 64-bit. Fix this.
                                apxs2_flags.gsub!('-m32 -march=i386 -mtune=generic', '')
                        end
                        
                        apxs2_flags.strip!
                        flags << apxs2_flags
                end
                if !httpd.nil? && os_name == "macosx"
                        # 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