Re: command-line test for 64-bit hardware
Re: command-line test for 64-bit hardware
- Subject: Re: command-line test for 64-bit hardware
- From: Brian Arnold <email@hidden>
- Date: Thu, 06 Sep 2007 09:02:34 -0400
- Thread-topic: command-line test for 64-bit hardware
Hi,
We build almost everything from gnu makefiles, and so we use our own
compiled tool, nativearchactual (hmm, wonder where I got this idea from), to
detect processor types understood by Apple's gcc, replacing tests for uname
-p or uname -m.
#include <stdio.h>
static const char* getProcessorType()
{
#if defined(__x86_64__)
return ("x86_64");
#elif defined(__i386__)
return ("i386");
#elif defined(__ppc64__)
return ("ppc64");
#elif defined(__ppc__)
return ("ppc");
#else
return ("unkown processor type");
#endif
}
int main(int argc, char *argv[])
{
printf( "%s", getProcessorType() );
return(0);
}
To build it, use this:
g++ nativearchactual.cpp -arch ppc -arch ppc64 -arch i386 -arch x86_64 \
-o nativearchactual
Building this requires a minimum gcc version which supports compiling all of
these architectures. It would be nice if Apple provided such a tool
(outside of Xcode) and kept it current.
- Brian
Mac Developer
The MathWorks, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden