If you're compiling Julia from source, you should be able to do something like write a base/userimg.jl file that contains this kind of text:
Base.require("Distributions.jl")
Base.require("Optim.jl")
Base.require("DataFrames.jl")
Base.require("Gadfly.jl”)
You'll need to create a new build after adding this userimg.jl file. Also be aware that changes to these packages will stop showing up when you type "using Gadfly" since you'll always access your precompiled version.