Guessing compiler features from a binary

Jeffrey Yasskin jyasskin at gmail.com
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
hopeful.


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/runtests.py  -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
config.compiler=\"/Users/jyasskin/src/ghc/HEAD/ghc/compiler/stage1/ghc-inplace\"
-e config.compiler_always_flags.append"(\"-Dpowerpc_apple_darwin\")"
-e config.compiler_always_flags.append"(\"\")" -e
config.ghc_pkg=\"/Users/jyasskin/src/ghc/HEAD/ghc/utils/ghc-pkg/ghc-pkg-inplace\"
-e config.hp2ps=\"/Users/jyasskin/src/ghc/HEAD/ghc/utils/hp2ps/hp2ps\"
-e config.gs=\"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
../../../testsuite/driver/runtests.py
--compiler="/Users/jyasskin/src/ghc/HEAD/ghc/compiler/stage1/ghc-inplace"`.

Thanks for any suggestions,
Jeffrey


More information about the Glasgow-haskell-users mailing list