Re: [HACKERS] Checking if a system is ELF

From: "D'Arcy" "J(dot)M(dot)" Cain <darcy(at)druid(dot)net>
To: reedstrm(at)wallace(dot)ece(dot)rice(dot)edu (Ross J(dot) Reedstrom)
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Checking if a system is ELF
Date: 1999-07-28 00:20:31
Message-ID: m119HSR-0000cIC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)druid:work/trends] $ echo __ELF__ | gcc -E -
# 1 ""
__ELF__

[db(at)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(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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fred Wilson Horch 1999-07-28 01:21:05 Re: Bug tracking system policy
Previous Message Hannu Krosing 1999-07-28 00:13:53 Re: Selectivity of "=" (Re: [HACKERS] Index not used on simple select)