Both mencoder and ffmpeg support using a set of JPEG images as their input. As AVI is a container, depending on whether it supports the codec, you can even make an MJPEG movie (which should almost literally correspond to stacking the JPEG images as frames inside the AVI container).
But, unless you have very strict quality requirements, it'll probably be way easier if you just try one of the default or more common codecs.
It has been some time since I did this for the last time, but browsing the web, it seems that making a movie out of frames can be as simple as issuing a command like
ffmpeg -r 40 -i %d.jpg video.avi
Where, -r sets the framerate. Here, this outputs a divx video stream by default. But of course you can specify another video codec (or another container).