update readme (#21797)
[mono-project.git] / mono / utils / mono-hwcap.c
blobc0e68ee034fffc8368b0ce06660a2f9ae4eadcd6
1 /**
2 * \file
3 * Hardware feature detection
5 * Authors:
6 * Alex Rønne Petersen (alexrp@xamarin.com)
7 * Elijah Taylor (elijahtaylor@google.com)
8 * Miguel de Icaza (miguel@xamarin.com)
9 * Neale Ferguson (Neale.Ferguson@SoftwareAG-usa.com)
10 * Paolo Molaro (lupus@xamarin.com)
11 * Rodrigo Kumpera (kumpera@gmail.com)
12 * Sebastien Pouliot (sebastien@xamarin.com)
13 * Zoltan Varga (vargaz@xamarin.com)
15 * Copyright 2003 Ximian, Inc.
16 * Copyright 2003-2011 Novell, Inc
17 * Copyright 2006 Broadcom
18 * Copyright 2007-2008 Andreas Faerber
19 * Copyright 2011-2013 Xamarin Inc
20 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
23 #include <stdlib.h>
24 #include <string.h>
26 #include "mono/utils/mono-hwcap.h"
28 #define MONO_HWCAP_VAR(NAME) gboolean mono_hwcap_ ## NAME = FALSE;
29 #include "mono/utils/mono-hwcap-vars.h"
30 #undef MONO_HWCAP_VAR
32 static gboolean hwcap_inited = FALSE;
34 void
35 mono_hwcap_init (void)
37 char *verbose = g_getenv ("MONO_VERBOSE_HWCAP");
38 char *conservative = g_getenv ("MONO_CONSERVATIVE_HWCAP");
40 if (hwcap_inited)
41 return;
43 if (!conservative || strncmp (conservative, "1", 1))
44 mono_hwcap_arch_init ();
46 if (verbose && !strncmp (verbose, "1", 1))
47 mono_hwcap_print ();
49 g_free (verbose);
50 g_free (conservative);
53 void
54 mono_hwcap_print (void)
56 g_print ("[mono-hwcap] Detected following hardware capabilities:\n\n");
58 #define MONO_HWCAP_VAR(NAME) g_print ("\t" #NAME " = %s\n", mono_hwcap_ ## NAME ? "yes" : "no");
59 #include "mono/utils/mono-hwcap-vars.h"
60 #undef MONO_HWCAP_VAR
62 g_print ("\n");