Guessing compiler features from a binary

Jeffrey Yasskin jyasskin at
Sat Apr 14 15:33:31 EDT 2007

Hi all.

I'm looking for the best way to derive the following attributes of a
compiled ghc from just the binary:
 * Supports native code generation
 * Supports profiling
 * Supports -unreg
 * Has ghci
 * Has the threaded RTS
 * Supports SMP

I can probably detect each of these by writing a small test program,
but I'm hoping there's a more straightforward (and faster) way. I was
hoping for a mode similar to `perl -V`, but `ghc -V -v5` doesn't seem
to print anything relevant and I don't see any other flags that look

Some background: I'm trying to make it easy to run the testsuite
driver from outside of the ghc Makefile system. Right now, its command
line (on my system) looks something like:

python ../../../testsuite/driver/  -e
ghc_with_native_codegen=1 -e ghc_with_profiling=0 -e ghc_with_unreg=0
-e ghc_with_interpreter=1 -e ghc_with_threaded_rts=1 -e ghc_with_smp=1
--rootdir=. --config=../../../testsuite/config/ghc -e
config.confdir=\"../../../testsuite/config\" -e
-e config.compiler_always_flags.append"(\"-Dpowerpc_apple_darwin\")"
-e config.compiler_always_flags.append"(\"\")" -e
-e config.hp2ps=\"/Users/jyasskin/src/ghc/HEAD/ghc/utils/hp2ps/hp2ps\"
-e\"gs\" -e config.platform=\"powerpc-apple-darwin\" -e
config.wordsize=\"32\" -e default_testopts.cleanup=\"\" -e "if '0':
config.use_threads=int(0)" -e config.timeout="int() or config.timeout"
-e config.timeout_prog=\"../../../testsuite/timeout/timeout\"

which is not something I'd want to have to type. I'm hoping to be able
to derive all of these arguments from just the path to the compiler,
which could produce a command line as short as `python

Thanks for any suggestions,

More information about the Glasgow-haskell-users mailing list