Re: [HACKERS] Checking if a system is ELF - Mailing list pgsql-hackers

From Ross J. Reedstrom
Subject Re: [HACKERS] Checking if a system is ELF
Date
Msg-id 19990727172752.A14498@wallace.ece.rice.edu
Whole thread Raw
In response to Checking if a system is ELF  ("D'Arcy" "J.M." Cain <darcy@druid.net>)
Responses Re: [HACKERS] Checking if a system is ELF
List pgsql-hackers
On Tue, Jul 27, 1999 at 05:58:33PM -0400, D'Arcy J.M. Cain wrote:
> Todd Vierling (tv@pobox.com) suggested the following test for ELFness.
> Seems pretty portable to me.
> 
> Thus spake Todd Vierling (tv@pobox.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

Uh, two problems:

One, it assumes ${CC} is really gcc - the native SGI MIPS compiler doesn't
like - for compiling stdin. Second, my linux box seems to #define __ELF__
as 1. I'm not sure if that is gcc version related, or platform.

tatabox% echo __ELF__ | cc -E - 
cc ERROR parsing -:  unknown flag
cc ERROR:  no source or object file given
tatabox% cc -version 
MIPSpro Compilers: Version 7.2.1.3m

tatabox% echo __ELF__ | gcc -E -
# 1 ""
__ELF__
tatabox% gcc -v
Reading specs from /usr/site/egcs-1.1.2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)


wallace$  echo __ELF__ | gcc -E -
# 1 ""
1 
wallace$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2.3/specs
gcc version 2.7.2.3

Ross
-- 
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005


pgsql-hackers by date:

Previous
From: "Hub.Org News Admin"
Date:
Subject: ...
Next
From: Bruce Momjian
Date:
Subject: Re: Selectivity of "=" (Re: [HACKERS] Index not used on simple select)