#include <limits>
-#ifndef _WIN32
-#include <sys/utsname.h>
-#endif
#include <msp/strings/format.h>
#include <msp/strings/utils.h>
#include "architecture.h"
#include "builder.h"
+#include "sysutils.h"
using namespace std;
using namespace Msp;
{
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
+ parse_specification(get_system_type());
+ // We really only want to set type for the default arch
+ cpu.clear();
bits = sizeof(void *)*numeric_limits<unsigned char>::digits;
native = true;
}
--- /dev/null
+#ifndef _WIN32
+#include <sys/utsname.h>
+#endif
+#include <msp/strings/format.h>
+#include <msp/strings/utils.h>
+#include "sysutils.h"
+
+using namespace std;
+using namespace Msp;
+
+string get_system_type()
+{
+#ifdef _WIN32
+ return "windows";
+#else
+ utsname un;
+ if(uname(&un)==0)
+ return tolower(format("%s-%s", un.sysname, un.machine));
+#endif
+
+ return string();
+}