Subject: Re: how to determine if the os is elf or a.out while building pkg
To: John Refling <johnr@imageworks.com>
From: D'Arcy J.M. Cain <darcy@druid.net>
List: tech-pkg
Date: 03/01/2001 07:35:17
Thus spake John Refling
> I have software which I'm packaging which wants to read its own symbol
> tables and stuff, so there is a.out code and elf code to do this.  Is
> there a pkg variable which I can test to determine this?
> 
> Also, where can I find out which ports and which versions thereof use
> elf or a.out format?
> 
> Finally, how would we distribute binaries for such a beast?  An a.out
> version and elf version for each architecture that ever had an a.out
> or elf format?  Sounds problematic.

How's this for a generic wrapper?  Tested on an ELF system where it DTRT.

#! /bin/sh

CC=gcc

if echo __ELF__ | ${CC} -E - | grep -q __ELF__
then exec $0.aout
else exec $0.elf
fi

-- 
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 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.