macos: add darwin OS detection.

This commit is contained in:
Christian Jullien 2020-06-21 10:58:36 +02:00
parent a3d1e9cd3d
commit c69356635c

View file

@ -24,8 +24,10 @@
# define TRIPLET_OS "linux" # define TRIPLET_OS "linux"
#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__) #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
# define TRIPLET_OS "kfreebsd" # define TRIPLET_OS "kfreebsd"
#elif defined _WIN32 #elif defined(_WIN32)
# define TRIPLET_OS "win32" # define TRIPLET_OS "win32"
#elif defined(__APPLE__)
# define TRIPLET_OS "darwin"
#elif !defined (__GNU__) #elif !defined (__GNU__)
# define TRIPLET_OS "unknown" # define TRIPLET_OS "unknown"
#endif #endif
@ -65,21 +67,22 @@ int main(int argc, char *argv[])
puts(*(unsigned char*)&foo == 0x67 ? "no" : "yes"); puts(*(unsigned char*)&foo == 0x67 ? "no" : "yes");
break; break;
} }
#ifdef __clang__ #if defined(__clang__)
case 'm': case 'm':
printf("%d\n", __clang_minor__); printf("%d\n", __clang_minor__);
break; break;
case 'v': case 'v':
printf("%d\n", __clang_major__); printf("%d\n", __clang_major__);
break; break;
#elif defined __TINYC__ #elif defined(__TINYC__)
case 'v': case 'v':
puts("0"); puts("0");
break; break;
case 'm': case 'm':
printf("%d\n", __TINYC__); printf("%d\n", __TINYC__);
break; break;
#elif defined( __GNUC__) && defined(__GNUC_MINOR__) #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
/* GNU comes last as other compilers may add 'GNU' compatibility */
case 'm': case 'm':
printf("%d\n", __GNUC_MINOR__); printf("%d\n", __GNUC_MINOR__);
break; break;