First set of licensing changes
[mono.git] / mono / utils / mono-hwcap.c
1 /*
2  * mono-hwcap.c: Hardware feature detection
3  *
4  * Authors:
5  *    Alex Rønne Petersen (alexrp@xamarin.com)
6  *    Elijah Taylor (elijahtaylor@google.com)
7  *    Miguel de Icaza (miguel@xamarin.com)
8  *    Neale Ferguson (Neale.Ferguson@SoftwareAG-usa.com)
9  *    Paolo Molaro (lupus@xamarin.com)
10  *    Rodrigo Kumpera (kumpera@gmail.com)
11  *    Sebastien Pouliot (sebastien@xamarin.com)
12  *    Zoltan Varga (vargaz@xamarin.com)
13  *
14  * Copyright 2003 Ximian, Inc.
15  * Copyright 2003-2011 Novell, Inc
16  * Copyright 2006 Broadcom
17  * Copyright 2007-2008 Andreas Faerber
18  * Copyright 2011-2013 Xamarin Inc
19  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
20  */
21
22 #include <stdlib.h>
23 #include <string.h>
24
25 #include "mono/utils/mono-hwcap.h"
26
27 static gboolean hwcap_inited = FALSE;
28
29 void
30 mono_hwcap_init (void)
31 {
32         const char *verbose = g_getenv ("MONO_VERBOSE_HWCAP");
33         const char *conservative = g_getenv ("MONO_CONSERVATIVE_HWCAP");
34
35         if (hwcap_inited)
36                 return;
37
38 #ifdef MONO_CROSS_COMPILE
39         /*
40          * If we're cross-compiling, we want to be as
41          * conservative as possible so that we produce
42          * code that's portable. Default to that.
43          */
44         if (!conservative)
45                 conservative = "1";
46 #endif
47
48         if (!conservative || strncmp (conservative, "1", 1))
49                 mono_hwcap_arch_init ();
50
51         if (verbose && !strncmp (verbose, "1", 1))
52                 mono_hwcap_print (stdout);
53 }