-typedef enum lang_standard_t {
- STANDARD_DEFAULT, /* gnu99 (for C, GCC does gnu89) or gnu++98 (for C++) */
- STANDARD_ANSI, /* c89 (for C) or c++98 (for C++) */
- STANDARD_C89, /* ISO C90 (sic) */
- STANDARD_C90, /* ISO C90 as modified in amendment 1 */
- STANDARD_C99, /* ISO C99 */
- STANDARD_GNU89, /* ISO C90 plus GNU extensions (including some C99) */
- STANDARD_GNU99, /* ISO C99 plus GNU extensions */
- STANDARD_CXX98, /* ISO C++ 1998 plus amendments */
- STANDARD_GNUXX98 /* ISO C++ 1998 plus amendments and GNU extensions */
-} lang_standard_t;
+static bool parse_target_triple(const char *arg)
+{
+ const char *manufacturer = strchr(arg, '-');
+ if (manufacturer == NULL) {
+ fprintf(stderr, "Target-triple is not in the form 'cpu_type-manufacturer-operating_system'\n");
+ return false;
+ }
+ manufacturer += 1;
+
+ const char *os = strchr(manufacturer, '-');
+ if (os == NULL) {
+ fprintf(stderr, "Target-triple is not in the form 'cpu_type-manufacturer-operating_system'\n");
+ return false;
+ }
+ os += 1;
+
+ /* Note: Triples are more or less defined by what the config.guess and
+ * config.sub scripts from GNU autoconf emit. We have to lookup there what
+ * triples are possible */
+
+ /* process cpu type */
+ if (strstart(arg, "i386-")) {
+ be_parse_arg("isa=ia32");
+ be_parse_arg("ia32-arch=i386");
+ } else if (strstart(arg, "i486-")) {
+ be_parse_arg("isa=ia32");
+ be_parse_arg("ia32-arch=i486");
+ } else if (strstart(arg, "i586-")) {
+ be_parse_arg("isa=ia32");
+ be_parse_arg("ia32-arch=i586");
+ } else if (strstart(arg, "i686-")) {
+ be_parse_arg("isa=ia32");
+ be_parse_arg("ia32-arch=i686");
+ } else if (strstart(arg, "i786-")) {
+ be_parse_arg("isa=ia32");
+ be_parse_arg("ia32-arch=pentium4");
+ } else if (strstart(arg, "x86_64")) {
+ be_parse_arg("isa=amd64");
+ } else if (strstart(arg, "sparc-")) {
+ be_parse_arg("isa=sparc");
+ } else if (strstart(arg, "arm-")) {
+ be_parse_arg("isa=arm");
+ } else {
+ fprintf(stderr, "Unknown cpu in triple '%s'\n", arg);
+ return false;
+ }
+
+ /* process manufacturer, alot of people incorrectly leave out the
+ * manufacturer instead of using unknown- */
+ if (strstart(manufacturer, "linux")) {
+ os = manufacturer;
+ manufacturer = "unknown-";
+ }
+
+ /* process operating system */
+ if (!set_os_support(os)) {
+ fprintf(stderr, "Unknown operating system '%s' in triple '%s'\n", os, arg);
+ return false;
+ }
+
+ target_triple = arg;
+ return true;
+}