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

From D'Arcy" "J.M." Cain
Subject Re: [HACKERS] Checking if a system is ELF
Date
Msg-id m119HSR-0000cIC@druid.net
Whole thread Raw
In response to Re: [HACKERS] Checking if a system is ELF  ("Ross J. Reedstrom" <reedstrm@wallace.ece.rice.edu>)
Responses Re: [HACKERS] Checking if a system is ELF
Re: [HACKERS] Checking if a system is ELF
List pgsql-hackers
Thus spake Ross J. Reedstrom
> Uh, two problems:
> 
> One, it assumes ${CC} is really gcc - the native SGI MIPS compiler doesn't
> like - for compiling stdin.

OK, so we do the test for specific ports like NetBSD.  That would be better
than no test at all.  Perhaps we can also add an option to config to force
it if we can't tell automatically.

>                             Second, my linux box seems to #define __ELF__
> as 1. I'm not sure if that is gcc version related, or platform.

Well, that's sort of the idea assuming that your Linux box is ELF.  Here
is the output from two systems.  Druid is a.out and smaug is ELF.

[darcy@druid:work/trends] $ echo __ELF__ | gcc -E -
# 1 ""
__ELF__

[db@smaug:/usr/db] $ echo __ELF__ | gcc -E -
# 1 ""
1 

So grep will find "__ELF__" in the output on druid proving that it is an
a.out system.  On smaug, __ELF__ is defined as "1" so grep fails to find
the string "__ELF__" proving it to be an ELF system.

> tatabox% echo __ELF__ | cc -E - 
> cc ERROR parsing -:  unknown flag
> cc ERROR:  no source or object file given

Is there any way to compile stdin?  If so then all we need to do is make
the command a variable and special case it for some ports.

> tatabox% cc -version 
> MIPSpro Compilers: Version 7.2.1.3m
> 
> tatabox% echo __ELF__ | gcc -E -
> # 1 ""
> __ELF__

This implies that tatabox is not an ELF system.  Is that accurate?

> wallace$  echo __ELF__ | gcc -E -
> # 1 ""
> 1 

And this says that wallace is.  Correct or no?

-- 
D'Arcy J.M. Cain <darcy@{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.


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Selectivity of "=" (Re: [HACKERS] Index not used on simple select)
Next
From: Fred Wilson Horch
Date:
Subject: Re: Bug tracking system policy