“First order extendedgravity and the dark side of the universe: the general theories