www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - programmatically get -I and -L flags from dmd; dmd.conf should

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
Dec 28 2015