[Liverpool] Runtime OS architecture detection

Liam Devine dmail00 at gmail.com
Thu Dec 9 15:31:29 UTC 2010


Hello,
I have not posted to this list much at all since registering at University and have never attended a LUG meeting. Yes I do hear the cries of 'burn him at the stake'  :)

At little bit of background info.
Premake[1] is an Open Source cross platform 'configure' type library written in Lua which generates project files, solutions and make files. Currently I am trying to figure out the best and most universal method of detecting the host architecture for Linux distros at runtime for a couple of reasons:
To let users call out to external executables depending on the arch [2]
To set the correct location to look for libraries [3]

My current thinking is the best method is to parse the output of 'uname -m' and this method has been confirmed to me that at least on one distro gives the value of a 32 bit id when a 32 bit distro is installed on a 64 bit system, which is what I am looking for. The other alternatives as I see it are:
parsing /proc/cpuinfo  Although I am not sure if this would give a 64 bit value in the above case
uname -p Does not always give a valid value, sometimes returning 'unknown'


The current values that I have can be seen in [4]. Are there any others that are known to yourselves and is this the best method of obtaining the information? Any help would be gratefully received and any calls to burn me will be ignored :)

Thanks

Liam  

[1] http://industriousone.com/premake
[2] http://sourceforge.net/tracker/index.php?func=detail&aid=1582602&group_id=71616&atid=531881
[3] http://sourceforge.net/tracker/?func=detail&aid=3121217&group_id=71616&atid=531878
[4] http://industriousone.com/topic/native-arch

PS Hmm does it show that I do not post to this mailing list much when I sent the first mail to liverpool-request :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/liverpool/attachments/20101209/d5d3ca3f/attachment.htm>


More information about the Liverpool mailing list