class Object

Public Instance Methods

find_files(dir = nil) click to toggle source
# File extconf.rb, line 37
def find_files(dir = nil)
  if( dir )
    search_dirs = [dir]
  else
    search_dirs =
      ["/usr/local", "/usr", "/opt"] +
      Dir.glob("/usr/local/./*ldap*").collect{|d| d.gsub(/\/\.\//, "/")} +
      Dir.glob("/usr/./*ldap*").collect{|d| d.gsub(/\/\.\//, "/") +
        Dir.glob("/usr/lib{64,}/mozldap/*ldap*") + ["/usr/include/mozldap"]
    }
  end
  for d in search_dirs
    h = File.join(d,"include","ldap.h")
    l = File.join(d,"lib","libldap*")
    if( File.exist?(h) )
      l = Dir.glob(l)[0]
      if( l )
        if( $INTERACTIVE )
          print("--with-ldap-dir=#{d} [y/n]")
          ans = $stdin.gets
          ans.chop!
          if( ans == "y" )
            result = [d, File.basename(l).split(".")[0][3..-1], File.basename(h)]
            return result
            break
          end
        else
          print("--with-ldap-dir=#{d}\n")
          result = [d, File.basename(l).split(".")[0][3..-1], File.basename(h)]
          return result
          break
        end
      end
    end
  end
end
ldap_with_config(arg, default = nil) click to toggle source
# File extconf.rb, line 74
def ldap_with_config(arg, default = nil)
  cfg1  = with_config(arg, nil)
  cfg2  = arg_config("--without-" + arg, nil)
  if( cfg1 )
    return cfg1
  else
    if( cfg2 )
      return nil
    else
      return default
    end
  end
end