The Avenger's relationship to SHIELD or other government agencies varied depending on which Marvel Universe you were in. There are currently two, the primary comic universe #616 or the Cinematic/Ultimate Universe, #19999/#1610. But the general consensus was, government and its attendant agencies (SHIELD, SWORD, HAMMER) were never too fond of people with the power to alter the status quo or ignore the government, acting as if they were above the Law. This has played out in both Universes, particularly in the events of Superhuman Registration Act and the resulting Civil War.
In the Marvel Universe #616, the prime Marvel continuity, SHIELD and the Avengers, in their early careers did not have much of an overlap. SHIELD spent its time dealing with other covert or costumed agencies such as The Red Skull, Baron Strucker, HYDRA or AIM (Advanced Idea Mechanics).
The Avengers had less to do with those threats except when a member of the Avengers was having to deal with those threats on their own. Captain America often had issues with HYDRA and the Red Skull so he and SHIELD had a relationship of sorts that was reasonably cordial. Indeed for a time, SHIELD and the Avengers even traded Stark technology, training and developed superheroes using technology from Project Pegasus. This golden age lasted up to the late 70's.
As the Avengers (in #616) grew more powerful, they would have occasional interactions with SHIELD, especially when the Hulk left the Avengers but overall the two agencies did not interact nearly as often as they appear to in the movie. There were plenty of other government agencies who felt completely empowered to harass, annoy, prosecute or otherwise become a burden to the Avengers.
The single man who was often the front man of that harassment was Henry Peter Gyrich, first appearance Avengers #165, 1977. I will not even begin to cover the agencies this man has worked with that have given the Avengers grief. Most of the Avengers during his time as government liaison to the Avengers had choice words they would use to describe him. For a long time (two decades our time, when you saw Gyrich, you knew nothing good could come from it.) He has worked for:
- U.S. Superhuman Armed Forces Department
- Commission on Superhuman Activities
- Office of the Chief of Protocol
- National Security Agency
- National Security Council
to name just a few. Feel free to read up on the man in great detail at Wikipedia.
The Marvel continuity known as the Ultimate Marvel Universe (Earth #1610) resembles the Marvel Cinematic Universe (Earth #19999) far more closely and SHIELD is much more in the face of the Avengers, both in the front of the game, trying to control them, and in the covert sphere by making super-soldiers, super-weapons, and trying to manipulate metahumans at every opportunity.
In the Ultimate Universe, SHIELD does whatever it can to control the Avengers, with the same effect they have in the movie, fair to middling, depending on how the Avengers are feeling about SHIELD at the moment.
The Marvel Cinematic Universe and the Ultimate Universe are also similar to Marvel's new Animated Universe (containing the Avengers and Spiderman) which also seems to be very close in tone and tenor as far as the relationship between metahumans and humans.
I think the goal for the writers was when they rewrote the Earth #19999/#1610 Universes was to start the Universe with SHIELD acting as the government's watchdog on the potential danger metahumans pose and guide, harness, control, contain or destroy those threats that cannot be reasoned with and which pose a threat to the human populace of Earth.
[EDIT] An interesting point was made by eidylon that in the Cinematic Universe (Earth #19999) SHIELD appears to be a tool used by the writers to bind the stories together, connecting the characters by their interactions with the enigmatic and often conflicted organization.