<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Thanks for the responses guys.<br><blockquote type="cite"><div><br><br> Bob Ham <<a href="mailto:rah@bash.sh">rah@bash.sh</a>><br><br><blockquote type="cite">Currently I am trying to figure out the best and most universal method<br></blockquote><blockquote type="cite">of detecting the host architecture for Linux distros at runtime<br></blockquote><br>Use config.guess from GNU autotools. Eg, on my system I can do the<br>following:<br><br>rah@myrtle:~$ /usr/share/automake-1.11/config.guess <br>x86_64-unknown-linux-gnu<br>rah@myrtle:~$ /usr/share/automake-1.11/config.guess | cut -f 1 -d -<br>x86_64<br><br>Note also that for your purposes, "use" will most likely mean reading<br>the source.<br></div></blockquote><br><blockquote type="cite"><div>Dave Love</div></blockquote><blockquote type="cite"><div>Do you mean GNU/Linux? Even if you don't think much of GNU autotools,<br>I'm pretty sure you won't do better for platform information than<br>config.sub/config.guess, and they're not specific to Linux-based<br>systems. The autotools have a lot of hard experience behind them, and I<br>guess such questions are best asked in an autoconf forum.</div></blockquote><div><br></div><div><br></div>This has just recently been suggested to me and I am currently in the process of grokking it.</div><div><br></div><div><br><blockquote type="cite"><div><br><blockquote type="cite">for a couple of reasons: To let users call out to external<br></blockquote><blockquote type="cite">executables depending on the arch [2]<br></blockquote><br>I don't understand exactly what's required, but for building you don't<br>normally care about the hardware, just what the tools target -- what<br>width is a C long, not what's the addressing of the metal.<br></div></blockquote>It has been requested by users and I have seen real world examples of users trying to obtain this information using a number of methods, so it would be a nice feature to add such information and make it available to users. Users can have different settings for different architectures yet the information wanted is for a 'just the host' without a user supplying such information.</div><div>I do not understand what you are getting at but as I am sure you are aware the size of a long in C is not defined by the standard yet only in relation to other types or using sizeof(long), minimum sizes LONG_MIN and LONG_MAX or figuring out which arch the system is using ie. LP64 et al<br><blockquote type="cite"><div><br><blockquote type="cite">To set the correct location to look for libraries [3]<br></blockquote><br>I don't know why you want to, but you're on to a loser if you assume<br>libraries are necessarily somewhere like /usr/lib64, and especially if<br>you consider non-GNU/Linux systems. While you can, perhaps, locate<br>libraries with ldd and a sample binary, ask yourself why.<br><br></div></blockquote><div>This is required for users to search for the libraries and if present report there locations. where these are well known locations and the results from the ld cache. A sample binary is something we would rather not have to have if it was at all possible, the problem is that Linux has no standards for this or that it does yet distros disregard it. lib can be 32, 64 or a semlink, lib32 can be present or lib64 can plus there may also be other 'known locations'</div><br><blockquote type="cite"><div><blockquote type="cite">My current thinking is the best method is to parse the output of<br></blockquote><blockquote type="cite">'uname -m' and this method has been confirmed to me that at least on<br></blockquote><blockquote type="cite">one distro gives the value of a 32 bit id when a 32 bit distro is<br></blockquote><blockquote type="cite">installed on a 64 bit system, which is what I am looking for.<br></blockquote><br>(In the absence of details,) that's not necessarily what's relevant,<br>e.g.<br><br> $ /usr/share/misc/config.guess<br> x86_64-unknown-linux-gnu<br> $ linux32 /usr/share/misc/config.guess<br> i686-pc-linux-gnu<br><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote></div><div><blockquote type="cite"><div>You can't, in general, determine the target parameters with build-time<br>tests; think cross-building a cross-compiler, and you may or may not<br>regard `gcc -m...' as cross-compiling.<br></div></blockquote><br>I do not understand, the first returns information that it is 64 bits and the second 32. Am I missing something here? Cross compiling I currently do not see as a problem for most of the library as the user will have provided the architecture information to the library in a script, yet in the instance of wanting to find a library this information is a help. We can search the known locations and if not found and a 64 bit host try *lib64</div><div><blockquote type="cite"><div><br><blockquote type="cite">The current values that I have can be seen in [4]. Are there any<br></blockquote><blockquote type="cite">others that are known to yourselves<br></blockquote><br>Look at GCC for a start on architectures of current interest, but it<br>probably misses current ones.<br><br><br></div></blockquote><div>Thanks will do.</div><div><br></div><div>Liam</div></div><br></body></html>