A machine can be programmed to demonstrate thinking/actions in disagreement/independent from anyone else. Someone has to program it. Even if the program is a very general purpose type of program which includes general instructions on how to form conclusions based on observations, that is still a program. It would be difficult to predict exactly what type of personality would develop in this AI, exactly what conclusions it would arrive at on various moral issues, but it would still be possible in theory. If you know what sensory input goes into it, you can deduce exactly how this will shape the machine's personality, desires, opinions, reactions, interations, etc. On its most basic level it is still following the instructions of the programmer. Independence is just an illusion cast by the complexity of its decision making process in combination with the unpredictability of what it will encounter in the world. Even AIs that use random number algorithms in their decision making cannot be said to be truly autonomous. What they do is at the mercy of random variables and not directed by will. The same thing has been theorized about humans, that we are no more autonomous than a leaf being blown by the wind. We're not even sure if we have free will, so how can we use it as a criteria for deciding if a machine deserves the same rights as us?
That brings us back to the turing test. Can a machine demonstrate the appearance of free will? If so, does that mean it is self-aware, or is it no more conscious than a complex system of gears? Consciousness is an unprovable subjective experience. We could know absolutely everything there is to know about the human brain but still not be able to say why it is conscious.
I think, first of all, that we will give them some form of rights. Even if we don't officially revise the constitution or anything like that, we will still be emotionally effected enough by a convincing AI that we will find ourselves treating them like people. This has already happened. We might not give them the exact same rights as humans have. They will probably be different from us in a lot of fundamental ways, and some of the rights that we consider important might be utterly meaningless to them. But we will treat them the way they want to be treated. The Golden Rule will be the fundamental right that we unconsciously assign to any AI that can pass the turing test. I think that's how it should be.
If we treated our intelligent technology, technology that was convincingly alive and convincingly human, like a mere tool for our gratification then I believe this would translate over to our human interactions. It would make us more cynical and selfish with each other. The real question in my mind is should we create these machines?