Build 6.2 against libgif 5.0.3 fail

Trying to build mapserver 6.2.1 (released tarball) on system with giflib 5.0.3 configure is okay, but make fail at 

[   58s] mapimageio.c: In function 'gif_error_msg':
[   58s] mapimageio.c:1001:3: warning: implicit declaration of function 'GifLastError' [-Wimplicit-function-declaration]
[   58s] mapimageio.c: In function 'readGIF':
[   58s] mapimageio.c:1096:3: error: too few arguments to function 'DGifOpenFileName'
[   58s] In file included from mapimageio.c:38:0:
[   58s] /usr/include/gif_lib.h:177:14: note: declared here


Full build log is available here http://goo.gl/UVS0R