Re: Mac OS X Snow Leopard and 64-bit applications
Re: Mac OS X Snow Leopard and 64-bit applications
- Subject: Re: Mac OS X Snow Leopard and 64-bit applications
- From: Mo McRoberts <email@hidden>
- Date: Tue, 1 Sep 2009 08:46:04 +0100
On Tue, Sep 1, 2009 at 00:16, Nathan Herring<email@hidden> wrote:
> Over here in CLR-land, we've got similar issues where there's no nice autoconf mechanism to figure out what'll get built by gcc if you fail to provide an -arch flag. We use this because we differentiate between building the tools we need to complete the rest of the build, and the actual build products. (The former must run on the current system, even if it's not the exact architecture. i.e., for an x86_64 machine, it can be ppc if Rosetta is installed, or i386. The latter must run for the target system, which might have different minimum/maximum OS requirements.)
(g)libtool uses 'file' to detect archives, so you could use a similar
mechanism. if, after detecting the C compiler and so on, you compile a
test program with it—I don’t think autoconf has a macro for the
equivalent of AC_LINK_IFELSE which preserves the output, so you’ll
have to roll your own—then you can pattern-match the output of 'file'
on the result.
On 10.6 with Xcode 3.2, /usr/bin/file will produce the following
(fairly easy to match conclusively):
conftest: Mach-O 64-bit executable x86_64
An alternative would be to rely on what 'sysctl -n hw.optional.x86_64'
says, but Apple could well adjust the x86_64 strand of gcc at some
unspecified time in the future to produce something other than x86_64
binaries by default (or, and probably more likely, a user could
specify CC='gcc -arch i386' when running configure).
That said, I’d wonder if it was necessary… Autoconf is (obviously)
designed to cope with cross-compiling, but it does depend on
host/build/target being set appropriately. If _everything’s_ left to
config.guess, it’ll obviously not know and assume that the archs are
the same (and enough feature-test/arch-property macros are provided to
figure out the finer points of what that arch is at compile-time in
many cases).
If you're cross-compiling for a specific known platform which is
different to the build system (e.g. -arch ppc -isysroot
/Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4), then
--host and --target should be specified explicitly.
If you need to *detect* aspects of both the "build" and "host" systems
separately, the usual trick is to split things into subdirs and add a
top-level configure/Makefile which ties them up, forcing host=$build
and ignoring the likes of $CC and $CFLAGS when recursing into the
for-build-system tools subdir.
M.
--
http://nevali.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden