# File install.rb, line 34
def instdir
    g = GetoptLong.new(['--install-dir', '-i', GetoptLong::REQUIRED_ARGUMENT])
    g.each { | name, arg |
        if name == '--install-dir'
            return arg
        else
            $stderr.puts "usage: $0 [--install-dir dir]"
        end
    }

    begin
        require 'rbconfig'
        libdir = Config::CONFIG['sitedir'] + "/" + 
            Config::CONFIG['MAJOR'] + "." +
            Config::CONFIG['MINOR']
    rescue ScriptError
        $LOAD_PATH.each do |l|
            if l =~ /site_ruby/ && l =~ /\d$/ && l !~ /#{PLATFORM}/
                libdir = l
                break
            end
        end
        STDERR.puts "Can't find required file `rbconfig.rb'."
        STDERR.puts "The 'json' files need to be installed manually in " +
            " #{libdir}"
    end
    return libdir
end