Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Shorter version of question:

Which C header contains the macro that corresponds to the machine architecture of the system (e.g., __x86_64__, __ia64__, __mips__?)

Longer version of question:

I'd like to run the ganglia monitoring tools on a Tilera-based system that runs Linux.

Ganglia doesn't currently have support for Tilera. To get this to work, I ned to modify a C function called machine_type_func that returns the machine architecture. The body of this function is determined at compile-time, it looks like this:

machine_type_func ( void )
   g_val_t val;

#ifdef __i386__
   snprintf(val.str, MAX_G_STRING_SIZE, "x86");
#ifdef __x86_64__
   snprintf(val.str, MAX_G_STRING_SIZE, "x86_64");
   return val;

I need to add the appropriate line for Tilera, but I don't know the name of the macro that specifies a Tilera-based system. I'm guessing this macro is defined in one of the standard Linux headers, but I don't know which one to look in.

share|improve this question
up vote 5 down vote accepted

No header file defines it - those macros are predefined by the compiler. To find out the full list of predefined macros do this:

echo | gcc -E -dM -

Then look through the results for likely macros.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.