Merge branch 'options'

A lot of content in lib.c have been added by just appending at the
bottom of what was already present. As consequence, things are now
not well organized at all, especially when related to the options.
So, reorganize things a little bit here:
* move all helpers on top
* keep things alphabetically sorted
* move options parsing in a separate file
* move predefine-related stuff in a separate file