+ bits(0),
+ native(false)
+{
+ if(spec.empty())
+ {
+#ifdef WIN32
+ system = "windows";
+#else
+ utsname un;
+ if(uname(&un)==0)
+ {
+ system = tolower(un.sysname);
+ parse_specification(tolower(un.machine));
+ // We really only want to set type for the default arch
+ cpu.clear();
+ }
+#endif
+ bits = sizeof(void *)*numeric_limits<unsigned char>::digits;
+ native = true;
+ }
+ else
+ {
+ parse_specification(spec);
+ const Architecture &native_arch = builder.get_native_arch();
+ if(type.empty())
+ type = native_arch.type;
+ if(cpu.empty())
+ cpu = native_arch.cpu;
+ if(system.empty())
+ system = native_arch.system;
+ if(!bits)
+ {
+ if(type==native_arch.type)
+ bits = native_arch.bits;
+ else
+ bits = 32;
+ }
+
+ if(type!=native_arch.type || system!=native_arch.system)
+ cross_prefix = format("%s-%s", type, system);
+ else if(bits!=native_arch.bits)
+ {
+ build_info.cflags.push_back(format("-m%d", bits));
+ build_info.ldflags.push_back(format("-m%d", bits));
+ }
+ else
+ native = true;
+
+ if(!cpu.empty())
+ build_info.cflags.push_back(format("-march=%s", cpu));
+ }
+ name = type;
+ if(!cpu.empty())
+ name += format("-%s", cpu);
+ name += format("-%d-%s", bits, system);
+}