def with_standard_compiler_flags(env = {}, opts = {})
      env ||= {}
      opts ||= {}
      compiler_flags =
        case Ohai["platform"]
        when "aix"
          {
            "CC" => "xlc_r -q64",
            "CXX" => "xlC_r -q64",
            "CFLAGS" => "-q64 -I#{install_dir}/embedded/include -D_LARGE_FILES -O",
            "LDFLAGS" => "-q64 -L#{install_dir}/embedded/lib -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib",
            "LD" => "ld -b64",
            "OBJECT_MODE" => "64",
            "ARFLAGS" => "-X64 cru",
          }
        when "solaris2"
          if platform_version.satisfies?("<= 5.10")
            solaris_flags = {
              # this override is due to a bug in libtool documented here:
              # http://lists.gnu.org/archive/html/bug-libtool/2005-10/msg00004.html
              "CC" => "gcc -static-libgcc",
              "LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
              "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
            }
          elsif platform_version.satisfies?(">= 5.11")
            solaris_flags = {
              "CC" => "gcc -m64 -static-libgcc",
              "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
              "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
            }
          end
          solaris_flags
        when "freebsd"
          {
            "CC" => "clang",
            "CXX" => "clang++",
            "LDFLAGS" => "-L#{install_dir}/embedded/lib",
            "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
          }
        when "suse"
          suse_flags = {
            "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
            "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
          }
          # Enable gcc version 4.8 if it is available
          if which("gcc-4.8") && platform_version.satisfies?("< 12")
            suse_flags["CC"] = "gcc-4.8"
            suse_flags["CXX"] = "g++-4.8"
          end
          suse_flags
        when "windows"
          arch_flag = windows_arch_i386? ? "-m32" : "-m64"
          opt_flag = windows_arch_i386? ? "-march=i686" : "-march=x86-64"
          {
            "LDFLAGS" => "-L#{install_dir}/embedded/lib #{arch_flag} -fno-lto",
            # We do not wish to enable SSE even though we target i686 because
            # of a stack alignment issue with some libraries. We have not
            # exactly ascertained the cause but some compiled library/binary
            # violates gcc's assumption that the stack is going to be 16-byte
            # aligned which is just fine as long as one is pushing 32-bit
            # values from general purpose registers but stuff hits the fan as
            # soon as gcc emits aligned SSE xmm register spills which generate
            # GPEs and terminate the application very rudely with very little
            # to debug with.
            "CFLAGS" => "-I#{install_dir}/embedded/include #{arch_flag} -O3 #{opt_flag}",
          }
        else
          {
            "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
            "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
          }
        end

      # merge LD_RUN_PATH into the environment.  most unix distros will fall
      # back to this if there is no LDFLAGS passed to the linker that sets
      # the rpath.  the LDFLAGS -R or -Wl,-rpath will override this, but in
      # some cases software may drop our LDFLAGS or think it knows better
      # and edit them, and we *really* want the rpath setting and do know
      # better.  in that case LD_RUN_PATH will probably survive whatever
      # edits the configure script does
      extra_linker_flags = {
        "LD_RUN_PATH" => "#{install_dir}/embedded/lib",
      }

      if solaris2?
        ld_options = "-R#{install_dir}/embedded/lib"

        if platform_version.satisfies?("<= 5.10")
          # in order to provide compatibility for earlier versions of libc on solaris 10,
          # we need to specify a mapfile that restricts the version of system libraries
          # used. See http://docs.oracle.com/cd/E23824_01/html/819-0690/chapter5-1.html
          # for more information
          # use the mapfile if it exists, otherwise ignore it
          mapfile_path = File.expand_path(Config.solaris_linker_mapfile, Config.project_root)
          ld_options << " -M #{mapfile_path}" if File.exist?(mapfile_path)
        end

        # solaris linker can also use LD_OPTIONS, so we throw the kitchen sink against
        # the linker, to find every way to make it use our rpath. This is also required
        # to use the aforementioned mapfile.
        extra_linker_flags["LD_OPTIONS"] = ld_options
      end

      env.merge(compiler_flags)
        .merge(extra_linker_flags).
        # always want to favor pkg-config from embedded location to not hose
        # configure scripts which try to be too clever and ignore our explicit
        # CFLAGS and LDFLAGS in favor of pkg-config info
        merge({ "PKG_CONFIG_PATH" => "#{install_dir}/embedded/lib/pkgconfig" }).
        # Set default values for CXXFLAGS and CPPFLAGS.
        merge("CXXFLAGS" => compiler_flags["CFLAGS"])
        .merge("CPPFLAGS" => compiler_flags["CFLAGS"])
        .merge("OMNIBUS_INSTALL_DIR" => install_dir)
    end
def with_standard_compiler_flags(env = {}, opts = {})
      env ||= {}
      opts ||= {}
      compiler_flags =
        case Ohai["platform"]
        when "aix"
          {
            "CC" => "xlc_r -q64",
            "CXX" => "xlC_r -q64",
            "CFLAGS" => "-q64 -I#{install_dir}/embedded/include -D_LARGE_FILES -O",
            "LDFLAGS" => "-q64 -L#{install_dir}/embedded/lib -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib",
            "LD" => "ld -b64",
            "OBJECT_MODE" => "64",
            "ARFLAGS" => "-X64 cru",
          }
        when "solaris2"
          if platform_version.satisfies?("<= 5.10")
            solaris_flags = {
              # this override is due to a bug in libtool documented here:
              # http://lists.gnu.org/archive/html/bug-libtool/2005-10/msg00004.html
              "CC" => "gcc -static-libgcc",
              "LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
              "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
            }
          elsif platform_version.satisfies?(">= 5.11")
            solaris_flags = {
              "CC" => "gcc -m64 -static-libgcc",
              "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
              "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
            }
          end
          solaris_flags
        when "freebsd"
          {
            "CC" => "clang",
            "CXX" => "clang++",
            "LDFLAGS" => "-L#{install_dir}/embedded/lib",
            "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
          }
        when "suse"
          suse_flags = {
            "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
            "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
          }
          # Enable gcc version 4.8 if it is available
          if which("gcc-4.8") && platform_version.satisfies?("< 12")
            suse_flags["CC"] = "gcc-4.8"
            suse_flags["CXX"] = "g++-4.8"
          end
          suse_flags
        when "windows"
          arch_flag = windows_arch_i386? ? "-m32" : "-m64"
          opt_flag = windows_arch_i386? ? "-march=i686" : "-march=x86-64"
          {
            "LDFLAGS" => "-L#{install_dir}/embedded/lib #{arch_flag} -fno-lto",
            # We do not wish to enable SSE even though we target i686 because
            # of a stack alignment issue with some libraries. We have not
            # exactly ascertained the cause but some compiled library/binary
            # violates gcc's assumption that the stack is going to be 16-byte
            # aligned which is just fine as long as one is pushing 32-bit
            # values from general purpose registers but stuff hits the fan as
            # soon as gcc emits aligned SSE xmm register spills which generate
            # GPEs and terminate the application very rudely with very little
            # to debug with.
            "CFLAGS" => "-I#{install_dir}/embedded/include #{arch_flag} -O3 #{opt_flag}",
          }
        else
          {
            "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
            "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
          }
        end

      # merge LD_RUN_PATH into the environment.  most unix distros will fall
      # back to this if there is no LDFLAGS passed to the linker that sets
      # the rpath.  the LDFLAGS -R or -Wl,-rpath will override this, but in
      # some cases software may drop our LDFLAGS or think it knows better
      # and edit them, and we *really* want the rpath setting and do know
      # better.  in that case LD_RUN_PATH will probably survive whatever
      # edits the configure script does
      extra_linker_flags = {
        "LD_RUN_PATH" => "#{install_dir}/embedded/lib",
      }

      if solaris2?
        ld_options = "-R#{install_dir}/embedded/lib"

        if platform_version.satisfies?("<= 5.10")
          # in order to provide compatibility for earlier versions of libc on solaris 10,
          # we need to specify a mapfile that restricts the version of system libraries
          # used. See http://docs.oracle.com/cd/E23824_01/html/819-0690/chapter5-1.html
          # for more information
          # use the mapfile if it exists, otherwise ignore it
          mapfile_path = File.expand_path(Config.solaris_linker_mapfile, Config.project_root)
          ld_options << " -M #{mapfile_path}" if File.exist?(mapfile_path)
        end

        # solaris linker can also use LD_OPTIONS, so we throw the kitchen sink against
        # the linker, to find every way to make it use our rpath. This is also required
        # to use the aforementioned mapfile.
        extra_linker_flags["LD_OPTIONS"] = ld_options
      end

      env.merge(compiler_flags)
        .merge(extra_linker_flags).
        # always want to favor pkg-config from embedded location to not hose
        # configure scripts which try to be too clever and ignore our explicit
        # CFLAGS and LDFLAGS in favor of pkg-config info
        merge({ "PKG_CONFIG_PATH" => "#{install_dir}/embedded/lib/pkgconfig" }).
        # Set default values for CXXFLAGS and CPPFLAGS.
        merge("CXXFLAGS" => compiler_flags["CFLAGS"])
        .merge("CPPFLAGS" => compiler_flags["CFLAGS"])
        .merge("OMNIBUS_INSTALL_DIR" => install_dir)
    end
Add standard compiler flags to the environment hash to produce omnibus
 binaries (correct RPATH, etc).

 Supported options:
    :aix => :use_gcc    force using gcc/g++ compilers on aix

 @param [Hash] env
 @param [Hash] opts

 @return [Hash]