Todd Vierling (tv(at)pobox(dot)com) suggested the following test for ELFness.
Seems pretty portable to me.
Thus spake Todd Vierling (tv(at)pobox(dot)com)
>On NetBSD, the following will do it. This may even be platform independednt
>if "grep -q" is replaced by "grep >/dev/null 2>&1".
>
>if echo __ELF__ | ${CC} -E - | grep -q __ELF__; then
> ... a.out action ...
>else
> ... ELF action ...
>fi
--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.