for the 'dmd.conf should prepend instead of append?' aspect of the question, I filed https://issues.dlang.org/show_bug.cgi?id=15531


On Mon, Dec 28, 2015 at 6:50 AM, Timothee Cour <thelastmammoth@gmail.com> wrote:
I'd like to have a command line flag for dmd (and ldc,gdc) that would be the analog to:
llvm-config --ldflags --cflags
ie, would print the corresponding flags used by dmd after following the internal logic (look for dmd.conf in a number of directories, look for DFLAGS environment variable etc).

one use case among others:

when using 'dmd -L-Lfoo -lbar ...', i'd like to first guess which linker flags are used by dmd (eg transforming -L-L%@P% into -L-Lsome_path) and then call:
'dmd -L-Lsome_path -L-Lfoo -lbar ...'

Note that what's actually called is instead:
'dmd -L-Lfoo -lbar ... -L-Lsome_path '
ie, dmd appends instead of prepends the library search path given by dmd.conf, which leads to weird behavior if foo (from -L-Lfoo) contains an unwanted version of libphobos2