Shrek was just sensationalized because of the Chris Farley controversy, and the fact that it was the first highly advertised CG animated film that wasn't gaggingly sweet. But in all retrospect, Madagascar has a stronger premise, better acting, and it's an overall more creative project.
Chris Farley controversy? I don't know what that is.
Anyway, I don't think any of Pixar's films are gaggingly sweet, and I liked Shrek far more than this. I think Shrek was the only good animation that Dreamworks did without Aardman. It was genuinely funny, enthralling, original, I actually cared about each of the characters, the fairytale references were brilliant, and the soundtrack was amazing. All the voice acting was great. And unlike Madagascar, at no point in Shrek did I cringe.
I know what you mean - almost heresy to even think it. Shrek 1 & 2 will always be special to me because they were the first of their kind. Madagascar is way more sophisticated, although I watched it with a 3 year old and he thought all the sight gags were hilarious. The Shrek characters are more loveable, though. And Shrek started life as a fairytale, so perhaps the adult content was just bolted-on. Don't mind, don't care - both great films. But Madagascar just beats it. By a head.