diff --git a/Documentation/clr-code-guide.md b/Documentation/clr-code-guide.md
index 1684bea33a08..589b93a65c40 100644
--- a/Documentation/clr-code-guide.md
+++ b/Documentation/clr-code-guide.md
@@ -1,5 +1,12 @@
-What Every CLR Developer Must Know Before Writing Code
-===
+What Every CLR Developer Must Know Before Writing Code
+===
+
+Written in 2006, by:
+
+- Rick Byers ([@RByers](https://github.com/RByers))
+- Jan Kotas ([@jkotas](https://github.com/jkotas))
+- Mike Stall ([@mikestall](https://github.com/mikestall))
+- Rudi Martin ([@Rudi-Martin](https://github.com/Rudi-Martin))
# Why you must read this document
diff --git a/Documentation/glossary.md b/Documentation/glossary.md
index 7458d9595794..91c8a1d27cc4 100644
--- a/Documentation/glossary.md
+++ b/Documentation/glossary.md
@@ -6,6 +6,7 @@ This glossary defines terms, both common and more niche, that are important to u
As much as possible, we should link to the most authoritative and recent source of information for a term. That approach should be the most helpful for people who want to learn more about a topic.
* CLR: Common Language Runtime
+* COMPLUS: An early name for the .NET platform, back when it was envisioned as a successor to the COM platform (hence, "COM+"). Used in various places in the CLR infrastructure, most prominently as a common prefix for the names of internal configuration settings. Note that this is different from the product that eventually ended up being named [COM+](https://msdn.microsoft.com/en-us/library/windows/desktop/ms685978.aspx).
* COR: [Common Object Runtime](http://www.danielmoth.com/Blog/mscorlibdll.aspx). The name of .NET before it was named .NET.
* DAC: Data Access Component. An abstraction layer over the internal structures in the runtime.
* EE: Execution Engine.
@@ -14,4 +15,4 @@ As much as possible, we should link to the most authoritative and recent source
* SVR: The CLR used to be built as two variants, with one called "mscorsvr.dll", to mean the "server" version. In particular, it contained the server GC implementation, which was intended for multi-threaded apps capable of taking advantage of multiple processors. In the .NET Framework 2 release, the two variants were merged into "mscorwks.dll". The WKS version was the default, however the SVR version remained available.
* URT: Universal Runtime. Ancient name for what ended up being .NET, is used in the WinError facility name FACILITY_URT.
* VM: Virtual machine.
-* WKS: The CLR used to be built as two variants, with one called "mscorwks.dll", to mean the "workstation" version. In particular, it contained the client GC implementation, which was intended for single-threaded apps, independent of how many processors were on the machine. In the .NET Framework 2 release, the two variants were merged into "mscorwks.dll". The WKS version was the default, however the SVR version remained available.
\ No newline at end of file
+* WKS: The CLR used to be built as two variants, with one called "mscorwks.dll", to mean the "workstation" version. In particular, it contained the client GC implementation, which was intended for single-threaded apps, independent of how many processors were on the machine. In the .NET Framework 2 release, the two variants were merged into "mscorwks.dll". The WKS version was the default, however the SVR version remained available.
diff --git a/Documentation/images/type-system-dependencies.png b/Documentation/images/type-system-dependencies.png
new file mode 100644
index 000000000000..b0cea6038e3f
Binary files /dev/null and b/Documentation/images/type-system-dependencies.png differ
diff --git a/Documentation/images/typeloader-fig1.png b/Documentation/images/typeloader-fig1.png
new file mode 100644
index 000000000000..750889be4c4c
Binary files /dev/null and b/Documentation/images/typeloader-fig1.png differ
diff --git a/Documentation/images/typeloader-fig2.png b/Documentation/images/typeloader-fig2.png
new file mode 100644
index 000000000000..6e3f426d10b2
Binary files /dev/null and b/Documentation/images/typeloader-fig2.png differ
diff --git a/Documentation/images/typeloader-fig3.png b/Documentation/images/typeloader-fig3.png
new file mode 100644
index 000000000000..73179c468be1
Binary files /dev/null and b/Documentation/images/typeloader-fig3.png differ
diff --git a/Documentation/images/typeloader-fig4.png b/Documentation/images/typeloader-fig4.png
new file mode 100644
index 000000000000..3bdbce28f0d9
Binary files /dev/null and b/Documentation/images/typeloader-fig4.png differ
diff --git a/Documentation/index.md b/Documentation/index.md
index 8b9ecc909096..ae831b37ac48 100644
--- a/Documentation/index.md
+++ b/Documentation/index.md
@@ -7,6 +7,7 @@ This repo includes several documents that explain both high-level and low-level
- [Introduction to the Common Language Runtime](intro-to-clr.md)
- [Mscorlib and Calling Into the Runtime](mscorlib.md)
+- [Type Loader](type-loader.md)
- [Stack Walking](stackwalking.md)
- [Book of the Runtime FAQ](botr-faq.md)
@@ -23,7 +24,7 @@ This repo includes several documents that explain both high-level and low-level
- [MSDN Entry for the CLR](http://msdn.microsoft.com/en-us/library/8bs2ecf4(VS.71).aspx)
- [Wikipedia Entry for the CLR](http://en.wikipedia.org/wiki/Common_Language_Runtime)
-- [ECMA Standard for the Common Language Infrastructure (CLI)](http://msdn.microsoft.com/en-us/netframework/aa569283.aspx)
+- [ECMA Standard for the Common Language Infrastructure (CLI)](http://www.ecma-international.org/publications/standards/Ecma-335.htm)
- [Partition I Concepts and Architecture](http://download.microsoft.com/download/7/3/3/733AD403-90B2-4064-A81E-01035A7FE13C/MS%20Partition%20I.pdf)
- [Partition II Meta Data Definition and Semantics](http://download.microsoft.com/download/7/3/3/733AD403-90B2-4064-A81E-01035A7FE13C/MS%20Partition%20II.pdf)
- [Partition III CIL Instruction Set](http://download.microsoft.com/download/7/3/3/733AD403-90B2-4064-A81E-01035A7FE13C/MS%20Partition%20III.pdf)
diff --git a/Documentation/intro-to-clr.md b/Documentation/intro-to-clr.md
index 4818b835e557..757aa19b1634 100644
--- a/Documentation/intro-to-clr.md
+++ b/Documentation/intro-to-clr.md
@@ -251,13 +251,13 @@ Phew! The runtime does a lot! It has taken many pages just to describe _some_ o
- [MSDN Entry for the CLR][clr]
- [Wikipedia Entry for the CLR](http://en.wikipedia.org/wiki/Common_Language_Runtime)
-- [ECMA Standard for the Common Language Infrastructure (CLI)](http://msdn.microsoft.com/en-us/netframework/aa569283.aspx)
+- [ECMA Standard for the Common Language Infrastructure (CLI)][ecma-spec]
- [Partition I Concepts and Architecture](http://download.microsoft.com/download/7/3/3/733AD403-90B2-4064-A81E-01035A7FE13C/MS%20Partition%20I.pdf)
- [Partition II Meta Data Definition and Semantics](http://download.microsoft.com/download/7/3/3/733AD403-90B2-4064-A81E-01035A7FE13C/MS%20Partition%20II.pdf)
- [Partition III CIL Instruction Set][cil-spec]
- [.NET Framework Design Guidelines](http://msdn.microsoft.com/en-us/library/ms229042.aspx)
-[ecma-spec]: http://msdn.microsoft.com/en-us/netframework/aa569283.aspx
+[ecma-spec]: http://www.ecma-international.org/publications/standards/Ecma-335.htm
[clr]: http://msdn.microsoft.com/en-us/library/8bs2ecf4(VS.71).aspx
[cil-spec]: http://download.microsoft.com/download/7/3/3/733AD403-90B2-4064-A81E-01035A7FE13C/MS%20Partition%20III.pdf
[fx-design-guidelines]: http://msdn.microsoft.com/en-us/library/ms229042.aspx
diff --git a/Documentation/mscorlib.md b/Documentation/mscorlib.md
index c3e72de0970b..23c0853b4981 100644
--- a/Documentation/mscorlib.md
+++ b/Documentation/mscorlib.md
@@ -85,7 +85,7 @@ Do not replicate the comments into your actual QCall implementation. This is for
// All QCalls should have the following DllImport and
// SuppressUnmanagedCodeSecurity attributes
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- SuppressUnmanagedCodeSecurity]
+ [SuppressUnmanagedCodeSecurity]
// QCalls should always be static extern.
private static extern bool Bar(int flags, string inString, StringHandleOnStack retString);
diff --git a/Documentation/type-loader.md b/Documentation/type-loader.md
new file mode 100644
index 000000000000..9b108975fd34
--- /dev/null
+++ b/Documentation/type-loader.md
@@ -0,0 +1,317 @@
+Type Loader Design
+===
+
+Author: Ladi Prosek - 2007
+
+# Introduction
+
+In a class-based object oriented system, types are templates
+describing the data that individual instances will contain, and the
+functionality that they will provide. It is not possible to create an
+object without first defining its type1. Two objects are said to
+be of the same type if they are instances of the same type. The fact
+that they define the exact same set of members does not make them
+related in any way.
+
+The previous paragraph could as well describe a typical C++
+system. One additional feature essential to CLR is the availability of
+full runtime type information. In order to "manage" the managed code
+and provide type safe environment, the runtime must know the type of
+any object at any time. Such a type information must be readily
+available without extensive computation because the type identity
+queries are expected to be rather frequent (e.g. any type-cast
+involves querying the type identity of the object to verify that the
+cast is safe and can be done).
+
+This performance requirement rules out any dictionary look up
+approaches and leaves us with the following high-level architecture.
+
+
+
+Figure 1 The abstract high-level object design
+
+Apart from the actual instance data, each object contains a type id
+which is simply a pointer to the structure that represents the
+type. This concept is similar to C++ v-table pointers, but the
+structure, which we call TYPE now and will define it more precisely
+later, contains more than just a v-table. For instance, it has to
+contain information about the hierarchy so that "is-a" subsumption
+questions can be answered.
+
+1 The C# 3.0 feature called "anonymous types" lets you define an
+object without explicit reference to a type - simply by directly
+listing its fields. Don't let this fool you, there is in fact a type
+created behind the scenes for you by the compiler.
+
+## 1.1 Related Reading
+
+[1] Martin Abadi, Luca Cardelli, A Theory of Objects, ISBN
+978-0387947754
+
+[2] Andrew Kennedy ([@andrewjkennedy](https://github.com/andrewjkennedy)), Don Syme ([@dsyme](https://github.com/dsyme)), [Design and Implementation of Generics
+for the .NET Common Language
+Runtime][generics-design]
+
+[generics-design]: http://research.microsoft.com/apps/pubs/default.aspx?id=64031
+
+[3] [ECMA Standard for the Common Language Infrastructure (CLI)](http://www.ecma-international.org/publications/standards/Ecma-335.htm)
+
+## 1.2 Design Goals
+
+The ultimate purpose of the type loader (sometimes referred to as the
+class loader, which is strictly speaking not correct, because classes
+constitute just a subset of types - namely reference types - and the
+loader loads value types as well) is to build data structures
+representing the type which it is asked to load. These are the
+properties that the loader should have:
+
+- Fast type lookup ([module, token] => handle and [assembly, name] => handle).
+- Optimized memory layout to achieve good working set size, cache hit rate, and JITted code performance.
+- Type safety - malformed types are not loaded and a TypeLoadException is thrown.
+- Concurrency - scales well in multi-threaded environments.
+
+# 2 Type Loader Architecture
+
+There is a relatively small number of entry-points to the loader. Although the signature of each individual entry-point is slightly different, they all have the similar semantics. They take a type/member designation in the form of a metadata **token** or a **name** string, a scope for the token (a **module** or an **assembly** ), and some additional information like flags. They return the loaded entity in the form of a **handle**.
+
+There are usually many calls to the type loader during JITting. Consider:
+
+ object CreateClass()
+ {
+ return new MyClass();
+ }
+
+In the IL, MyClass is referred to using a metadata token. In order to generate a call to the **JIT\_New** helper which takes care of the actual instantiation, the JIT will ask the type loader to load the type and return a handle to it. This handle will be then directly embedded in the JITted code as an immediate value. The fact that types and members are usually resolved and loaded at JIT time and not at run-time also explains the sometimes confusing behavior easily hit with code like this:
+
+ object CreateClass()
+ {
+ try {
+ return new MyClass();
+ } catch (TypeLoadException) {
+ return null;
+ }
+ }
+
+If **MyClass** fails to load, for example because it's supposed to be defined in another assembly and it was accidentally removed in the newest build, then this code will still throw **TypeLoadException**. The reason that the catch block did not catch it is that it never ran! The exception occurred during JITting and would only be catchable in the method that called **CreateClass** and caused it to be JITted. In addition, it may not be always obvious at which point the JITting is triggered due to inlining, so users should not expect and rely on deterministic behavior.
+
+## Key Data Structures
+
+The most universal type designation in the CLR is the **TypeHandle**. It's an abstract entity which encapsulates a pointer to either a **MethodTable** (representing "ordinary" types like **System.Object** or **List** ) or a **TypeDesc** (representing byrefs, pointers, function pointers, arrays, and generic variables). It constitutes the identity of a type in that two handles are equal if and only if they represent the same type. To save space, the fact that a **TypeHandle** contains a **TypeDesc** is indicated by setting the second lowest bit of the pointer to 1 (i.e. (ptr | 2)) instead of using additional flags2. **TypeDesc** is "abstract" and has the following inheritance hierarchy.
+
+
+
+Figure 2 The TypeDesc hierarchy
+
+**TypeDesc**
+
+Abstract type descriptor. The concrete descriptor type is determined by flags.
+
+**TypeVarTypeDesc**
+
+Represents a type variable, i.e. the **T** in **List** or in **Array.Sort** (see the part about generics below). Type variables are never shared between multiple types or methods so each variable has its one and only owner.
+
+**FnPtrTypeDesc**
+
+Represents a function pointer, essentially a variable-length list of type handles referring to the return type and parameters. It's not that common to see this descriptor because function pointers are not supported by C#. However, managed C++ uses them.
+
+**ParamTypeDesc**
+
+This descriptor represents a byref and pointer types. Byrefs are the results of the **ref** and **out** C# keywords applied to method parameters3 whereas pointer types are unmanaged pointers to data used in unsafe C# and managed C++.
+
+**ArrayTypeDesc**
+
+Represents array types. It is derived from **ParamTypeDesc** because arrays are also parameterized by a single parameter (the type of their element). This is opposed to generic instantiations whose number of parameters is variable.
+
+**MethodTable**
+
+This is by far the central data structure of the runtime. It represents any type which does not fall into one of the categories above (this includes primitive types, and generic types, both "open" and "closed"). It contains everything about the type that needs to be looked up quickly, such as its parent type, implemented interfaces, and the v-table.
+
+**EEClass**
+
+**MethodTable** data are split into "hot" and "cold" structures to improve working set and cache utilization. **MethodTable** itself is meant to only store "hot" data that are needed in program steady state. **EEClass** stores "cold" data that are typically only needed by type loading, JITing or reflection. Each **MethodTable** points to one **EEClass**.
+
+Moreover, **EEClasse**s are shared by generic types. Multiple generic type **MethodTable**s can point to single **EEClass**. This sharing adds additional constrains on data that can be stored on **EEClass**.
+
+**MethodDesc**
+
+It is no surprise that this structure describes a method. It actually comes in a few flavors which have their corresponding **MethodDesc** subtypes but most of them really are out of the scope of this document. Suffice it to say that there is one subtype called **InstantiatedMethodDesc** which plays an important role for generics. For more information please see [**Method Descriptor Design**](method-descriptor.md).
+
+**FieldDesc**
+
+Analogous to **MethodDesc** , this structure describes a field. Except for certain COM interop scenarios, the EE does not care about properties and events at all because they boil down to methods and fields at the end of the day, and it's just compilers and reflection who generate and understand them in order to provide that syntactic sugar kind of experience.
+
+2 This is useful for debugging. If the value of a **TypeHandle**
+ends with 2, 6, A, or E, then it's not a **MethodTable** and the extra
+bit has to be cleared in order to successfully inspect the
+**TypeDesc**.
+
+3 Note that the difference between **ref** and **out** is just in a
+parameter attribute. As far as the type system is concerned, they are
+both the same type.
+
+## 2.1 Load Levels
+
+When the type loader is asked to load a specified type, identified for example by a typedef/typeref/typespec **token** and a **Module** , it does not do all the work atomically at once. The loading is done in phases instead. The reason for this is that the type usually depends on other types and requiring it to be fully loaded before it can be referred to by other types would result in infinite recursion and deadlocks. Consider:
+
+ classA : C>
+ { }
+
+ classB : C>
+ { }
+
+ classC
+ { }
+
+These are valid types and apparently **A** depends on **B** and **B** depends on **A**.
+
+The loader initially creates the structure(s) representing the type and initializes them with data that can be obtained without loading other types. When this "no-dependencies" work is done, the structure(s) can be referred from other places, usually by sticking pointers to them into another structures. After that the loader progresses in incremental steps and fills the structure(s) with more and more information until it finally arrives at a fully loaded type. In the above example, the base types of **A** and **B** will be approximated by something that does not include the other type, and substituted by the real thing later.
+
+The exact half-loaded state is described by the so-called load level, starting with CLASS\_LOAD\_BEGIN, ending with CLASS\_LOADED, and having a couple of intermediate levels in between. There are rich and useful comments about individual load levels in the [classloadlevel.h](https://github.com/dotnet/coreclr/blob/master/src/vm/classloadlevel.h) source file. Notice that although types can be saved in NGEN images, the representing structures cannot be simply mapped or blitted into memory and used without additional work called "restoring". The fact that a type came from an NGEN image and needs to be restored is also captured by its load level.
+
+See [Design and Implementation of Generics
+for the .NET Common Language
+Runtime][generics-design] for more detailed explanation of load levels.
+
+## 2.2 Generics
+
+In the generics-free world, everything is nice and everyone is happy because every ordinary (not represented by a **TypeDesc**) type has one **MethodTable** pointing to its associated **EEClass** which in turn points back to the **MethodTable**. All instances of the type contain a pointer to the **MethodTable** as their first field at offset 0, i.e. at the address seen as the reference value. To conserve space, **MethodDescs** representing methods declared by the type are organized in a linked list of chunks pointed to by the **EEClass**4.
+
+
+
+Figure 3 Non-generic type with non-generic methods
+
+4 Of course, when managed code runs, it does not call methods by
+looking them up in the chunks. Calling a method is a very "hot"
+operation and normally needs to access only information in the
+**MethodTable**.
+
+### 2.2.1 Terminology
+
+**Generic Parameter**
+
+A placeholder to be substituted by another type; the **T** in the declaration of **List**. Sometimes called formal type parameter. A generic parameter has a name and optional generic constraints.
+
+**Generic Argument**
+
+A type being substituted for a generic parameter; the **int** in **List**. Note that a generic parameter can also be used as an argument. Consider:
+
+ List GetList()
+ {
+ return new List();
+ }
+
+The method has one generic parameter **T** which is used as a generic argument for the generic list class.
+
+**Generic Constraint**
+
+An optional requirement placed by generic parameters on its potential generic arguments. Types that do not have the required properties may not be substituted for the generic parameter and it is enforced by the type loader. There are three kinds of generic constraints:
+
+1. Special constraints
+ - Reference type constraint - the generic argument must be a reference type (as opposed to a value type). The `class` keyword is used in C# to express this constraint.
+
+ public class A where T : class
+
+ - Value type constraint - the generic argument must be a value type different from `System.Nullable`. C# uses the `struct` keyword.
+
+ public class A where T : struct
+
+ - Default constructor constraint - the generic argument must have a public parameterless constructor. This is expressed by `new()` in C#.
+
+ public class A where T : new()
+
+2. Base type constraints - the generic argument must be derived from
+(or directly be of) the given non-interface type. It obviously makes
+sense to use only zero or one reference type as a base types
+constraint.
+
+ public class A where T : EventArgs
+
+3. Implemented interface constraints - the generic argument must
+implement (or directly be of) the given interface type. Zero or more
+interfaces can be given.
+
+ public class A where T : ICloneable, IComparable
+
+The above constraints are combined with an implicit AND, i.e. a
+generic parameter can be constrained to be derived from a given type,
+implement several interfaces, and have the default constructor. All
+generic parameters of the declaring type can be used to express the
+constraints, introducing interdependencies among the parameters. For
+example:
+
+ public class A
+ where S : T
+ where T : IList {
+ void f(V v) where V : S {}
+ }
+
+**Instantiation**
+
+The list of generic arguments that were substituted for generic
+parameters of a generic type or method. Each loaded generic type and
+method has its instantiation.
+
+**Typical Instantiation**
+
+An instantiation consisting purely of the type's or method's own type
+parameters and in the same order in which the parameters are
+declared. There exists exactly one typical instantiation for each
+generic type and method. Usually when one talks about an open generic
+type, they have the typical instantiation in mind. Example:
+
+ public class A {}
+
+The C# `typeof(A<,,>)` compiles to ldtoken A\'3 which makes the
+runtime load **A`3** instantiated at **S** , **T** , **U**.
+
+**Canonical Instantiation**
+
+An instantiation where all generic arguments are
+**System.\_\_Canon**. **System.\_\_Canon** is an internal type defined
+in **mscorlib** and its task is just to be well-known and different
+from any other type which may be used as a generic
+argument. Types/methods with canonical instantiation are used as
+representatives of all instantiations and carry information shared by
+all instantiations. Since **System.\_\_Canon** can obviously not
+satisfy any constraints that the respective generic parameter may have
+on it, constraint checking is special-cased with respect to
+**System.\_\_Canon** and ignores these violations.
+
+### 2.2.2 Sharing
+
+With the advent of generics, the number of types loaded by the runtime
+tends to be higher. Although generic types with different
+instantiations (for example **List<string>** and **List<object>**)
+are different types each with its own **MethodTable** , it turns out
+that there is a considerable amount of information that they can
+share. This sharing has a positive impact on the memory footprint and
+consequently also performance.
+
+
+
+Figure 4 Generic type with non-generic methods - shared EEClass
+
+Currently all instantiations containing reference types share the same
+**EEClass** and its **MethodDescs**. This is feasible because all
+references are of the same size - 4 or 8 bytes - and hence the layout
+of all these types is the same. The figure illustrates this for
+**List<object>** and **List<string>**. The canonical **MethodTable**
+was created automatically before the first reference type
+instantiation was loaded and contains data which is hot but not
+instantiation specific like non-virtual slots or
+**RemotableMethodInfo**. Instantiations containing only value types
+are not shared and every such instantiated type gets its own unshared
+**EEClass**.
+
+**MethodTables** representing generic types loaded so far are cached
+in a hash table owned by their loader module5. This hash table is
+consulted before a new instantiation is constructed, making sure
+that there will never be two or more **MethodTable** instances
+representing the same type.
+
+See [Design and Implementation of Generics
+for the .NET Common Language
+Runtime][generics-design] for more information about generic sharing.
+
+5 Things get a bit more complicated for types loaded from NGEN
+images.
diff --git a/build.proj b/build.proj
index e6ad3c5d8823..b1d6dfacaf2b 100644
--- a/build.proj
+++ b/build.proj
@@ -46,12 +46,14 @@
-
+
+
-
+
+
diff --git a/build.sh b/build.sh
index f8ce4aa1c83a..8d0164fec2f1 100755
--- a/build.sh
+++ b/build.sh
@@ -41,7 +41,7 @@ clean()
# Cleanup intermediates folder
if [ -d "$__IntermediatesDir" ]; then
- rm -f "$__IntermediatesDir"
+ rm -r "$__IntermediatesDir"
fi
mkdir -p "$__IntermediatesDir"
@@ -57,7 +57,8 @@ check_prereqs()
hash cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; }
# Check for clang
- hash clang 2>/dev/null || { echo >&2 "Please install clang before running this script"; exit 1; }
+ hash clang-3.5 2>/dev/null || hash clang 2>/dev/null || { echo >&2 "Please install clang before running this script"; exit 1; }
+
}
build_coreclr()
diff --git a/src/.nuget/Microsoft.DotNet.CoreCLR.Debug.Development.nuspec b/src/.nuget/Microsoft.DotNet.CoreCLR.Debug.Development.nuspec
new file mode 100644
index 000000000000..d879548cea28
--- /dev/null
+++ b/src/.nuget/Microsoft.DotNet.CoreCLR.Debug.Development.nuspec
@@ -0,0 +1,43 @@
+
+
+
+ Microsoft.DotNet.CoreCLR.Debug.Development
+ 1.0.2-prerelease
+ Microsoft DotNet CoreCLR Runtime For Component Development
+ Microsoft
+ Microsoft
+ http://go.microsoft.com/fwlink/?LinkId=329770
+ https://github.com/dotnet/coreclr
+ http://go.microsoft.com/fwlink/?LinkID=288859
+ true
+ Provides the CoreCLR runtime binaries with debug information and interface headers
+ Initial release
+ Copyright © Microsoft Corporation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/.nuget/Microsoft.DotNet.CoreCLR.Development.nuspec b/src/.nuget/Microsoft.DotNet.CoreCLR.Development.nuspec
index faf2c8e9ca9a..b8306b760b0f 100644
--- a/src/.nuget/Microsoft.DotNet.CoreCLR.Development.nuspec
+++ b/src/.nuget/Microsoft.DotNet.CoreCLR.Development.nuspec
@@ -2,7 +2,7 @@
Microsoft.DotNet.CoreCLR.Development
- 1.0.1-prerelease
+ 1.0.2-prerelease
Microsoft DotNet CoreCLR Runtime For Component Development
Microsoft
Microsoft
@@ -15,25 +15,25 @@
Copyright © Microsoft Corporation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/.nuget/Microsoft.DotNet.CoreCLR.nuspec b/src/.nuget/Microsoft.DotNet.CoreCLR.nuspec
index c58e26471df8..a41c89cd9c5e 100644
--- a/src/.nuget/Microsoft.DotNet.CoreCLR.nuspec
+++ b/src/.nuget/Microsoft.DotNet.CoreCLR.nuspec
@@ -2,7 +2,7 @@
Microsoft.DotNet.CoreCLR
- 1.0.0-prerelease
+ 1.0.2-prerelease
Microsoft DotNet CoreCLR Runtime
Microsoft
Microsoft
@@ -15,13 +15,13 @@
Copyright © Microsoft Corporation
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/debug/CMakeLists.txt b/src/debug/CMakeLists.txt
index 89e8a75564d9..15444d598693 100644
--- a/src/debug/CMakeLists.txt
+++ b/src/debug/CMakeLists.txt
@@ -2,9 +2,7 @@ add_subdirectory(daccess)
add_subdirectory(dbgutil)
add_subdirectory(ildbsymlib)
add_subdirectory(ee)
-if(NOT CLR_CMAKE_PLATFORM_DARWIN)
- add_subdirectory(di)
-endif(NOT CLR_CMAKE_PLATFORM_DARWIN)
+add_subdirectory(di)
if(WIN32)
add_subdirectory(shim)
endif(WIN32)
diff --git a/src/debug/daccess/dacdbiimplstackwalk.cpp b/src/debug/daccess/dacdbiimplstackwalk.cpp
index 1fd3202842c3..8c59ef7fffa4 100644
--- a/src/debug/daccess/dacdbiimplstackwalk.cpp
+++ b/src/debug/daccess/dacdbiimplstackwalk.cpp
@@ -1175,15 +1175,9 @@ void DacDbiInterfaceImpl::UpdateContextFromRegDisp(REGDISPLAY * pRegDisp,
{
*pContext = *pRegDisp->pContext;
}
-
-#elif defined(_WIN64) || defined(_TARGET_ARM_)
+#else
*pContext = *pRegDisp->pCurrentContext;
-
-#else // !_TARGET_X86_ && !_WIN64
- _ASSERTE(!"DDII::UpdateContextFromRegDisplay() - NYI on this platform\n");
- ThrowHR(E_NOTIMPL);
-
-#endif // !_TARGET_X86_ && !_WIN64
+#endif
}
//---------------------------------------------------------------------------------------
diff --git a/src/debug/daccess/fntableaccess.h b/src/debug/daccess/fntableaccess.h
index 674aed8fac44..16954d0b4e5d 100644
--- a/src/debug/daccess/fntableaccess.h
+++ b/src/debug/daccess/fntableaccess.h
@@ -143,10 +143,10 @@ class CheckDuplicatedStructLayouts
CHECK_OFFSET(HeapList, mapBase);
CHECK_OFFSET(HeapList, pHdrMap);
-#if defined(_WIN64) || defined(_TARGET_ARM_)
+#if !defined(_TARGET_X86_)
CHECK_OFFSET(RealCodeHeader, nUnwindInfos);
CHECK_OFFSET(RealCodeHeader, unwindInfos);
-#endif // _WIN64 || _TARGET_ARM_
+#endif // !_TARGET_X86_
#ifdef DEBUGSUPPORT_STUBS_HAVE_UNWIND_INFO
CHECK_OFFSET(StubUnwindInfoHeader, pNext);
diff --git a/src/debug/di/process.cpp b/src/debug/di/process.cpp
index 7f243a86aa09..fcf9d8ff35cd 100644
--- a/src/debug/di/process.cpp
+++ b/src/debug/di/process.cpp
@@ -9742,9 +9742,10 @@ void CordbProcess::MarshalManagedEvent(DebuggerIPCEvent * pManagedEvent)
// The event still needs to be Marshaled before being used. (see code:CordbProcess::MarshalManagedEvent)
//
//---------------------------------------------------------------------------------------
-#ifdef _TARGET_ARM_
-// This is a temporary workaround for an ARM specific C++ compiler bug.
-// It should be removed once the bug is fixed.
+#if defined(_MSC_VER) && defined(_TARGET_ARM_)
+// This is a temporary workaround for an ARM specific MS C++ compiler bug (internal LKG build 18.1).
+// Branch < if (ptrRemoteManagedEvent == NULL) > was always taken and the function always returned false.
+// TODO: It should be removed once the bug is fixed.
#pragma optimize("", off)
#endif
bool CordbProcess::CopyManagedEventFromTarget(
@@ -9793,7 +9794,7 @@ bool CordbProcess::CopyManagedEventFromTarget(
return true;
}
-#ifdef _TARGET_ARM_
+#if defined(_MSC_VER) && defined(_TARGET_ARM_)
#pragma optimize("", on)
#endif
diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp
index b97257210449..12d02a12239a 100644
--- a/src/debug/ee/debugger.cpp
+++ b/src/debug/ee/debugger.cpp
@@ -3956,12 +3956,10 @@ HRESULT Debugger::SetIP( bool fCanSetIPOnly, Thread *thread,Module *module,
DeleteInteropSafe(rgVal2);
}
-#if defined(_TARGET_X86_) || defined(_WIN64) || defined(_TARGET_ARM_)
if (pEHRT != NULL)
{
delete pEHRT;
}
-#endif // _TARGET_X86_ || _WIN64
LOG((LF_CORDB, LL_INFO1000, "D::SIP:Returning 0x%x\n", hr));
return hrAdvise;
diff --git a/src/debug/ee/debugger.h b/src/debug/ee/debugger.h
index 29585de31d1b..41ff93d16f46 100644
--- a/src/debug/ee/debugger.h
+++ b/src/debug/ee/debugger.h
@@ -3825,7 +3825,7 @@ class IPCHostSecurityAttributeHolder
// Returns true if the specified IL offset has a special meaning (eg. prolog, etc.)
bool DbgIsSpecialILOffset(DWORD offset);
-#if defined(_WIN64) || defined(_TARGET_ARM_)
+#if !defined(_TARGET_X86_)
void FixupDispatcherContext(T_DISPATCHER_CONTEXT* pDispatcherContext, T_CONTEXT* pContext, T_CONTEXT* pOriginalContext, PEXCEPTION_ROUTINE pUnwindPersonalityRoutine = NULL);
#endif
diff --git a/src/debug/ee/frameinfo.cpp b/src/debug/ee/frameinfo.cpp
index 810682d1380f..d4dc6838e49f 100644
--- a/src/debug/ee/frameinfo.cpp
+++ b/src/debug/ee/frameinfo.cpp
@@ -2128,7 +2128,7 @@ StackWalkAction DebuggerWalkStack(Thread *thread,
data.regDisplay.ControlPC = context->Eip;
data.regDisplay.PCTAddr = (TADDR)&(context->Eip);
-#elif defined(_WIN64) || defined(_TARGET_ARM_)
+#else
//
// @TODO: this should be the code for all platforms now that it uses FillRegDisplay,
// which encapsulates the platform variances. This could all be avoided if we used
@@ -2139,9 +2139,6 @@ StackWalkAction DebuggerWalkStack(Thread *thread,
FillRegDisplay(&data.regDisplay, context);
::SetSP(data.regDisplay.pCallerContext, 0);
-#else
- PORTABILITY_ASSERT("DebuggerWalkStack needs extended register information on this platform.");
-
#endif
}
diff --git a/src/inc/clrnt.h b/src/inc/clrnt.h
index e477b524dc66..ed52e04a5351 100644
--- a/src/inc/clrnt.h
+++ b/src/inc/clrnt.h
@@ -752,11 +752,7 @@ typedef VM_COUNTERS *PVM_COUNTERS;
#endif // !defined(FEATURE_PAL)
-//
-// WIN64
-//
-
-#if defined(_WIN64) || defined(_TARGET_ARM_)
+#if !defined(_TARGET_X86_)
typedef enum _FUNCTION_TABLE_TYPE {
RF_SORTED,
@@ -786,7 +782,7 @@ typedef struct _DYNAMIC_FUNCTION_TABLE {
ULONG EntryCount;
} DYNAMIC_FUNCTION_TABLE, *PDYNAMIC_FUNCTION_TABLE;
-#endif // defined(_WIN64) || defined(_TARGET_ARM_)
+#endif // !_TARGET_X86_
//
// AMD64
diff --git a/src/inc/corcompile.h b/src/inc/corcompile.h
index 2e59a5882334..693cf31edf7e 100644
--- a/src/inc/corcompile.h
+++ b/src/inc/corcompile.h
@@ -23,11 +23,11 @@
#error FEATURE_PREJIT is required for this file
#endif // FEATURE_PREJIT
-#if defined(_WIN64) || defined(_TARGET_ARM_)
+#if !defined(_TARGET_X86_)
#ifndef WIN64EXCEPTIONS
#define WIN64EXCEPTIONS
#endif
-#endif // _WIN64 || _TARGET_ARM_
+#endif // !_TARGET_X86_
#include
#include
diff --git a/src/inc/dbggcinfodecoder.h b/src/inc/dbggcinfodecoder.h
index f618ca336f33..b87f9e6a9f23 100644
--- a/src/inc/dbggcinfodecoder.h
+++ b/src/inc/dbggcinfodecoder.h
@@ -62,7 +62,7 @@ typedef void (*GCEnumCallback)(
);
-#if defined(_WIN64) || defined(_TARGET_ARM_)
+#if !defined(_TARGET_X86_)
#define USE_GC_INFO_DECODER
#endif
diff --git a/src/inc/eetwain.h b/src/inc/eetwain.h
index 1eab126734ad..b88af6fba207 100644
--- a/src/inc/eetwain.h
+++ b/src/inc/eetwain.h
@@ -32,7 +32,7 @@
#include "stackwalktypes.h"
#include "bitvector.h"
-#if defined(_WIN64) || defined(_TARGET_ARM_)
+#if !defined(_TARGET_X86_)
#define USE_GC_INFO_DECODER
#endif
diff --git a/src/inc/gcinfodecoder.h b/src/inc/gcinfodecoder.h
index 122b3396bba6..628bb355c39f 100644
--- a/src/inc/gcinfodecoder.h
+++ b/src/inc/gcinfodecoder.h
@@ -133,7 +133,7 @@ enum ICodeManagerFlags
#endif // !_strike_h
-#if defined(_WIN64) || defined(_TARGET_ARM_)
+#if !defined(_TARGET_X86_)
#define USE_GC_INFO_DECODER
#endif
diff --git a/src/inc/jithelpers.h b/src/inc/jithelpers.h
index 92e2bafdc1cd..686004499cfd 100644
--- a/src/inc/jithelpers.h
+++ b/src/inc/jithelpers.h
@@ -229,7 +229,7 @@
JITHELPER1(CORINFO_HELP_GETGENERICS_GCSTATIC_BASE, JIT_GetGenericsGCStaticBase,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF)
JITHELPER1(CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE, JIT_GetGenericsNonGCStaticBase,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF)
-#if defined(_TARGET_X86_)
+#ifdef _TARGET_X86_
DYNAMICJITHELPER1(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, NULL, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF)
DYNAMICJITHELPER1(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE, NULL, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF)
DYNAMICJITHELPER1(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR, NULL, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF)
@@ -278,16 +278,12 @@
DYNAMICJITHELPER1(CORINFO_HELP_INIT_PINVOKE_FRAME, NULL, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_INIT_PINVOKE_FRAME)
#endif
-#if defined(_WIN64) || defined(_TARGET_ARM_)
-
- JITHELPER1(CORINFO_HELP_MEMSET, JIT_MemSet, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MEMSET)
- JITHELPER1(CORINFO_HELP_MEMCPY, JIT_MemCpy, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MEMCPY)
-
-#else // _WIN64 || _TARGET_ARM_
-
+#ifdef _TARGET_X86_
JITHELPER1(CORINFO_HELP_MEMSET, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_MEMSET)
JITHELPER1(CORINFO_HELP_MEMCPY, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_MEMCPY)
-
+#else
+ JITHELPER1(CORINFO_HELP_MEMSET, JIT_MemSet, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MEMSET)
+ JITHELPER1(CORINFO_HELP_MEMCPY, JIT_MemCpy, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MEMCPY)
#endif
// Generics
diff --git a/src/inc/mdilhelpers.h b/src/inc/mdilhelpers.h
index 4318926e7d1a..a6c5cfc1edb6 100644
--- a/src/inc/mdilhelpers.h
+++ b/src/inc/mdilhelpers.h
@@ -176,12 +176,12 @@
MDILHELPER(MDIL_HELP_CHECK_PINVOKE_DOMAIN, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
#endif
-#if defined(_WIN64) || defined(_TARGET_ARM_)
- MDILHELPER(MDIL_HELP_MEMSET, CORINFO_HELP_SIG_REG_ONLY)
- MDILHELPER(MDIL_HELP_MEMCPY, CORINFO_HELP_SIG_REG_ONLY)
-#else
+#ifdef _TARGET_X86_
MDILHELPER(MDIL_HELP_MEMSET, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
MDILHELPER(MDIL_HELP_MEMCPY, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+#else
+ MDILHELPER(MDIL_HELP_MEMSET, CORINFO_HELP_SIG_REG_ONLY)
+ MDILHELPER(MDIL_HELP_MEMCPY, CORINFO_HELP_SIG_REG_ONLY)
#endif
MDILHELPER(MDIL_HELP_RUNTIMEHANDLE_METHOD, CORINFO_HELP_SIG_REG_ONLY)
diff --git a/src/inc/regdisp.h b/src/inc/regdisp.h
index 9da1abed973b..601137ddf92f 100644
--- a/src/inc/regdisp.h
+++ b/src/inc/regdisp.h
@@ -489,14 +489,12 @@ inline void CopyRegDisplay(const PREGDISPLAY pInRD, PREGDISPLAY pOutRD, T_CONTEX
if (pInRD->pEdx != NULL) {pOutCtx->Edx = *pInRD->pEdx;} else {pInRD->pEdx = NULL;}
pOutCtx->Esp = pInRD->Esp;
pOutCtx->Eip = pInRD->ControlPC;
-#elif defined(_WIN64) || defined(_TARGET_ARM_)
+#else
*pOutCtx = *(pInRD->pCurrentContext);
if (pInRD->IsCallerContextValid)
{
pOutCallerCtx = pInRD->pCallerContext;
}
-#else
- PORTABILITY_ASSERT("@NYI Platform - CopyRegDisplay (Threads.cpp)");
#endif
if (pOutRD)
@@ -575,15 +573,9 @@ inline void UpdateContextFromRegDisp(PREGDISPLAY pRegDisp, PT_CONTEXT pContext)
pContext->Edx = *pRegDisp->pEdx;
pContext->Esp = pRegDisp->Esp;
pContext->Eip = pRegDisp->ControlPC;
-
-#elif defined(_WIN64) || defined(_TARGET_ARM_)
+#else
*pContext = *pRegDisp->pCurrentContext;
-
-#else // !_TARGET_X86_ && !_WIN64 && !_TARGET_ARM_
- _ASSERTE(!"DDII::UpdateContextFromRegDisplay() - NYI on this platform\n");
- ThrowHR(E_NOTIMPL);
-
-#endif // !_TARGET_X86_ && !_WIN64 && !_TARGET_ARM_
+#endif
}
diff --git a/src/inc/switches.h b/src/inc/switches.h
index 12cd6278c00e..b298b5563b94 100644
--- a/src/inc/switches.h
+++ b/src/inc/switches.h
@@ -149,7 +149,7 @@
#endif
-#if defined(_DEBUG) && (defined(_TARGET_X86_) || defined(_WIN64) || defined(_TARGET_ARM_))
+#ifdef _DEBUG
//hurray DAC makes everything more fun - you can't have defines that control whether
//or not data members are visible which differ between DAC and non-DAC builds.
@@ -168,7 +168,7 @@
#define PROF_TEST_ONLY_FORCE_OBJECT_ALLOCATED
#endif // PROFILING_SUPPORTED
-#endif // defined(_DEBUG) && (defined(_TARGET_X86_) || defined(_WIN64))
+#endif // _DEBUG
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index b5ee386516c2..22a4cf21c974 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -1489,6 +1489,17 @@ CreateSemaphoreA(
IN LONG lMaximumCount,
IN LPCSTR lpName);
+PALIMPORT
+HANDLE
+PALAPI
+CreateSemaphoreExA(
+ IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
+ IN LONG lInitialCount,
+ IN LONG lMaximumCount,
+ IN LPCSTR lpName,
+ IN /*_Reserved_*/ DWORD dwFlags,
+ IN DWORD dwDesiredAccess);
+
PALIMPORT
HANDLE
PALAPI
diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt
index 6be874de0d84..3e4e9bbcc893 100644
--- a/src/pal/src/CMakeLists.txt
+++ b/src/pal/src/CMakeLists.txt
@@ -1,4 +1,7 @@
cmake_minimum_required(VERSION 2.8.12.2)
+
+include(configure.cmake)
+
project(CoreClrPal)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -144,16 +147,12 @@ add_library(CoreClrPal
${PLATFORM_SOURCES}
)
-target_link_libraries(CoreClrPal
- dl
- m
- unwind
-)
-
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
target_link_libraries(CoreClrPal
pthread
rt
+ dl
+ unwind
)
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
@@ -161,10 +160,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
find_library(COREFOUNDATION CoreFoundation)
find_library(CORESERVICES CoreServices)
find_library(SECURITY Security)
+ find_library(SYSTEM System)
target_link_libraries(CoreClrPal
${COREFOUNDATION}
${CORESERVICES}
${SECURITY}
+ ${SYSTEM}
)
endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
diff --git a/src/pal/src/config.h b/src/pal/src/config.h
deleted file mode 100644
index 904d85e27f94..000000000000
--- a/src/pal/src/config.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#if defined(__APPLE__)
-#include "config.h.osx"
-#else
-#include "config.h.linux"
-#endif
diff --git a/src/pal/src/config.h.in b/src/pal/src/config.h.in
index 462072b31c1f..94b4442c087c 100644
--- a/src/pal/src/config.h.in
+++ b/src/pal/src/config.h.in
@@ -1,529 +1,143 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- include/pal/config.h.in
-
- process this file with configure to create the PAL's configuration header
-
---*/
-
#ifndef _PAL_CONFIG_H_INCLUDED
#define _PAL_CONFIG_H_INCLUDED 1
-/*++
-_DEBUG : configure option --disable-debug
-
-This turns off compilation of debug-only code.
---*/
-#undef _DEBUG
-
-/*++
-_NO_DEBUG_MESSAGES_ : configure option --disable-dbgmsg
-
-This turns off compilation of TRACE, WARN, ERROR and ENTRY debug messages
---*/
-
#define _NO_DEBUG_MESSAGES_ 0
+#cmakedefine01 HAVE_IEEEFP_H
+#cmakedefine01 HAVE_ALLOCA_H
+#cmakedefine01 HAVE_SYS_VMPARAM_H
+#cmakedefine01 HAVE_MACH_VM_TYPES_H
+#cmakedefine01 HAVE_MACH_VM_PARAM_H
+#cmakedefine01 HAVE_PROCFS_H
+#cmakedefine01 HAVE_CRT_EXTERNS_H
+#cmakedefine01 HAVE_SYS_TIME_H
+#cmakedefine01 HAVE_PTHREAD_NP_H
+#cmakedefine01 HAVE_SYS_LWP_H
+
+#cmakedefine01 HAVE_KQUEUE
+#cmakedefine01 HAVE_GETPWUID_R
+#cmakedefine01 HAVE_PTHREAD_SUSPEND
+#cmakedefine01 HAVE_PTHREAD_SUSPEND_NP
+#cmakedefine01 HAVE_PTHREAD_CONTINUE
+#cmakedefine01 HAVE_PTHREAD_RESUME_NP
+#cmakedefine01 HAVE_PTHREAD_CONTINUE_NP
+#cmakedefine01 HAVE_SIGRETURN
+#cmakedefine01 HAVE__THREAD_SYS_SIGRETURN
+#cmakedefine01 HAVE_SETCONTEXT
+#cmakedefine01 HAVE_GETCONTEXT
+#cmakedefine01 HAVE_COPYSIGN
+#cmakedefine01 HAVE_FSYNC
+#cmakedefine01 HAVE_FUTIMES
+#cmakedefine01 HAVE_UTIMES
+#cmakedefine01 HAVE_SYSCTL
+#cmakedefine01 HAVE_SYSCONF
+#cmakedefine01 HAVE_LOCALTIME_R
+#cmakedefine01 HAVE_GMTIME_R
+#cmakedefine01 HAVE_TIMEGM
+#cmakedefine01 HAVE__SNWPRINTF
+#cmakedefine01 HAVE_POLL
+#cmakedefine01 HAVE_STATVFS
+#cmakedefine01 HAVE_THREAD_SELF
+#cmakedefine01 HAVE__LWP_SELF
+#cmakedefine01 HAVE_MACH_THREADS
+#cmakedefine01 HAVE_MACH_EXCEPTIONS
+#cmakedefine01 HAVE_VM_ALLOCATE
+#cmakedefine01 HAVE_VM_READ
+#cmakedefine01 HAS_SYSV_SEMAPHORES
+#cmakedefine01 HAS_PTHREAD_MUTEXES
+#cmakedefine01 HAVE_TTRACE
+
+#cmakedefine01 HAVE_STAT_TIMESPEC
+#cmakedefine01 HAVE_STAT_NSEC
+#cmakedefine01 HAVE_TM_GMTOFF
+
+#cmakedefine01 HAVE_BSD_REGS_T
+#cmakedefine01 HAVE_PT_REGS
+#cmakedefine01 HAVE_GREGSET_T
+#cmakedefine01 HAVE_SIGINFO_T
+#cmakedefine01 HAVE_UCONTEXT_T
+#cmakedefine01 HAVE_PTHREAD_RWLOCK_T
+#cmakedefine01 HAVE_PRWATCH_T
+#cmakedefine SIZEOF_OFF_T @SIZEOF_OFF_T@
+
+#cmakedefine01 HAVE_TZNAME
+#cmakedefine01 HAVE_TIMEZONE_VAR
+#cmakedefine01 HAVE_YIELD_SYSCALL
+#cmakedefine01 HAVE_INFTIM
+#cmakedefine01 HAVE_CHAR_BIT
+#cmakedefine01 USER_H_DEFINES_DEBUG
+#cmakedefine01 HAVE__SC_PHYS_PAGES
+#cmakedefine01 HAVE__SC_AVPHYS_PAGES
+
+#cmakedefine01 REALPATH_SUPPORTS_NONEXISTENT_FILES
+#cmakedefine01 SSCANF_CANNOT_HANDLE_MISSING_EXPONENT
+#cmakedefine01 SSCANF_SUPPORT_ll
+#cmakedefine01 HAVE_LARGE_SNPRINTF_SUPPORT
+#cmakedefine01 HAVE_BROKEN_FIFO_SELECT
+#cmakedefine01 HAVE_BROKEN_FIFO_KEVENT
+#cmakedefine01 HAVE_FTRUNCATE_LARGE_LENGTH_SUPPORT
+#cmakedefine01 HAS_FTRUNCATE_LENGTH_ISSUE
+#cmakedefine01 HAVE_SCHED_GET_PRIORITY
+#cmakedefine01 HAVE_WORKING_GETTIMEOFDAY
+#cmakedefine01 HAVE_WORKING_CLOCK_GETTIME
+#cmakedefine01 HAVE_CLOCK_MONOTONIC
+#cmakedefine01 STATVFS64_PROTOTYPE_BROKEN
+#cmakedefine01 HAVE_MMAP_DEV_ZERO
+#cmakedefine01 MMAP_IGNORES_HINT
+#cmakedefine01 MMAP_ANON_IGNORES_PROTECTION
+#cmakedefine01 MMAP_DOESNOT_ALLOW_REMAP
+#cmakedefine01 ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS
+#cmakedefine01 PTHREAD_CREATE_MODIFIES_ERRNO
+#cmakedefine01 SEM_INIT_MODIFIES_ERRNO
+#cmakedefine01 HAVE_PROCFS_CTL
+#cmakedefine01 HAVE_COMPATIBLE_ACOS
+#cmakedefine01 HAVE_COMPATIBLE_ASIN
+#cmakedefine01 HAVE_COMPATIBLE_POW
+#cmakedefine01 HAVE_VALID_NEGATIVE_INF_POW
+#cmakedefine01 HAVE_VALID_POSITIVE_INF_POW
+#cmakedefine01 HAVE_COMPATIBLE_ATAN2
+#cmakedefine01 HAVE_COMPATIBLE_EXP
+#cmakedefine01 HAVE_COMPATIBLE_LOG
+#cmakedefine01 HAVE_COMPATIBLE_LOG10
+#cmakedefine01 UNGETC_NOT_RETURN_EOF
+#cmakedefine01 HAS_POSIX_SEMAPHORES
+#cmakedefine01 GETPWUID_R_SETS_ERRNO
+#cmakedefine01 FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL
-/*++
-CHECK_TRACE_SPECIFIERS : configure option --enable-tracechecks
-
-Ask gcc to check the format specifiers used in trace macros. Not on by default,
-because gcc will complain about %I64d and %S
---*/
-
-#define CHECK_TRACE_SPECIFIERS 0
-
-/* Define as 1 if you have wchar.h. */
-#define HAVE_WCHAR_H 0
-
-/* Define as 1 if you have ieeefp.h. */
-#define HAVE_IEEEFP_H 0
-
-/* Define as 1 if you have alloca.h. */
-#define HAVE_ALLOCA_H 0
-
-/* Define as 1 if you have stdint.h. */
-#define HAVE_STDINT_H 0
-
-/* Define as 1 if you have netdb.h. */
-#define HAVE_NETDB_H 0
-
-/* Define as 1 if you have inttypes.h. */
-#define HAVE_INTTYPES_H 0
-
-/* Define as 1 if you have sys/vmparam.h. */
-#define HAVE_SYS_VMPARAM_H 0
-
-/* Define as 1 if you have mach/vm_types.h. */
-#define HAVE_MACH_VM_TYPES_H 0
-
-/* Define as 1 if you have mach/vm_param.h. */
-#define HAVE_MACH_VM_PARAM_H 0
-
-/* Define as 1 if you have sys/param.h. */
-#define HAVE_SYS_PARAM_H 0
-
-/* Define as 1 if you have sys/filio.h. */
-#define HAVE_SYS_FILIO_H 0
-
-/* Define as 1 if you have sys/sockio.h. */
-#define HAVE_SYS_SOCKIO_H 0
-
-/* Define as 1 if you have procfs.h. */
-#define HAVE_PROCFS_H 0
-
-/* Define as 1 if you have sys/event.h. */
-#define HAVE_KQUEUE 0
-
-// Define as 1 if you are using dylibs and need dlcompat.
-#define NEED_DLCOMPAT 0
-
-/* Define as 1 if you have crt_externs.h. */
-#define HAVE_CRT_EXTERNS_H 0
-
-// Define as 1 if you have sys/time.h.
-#define HAVE_SYS_TIME_H 0
-
-/* Define as 1 if you have pthread_np.h */
-#define HAVE_PTHREAD_NP_H 0
-
-/* Define as 1 if you have sys/lwp.h */
-#define HAVE_SYS_LWP_H 0
-
-/* Define as 1 if you have towlower. */
-#define HAVE_TOWLOWER 0
-
-/* Define as 1 if struct stat contains st_atimespec, etc. */
-#define HAVE_STAT_TIMESPEC 0
-
-/* Define as 1 if struct stat contains st_atimensec, etc. */
-#define HAVE_STAT_NSEC 0
-
-/* Define as 1 if struct sockaddr contains sa_len. */
-#define HAVE_SOCKADDR_SA_LEN 0
-
-/* Define as 1 if getpwuid_r function exists. */
-#define HAVE_GETPWUID_R 0
-
-/* Define as 1 if you have extern char *tzname. */
-#define HAVE_TZNAME 0
-
-/* Define as 1 if you have extern long int timezone. */
-#define HAVE_TIMEZONE_VAR 0
-
-/* Define as 1 if struct tm has tm_gmtoff. */
-#define HAVE_TM_GMTOFF 0
-
-// Define as 1 if the BSD struct reg is supported.
-#define HAVE_BSD_REGS_T 0
-
-// Define as 1 if ptrace's struct pt_regs is supported.
-#define HAVE_PT_REGS 0
-
-// Define as 1 if mcontext_t contains a gregset_t.
-#define HAVE_GREGSET_T 0
-
-// Define as 1 if realpath() does not require that the last path component
-// be a file.
-#define REALPATH_SUPPORTS_NONEXISTENT_FILES 0
-
-// Define as 1 if sscanf supports the "%ll" format.
-#define SSCANF_SUPPORT_ll 0
-
-// Define as 1 if sscanf has trouble parsing a float from
-// something like "12.34e" (e.g. AIX)
-#define SSCANF_CANNOT_HANDLE_MISSING_EXPONENT 0
-
-// Define as 1 if snprintf works correctly for large values of n.
-#define HAVE_LARGE_SNPRINTF_SUPPORT 0
-
-/* Define as 1 if select() on a fifo that has not had any data
- written to it returns that data is available for reading. */
-#define HAVE_BROKEN_FIFO_SELECT 0
-
-/* Define as 1 if kevent() on a fifo returns EV_ERROR. */
-#define HAVE_BROKEN_FIFO_KEVENT 0
-
-// Define as 1 if ftruncate correctly returns failure on large lengths.
-#define HAVE_FTRUNCATE_LARGE_LENGTH_SUPPORT 0
-
-// Define as 1 if ftruncate returns failure but extends the file anyway.
-#define HAS_FTRUNCATE_LENGTH_BUG 0
-
-/* Define as 1 if SYS_yield is a supported syscall. */
-#define HAVE_YIELD_SYSCALL 0
-
-// Define as 1 if pthreads are Mach threads.
-#define HAVE_MACH_THREADS 0
-
-// Define as 1 if pthreads are Solaris threads.
-#define HAVE_SOLARIS_THREADS 0
-
-// Define as 1 if pthreads has pthread_suspend
-#define HAVE_PTHREAD_SUSPEND 0
-
-// Define as 1 if pthreads has pthread_suspend_np
-#define HAVE_PTHREAD_SUSPEND_NP 0
-
-// Define as 1 if pthreads has pthread_continue
-#define HAVE_PTHREAD_CONTINUE 0
-
-// Define as 1 if pthreads has pthread_resume_np
-#define HAVE_PTHREAD_RESUME_NP 0
-
-// Define as 1 if pthreads has pthread_continue_np
-#define HAVE_PTHREAD_CONTINUE_NP 0
-
-// Define as 1 if mkstemp64 is used instead of mkstemp
-#define MKSTEMP64_IS_USED_INSTEAD_OF_MKSTEMP 0
-
-// Define as 1 if open64 is used instead of open
-#define OPEN64_IS_USED_INSTEAD_OF_OPEN 0
-
-// Define as 1 if pthread has thread_self
-#define HAVE_THREAD_SELF 0
-
-// Define as 1 if pthread has _lwp_self
-#define HAVE__LWP_SELF 0
-
-// Define as 1 if sched_get_priority_[min|max] is supported
-#define HAVE_SCHED_GET_PRIORITY 0
-
-// Define as the hardcoded min and max thread priority (for platforms where
-// sched_get_priority_[min|max] does not exist
#define PAL_THREAD_PRIORITY_MIN 0
#define PAL_THREAD_PRIORITY_MAX 0
-// Define as 1 if pthread_setschedparam requires special privileges
-#define SET_SCHEDPARAM_NEEDS_PRIVS 0
-
-/* Define as 1 if Mach exceptions are supported. */
-#define HAVE_MACH_EXCEPTIONS 0
-
-// Define as 1 if Mach's vm_read and vm_write are supported.
-#define HAVE_VM_READ 0
-
-/* Define as 1 if sigreturn is supported. */
-#define HAVE_SIGRETURN 0
-
-/* Define as 1 if _thread_sys_sigreturn is supported. */
-#define HAVE__THREAD_SYS_SIGRETURN 0
-
-// Define as 1 if setcontext is supported.
-#define HAVE_SETCONTEXT 0
-
-// Define as 1 if getcontext is supported.
-#define HAVE_GETCONTEXT 0
-
-// Define as 1 if copysign is supported.
-#define HAVE_COPYSIGN 0
-
-// Define as 1 if gethrtime (Solaris/HPUX) is supported.
-#define HAVE_GETHRTIME 0
-
-// Define as 1 if read_real_time (AIX) is supported.
-#define HAVE_READ_REAL_TIME 0
-
-// Define as 1 if fsync is supported.
-#define HAVE_FSYNC 0
-
-// Define as 1 if current platform has a working gettimeofday
-#define HAVE_WORKING_GETTIMEOFDAY 0
-
-// Define as 1 if current platform has a working clock_gettime
-#define HAVE_WORKING_CLOCK_GETTIME 0
-
-// Define as 1 if clock_gettime supports CLOCK_MONOTONIC.
-#define HAVE_CLOCK_MONOTONIC 0
-
-/* Define as 1 if futimes is supported. */
-#define HAVE_FUTIMES 0
-
-/* Define as 1 if utimes is supported. */
-#define HAVE_UTIMES 0
-
-/* Define as 1 if sysctl is supported. */
-#define HAVE_SYSCTL 0
-
-/* Define as 1 if sysconf is supported. */
-#define HAVE_SYSCONF 0
-
-/* Define as 1 if strtok_r is supported. */
-#define HAVE_STRTOK_R 0
-
-/* Define as 1 if localtime_r is supported. */
-#define HAVE_LOCALTIME_R 0
-
-/* Define as 1 if ctime_r is supported. */
-#define HAVE_CTIME_R 0
-
-/* Defined as 1 if gmtime_r is supported. */
-#define HAVE_GMTIME_R 0
-
-/* Define as 1 if timegm is supported. */
-#define HAVE_TIMEGM 0
+#cmakedefine01 HAVE_COREFOUNDATION
+#cmakedefine01 HAVE__NSGETENVIRON
+#cmakedefine01 DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX
+#cmakedefine PAL_PTRACE(cmd, pid, addr, data) @PAL_PTRACE@
+#cmakedefine PAL_PT_ATTACH @PAL_PT_ATTACH@
+#cmakedefine PAL_PT_DETACH @PAL_PT_DETACH@
+#cmakedefine PAL_PT_READ_D @PAL_PT_READ_D@
+#cmakedefine PAL_PT_WRITE_D @PAL_PT_WRITE_D@
+#cmakedefine01 USE_SIGNALS_FOR_THREAD_SUSPENSION
+#cmakedefine01 SYNCHMGR_SUSPENSION_SAFE_CONDITION_SIGNALING
+#cmakedefine01 ERROR_FUNC_FOR_GLOB_HAS_FIXED_PARAMS
+#cmakedefine01 UNWIND_CONTEXT_IS_UCONTEXT_T
+
+#cmakedefine JA_JP_LOCALE_NAME "@JA_JP_LOCALE_NAME@"
+#cmakedefine KO_KR_LOCALE_NAME "@KO_KR_LOCALE_NAME@"
+#cmakedefine ZH_TW_LOCALE_NAME "@ZH_TW_LOCALE_NAME@"
-/* Define as 1 if _snwprintf is supported. */
-#define HAVE__SNWPRINTF 0
-
-// Define as 1 if poll is supported.
-#define HAVE_POLL 0
-
-// Define as 1 if INFTIM is defined.
-#define HAVE_INFTIM 0
-
-// Define as 1 if CHAR_BIT is defined
-#define HAVE_CHAR_BIT 0
-
-/* Define as 1 if directio is supported. */
-#define HAVE_DIRECTIO 0
-
-/* Define as 1 if use of directio is disabled,
- even if HAVE_DIRECTIO is defined. */
-#define DIRECTIO_DISABLED 0
-
-/* Define as 1 if vm_allocate is supported. */
-#define HAVE_VM_ALLOCATE 0
-
-/* Define as 1 if statfs is supported. */
-#define HAVE_STATFS 0
-
-/* Define as 1 if statvfs is supported. */
-#define HAVE_STATVFS 0
-
-/* Define as 1 if statvfs64 prototype is broken. */
-#define STATVFS64_PROTOTYPE_BROKEN 0
-
-/* Define as 1 if siginfo_t is supported. */
-#define HAVE_SIGINFO_T 0
-
-/* Define as 1 if ucontext_t is supported. */
-#define HAVE_UCONTEXT_T 0
-
-/* Defined to sizeof(off_t). */
-#define SIZEOF_OFF_T 0
-
-/* Define as 1 if in_addr_t is supported. */
-#define HAVE_IN_ADDR_T 0
-
-// Define as 1 if caddr_t is supported.
-#define HAVE_CADDR_T 0
-
-/* Define as 1 if socklen_t is supported. */
-#define HAVE_SOCKLEN_T 0
-
-/* Define as 1 if sockaddr_ext is supported. */
-#define HAVE_SOCKADDR_EXT 0
-
-/* Define as 1 if pthread_rwlock_t is supported. */
-#define HAVE_PTHREAD_RWLOCK_T 0
-
-/* Define as 1 if Core Foundation is supported (Darwin/Mac OS X only). */
-#define HAVE_COREFOUNDATION 0
-
-/* Define as 1 if _NSGetEnviron is supported (Darwin/Mac OS X only). */
-#define HAVE__NSGETENVIRON 0
-
-/* Define this if debug channel output should be appended to existing files
- instead of overwriting */
-#undef _PAL_APPEND_DBG_OUTPUT_
-
-/* Define as 1 if mmap() can map a file descriptor for /dev/zero */
-#define HAVE_MMAP_DEV_ZERO 0
-
-// Define as 1 if mmap() ignores its hint parameter.
-#define MMAP_IGNORES_HINT 0
-
-// Define as 1 if mmap() ignores its protection parameter when
-// mapping anonymous pages.
-#define MMAP_ANON_IGNORES_PROTECTION 0
-
-// Define as 1 if mmap() allows remapping previously mapped pages
-#define MMAP_DOESNOT_ALLOW_REMAP 0
-
-// Define as 1 if there cannot be more than one shared mapping of a file
-// region per process at the same time
-#define ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS 0
-
-// Define as 1 if pthread_create() modifies errno when it succeeds.
-#define PTHREAD_CREATE_MODIFIES_ERRNO 0
-
-// Define as 1 if sem_init() modifies errno when it succeeds.
-#define SEM_INIT_MODIFIES_ERRNO 0
-
-// Define as 1 if prwatch_t is supported
-#define HAVE_PRWATCH_T 0
-
-// Define as 1 if /proc//ctl is supported.
-#define HAVE_PROCFS_CTL 0
-
-// Define as the name of the memory file in /proc/
+#define CHECK_TRACE_SPECIFIERS 0
#define PROCFS_MEM_NAME ""
-
-// Define as 1 if including sys/user.h will result in
-// _DEBUG being defined
-#define USER_H_DEFINES_DEBUG 0
-
-// Define as 1 if close(fd) blocks until there is any outstanding
-// syscall using fd (e.g. AIX)
-#define CLOSE_BLOCKS_ON_OUTSTANDING_SYSCALLS 0
-
-// Define as 1 if sendto returns EHOSTUNREACH when sendto'ing using a
-// "to" sockaddr which does not match the socket address family
-// (e.g. AIX)
-#define SENDTO_RETURNS_UNREACH_ON_WRONG_AF 0
-
-// Define as 1 if shutdown fails on connectionless sockets
-// (e.g. AIX)
-#define SHUTDOWN_FAILS_ON_CONNECTIONLESS_SOCKETS 0
-
-// Define as 1 if it is possible to broadcast on a socket regardless of SO_BROADCAST
-// (e.g. Solaris)
-#define BROADCAST_ALLOWED_WITHOUT_SO_BROADCAST 0
-
-// Define as 1 if SO_RCVTIMEO and SO_SNDTIMEO are not supported
-// or are ignored
-#define SO_TIMEO_NOT_SUPPORTED 0
-
-// Define as 1 if write of 0 bytes to the console hangs.
-#define WRITE_0_BYTES_HANGS_TTY 0
-
-// Define as 1 if acos is compatible with Windows.
-#define HAVE_COMPATIBLE_ACOS 0
-
-// Define as 1 if asin is compatible with Windows.
-#define HAVE_COMPATIBLE_ASIN 0
-
-// Define as 1 if pow is compatible with Windows.
-#define HAVE_COMPATIBLE_POW 0
-
-// Define as 1 if pow returns -Inf when given a negative base and a
-// large magnitude odd exponent.
-#define HAVE_VALID_NEGATIVE_INF_POW 0
-
-// Define as 1 if pow returns +Inf when given a negative base and a
-// large magnitude even exponent.
-#define HAVE_VALID_POSITIVE_INF_POW 0
-
-// Define as 1 if atan2 is compatible with Windows.
-#define HAVE_COMPATIBLE_ATAN2 0
-
-// Define as 1 if exp is compatible with Windows.
-#define HAVE_COMPATIBLE_EXP 0
-
-// Define as 1 if log is compatible with Windows.
-#define HAVE_COMPATIBLE_LOG 0
-
-// Define as 1 if log10 is compatible with Windows.
-#define HAVE_COMPATIBLE_LOG10 0
-
-// Define as 1 if ttrace is supported
-#define HAVE_TTRACE 0
-
-// Define as 1 if calling dlopen() on a library which is already
-// opened returns a different handle
-#define RETURNS_NEW_HANDLES_ON_REPEAT_DLOPEN 0
-
-// If 1, SetThreadPriority() will not actually modify the pthread priority
-// for threads which aren't critical or idle
-#define PAL_IGNORE_NORMAL_THREAD_PRIORITY 0
-
-// Define as a macro that correctly calls ptrace for the platform, e.g.:
-// #define PAL_PTRACE(cmd, pid, addr, data) ptrace((cmd), (pid), (int*)(addr), (data), 0)
-// Note that for autconfig substitution to properly occur the argument list
-// must not be present in this file -- it should only be in the appropriate
-// AC_DEFINE statement
-#define PAL_PTRACE ptrace_not_configured_for_this_platform
-
-// Define as the ptrace cmd value to attach to a process
-#define PAL_PT_ATTACH 0
-
-// Define as the ptrace cmd value to detach from a process
-#define PAL_PT_DETACH 0
-
-// Define as the ptrace cmd value to read a word from a process's data space
-#define PAL_PT_READ_D 0
-
-// Define as the ptrace cmd value to write a word to a process's data space
-#define PAL_PT_WRITE_D 0
-
-// Define as 1 if ISO locale names needs to be in lowercase
+#define HAVE_GETHRTIME 0
#define HAVE_LOWERCASE_ISO_NAME 0
-
-// Define as 1 if ISO locale names need an underscore after
-// the "ISO" in the name.
+#define HAVE_READ_REAL_TIME 0
#define HAVE_UNDERSCORE_ISO_NAME 0
-
-// Define as 1 if we have per-thread locales as defined in xlocale.h
-#define HAVE_XLOCALE 0
-
-// Define as 1 if ungetc dose not return EOF on write-only file
-#define UNGETC_NOT_RETURN_EOF 0
-
-// Define as 1 if malloc(0) returns null
#define MALLOC_ZERO_RETURNS_NULL 0
-
-// Define as 1 if error function for glob takes specific parameters
-#define ERROR_FUNC_FOR_GLOB_HAS_FIXED_PARAMS 0
-
-// Define the ja_JP locale name
-#define JA_JP_LOCALE_NAME ""
-
-// Define the ko_KR locale name
-#define KO_KR_LOCALE_NAME ""
-
-// Define the zh_TW locale name
-#define ZH_TW_LOCALE_NAME ""
-
-// Define as 1 if thread suspension uses signals
-#define USE_SIGNALS_FOR_THREAD_SUSPENSION 0
-
-// Define as 1 if platform has POSIX semaphores
-#define HAS_POSIX_SEMAPHORES 0
-
-// Define as 1 if suspending a thread while blocked on a lock can cause a hang
-#define DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 0
-
-// Define as 1 if sigwait cannot take a full sigset as a valid parameter
-#define SIGWAIT_FAILS_WHEN_PASSED_FULL_SIGSET 0
-
-// Define as 1 if a thread cannot suspend itself using the native suspension function
+#define MKSTEMP64_IS_USED_INSTEAD_OF_MKSTEMP 0
+#define NEED_DLCOMPAT 0
+#define OPEN64_IS_USED_INSTEAD_OF_OPEN 0
+#define PAL_IGNORE_NORMAL_THREAD_PRIORITY 0
#define SELF_SUSPEND_FAILS_WITH_NATIVE_SUSPENSION 0
-
-// Define as 1 if netdb.h defines MAXHOSTNAMELEN
-#define NETDB_DEFINES_MAXHOSTNAMELEN 0
-
-// Define as 1 if sys/param.h defines MAXHOSTNAMELEN
-#define SYS_PARAM_DEFINES_MAXHOSTNAMELEN 0
-
-// Define as 1 if getpwuid_r sets errno to ERANGE instead of returning ERANGE error
-#define GETPWUID_R_SETS_ERRNO 0
-
-// Define as 1 in order to use pipes as native support for thread blocking in the
-// Synchronization Manager
+#define SET_SCHEDPARAM_NEEDS_PRIVS 0
+#define SIGWAIT_FAILS_WHEN_PASSED_FULL_SIGSET 0
#define SYNCHMGR_PIPE_BASED_THREAD_BLOCKING 0
-
-// Define as 1 in order to signal conditions from a thread suspension safe area
-#define SYNCHMGR_SUSPENSION_SAFE_CONDITION_SIGNALING 1
-
-// Define as 1 if C-runtime file functions (e.g. fwrite) use the ferror()
-// value set by a previous file operation.
-#define FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL 0
-
-// Define as 1 if platform has SYSV semaphores
-#define HAS_SYSV_SEMAPHORES 0
-
-// Define as 1 if platform has pthread mutexes
-#define HAS_PTHREAD_MUTEXES 0
-
-// Define as 1 if using stack protection, but need implementation
-#define NEED_STACK_PROTECTOR_IMPL 1
-
-#endif // _PAL_CONFIG_H_INCLUDED
-
-
+#define WRITE_0_BYTES_HANGS_TTY 0
+#endif
diff --git a/src/pal/src/config.h.linux b/src/pal/src/config.h.linux
deleted file mode 100644
index 90ba8356ed45..000000000000
--- a/src/pal/src/config.h.linux
+++ /dev/null
@@ -1,531 +0,0 @@
-//
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-//
-
-/* config.h. Generated from config.h.in by configure. */
-/*++
-
-
-
-Module Name:
-
- include/pal/config.h.in
-
- process this file with configure to create the PAL's configuration header
-
---*/
-
-#ifndef _PAL_CONFIG_H_INCLUDED
-#define _PAL_CONFIG_H_INCLUDED 1
-
-/*++
-_NO_DEBUG_MESSAGES_ : configure option --disable-dbgmsg
-
-This turns off compilation of TRACE, WARN, ERROR and ENTRY debug messages
---*/
-
-#define _NO_DEBUG_MESSAGES_ 0
-
-
-/*++
-CHECK_TRACE_SPECIFIERS : configure option --enable-tracechecks
-
-Ask gcc to check the format specifiers used in trace macros. Not on by default,
-because gcc will complain about %I64d and %S
---*/
-
-#define CHECK_TRACE_SPECIFIERS 0
-
-/* Define as 1 if you have wchar.h. */
-#define HAVE_WCHAR_H 1
-
-/* Define as 1 if you have ieeefp.h. */
-#define HAVE_IEEEFP_H 0
-
-/* Define as 1 if you have alloca.h. */
-#define HAVE_ALLOCA_H 1
-
-/* Define as 1 if you have stdint.h. */
-#define HAVE_STDINT_H 1
-
-/* Define as 1 if you have netdb.h. */
-#define HAVE_NETDB_H 1
-
-/* Define as 1 if you have inttypes.h. */
-#define HAVE_INTTYPES_H 1
-
-/* Define as 1 if you have stropts.h. */
-#define HAVE_STROPTS_H 1
-
-/* Define as 1 if you have sys/vmparam.h. */
-#define HAVE_SYS_VMPARAM_H 0
-
-/* Define as 1 if you have mach/vm_types.h. */
-#define HAVE_MACH_VM_TYPES_H 0
-
-/* Define as 1 if you have mach/vm_param.h. */
-#define HAVE_MACH_VM_PARAM_H 0
-
-/* Define as 1 if you have sys/param.h. */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define as 1 if you have sys/filio.h. */
-#define HAVE_SYS_FILIO_H 0
-
-/* Define as 1 if you have sys/sockio.h. */
-#define HAVE_SYS_SOCKIO_H 0
-
-/* Define as 1 if you have procfs.h. */
-#define HAVE_PROCFS_H 0
-
-/* Define as 1 if you have sys/event.h. */
-#define HAVE_KQUEUE 0
-
-// Define as 1 if you are using dylibs and need dlcompat.
-#define NEED_DLCOMPAT 0
-
-/* Define as 1 if you have crt_externs.h. */
-#define HAVE_CRT_EXTERNS_H 0
-
-// Define as 1 if you have sys/time.h.
-#define HAVE_SYS_TIME_H 1
-
-/* Define as 1 if you have pthread_np.h */
-#define HAVE_PTHREAD_NP_H 0
-
-/* Define as 1 if you have sys/lwp.h */
-#define HAVE_SYS_LWP_H 0
-
-/* Define as 1 if you have towlower. */
-#define HAVE_TOWLOWER 0
-
-/* Define as 1 if struct stat contains st_atimespec, etc. */
-#define HAVE_STAT_TIMESPEC 0
-
-/* Define as 1 if struct stat contains st_atimensec, etc. */
-#define HAVE_STAT_NSEC 0
-
-/* Define as 1 if struct sockaddr contains sa_len. */
-#define HAVE_SOCKADDR_SA_LEN 0
-
-/* Define as 1 if getpwuid_r function exists. */
-#define HAVE_GETPWUID_R 1
-
-/* Define as 1 if you have extern char *tzname. */
-#define HAVE_TZNAME 1
-
-/* Define as 1 if you have extern long int timezone. */
-#define HAVE_TIMEZONE_VAR 0
-
-/* Define as 1 if struct tm has tm_gmtoff. */
-#define HAVE_TM_GMTOFF 1
-
-// Define as 1 if the BSD struct reg is supported.
-#define HAVE_BSD_REGS_T 0
-
-// Define as 1 if ptrace's struct pt_regs is supported.
-#define HAVE_PT_REGS 1
-
-// Define as 1 if mcontext_t contains a gregset_t.
-#define HAVE_GREGSET_T 1
-
-// Define as 1 if realpath() does not require that the last path component
-// be a file.
-#define REALPATH_SUPPORTS_NONEXISTENT_FILES 0
-
-// Define as 1 if sscanf supports the "%ll" format.
-#define SSCANF_SUPPORT_ll 0
-
-// Define as 1 if sscanf has trouble parsing a float from
-// something like "12.34e" (e.g. AIX)
-#define SSCANF_CANNOT_HANDLE_MISSING_EXPONENT 0
-
-// Define as 1 if snprintf works correctly for large values of n.
-#define HAVE_LARGE_SNPRINTF_SUPPORT 1
-
-/* Define as 1 if select() on a fifo that has not had any data
- written to it returns that data is available for reading. */
-#define HAVE_BROKEN_FIFO_SELECT 0
-
-/* Define as 1 if kevent() on a fifo returns EV_ERROR. */
-#define HAVE_BROKEN_FIFO_KEVENT 1
-
-// Define as 1 if ftruncate correctly returns failure on large lengths.
-#define HAVE_FTRUNCATE_LARGE_LENGTH_SUPPORT 0
-
-// Define as 1 if ftruncate returns failure but extends the file anyway.
-#define HAS_FTRUNCATE_LENGTH_ISSUE 0
-
-/* Define as 1 if SYS_yield is a supported syscall. */
-#define HAVE_YIELD_SYSCALL 0
-
-// Define as 1 if pthreads are Mach threads.
-#define HAVE_MACH_THREADS 0
-
-// Define as 1 if pthreads are Solaris threads.
-#define HAVE_SOLARIS_THREADS 0
-
-// Define as 1 if pthreads has pthread_suspend
-#define HAVE_PTHREAD_SUSPEND 0
-
-// Define as 1 if pthreads has pthread_suspend_np
-#define HAVE_PTHREAD_SUSPEND_NP 0
-
-// Define as 1 if pthreads has pthread_continue
-#define HAVE_PTHREAD_CONTINUE 0
-
-// Define as 1 if pthreads has pthread_resume_np
-#define HAVE_PTHREAD_RESUME_NP 0
-
-// Define as 1 if pthreads has pthread_continue_np
-#define HAVE_PTHREAD_CONTINUE_NP 0
-
-// Define as 1 if mkstemp64 is used instead of mkstemp
-#define MKSTEMP64_IS_USED_INSTEAD_OF_MKSTEMP 0
-
-// Define as 1 if open64 is used instead of open
-#define OPEN64_IS_USED_INSTEAD_OF_OPEN 0
-
-// Define as 1 if pthread has thread_self
-#define HAVE_THREAD_SELF 0
-
-// Define as 1 if pthread has _lwp_self
-#define HAVE__LWP_SELF 0
-
-// Define as 1 if sched_get_priority_[min|max] is supported
-#define HAVE_SCHED_GET_PRIORITY 1
-
-// Define as the hardcoded min and max thread priority (for platforms where
-// sched_get_priority_[min|max] does not exist
-#define PAL_THREAD_PRIORITY_MIN 0
-#define PAL_THREAD_PRIORITY_MAX 0
-
-// Define as 1 if pthread_setschedparam requires special privileges
-#define SET_SCHEDPARAM_NEEDS_PRIVS 0
-
-/* Define as 1 if Mach exceptions are supported. */
-#define HAVE_MACH_EXCEPTIONS 0
-
-// Define as 1 if Mach's vm_read and vm_write are supported.
-#define HAVE_VM_READ 0
-
-/* Define as 1 if sigreturn is supported. */
-#define HAVE_SIGRETURN 0
-
-/* Define as 1 if _thread_sys_sigreturn is supported. */
-#define HAVE__THREAD_SYS_SIGRETURN 0
-
-// Define as 1 if setcontext is supported.
-#define HAVE_SETCONTEXT 1
-
-// Define as 1 if getcontext is supported.
-#define HAVE_GETCONTEXT 1
-
-// Define as 1 if copysign is supported.
-#define HAVE_COPYSIGN 1
-
-// Define as 1 if gethrtime (Solaris/HPUX) is supported.
-#define HAVE_GETHRTIME 0
-
-// Define as 1 if read_real_time (AIX) is supported.
-#define HAVE_READ_REAL_TIME 0
-
-// Define as 1 if fsync is supported.
-#define HAVE_FSYNC 1
-
-// Define as 1 if current platform has a working gettimeofday
-#define HAVE_WORKING_GETTIMEOFDAY 1
-
-// Define as 1 if current platform has a working clock_gettime
-#define HAVE_WORKING_CLOCK_GETTIME 1
-
-// Define as 1 if clock_gettime supports CLOCK_MONOTONIC.
-#define HAVE_CLOCK_MONOTONIC 1
-
-/* Define as 1 if futimes is supported. */
-#define HAVE_FUTIMES 1
-
-/* Define as 1 if utimes is supported. */
-#define HAVE_UTIMES 1
-
-/* Define as 1 if sysctl is supported. */
-#define HAVE_SYSCTL 1
-
-/* Define as 1 if sysconf is supported. */
-#define HAVE_SYSCONF 1
-
-/* Define as 1 if strtok_r is supported. */
-#define HAVE_STRTOK_R 1
-
-/* Define as 1 if localtime_r is supported. */
-#define HAVE_LOCALTIME_R 1
-
-/* Define as 1 if ctime_r is supported. */
-#define HAVE_CTIME_R 1
-
-/* Defined as 1 if gmtime_r is supported. */
-#define HAVE_GMTIME_R 1
-
-/* Define as 1 if timegm is supported. */
-#define HAVE_TIMEGM 1
-
-/* Define as 1 if _snwprintf is supported. */
-#define HAVE__SNWPRINTF 0
-
-// Define as 1 if poll is supported.
-#define HAVE_POLL 1
-
-// Define as 1 if INFTIM is defined.
-#define HAVE_INFTIM 0
-
-// Define as 1 if CHAR_BIT is defined
-#define HAVE_CHAR_BIT 0
-
-/* Define as 1 if directio is supported. */
-#define HAVE_DIRECTIO 0
-
-/* Define as 1 if use of directio is disabled,
- even if HAVE_DIRECTIO is defined. */
-#define DIRECTIO_DISABLED 0
-
-/* Define as 1 if vm_allocate is supported. */
-#define HAVE_VM_ALLOCATE 0
-
-/* Define as 1 if statfs is supported. */
-#define HAVE_STATFS 0
-
-/* Define as 1 if statvfs is supported. */
-#define HAVE_STATVFS 1
-
-/* Define as 1 if statvfs64 prototype is broken. */
-#define STATVFS64_PROTOTYPE_BROKEN 0
-
-/* Define as 1 if siginfo_t is supported. */
-#define HAVE_SIGINFO_T 1
-
-/* Define as 1 if ucontext_t is supported. */
-#define HAVE_UCONTEXT_T 1
-
-/* Defined to sizeof(off_t). */
-#define SIZEOF_OFF_T 8
-
-/* Define as 1 if in_addr_t is supported. */
-#define HAVE_IN_ADDR_T 0
-
-// Define as 1 if caddr_t is supported.
-#define HAVE_CADDR_T 0
-
-/* Define as 1 if socklen_t is supported. */
-#define HAVE_SOCKLEN_T 1
-
-/* Define as 1 if sockaddr_ext is supported. */
-#define HAVE_SOCKADDR_EXT 0
-
-/* Define as 1 if pthread_rwlock_t is supported. */
-#define HAVE_PTHREAD_RWLOCK_T 1
-
-/* Define as 1 if Core Foundation is supported (Darwin/Mac OS X only). */
-#define HAVE_COREFOUNDATION 0
-
-/* Define as 1 if _NSGetEnviron is supported (Darwin/Mac OS X only). */
-#define HAVE__NSGETENVIRON 0
-
-/* Define this if debug channel output should be appended to existing files
- instead of overwriting */
-/* #undef _PAL_APPEND_DBG_OUTPUT_ */
-
-/* Define as 1 if mmap() can map a file descriptor for /dev/zero */
-#define HAVE_MMAP_DEV_ZERO 1
-
-// Define as 1 if mmap() ignores its hint parameter.
-#define MMAP_IGNORES_HINT 0
-
-// Define as 1 if mmap() ignores its protection parameter when
-// mapping anonymous pages.
-#define MMAP_ANON_IGNORES_PROTECTION 0
-
-// Define as 1 if mmap() allows remapping previously mapped pages
-#define MMAP_DOESNOT_ALLOW_REMAP 0
-
-// Define as 1 if there cannot be more than one shared mapping of a file
-// region per process at the same time
-#define ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS 0
-
-// Define as 1 if pthread_create() modifies errno when it succeeds.
-#define PTHREAD_CREATE_MODIFIES_ERRNO 0
-
-// Define as 1 if sem_init() modifies errno when it succeeds.
-#define SEM_INIT_MODIFIES_ERRNO 0
-
-// Define as 1 if prwatch_t is supported
-#define HAVE_PRWATCH_T 0
-
-// Define as 1 if /proc//ctl is supported.
-#define HAVE_PROCFS_CTL 0
-
-// Define as the name of the memory file in /proc/
-#define PROCFS_MEM_NAME ""
-
-// Define as 1 if including sys/user.h will result in
-// _DEBUG being defined
-#define USER_H_DEFINES_DEBUG 0
-
-// Define as 1 if close(fd) blocks until there is any outstanding
-// syscall using fd (e.g. AIX)
-#define CLOSE_BLOCKS_ON_OUTSTANDING_SYSCALLS 0
-
-// Define as 1 if sendto returns EHOSTUNREACH when sendto'ing using a
-// "to" sockaddr which does not match the socket address family
-// (e.g. AIX)
-#define SENDTO_RETURNS_UNREACH_ON_WRONG_AF 0
-
-// Define as 1 if shutdown fails on connectionless sockets
-// (e.g. AIX)
-#define SHUTDOWN_FAILS_ON_CONNECTIONLESS_SOCKETS 1
-
-// Define as 1 if it is possible to broadcast on a socket regardless of SO_BROADCAST
-// (e.g. Solaris)
-#define BROADCAST_ALLOWED_WITHOUT_SO_BROADCAST 0
-
-// Define as 1 if SO_RCVTIMEO and SO_SNDTIMEO are not supported
-// or are ignored
-#define SO_TIMEO_NOT_SUPPORTED 0
-
-// Define as 1 if write of 0 bytes to the console hangs.
-#define WRITE_0_BYTES_HANGS_TTY 0
-
-// Define as 1 if acos is compatible with Windows.
-#define HAVE_COMPATIBLE_ACOS 1
-
-// Define as 1 if asin is compatible with Windows.
-#define HAVE_COMPATIBLE_ASIN 1
-
-// Define as 1 if pow is compatible with Windows.
-#define HAVE_COMPATIBLE_POW 0
-
-// Define as 1 if pow returns -Inf when given a negative base and a
-// large magnitude odd exponent.
-#define HAVE_VALID_NEGATIVE_INF_POW 1
-
-// Define as 1 if pow returns +Inf when given a negative base and a
-// large magnitude even exponent.
-#define HAVE_VALID_POSITIVE_INF_POW 1
-
-// Define as 1 if atan2 is compatible with Windows.
-#define HAVE_COMPATIBLE_ATAN2 1
-
-// Define as 1 if exp is compatible with Windows.
-#define HAVE_COMPATIBLE_EXP 1
-
-// Define as 1 if log is compatible with Windows.
-#define HAVE_COMPATIBLE_LOG 1
-
-// Define as 1 if log10 is compatible with Windows.
-#define HAVE_COMPATIBLE_LOG10 1
-
-// Define as 1 if ttrace is supported
-#define HAVE_TTRACE 0
-
-// Define as 1 if calling dlopen() on a library which is already
-// opened returns a different handle
-#define RETURNS_NEW_HANDLES_ON_REPEAT_DLOPEN 0
-
-// If 1, SetThreadPriority() will not actually modify the pthread priority
-// for threads which aren't critical or idle
-#define PAL_IGNORE_NORMAL_THREAD_PRIORITY 0
-
-// Define as a macro that correctly calls ptrace for the platform, e.g.:
-// #define PAL_PTRACE(cmd, pid, addr, data) ptrace((cmd), (pid), (void*)(addr), (data), 0)
-// Note that for autconfig substitution to properly occur the argument list
-// must not be present in this file -- it should only be in the appropriate
-// AC_DEFINE statement
-#define PAL_PTRACE(cmd, pid, addr, data) ptrace((cmd), (pid), (void*)(addr), (data))
-
-// Define as the ptrace cmd value to attach to a process
-#define PAL_PT_ATTACH PTRACE_ATTACH
-
-// Define as the ptrace cmd value to detach from a process
-#define PAL_PT_DETACH PTRACE_DETACH
-
-// Define as the ptrace cmd value to read a word from a process's data space
-#define PAL_PT_READ_D PTRACE_PEEKDATA
-
-// Define as the ptrace cmd value to write a word to a process's data space
-#define PAL_PT_WRITE_D PTRACE_POKEDATA
-
-// Define as 1 if ISO locale names needs to be in lowercase
-#define HAVE_LOWERCASE_ISO_NAME 0
-
-// Define as 1 if ISO locale names need an underscore after
-// the "ISO" in the name.
-#define HAVE_UNDERSCORE_ISO_NAME 0
-
-// Define as 1 if we have per-thread locales as defined in xlocale.h
-#define HAVE_XLOCALE 0
-
-// Define as 1 if ungetc dose not return EOF on write-only file
-#define UNGETC_NOT_RETURN_EOF 1
-
-// Define as 1 if malloc(0) returns null
-#define MALLOC_ZERO_RETURNS_NULL 0
-
-// Define as 1 if error function for glob takes specific parameters
-#define ERROR_FUNC_FOR_GLOB_HAS_FIXED_PARAMS 1
-
-// Define the ja_JP locale name
-#define JA_JP_LOCALE_NAME "ja_JP_LOCALE_NOT_FOUND"
-
-// Define the ko_KR locale name
-#define KO_KR_LOCALE_NAME "ko_KR_LOCALE_NOT_FOUND"
-
-// Define the zh_TW locale name
-#define ZH_TW_LOCALE_NAME "zh_TW_LOCALE_NOT_FOUND"
-
-// Define as 1 if thread suspension uses signals
-#define USE_SIGNALS_FOR_THREAD_SUSPENSION 1
-
-// Define as 1 if platform has POSIX semaphores
-#define HAS_POSIX_SEMAPHORES 1
-
-// Define as 1 if suspending a thread while blocked on a lock can cause a hang
-#define DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 0
-
-// Define as 1 if sigwait cannot take a full sigset as a valid parameter
-#define SIGWAIT_FAILS_WHEN_PASSED_FULL_SIGSET 0
-
-// Define as 1 if a thread cannot suspend itself using the native suspension function
-#define SELF_SUSPEND_FAILS_WITH_NATIVE_SUSPENSION 0
-
-// Define as 1 if netdb.h defines MAXHOSTNAMELEN
-#define NETDB_DEFINES_MAXHOSTNAMELEN 0
-
-// Define as 1 if sys/param.h defines MAXHOSTNAMELEN
-#define SYS_PARAM_DEFINES_MAXHOSTNAMELEN 0
-
-// Define as 1 if getpwuid_r sets errno to ERANGE instead of returning ERANGE error
-#define GETPWUID_R_SETS_ERRNO 1
-
-// Define as 1 in order to use pipes as native support for thread blocking in the
-// Synchronization Manager
-#define SYNCHMGR_PIPE_BASED_THREAD_BLOCKING 0
-
-// Define as 1 in order to signal conditions from a thread suspension safe area
-#define SYNCHMGR_SUSPENSION_SAFE_CONDITION_SIGNALING 1
-
-// Define as 1 if C-runtime file functions (e.g. fwrite) use the ferror()
-// value set by a previous file operation.
-#define FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL 0
-
-// Define as 1 if platform has SYSV semaphores
-#define HAS_SYSV_SEMAPHORES 1
-
-// Define as 1 if platform has pthread mutexes
-#define HAS_PTHREAD_MUTEXES 1
-
-// Define as 1 if using stack protection, but need implementation
-#define NEED_STACK_PROTECTOR_IMPL 0
-
-#endif // _PAL_CONFIG_H_INCLUDED
-
-
diff --git a/src/pal/src/config.h.osx b/src/pal/src/config.h.osx
deleted file mode 100644
index 3ee1a700483f..000000000000
--- a/src/pal/src/config.h.osx
+++ /dev/null
@@ -1,526 +0,0 @@
-/* config.h. Generated from config.h.in by configure. */
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- include/pal/config.h.in
-
- process this file with configure to create the PAL's configuration header
-
---*/
-
-#ifndef _PAL_CONFIG_H_INCLUDED
-#define _PAL_CONFIG_H_INCLUDED 1
-
-/*++
-_NO_DEBUG_MESSAGES_ : configure option --disable-dbgmsg
-
-This turns off compilation of TRACE, WARN, ERROR and ENTRY debug messages
---*/
-
-#define _NO_DEBUG_MESSAGES_ 0
-
-
-/*++
-CHECK_TRACE_SPECIFIERS : configure option --enable-tracechecks
-
-Ask gcc to check the format specifiers used in trace macros. Not on by default,
-because gcc will complain about %I64d and %S
---*/
-
-#define CHECK_TRACE_SPECIFIERS 0
-
-/* Define as 1 if you have wchar.h. */
-#define HAVE_WCHAR_H 1
-
-/* Define as 1 if you have ieeefp.h. */
-#define HAVE_IEEEFP_H 0
-
-/* Define as 1 if you have alloca.h. */
-#define HAVE_ALLOCA_H 1
-
-/* Define as 1 if you have stdint.h. */
-#define HAVE_STDINT_H 1
-
-/* Define as 1 if you have netdb.h. */
-#define HAVE_NETDB_H 1
-
-/* Define as 1 if you have inttypes.h. */
-#define HAVE_INTTYPES_H 1
-
-/* Define as 1 if you have stropts.h. */
-#define HAVE_STROPTS_H 0
-
-/* Define as 1 if you have sys/vmparam.h. */
-#define HAVE_SYS_VMPARAM_H 1
-
-/* Define as 1 if you have mach/vm_types.h. */
-#define HAVE_MACH_VM_TYPES_H 1
-
-/* Define as 1 if you have mach/vm_param.h. */
-#define HAVE_MACH_VM_PARAM_H 1
-
-/* Define as 1 if you have sys/param.h. */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define as 1 if you have sys/filio.h. */
-#define HAVE_SYS_FILIO_H 1
-
-/* Define as 1 if you have sys/sockio.h. */
-#define HAVE_SYS_SOCKIO_H 1
-
-/* Define as 1 if you have procfs.h. */
-#define HAVE_PROCFS_H 0
-
-/* Define as 1 if you have sys/event.h. */
-#define HAVE_KQUEUE 1
-
-// Define as 1 if you are using dylibs and need dlcompat.
-#define NEED_DLCOMPAT 0
-
-/* Define as 1 if you have crt_externs.h. */
-#define HAVE_CRT_EXTERNS_H 1
-
-// Define as 1 if you have sys/time.h.
-#define HAVE_SYS_TIME_H 1
-
-/* Define as 1 if you have pthread_np.h */
-#define HAVE_PTHREAD_NP_H 0
-
-/* Define as 1 if you have sys/lwp.h */
-#define HAVE_SYS_LWP_H 0
-
-/* Define as 1 if you have towlower. */
-#define HAVE_TOWLOWER 0
-
-/* Define as 1 if struct stat contains st_atimespec, etc. */
-#define HAVE_STAT_TIMESPEC 1
-
-/* Define as 1 if struct stat contains st_atimensec, etc. */
-#define HAVE_STAT_NSEC 0
-
-/* Define as 1 if struct sockaddr contains sa_len. */
-#define HAVE_SOCKADDR_SA_LEN 1
-
-/* Define as 1 if getpwuid_r function exists. */
-#define HAVE_GETPWUID_R 1
-
-/* Define as 1 if you have extern char *tzname. */
-#define HAVE_TZNAME 1
-
-/* Define as 1 if you have extern long int timezone. */
-#define HAVE_TIMEZONE_VAR 0
-
-/* Define as 1 if struct tm has tm_gmtoff. */
-#define HAVE_TM_GMTOFF 1
-
-// Define as 1 if the BSD struct reg is supported.
-#define HAVE_BSD_REGS_T 0
-
-// Define as 1 if ptrace's struct pt_regs is supported.
-#define HAVE_PT_REGS 0
-
-// Define as 1 if mcontext_t contains a gregset_t.
-#define HAVE_GREGSET_T 0
-
-// Define as 1 if realpath() does not require that the last path component
-// be a file.
-#define REALPATH_SUPPORTS_NONEXISTENT_FILES 0
-
-// Define as 1 if sscanf supports the "%ll" format.
-#define SSCANF_SUPPORT_ll 0
-
-// Define as 1 if sscanf has trouble parsing a float from
-// something like "12.34e" (e.g. AIX)
-#define SSCANF_CANNOT_HANDLE_MISSING_EXPONENT 0
-
-// Define as 1 if snprintf works correctly for large values of n.
-#define HAVE_LARGE_SNPRINTF_SUPPORT 0
-
-/* Define as 1 if select() on a fifo that has not had any data
- written to it returns that data is available for reading. */
-#define HAVE_BROKEN_FIFO_SELECT 0
-
-/* Define as 1 if kevent() on a fifo returns EV_ERROR. */
-#define HAVE_BROKEN_FIFO_KEVENT 0
-
-// Define as 1 if ftruncate correctly returns failure on large lengths.
-#define HAVE_FTRUNCATE_LARGE_LENGTH_SUPPORT 1
-
-// Define as 1 if ftruncate returns failure but extends the file anyway.
-#define HAS_FTRUNCATE_LENGTH_BUG 1
-
-/* Define as 1 if SYS_yield is a supported syscall. */
-#define HAVE_YIELD_SYSCALL 0
-
-// Define as 1 if pthreads are Mach threads.
-#define HAVE_MACH_THREADS 1
-
-// Define as 1 if pthreads are Solaris threads.
-#define HAVE_SOLARIS_THREADS 0
-
-// Define as 1 if pthreads has pthread_suspend
-#define HAVE_PTHREAD_SUSPEND 0
-
-// Define as 1 if pthreads has pthread_suspend_np
-#define HAVE_PTHREAD_SUSPEND_NP 0
-
-// Define as 1 if pthreads has pthread_continue
-#define HAVE_PTHREAD_CONTINUE 0
-
-// Define as 1 if pthreads has pthread_resume_np
-#define HAVE_PTHREAD_RESUME_NP 0
-
-// Define as 1 if pthreads has pthread_continue_np
-#define HAVE_PTHREAD_CONTINUE_NP 0
-
-// Define as 1 if mkstemp64 is used instead of mkstemp
-#define MKSTEMP64_IS_USED_INSTEAD_OF_MKSTEMP 0
-
-// Define as 1 if open64 is used instead of open
-#define OPEN64_IS_USED_INSTEAD_OF_OPEN 0
-
-// Define as 1 if pthread has thread_self
-#define HAVE_THREAD_SELF 0
-
-// Define as 1 if pthread has _lwp_self
-#define HAVE__LWP_SELF 0
-
-// Define as 1 if sched_get_priority_[min|max] is supported
-#define HAVE_SCHED_GET_PRIORITY 1
-
-// Define as the hardcoded min and max thread priority (for platforms where
-// sched_get_priority_[min|max] does not exist
-#define PAL_THREAD_PRIORITY_MIN 0
-#define PAL_THREAD_PRIORITY_MAX 0
-
-// Define as 1 if pthread_setschedparam requires special privileges
-#define SET_SCHEDPARAM_NEEDS_PRIVS 0
-
-/* Define as 1 if Mach exceptions are supported. */
-#define HAVE_MACH_EXCEPTIONS 1
-
-// Define as 1 if Mach's vm_read and vm_write are supported.
-#define HAVE_VM_READ 1
-
-/* Define as 1 if sigreturn is supported. */
-#define HAVE_SIGRETURN 0
-
-/* Define as 1 if _thread_sys_sigreturn is supported. */
-#define HAVE__THREAD_SYS_SIGRETURN 0
-
-// Define as 1 if setcontext is supported.
-#define HAVE_SETCONTEXT 1
-
-// Define as 1 if getcontext is supported.
-#define HAVE_GETCONTEXT 1
-
-// Define as 1 if copysign is supported.
-#define HAVE_COPYSIGN 1
-
-// Define as 1 if gethrtime (Solaris/HPUX) is supported.
-#define HAVE_GETHRTIME 0
-
-// Define as 1 if read_real_time (AIX) is supported.
-#define HAVE_READ_REAL_TIME 0
-
-// Define as 1 if fsync is supported.
-#define HAVE_FSYNC 1
-
-// Define as 1 if current platform has a working gettimeofday
-#define HAVE_WORKING_GETTIMEOFDAY 1
-
-// Define as 1 if current platform has a working clock_gettime
-#define HAVE_WORKING_CLOCK_GETTIME 0
-
-// Define as 1 if clock_gettime supports CLOCK_MONOTONIC.
-#define HAVE_CLOCK_MONOTONIC 0
-
-/* Define as 1 if futimes is supported. */
-#define HAVE_FUTIMES 1
-
-/* Define as 1 if utimes is supported. */
-#define HAVE_UTIMES 1
-
-/* Define as 1 if sysctl is supported. */
-#define HAVE_SYSCTL 1
-
-/* Define as 1 if sysconf is supported. */
-#define HAVE_SYSCONF 0
-
-/* Define as 1 if strtok_r is supported. */
-#define HAVE_STRTOK_R 1
-
-/* Define as 1 if localtime_r is supported. */
-#define HAVE_LOCALTIME_R 1
-
-/* Define as 1 if ctime_r is supported. */
-#define HAVE_CTIME_R 1
-
-/* Defined as 1 if gmtime_r is supported. */
-#define HAVE_GMTIME_R 1
-
-/* Define as 1 if timegm is supported. */
-#define HAVE_TIMEGM 1
-
-/* Define as 1 if _snwprintf is supported. */
-#define HAVE__SNWPRINTF 0
-
-// Define as 1 if poll is supported.
-#define HAVE_POLL 1
-
-// Define as 1 if INFTIM is defined.
-#define HAVE_INFTIM 0
-
-// Define as 1 if CHAR_BIT is defined
-#define HAVE_CHAR_BIT 0
-
-/* Define as 1 if directio is supported. */
-#define HAVE_DIRECTIO 0
-
-/* Define as 1 if use of directio is disabled,
- even if HAVE_DIRECTIO is defined. */
-#define DIRECTIO_DISABLED 0
-
-/* Define as 1 if vm_allocate is supported. */
-#define HAVE_VM_ALLOCATE 1
-
-/* Define as 1 if statfs is supported. */
-#define HAVE_STATFS 0
-
-/* Define as 1 if statvfs is supported. */
-#define HAVE_STATVFS 1
-
-/* Define as 1 if statvfs64 prototype is broken. */
-#define STATVFS64_PROTOTYPE_BROKEN 0
-
-/* Define as 1 if siginfo_t is supported. */
-#define HAVE_SIGINFO_T 1
-
-/* Define as 1 if ucontext_t is supported. */
-#define HAVE_UCONTEXT_T 0
-
-/* Defined to sizeof(off_t). */
-#define SIZEOF_OFF_T 8
-
-/* Define as 1 if in_addr_t is supported. */
-#define HAVE_IN_ADDR_T 1
-
-// Define as 1 if caddr_t is supported.
-#define HAVE_CADDR_T 0
-
-/* Define as 1 if socklen_t is supported. */
-#define HAVE_SOCKLEN_T 1
-
-/* Define as 1 if sockaddr_ext is supported. */
-#define HAVE_SOCKADDR_EXT 0
-
-/* Define as 1 if pthread_rwlock_t is supported. */
-#define HAVE_PTHREAD_RWLOCK_T 1
-
-/* Define as 1 if Core Foundation is supported (Darwin/Mac OS X only). */
-#define HAVE_COREFOUNDATION 1
-
-/* Define as 1 if _NSGetEnviron is supported (Darwin/Mac OS X only). */
-#define HAVE__NSGETENVIRON 1
-
-/* Define this if debug channel output should be appended to existing files
- instead of overwriting */
-/* #undef _PAL_APPEND_DBG_OUTPUT_ */
-
-/* Define as 1 if mmap() can map a file descriptor for /dev/zero */
-#define HAVE_MMAP_DEV_ZERO 0
-
-// Define as 1 if mmap() ignores its hint parameter.
-#define MMAP_IGNORES_HINT 0
-
-// Define as 1 if mmap() ignores its protection parameter when
-// mapping anonymous pages.
-#define MMAP_ANON_IGNORES_PROTECTION 0
-
-// Define as 1 if mmap() allows remapping previously mapped pages
-#define MMAP_DOESNOT_ALLOW_REMAP 0
-
-// Define as 1 if there cannot be more than one shared mapping of a file
-// region per process at the same time
-#define ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS 0
-
-// Define as 1 if pthread_create() modifies errno when it succeeds.
-#define PTHREAD_CREATE_MODIFIES_ERRNO 0
-
-// Define as 1 if sem_init() modifies errno when it succeeds.
-#define SEM_INIT_MODIFIES_ERRNO 0
-
-// Define as 1 if prwatch_t is supported
-#define HAVE_PRWATCH_T 0
-
-// Define as 1 if /proc//ctl is supported.
-#define HAVE_PROCFS_CTL 0
-
-// Define as the name of the memory file in /proc/
-#define PROCFS_MEM_NAME ""
-
-// Define as 1 if including sys/user.h will result in
-// _DEBUG being defined
-#define USER_H_DEFINES_DEBUG 0
-
-// Define as 1 if close(fd) blocks until there is any outstanding
-// syscall using fd (e.g. AIX)
-#define CLOSE_BLOCKS_ON_OUTSTANDING_SYSCALLS 0
-
-// Define as 1 if sendto returns EHOSTUNREACH when sendto'ing using a
-// "to" sockaddr which does not match the socket address family
-// (e.g. AIX)
-#define SENDTO_RETURNS_UNREACH_ON_WRONG_AF 0
-
-// Define as 1 if shutdown fails on connectionless sockets
-// (e.g. AIX)
-#define SHUTDOWN_FAILS_ON_CONNECTIONLESS_SOCKETS 1
-
-// Define as 1 if it is possible to broadcast on a socket regardless of SO_BROADCAST
-// (e.g. Solaris)
-#define BROADCAST_ALLOWED_WITHOUT_SO_BROADCAST 0
-
-// Define as 1 if SO_RCVTIMEO and SO_SNDTIMEO are not supported
-// or are ignored
-#define SO_TIMEO_NOT_SUPPORTED 0
-
-// Define as 1 if write of 0 bytes to the console hangs.
-#define WRITE_0_BYTES_HANGS_TTY 0
-
-// Define as 1 if acos is compatible with Windows.
-#define HAVE_COMPATIBLE_ACOS 1
-
-// Define as 1 if asin is compatible with Windows.
-#define HAVE_COMPATIBLE_ASIN 1
-
-// Define as 1 if pow is compatible with Windows.
-#define HAVE_COMPATIBLE_POW 0
-
-// Define as 1 if pow returns -Inf when given a negative base and a
-// large magnitude odd exponent.
-#define HAVE_VALID_NEGATIVE_INF_POW 1
-
-// Define as 1 if pow returns +Inf when given a negative base and a
-// large magnitude even exponent.
-#define HAVE_VALID_POSITIVE_INF_POW 1
-
-// Define as 1 if atan2 is compatible with Windows.
-#define HAVE_COMPATIBLE_ATAN2 1
-
-// Define as 1 if exp is compatible with Windows.
-#define HAVE_COMPATIBLE_EXP 1
-
-// Define as 1 if log is compatible with Windows.
-#define HAVE_COMPATIBLE_LOG 1
-
-// Define as 1 if log10 is compatible with Windows.
-#define HAVE_COMPATIBLE_LOG10 1
-
-// Define as 1 if ttrace is supported
-#define HAVE_TTRACE 0
-
-// Define as 1 if calling dlopen() on a library which is already
-// opened returns a different handle
-#define RETURNS_NEW_HANDLES_ON_REPEAT_DLOPEN 0
-
-// If 1, SetThreadPriority() will not actually modify the pthread priority
-// for threads which aren't critical or idle
-#define PAL_IGNORE_NORMAL_THREAD_PRIORITY 0
-
-// Define as a macro that correctly calls ptrace for the platform, e.g.:
-// #define PAL_PTRACE(cmd, pid, addr, data) ptrace((cmd), (pid), (int*)(addr), (data), 0)
-// Note that for autconfig substitution to properly occur the argument list
-// must not be present in this file -- it should only be in the appropriate
-// AC_DEFINE statement
-#define PAL_PTRACE(cmd, pid, addr, data) ptrace((cmd), (pid), (caddr_t)(addr), (data))
-
-// Define as the ptrace cmd value to attach to a process
-#define PAL_PT_ATTACH PT_ATTACH
-
-// Define as the ptrace cmd value to detach from a process
-#define PAL_PT_DETACH PT_DETACH
-
-// Define as the ptrace cmd value to read a word from a process's data space
-#define PAL_PT_READ_D PT_READ_D
-
-// Define as the ptrace cmd value to write a word to a process's data space
-#define PAL_PT_WRITE_D PT_WRITE_D
-
-// Define as 1 if ISO locale names needs to be in lowercase
-#define HAVE_LOWERCASE_ISO_NAME 0
-
-// Define as 1 if ISO locale names need an underscore after
-// the "ISO" in the name.
-#define HAVE_UNDERSCORE_ISO_NAME 0
-
-// Define as 1 if we have per-thread locales as defined in xlocale.h
-#define HAVE_XLOCALE 1
-
-// Define as 1 if ungetc dose not return EOF on write-only file
-#define UNGETC_NOT_RETURN_EOF 0
-
-// Define as 1 if malloc(0) returns null
-#define MALLOC_ZERO_RETURNS_NULL 0
-
-// Define as 1 if error function for glob takes specific parameters
-#define ERROR_FUNC_FOR_GLOB_HAS_FIXED_PARAMS 1
-
-// Define the ja_JP locale name
-#define JA_JP_LOCALE_NAME "ja_JP.SJIS"
-
-// Define the ko_KR locale name
-#define KO_KR_LOCALE_NAME "ko_KR.eucKR"
-
-// Define the zh_TW locale name
-#define ZH_TW_LOCALE_NAME "zh_TW.BIG5"
-
-// Define as 1 if thread suspension uses signals
-#define USE_SIGNALS_FOR_THREAD_SUSPENSION 0
-
-// Define as 1 if platform has POSIX semaphores
-#define HAS_POSIX_SEMAPHORES 0
-
-// Define as 1 if suspending a thread while blocked on a lock can cause a hang
-#define DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 1
-
-// Define as 1 if sigwait cannot take a full sigset as a valid parameter
-#define SIGWAIT_FAILS_WHEN_PASSED_FULL_SIGSET 0
-
-// Define as 1 if a thread cannot suspend itself using the native suspension function
-#define SELF_SUSPEND_FAILS_WITH_NATIVE_SUSPENSION 0
-
-// Define as 1 if netdb.h defines MAXHOSTNAMELEN
-#define NETDB_DEFINES_MAXHOSTNAMELEN 0
-
-// Define as 1 if sys/param.h defines MAXHOSTNAMELEN
-#define SYS_PARAM_DEFINES_MAXHOSTNAMELEN 0
-
-// Define as 1 if getpwuid_r sets errno to ERANGE instead of returning ERANGE error
-#define GETPWUID_R_SETS_ERRNO 0
-
-// Define as 1 in order to use pipes as native support for thread blocking in the
-// Synchronization Manager
-#define SYNCHMGR_PIPE_BASED_THREAD_BLOCKING 0
-
-// Define as 1 in order to signal conditions from a thread suspension safe area
-#define SYNCHMGR_SUSPENSION_SAFE_CONDITION_SIGNALING 1
-
-// Define as 1 if C-runtime file functions (e.g. fwrite) use the ferror()
-// value set by a previous file operation.
-#define FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL 0
-
-// Define as 1 if platform has SYSV semaphores
-#define HAS_SYSV_SEMAPHORES 1
-
-// Define as 1 if platform has pthread mutexes
-#define HAS_PTHREAD_MUTEXES 1
-
-// Define as 1 if using stack protection, but need implementation
-#define NEED_STACK_PROTECTOR_IMPL 1
-
-#endif // _PAL_CONFIG_H_INCLUDED
-
-
diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake
new file mode 100644
index 000000000000..c0687eae32dc
--- /dev/null
+++ b/src/pal/src/configure.cmake
@@ -0,0 +1,929 @@
+include(CheckCXXSourceCompiles)
+include(CheckCXXSourceRuns)
+include(CheckCXXSymbolExists)
+include(CheckFunctionExists)
+include(CheckIncludeFiles)
+include(CheckStructHasMember)
+include(CheckTypeSize)
+
+check_include_files(ieeefp.h HAVE_IEEEFP_H)
+check_include_files(alloca.h HAVE_ALLOCA_H)
+check_include_files(sys/vmparam.h HAVE_SYS_VMPARAM_H)
+check_include_files(mach/vm_types.h HAVE_MACH_VM_TYPES_H)
+check_include_files(mach/vm_param.h HAVE_MACH_VM_PARAM_H)
+check_include_files(procfs.h HAVE_PROCFS_H)
+check_include_files(crt_externs.h HAVE_CRT_EXTERNS_H)
+check_include_files(sys/time.h HAVE_SYS_TIME_H)
+check_include_files(pthread_np.h HAVE_PTHREAD_NP_H)
+check_include_files(sys/lwp.h HAVE_SYS_LWP_H)
+
+check_function_exists(kqueue HAVE_KQUEUE)
+check_function_exists(getpwuid_r HAVE_GETPWUID_R)
+check_function_exists(pthread_suspend HAVE_PTHREAD_SUSPEND)
+check_function_exists(pthread_suspend_np HAVE_PTHREAD_SUSPEND_NP)
+check_function_exists(pthread_continue HAVE_PTHREAD_CONTINUE)
+check_function_exists(pthread_resume_np HAVE_PTHREAD_RESUME_NP)
+check_function_exists(pthread_continue_np HAVE_PTHREAD_CONTINUE_NP)
+check_function_exists(sigreturn HAVE_SIGRETURN)
+check_function_exists(_thread_sys_sigreturn HAVE__THREAD_SYS_SIGRETURN)
+check_function_exists(setcontext HAVE_SETCONTEXT)
+check_function_exists(getcontext HAVE_GETCONTEXT)
+check_function_exists(copysign HAVE_COPYSIGN)
+check_function_exists(fsync HAVE_FSYNC)
+check_function_exists(futimes HAVE_FUTIMES)
+check_function_exists(utimes HAVE_UTIMES)
+check_function_exists(sysctl HAVE_SYSCTL)
+check_function_exists(sysconf HAVE_SYSCONF)
+check_function_exists(localtime_r HAVE_LOCALTIME_R)
+check_function_exists(gmtime_r HAVE_GMTIME_R)
+check_function_exists(timegm HAVE_TIMEGM)
+check_function_exists(_snwprintf HAVE__SNWPRINTF)
+check_function_exists(poll HAVE_POLL)
+check_function_exists(statvfs HAVE_STATVFS)
+check_function_exists(thread_self HAVE_THREAD_SELF)
+check_function_exists(_lwp_self HAVE__LWP_SELF)
+check_function_exists(pthread_mach_thread_np HAVE_MACH_THREADS)
+check_function_exists(thread_set_exception_ports HAVE_MACH_EXCEPTIONS)
+check_function_exists(vm_allocate HAVE_VM_ALLOCATE)
+check_function_exists(vm_read HAVE_VM_READ)
+check_function_exists(directio HAVE_DIRECTIO)
+check_function_exists(semget HAS_SYSV_SEMAPHORES)
+check_function_exists(pthread_mutex_init HAS_PTHREAD_MUTEXES)
+check_function_exists(ttrace HAVE_TTRACE)
+
+set(CMAKE_REQUIRED_DEFINITIONS "-D_DEFAULT_SOURCE")
+check_struct_has_member ("struct stat" st_atimespec "sys/types.h;sys/stat.h" HAVE_STAT_TIMESPEC)
+check_struct_has_member ("struct stat" st_atimensec "sys/types.h;sys/stat.h" HAVE_STAT_NSEC)
+check_struct_has_member ("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
+check_struct_has_member ("ucontext_t" uc_mcontext.gregs[0] ucontext.h HAVE_GREGSET_T)
+
+set(CMAKE_EXTRA_INCLUDE_FILES machine/reg.h)
+check_type_size("struct regs" BSD_REGS_T)
+set(CMAKE_EXTRA_INCLUDE_FILES)
+set(CMAKE_EXTRA_INCLUDE_FILES asm/ptrace.h)
+check_type_size("struct pt_regs" PT_REGS)
+set(CMAKE_EXTRA_INCLUDE_FILES)
+set(CMAKE_EXTRA_INCLUDE_FILES signal.h)
+check_type_size(siginfo_t SIGINFO_T)
+set(CMAKE_EXTRA_INCLUDE_FILES)
+set(CMAKE_EXTRA_INCLUDE_FILES ucontext.h)
+check_type_size(ucontext_t UCONTEXT_T)
+set(CMAKE_EXTRA_INCLUDE_FILES)
+set(CMAKE_EXTRA_INCLUDE_FILES pthread.h)
+check_type_size(pthread_rwlock_t PTHREAD_RWLOCK_T)
+set(CMAKE_EXTRA_INCLUDE_FILES)
+set(CMAKE_EXTRA_INCLUDE_FILE procfs.h)
+check_type_size(prwatch_t PRWATCH_T)
+set(CMAKE_EXTRA_INCLUDE_FILE)
+check_type_size(off_t SIZEOF_OFF_T)
+set(CMAKE_REQUIRED_DEFINITIONS)
+
+check_cxx_symbol_exists(tzname "time.h" HAVE_TZNAME)
+check_cxx_symbol_exists(timezone "time.h" HAVE_TIMEZONE_VAR)
+check_cxx_symbol_exists(SYS_yield sys/syscall.h HAVE_YIELD_SYSCALL)
+check_cxx_symbol_exists(INFTIM poll.h HAVE_INFTIM)
+check_cxx_symbol_exists(CHAR_BIT sys/limits.h HAVE_CHAR_BIT)
+check_cxx_symbol_exists(_DEBUG sys/user.h USER_H_DEFINES_DEBUG)
+check_cxx_symbol_exists(_SC_PHYS_PAGES unistd.h HAVE__SC_PHYS_PAGES)
+check_cxx_symbol_exists(_SC_AVPHYS_PAGES unistd.h HAVE__SC_AVPHYS_PAGES)
+
+check_cxx_source_runs("
+#include
+#include
+
+int main(void) {
+ char *path;
+#ifdef PATH_MAX
+ char resolvedPath[PATH_MAX];
+#elif defined(MAXPATHLEN)
+ char resolvedPath[MAXPATHLEN];
+#else
+ char resolvedPath[1024];
+#endif
+ path = realpath(\"a_nonexistent_file\", resolvedPath);
+ if (path == NULL) {
+ exit(1);
+ }
+ exit(0);
+}" REALPATH_SUPPORTS_NONEXISTENT_FILES)
+check_cxx_source_runs("
+#include
+#include
+int main(void)
+{
+ long long n = 0;
+ sscanf(\"5000000000\", \"%qu\", &n);
+ exit (n != 5000000000);
+ }" SSCANF_SUPPORT_ll)
+check_cxx_source_runs("
+#include
+#include
+
+int main()
+{
+ int ret;
+ float f = 0;
+ char * strin = \"12.34e\";
+
+ ret = sscanf (strin, \"%e\", &f);
+ if (ret <= 0)
+ exit (0);
+ exit(1);
+}" SSCANF_CANNOT_HANDLE_MISSING_EXPONENT)
+check_cxx_source_runs("
+#include
+#include
+
+int main(void) {
+ char buf[256] = { 0 };
+ snprintf(buf, 0x7fffffff, \"%#x\", 0x12345678);
+ if (buf[0] == 0x0) {
+ exit(1);
+ }
+ exit(0);
+}" HAVE_LARGE_SNPRINTF_SUPPORT)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main(void) {
+ int fd, numFDs;
+ fd_set readFDs, writeFDs, exceptFDs;
+ struct timeval time = { 0 };
+ char * filename = NULL;
+
+ filename = (char *)malloc(L_tmpnam * sizeof(char)); /* ok to leak this at exit */
+ if (NULL == filename) {
+ exit(0);
+ }
+
+ /* On some platforms (e.g. HP-UX) the multithreading c-runtime does not
+ support the tmpnam(NULL) semantics, and it returns NULL. Therefore
+ we need to use the tmpnam(pbuffer) version.
+ */
+ if (NULL == tmpnam(filename)) {
+ exit(0);
+ }
+ if (mkfifo(filename, S_IRWXU) != 0) {
+ if (unlink(filename) != 0) {
+ exit(0);
+ }
+ if (mkfifo(filename, S_IRWXU) != 0) {
+ exit(0);
+ }
+ }
+ fd = open(filename, O_RDWR | O_NONBLOCK);
+ if (fd == -1) {
+ exit(0);
+ }
+
+ FD_ZERO(&readFDs);
+ FD_ZERO(&writeFDs);
+ FD_ZERO(&exceptFDs);
+ FD_SET(fd, &readFDs);
+ numFDs = select(fd + 1, &readFDs, &writeFDs, &exceptFDs, &time);
+
+ close(fd);
+ unlink(filename);
+
+ /* numFDs is zero if select() works correctly */
+ exit(numFD==0);
+}" HAVE_BROKEN_FIFO_SELECT)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main(void)
+{
+ int ikq;
+ int iRet;
+ int fd;
+ struct kevent ke, keChangeList;
+ struct timespec ts = { 0, 0 };
+
+ char * filename = NULL;
+
+ filename = (char *)malloc(L_tmpnam * sizeof(char)); /* ok to leak this at exit */
+ if (NULL == filename)
+ {
+ exit(1);
+ }
+
+ /* On some platforms (e.g. HP-UX) the multithreading c-runtime does not
+ support the tmpnam(NULL) semantics, and it returns NULL. Therefore
+ we need to use the tmpnam(pbuffer) version.
+ */
+ if (NULL == tmpnam(filename)) {
+ exit(0);
+ }
+ if (mkfifo(filename, S_IRWXU) != 0) {
+ if (unlink(filename) != 0) {
+ exit(0);
+ }
+ if (mkfifo(filename, S_IRWXU) != 0) {
+ exit(0);
+ }
+ }
+ fd = open(filename, O_RDWR | O_NONBLOCK);
+ if (fd == -1) {
+ exit(0);
+ }
+
+ EV_SET(&keChangeList, fd, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, NULL);
+ ikq = kqueue();
+ iRet = kevent(ikq, &keChangeList, 1, &ke, 1, &ts);
+
+ close(fd);
+ unlink(filename);
+
+ /* iRet is zero is kevent() works correctly */
+ return(iRet==0);
+}" HAVE_BROKEN_FIFO_KEVENT)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+
+/* INT64_MAX */
+#define OFFSET 9223372036854775807
+
+int main(void) {
+ int fd;
+ off_t result;
+ char filename[1024];
+
+ strcpy(filename, \"/tmp/ftruncate_testXXXXXX\");
+ fd = mkstemp(filename);
+ if (fd == -1) {
+ exit(1);
+ }
+
+ result = ftruncate(fd, OFFSET);
+ unlink(filename);
+ close(fd);
+
+ if (result != -1) {
+ exit(1);
+ }
+ exit(0);
+}" HAVE_FTRUNCATE_LARGE_LENGTH_SUPPORT)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main(void)
+{
+ int fd;
+ struct stat sStat;
+ int has_bug = 0;
+
+ fd = open(\"/tmp/ftruncate_test2\", O_CREAT | O_EXCL | O_RDWR, 0777);
+ if (fd != -1)
+ {
+ if (ftruncate(fd, 0x7fffffffffffffffULL) == -1)
+ {
+ if (fstat(fd, &sStat) != -1)
+ has_bug = sStat.st_size != 0;
+ }
+
+ unlink(\"/tmp/ftruncate_test2\");
+ close(fd);
+ }
+
+ exit(has_bug ? 0 : 1);
+}" HAS_FTRUNCATE_LENGTH_ISSUE)
+set(CMAKE_REQUIRED_LIBRARIES pthread)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+
+int main(void)
+{
+ int policy;
+ struct sched_param schedParam;
+ int max_priority;
+ int min_priority;
+
+ if (0 != pthread_getschedparam(pthread_self(), &policy, &schedParam))
+ {
+ exit(1);
+ }
+
+ max_priority = sched_get_priority_max(policy);
+ min_priority = sched_get_priority_min(policy);
+
+ exit(-1 == max_priority || -1 == min_priority);
+}" HAVE_SCHED_GET_PRIORITY)
+set(CMAKE_REQUIRED_LIBRARIES)
+check_cxx_source_runs("
+#include
+#include
+#include
+
+int main()
+{
+ int ret;
+ struct timeval tv;
+ ret = gettimeofday(&tv, NULL);
+
+ exit(ret);
+}" HAVE_WORKING_GETTIMEOFDAY)
+check_cxx_source_runs("
+#include
+#include
+#include
+
+int main()
+{
+ int ret;
+ struct timespec ts;
+ ret = clock_gettime(CLOCK_REALTIME, &ts);
+
+ exit(ret);
+}" HAVE_WORKING_CLOCK_GETTIME)
+check_cxx_source_runs("
+#include
+#include
+#include
+
+int main()
+{
+ int ret;
+ struct timespec ts;
+ ret = clock_gettime(CLOCK_MONOTONIC, &ts);
+
+ exit(ret);
+}" HAVE_CLOCK_MONOTONIC)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+
+int main(void) {
+ int devzero;
+ void *retval;
+
+ devzero = open(\"/dev/zero\", O_RDWR);
+ if (-1 == devzero) {
+ exit(1);
+ }
+ retval = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, devzero, 0);
+ if (retval == (void *)-1) {
+ exit(1);
+ }
+ exit(0);
+}" HAVE_MMAP_DEV_ZERO)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+#include
+
+#ifndef MAP_ANON
+#define MAP_ANON MAP_ANONYMOUS
+#endif
+
+int main(void) {
+ void *hint, *ptr;
+ int pagesize;
+ int fd;
+
+ pagesize = getpagesize();
+ fd = open(\"/etc/passwd\", O_RDONLY);
+ if (fd == -1) {
+ exit(0);
+ }
+ ptr = mmap(NULL, pagesize, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
+ if (ptr == MAP_FAILED) {
+ exit(0);
+ }
+ hint = mmap(NULL, pagesize, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
+ if (hint == MAP_FAILED) {
+ exit(0);
+ }
+ if (munmap(ptr, pagesize) != 0) {
+ exit(0);
+ }
+ if (munmap(hint, pagesize) != 0) {
+ exit(0);
+ }
+ ptr = mmap(hint, pagesize, PROT_NONE, MAP_FIXED | MAP_PRIVATE, fd, 0);
+ if (ptr == MAP_FAILED || ptr != hint) {
+ exit(0);
+ }
+ exit(1);
+}" MMAP_IGNORES_HINT)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+#include
+
+#ifndef MAP_ANON
+#define MAP_ANON MAP_ANONYMOUS
+#endif
+
+void *handle_signal(int signal) {
+ /* If we reach this, we've crashed due to mmap honoring
+ PROT_NONE. */
+ _exit(1);
+}
+
+int main(void) {
+ int *ptr;
+ struct sigaction action;
+
+ ptr = (int *) mmap(NULL, getpagesize(), PROT_NONE,
+ MAP_ANON | MAP_PRIVATE, -1, 0);
+ if (ptr == (int *) MAP_FAILED) {
+ exit(0);
+ }
+ action.sa_handler = &handle_signal;
+ action.sa_flags = 0;
+ sigemptyset(&action.sa_mask);
+ if (sigaction(SIGBUS, &action, NULL) != 0) {
+ exit(0);
+ }
+ if (sigaction(SIGSEGV, &action, NULL) != 0) {
+ exit(0);
+ }
+ /* This will drop us into the signal handler if PROT_NONE
+ is honored. */
+ *ptr = 123;
+ exit(0);
+}" MMAP_ANON_IGNORES_PROTECTION)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+
+#ifndef MAP_ANON
+#define MAP_ANON MAP_ANONYMOUS
+#endif
+
+int main()
+{
+ int iRet = 1;
+ void * pAddr = MAP_FAILED;
+ int MemSize = 1024;
+
+ MemSize = getpagesize();
+ pAddr = mmap(0x0, MemSize, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0);
+ if (pAddr == MAP_FAILED)
+ exit(0);
+
+ pAddr = mmap(pAddr, MemSize, PROT_WRITE | PROT_READ, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
+ if (pAddr == MAP_FAILED)
+ iRet = 0;
+
+ munmap(pAddr, MemSize); // don't care of this
+ exit (iRet);
+}" MMAP_DOESNOT_ALLOW_REMAP)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define MEM_SIZE 1024
+
+int main(void)
+{
+ char * fname;
+ int fd;
+ int ret;
+ void * pAddr0, * pAddr1;
+
+ fname = (char *)malloc(MEM_SIZE);
+ if (!fname)
+ exit(1);
+ strcpy(fname, \"/tmp/name/multiplemaptestXXXXXX\");
+
+ fd = mkstemp(fname);
+ if (fd < 0)
+ exit(1);
+
+ ret = write (fd, (void *)fname, MEM_SIZE);
+ if (ret < 0)
+ exit(1);
+
+ pAddr0 = mmap(0, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ pAddr1 = mmap(0, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+
+ /* In theory we should look for (pAddr1 == MAP_FAILED) && (pAddr1 != MAP_FAILED)
+ but in case the first test also failed, i.e. we failed to run the test,
+ let's assume that the system might not allow multiple shared mapping of the
+ same file region in the same process. The code enabled in this case is
+ only a fall-back code path. In case the double mmap actually works, virtually
+ nothing will change and the normal code path will be executed */
+ if (pAddr1 == MAP_FAILED)
+ ret = 1;
+ else
+ ret = 0;
+
+ if (pAddr0)
+ munmap (pAddr0, MEM_SIZE);
+ if (pAddr1)
+ munmap (pAddr1, MEM_SIZE);
+ close(fd);
+ unlink(fname);
+ free(fname);
+
+ exit(ret != 1);
+}" ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS)
+set(CMAKE_REQUIRED_LIBRARIES pthread)
+check_cxx_source_runs("
+#include
+#include
+#include
+
+void *start_routine(void *param) { return NULL; }
+
+int main() {
+ int result;
+ pthread_t tid;
+
+ errno = 0;
+ result = pthread_create(&tid, NULL, start_routine, NULL);
+ if (result != 0) {
+ exit(1);
+ }
+ if (errno != 0) {
+ exit(0);
+ }
+ exit(1);
+}" PTHREAD_CREATE_MODIFIES_ERRNO)
+set(CMAKE_REQUIRED_LIBRARIES)
+set(CMAKE_REQUIRED_LIBRARIES pthread)
+check_cxx_source_runs("
+#include
+#include
+#include
+
+int main() {
+ int result;
+ sem_t sema;
+
+ errno = 50;
+ result = sem_init(&sema, 0, 0);
+ if (result != 0)
+ {
+ exit(1);
+ }
+ if (errno != 50)
+ {
+ exit(0);
+ }
+ exit(1);
+}" SEM_INIT_MODIFIES_ERRNO)
+set(CMAKE_REQUIRED_LIBRARIES)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+
+int main(void) {
+ int fd;
+#ifdef PATH_MAX
+ char path[PATH_MAX];
+#elif defined(MAXPATHLEN)
+ char path[MAXPATHLEN];
+#else
+ char path[1024];
+#endif
+
+ sprintf(path, \"/proc/%u/$1\", getpid());
+ fd = open(path, $2);
+ if (fd == -1) {
+ exit(1);
+ }
+ exit(0);
+}" HAVE_PROCFS_CTL)
+set(CMAKE_REQUIRED_LIBRARIES m)
+check_cxx_source_runs("
+#include
+#include
+
+int main(void) {
+ if (!isnan(acos(10))) {
+ exit(1);
+ }
+ exit(0);
+}" HAVE_COMPATIBLE_ACOS)
+set(CMAKE_REQUIRED_LIBRARIES)
+set(CMAKE_REQUIRED_LIBRARIES m)
+check_cxx_source_runs("
+#include
+#include
+
+int main(void) {
+ if (!isnan(asin(10))) {
+ exit(1);
+ }
+ exit(0);
+}" HAVE_COMPATIBLE_ASIN)
+set(CMAKE_REQUIRED_LIBRARIES)
+set(CMAKE_REQUIRED_LIBRARIES m)
+check_cxx_source_runs("
+#include
+#include
+
+int main(void) {
+ double infinity = 1.0 / 0.0;
+ if (!isnan(pow(1.0, infinity))) {
+ exit(1);
+ }
+ if (pow(0.0, -1) != infinity) {
+ exit(1);
+ }
+ exit(0);
+}" HAVE_COMPATIBLE_POW)
+set(CMAKE_REQUIRED_LIBRARIES)
+set(CMAKE_REQUIRED_LIBRARIES m)
+check_cxx_source_runs("
+#include
+#include
+
+int main(int argc, char **argv) {
+ double result;
+
+ result = pow(-3.2e-10, -5e14 + 1);
+ if (result != -1.0 / 0.0) {
+ exit(1);
+ }
+ exit(0);
+}" HAVE_VALID_NEGATIVE_INF_POW)
+set(CMAKE_REQUIRED_LIBRARIES)
+set(CMAKE_REQUIRED_LIBRARIES m)
+check_cxx_source_runs("
+#include
+#include
+
+int main(int argc, char **argv) {
+ double result;
+
+ result = pow(-3.5, 3e100);
+ if (result != 1.0 / 0.0) {
+ exit(1);
+ }
+ exit(0);
+}" HAVE_VALID_POSITIVE_INF_POW)
+set(CMAKE_REQUIRED_LIBRARIES)
+set(CMAKE_REQUIRED_LIBRARIES m)
+check_cxx_source_runs("
+#include
+#include
+
+int main(void) {
+ double pi = 3.14159265358979323846;
+ double result;
+
+ result = atan2(0.0, -0.0);
+ if (fabs(pi - result) > 0.0000001) {
+ exit(1);
+ }
+
+ result = atan2(-0.0, -0.0);
+ if (fabs(-pi - result) > 0.0000001) {
+ exit(1);
+ }
+
+ result = atan2 (-0.0, 0.0);
+ if (result != 0.0 || copysign (1.0, result) > 0) {
+ exit(1);
+ }
+
+ result = atan2 (0.0, 0.0);
+ if (result != 0.0 || copysign (1.0, result) < 0) {
+ exit(1);
+ }
+
+ exit (0);
+}" HAVE_COMPATIBLE_ATAN2)
+set(CMAKE_REQUIRED_LIBRARIES)
+set(CMAKE_REQUIRED_LIBRARIES m)
+check_cxx_source_runs("
+#include
+#include
+
+int main(void) {
+ double d = exp(1.0), e = M_E;
+
+ /* Used memcmp rather than == to test that the doubles are equal to
+ prevent gcc's optimizer from using its 80 bit internal long
+ doubles. If you use ==, then on BSD you get a false negative since
+ exp(1.0) == M_E to 64 bits, but not 80.
+ */
+
+ if (memcmp (&d, &e, sizeof (double)) == 0) {
+ exit(0);
+ }
+ exit(1);
+}" HAVE_COMPATIBLE_EXP)
+set(CMAKE_REQUIRED_LIBRARIES)
+set(CMAKE_REQUIRED_LIBRARIES m)
+check_cxx_source_runs("
+#include
+#include
+
+int main(void) {
+ if (!isnan(log(-10000))) {
+ exit(1);
+ }
+ exit(0);
+}" HAVE_COMPATIBLE_LOG)
+set(CMAKE_REQUIRED_LIBRARIES)
+set(CMAKE_REQUIRED_LIBRARIES m)
+check_cxx_source_runs("
+#include
+#include
+
+int main(void) {
+ if (!isnan(log10(-10000))) {
+ exit(1);
+ }
+ exit(0);
+}" HAVE_COMPATIBLE_LOG10)
+set(CMAKE_REQUIRED_LIBRARIES)
+check_cxx_source_runs("
+#include
+#include
+#include
+
+int main(void)
+{
+ char* szFileName;
+ FILE* pFile = NULL;
+ int ret = 1;
+
+ szFileName = tempnam(\".\", \"tmp\");
+
+ /* open the file write-only */
+ pFile = fopen(szFileName, \"a\");
+ if (pFile == NULL)
+ {
+ exit(0);
+ }
+ if (ungetc('A', pFile) != EOF)
+ {
+ ret = 0;
+ }
+ unlink(szFileName);
+ exit(ret);
+}" UNGETC_NOT_RETURN_EOF)
+check_cxx_source_runs("
+#include
+
+int main(void)
+{
+ void *p;
+
+ p = malloc(0);
+
+ if (p == NULL)
+ {
+ exit(0);
+ }
+
+ exit(1);
+}" MALLOC_ZERO_RETURNS_NULL)
+set(CMAKE_REQUIRED_LIBRARIES pthread)
+check_cxx_source_runs("
+#include
+#include
+#include
+
+int main() {
+ sem_t sema;
+ if (sem_init(&sema, 0, 0) == -1){
+ exit(1);
+ }
+ exit(0);
+}" HAS_POSIX_SEMAPHORES)
+set(CMAKE_REQUIRED_LIBRARIES)
+check_cxx_source_runs("
+#include
+#include
+#include
+#include
+#include
+
+int main(void)
+{
+ struct passwd sPasswd;
+ struct passwd *pPasswd;
+ char buf[1];
+ int bufLen = sizeof(buf)/sizeof(buf[0]);
+ int euid = geteuid();
+ int ret = 0;
+
+ errno = 0; // clear errno
+ ret = getpwuid_r(euid, &sPasswd, buf, bufLen, &pPasswd);
+ if (0 != ret)
+ {
+ if (ERANGE == errno)
+ {
+ return 0;
+ }
+ }
+
+ return 1; // assume errno is NOT set for all other cases
+}" GETPWUID_R_SETS_ERRNO)
+check_cxx_source_runs("
+#include
+#include
+
+int main()
+{
+ FILE *fp = NULL;
+ char *fileName = \"/dev/zero\";
+ char buf[10];
+
+ /*
+ * Open the file in append mode and try to read some text.
+ * And, make sure ferror() is set.
+ */
+ fp = fopen (fileName, \"a\");
+ if ( (NULL == fp) ||
+ (fread (buf, sizeof(buf), 1, fp) > 0) ||
+ (!ferror(fp))
+ )
+ {
+ return 0;
+ }
+
+ /*
+ * Now that ferror() is set, try to close the file.
+ * If we get an error, we can conclude that this
+ * fgets() depended on the previous ferror().
+ */
+ if ( fclose(fp) != 0 )
+ {
+ return 0;
+ }
+
+ return 1;
+}" FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL)
+
+if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ set(HAVE_COREFOUNDATION 1)
+ set(HAVE__NSGETENVIRON 1)
+ set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 1)
+ set(PAL_PTRACE "ptrace((cmd), (pid), (caddr_t)(addr), (data))")
+ set(PAL_PT_ATTACH PT_ATTACH)
+ set(PAL_PT_DETACH PT_DETACH)
+ set(PAL_PT_READ_D PT_READ_D)
+ set(PAL_PT_WRITE_D PT_WRITE_D)
+ set(USE_SIGNALS_FOR_THREAD_SUSPENSION 0)
+ set(SYNCHMGR_SUSPENSION_SAFE_CONDITION_SIGNALING 1)
+ set(JA_JP_LOCALE_NAME ja_JP.SJIS)
+ set(KO_KR_LOCALE_NAME ko_KR.eucKR)
+ set(ZH_TW_LOCALE_NAME zh_TG.BIG5)
+ set(ERROR_FUNC_FOR_GLOB_HAS_FIXED_PARAMS 1)
+ set(UNWIND_CONTEXT_IS_UCONTEXT_T 0)
+else()
+ set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 0)
+ set(PAL_PTRACE "ptrace((cmd), (pid), (void*)(addr), (data))")
+ set(PAL_PT_ATTACH PTRACE_ATTACH)
+ set(PAL_PT_DETACH PTRACE_DETACH)
+ set(PAL_PT_READ_D PTRACE_PEEKDATA)
+ set(PAL_PT_WRITE_D PTRACE_POKEDATA)
+ set(USE_SIGNALS_FOR_THREAD_SUSPENSION 1)
+ set(SYNCHMGR_SUSPENSION_SAFE_CONDITION_SIGNALING 1)
+ set(JA_JP_LOCALE_NAME ja_JP_LOCALE_NOT_FOUND)
+ set(KO_KR_LOCALE_NAME ko_KR_LOCALE_NOT_FOUND)
+ set(ZH_TW_LOCALE_NAME zh_TW_LOCALE_NOT_FOUND)
+ set(ERROR_FUNC_FOR_GLOB_HAS_FIXED_PARAMS 1)
+ set(UNWIND_CONTEXT_IS_UCONTEXT_T 1)
+endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
diff --git a/src/pal/src/configure.in b/src/pal/src/configure.in
deleted file mode 100644
index 35a1f7de95b4..000000000000
--- a/src/pal/src/configure.in
+++ /dev/null
@@ -1,2763 +0,0 @@
-dnl /*++
-dnl Copyright (c) Microsoft Corporation. All rights reserved.
-dnl
-dnl Module Name : configure.in
-dnl
-dnl process this file with autoconf to create a configure script
-dnl
-dnl --*/
-
-AC_INIT(include/pal/palinternal.h)
-rm -f config.status
-
-if test ! "$BUILD_ALT_DIR"
-then
- echo "Environment not set. Run '. env.sh' before building the PAL."
- exit
-fi
-
-AC_CONFIG_HEADER(config.h:../../config.h.in)
-
-dnl configure options go here.
-
-AC_ARG_ENABLE(debug,
-[ --disable-debug compile out all debug-only code],
-[if test "$enableval" = "no"; then DEBUG_ENABLED="no"; fi])
-
-AC_ARG_ENABLE(dbgmsg,
-[ --disable-dbgmsg compile out all debugging messages],
-[if test "$enableval" = "no"; then DEBUG_MSGS="no"; fi])
-
-AC_ARG_ENABLE(appendtraces,
-[ --enable-appendtraces append debug traces to existing file \
-instead of overwriting],
-[if test "$enableval" = "yes"; then DBG_APPEND="yes"; else DBG_APPEND="no"; fi])
-
-AC_ARG_ENABLE(tracechecks,
-[ --enable-tracechecks check format specifiers in trace macros (gcc only)],
-,enable_tracechecks=no)
-
-AC_ARG_WITH(vac,
-[ --with-vac use visual age compiler instead of gcc],
-USE_VAC_CC=1)
-
-dnl define more options here
-
-AC_SUBST(OPTIONS)
-
-
-AC_MSG_CHECKING(platform name)
-platform_name=`uname -s`
-if test X"$platform_name" = "X"; then
- platform_name=Unknown
-fi
-AC_MSG_RESULT($platform_name)
-
-AC_MSG_CHECKING(architecture)
-if test `uname -s` = Darwin; then
- if test "$_BUILDARCH" = rotor_x86; then
- ARCH_DIR=i386
- elif test "$_BUILDARCH" = rotor_amd64; then
- ARCH_DIR=i386
- else
- ARCH_DIR=$_BUILDARCH
- fi
-else
- ARCH_DIR=`(/usr/bin/uname -p | sed -e s/powerpc/ppc/ -e s/i.86/i386/) 2>/dev/null`
- if test X"$ARCH_DIR" = "X"; then
- if test "$platform_name" = "HP-UX"; then
- if test `uname -m` = "ia64"; then
- ARCH_DIR="hpia64"
- else
- ARCH_DIR=`(/usr/bin/uname -s | sed -e s/HP-UX/parisc/) 2>/dev/null || echo unknown`
- fi
- fi
- fi
- if test "$ARCH_DIR" = "ppc"; then
- if test "$platform_name" = "AIX"; then
- ARCH_DIR="aixppc"
- fi
- fi
-fi
-dnl Special hack to create the directory that will be needed -> normaly this is done by preconfig, but in this case
-dnl the preconfig doesn't know the directory name
-mkdir -p ../../arch/$ARCH_DIR/obj$BUILD_ALT_DIR/$_BUILDARCH
-AC_MSG_RESULT($ARCH_DIR)
-AC_SUBST(ARCH_DIR)
-
-
-if test "$DEBUG_ENABLED" = "no"
-then
- AC_DEFINE(_NO_DEBUG_MESSAGES_)
-else
- AC_DEFINE(_DEBUG)
- if test "$DEBUG_MSGS" = "no"
- then
- AC_DEFINE(_NO_DEBUG_MESSAGES_)
- fi
-fi
-
-if test "$DBG_APPEND" = "yes"
-then
- AC_DEFINE(_PAL_APPEND_DBG_OUTPUT_)
-fi
-
-if test "$enable_tracechecks" = "yes"
-then
- AC_DEFINE(CHECK_TRACE_SPECIFIERS,1)
-else
- AC_DEFINE(CHECK_TRACE_SPECIFIERS,0)
-fi
-
-dnl Default compiler flags. Honor any set in the environment, but
-dnl also turn all warnings on, create position-independent code,
-dnl enable exceptions, and disallow common symbols between
-dnl compilation units because the linker won't allow them on some
-dnl systems.
-dnl Note that this has to go before AC_C_BIGENDIAN because that will set
-dnl default CFLAGS values if CFLAGS isn't already set. Since we don't
-dnl always want the -g -O2 that autoconf uses by default, we have to
-dnl set CFLAGS before AC_C_BIGENDIAN.
-dnl All code whose makefiles we build with configure is LP64 compatible (i.e.
-dnl does not assume long is always 32-bits)
-if test "$USE_VAC_CC" = "1";
-then
- CC=xlc_r
- CXX=xlC_r
- dnl these flags are necessary for PAL shared library but not useful for a normal C program
- EXTRA_EXPORT_FLAGS="-L/usr/lib -L/usr/vacpp/lib -L/usr/vac/lib -G -bM:SRE -bnoentry -qalloca"
- CFLAGS="-L/usr/lib -L/usr/vacpp/lib $CFLAGS -qeh -qlanglvl=extc99 -qlanglvl=extended -DLP64COMPATIBLE"
- CFLAGS="$CFLAGS -qflag=w:w -D__STDC_VERSION__=199901L -qcpluscmt -D_VAC_"
-else
- EXTRA_EXPORT_FLAGS=
- CFLAGS="$CFLAGS $ALL_WARNINGS_FLAG -fexceptions -fno-common -DLP64COMPATIBLE"
-fi
-AC_SUBST(EXTRA_EXPORT_FLAGS)
-
-dnl Define BIGENDIAN if the current system is big-endian.
-dnl The presence of this macro causes autoconf 2.13 to print a warning
-dnl about cross-compiling. The warning is a non-issue and can't be
-dnl disabled without modifying autoconf.
-AC_C_BIGENDIAN
-if test "$ac_cv_c_bigendian" = yes; then
- BIGENDIAN="-DBIGENDIAN"
- CFLAGS="$CFLAGS $BIGENDIAN"
-else
- dnl For completeness
- BIGENDIAN=""
-fi
-
-dnl Determine -fstack-protector support.
-# -------------------------------
-# Recent versions of GCC support -fstack-protector (Xcode 3.0)
-# and recent versions of Mac OS X have implementations (10.5).
-# Check for both availabilities.
-
-AC_DEFUN([AC_PROG_CC_STACK_PROTECTOR],
-[AC_CACHE_CHECK([if $CC supports -fstack-protector],
- ac_cv_prog_cc_stack_protector,
-[ac_save_CFLAGS=$CFLAGS
-ac_cv_prog_cc_stack_protector=no
-if test "$GCC" = yes; then
- CFLAGS="$ac_save_CFLAGS -fstack-protector"
- _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
- [ac_cv_prog_cc_stack_protector=yes
-break])
-fi
-
-CFLAGS=$ac_save_CFLAGS
-])
-]) # AC_PROG_CC_STACK_PROTECTOR
-AC_PROG_CC_STACK_PROTECTOR
-
-AC_DEFUN([AC_PROG_SYS_STACK_PROTECTOR],
-[AC_CACHE_CHECK([if system has implementation for -fstack-protector],
- ac_cv_prog_sys_stack_protector,
-[ac_save_CFLAGS=$CFLAGS
-ac_cv_prog_sys_stack_protector=no
-if test "$GCC" = yes; then
- # use the "all" variant to ensure that we actually have a function that uses it.
- CFLAGS="$ac_save_CFLAGS -fstack-protector-all"
- _AC_LINK_IFELSE([AC_LANG_PROGRAM()],
- [ac_cv_prog_sys_stack_protector=yes
-break])
-fi
-
-CFLAGS=$ac_save_CFLAGS
-])
-
-if test "$ac_cv_prog_cc_stack_protector" = yes && test "$ac_cv_prog_sys_stack_protector" = no; then
- AC_DEFINE(NEED_STACK_PROTECTOR_IMPL)
-fi
-]) # AC_PROG_SYS_STACK_PROTECTOR
-AC_PROG_SYS_STACK_PROTECTOR
-#AC_SUBST(NEED_STACK_PROTECTOR_IMPL)
-
-
-dnl Defalt linker flags. Honor any set in the environment, but
-dnl also enable exceptions.
-if test "$USE_VAC_CC" = "1"; then
- LDFLAGS="$LDFLAGS -qeh"
-else
- LDFLAGS="$LDFLAGS -fexceptions"
-fi
-
-dnl Allow us to have tests which require the math library.
-LIBS="$LIBS -lm"
-
-dnl If we're on Solaris, we also need to set __EXTENSIONS__ to be
-dnl able to see prototypes for APIs that are not in ANSI C.
-dnl Also, set _POSIX_C_SOURCE=199506L so we see modern POSIX prototypes
-dnl for various POSIX APIs rather then the pre-POSIX Solaris
-dnl prototypes for the same APIs and set _LARGEFILE64_SOURCE and
-dnl _FILE_OFFSET_BITS=64 so we use 64-bit data types and functions for
-dnl file APIs. Finally, we require v9 instructions, so we build only
-dnl for that CPU.
-AC_MSG_CHECKING(whether __EXTENSIONS__ and _POSIX_C_SOURCE are required)
-if test "$platform_name" = "SunOS"; then
- CFLAGS="$CFLAGS -D__EXTENSIONS__ -D_POSIX_C_SOURCE=199506L"
- CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
- if test `uname -p` = "sparc"; then
- CFLAGS="$CFLAGS -Wa,-Av9"
- fi
- dnl mkstemp is redefined as mkstemp64 in stdlib.h.
- AC_DEFINE(MKSTEMP64_IS_USED_INSTEAD_OF_MKSTEMP)
- dnl open is redefined as open64 in fcntl.h
- AC_DEFINE(OPEN64_IS_USED_INSTEAD_OF_OPEN)
- AC_MSG_RESULT(yes)
-elif test "$platform_name" = "HP-UX"; then
- dnl _XOPEN_SOURCE_EXTENDED is needed to get modern prototypes for some
- dnl functions -- in particular, the use of socklen_t instead of int
- dnl in a lot of the socket functions
- CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199506L -D_HPUX_ -D_XOPEN_SOURCE_EXTENDED"
- if test "$_BIT64" = "1"; then
- CFLAGS="$CFLAGS -mlp64 -DBIT64 -D_WIN64"
- LDFLAGS="$LDFLAGS -mlp64 "
- fi
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl If we're on MacOS, we need to generate unwind tables for non-call instructions
-if test "$platform_name" = "Darwin"; then
- CFLAGS="$CFLAGS -fnon-call-exceptions"
-fi
-
-dnl Same On FreeBSD if using gcc 3.3.3
-if test "$platform_name" = "FreeBSD"; then
- if test "$ROTOR_TOOLSET_VERSION" \> "3.0.0 "; then
- CFLAGS="$CFLAGS -fnon-call-exceptions"
- fi
-fi
-
-dnl On 32-bit Solaris, we always use sjlj-exceptions
-dnl but 64-bit Solaris GCC doesn't support -fsjlj-exceptions
-if test "$platform_name" = "SunOS"; then
- if test "$_BIT64" != "1"; then
- CFLAGS="$CFLAGS -fsjlj-exceptions"
- fi
-fi
-
-dnl Add architecture-specific optimization flags
-if test "$ARCH_DIR" = "i386"; then
- OPTFLAGS="-momit-leaf-frame-pointer"
-fi
-
-dnl Decide whether to enable debugging.
-if test X"$CORECLR_BUILD" = "X1"; then
- dnl We always emit debugging information when building CoreCLR (we'll strip production binaries).
- dnl Specify -ggdb here explicitly to get dwarf debug info (the default is still the less useful
- dnl stabs format).
- CFLAGS="$CFLAGS -ggdb3"
-else
- if test "$NTDEBUG" != "ntsdnodbg"; then
- CFLAGS="$CFLAGS -ggdb3"
- fi
-fi
-
-dnl If we are checked (c) or free (f), or retail (r), turn on optimizations.
-dnl If we are building debug (d), turn optimizations off.
-if test "$BUILD_ALT_DIR" = "d"; then
- if test "$USE_VAC_CC" = "1"; then
- CFLAGS="$CFLAGS -O0 -qnoipa -qdbxextra"
- else
- CFLAGS="$CFLAGS -O0 -finline"
- fi
- if test "$ac_cv_prog_cc_stack_protector" = yes; then
- STACK_PROTECTOR_FLAGS=-fstack-protector-all
- fi
-fi
-if test "$BUILD_ALT_DIR" = "c"; then
- if test "$USE_VAC_CC" = "1"; then
- CFLAGS="$CFLAGS -O2 -qnoipa -qunroll -qdbxextra -qmaxmem=-1 -qstrict"
- else
- CFLAGS="$CFLAGS -O2 $OPTFLAGS"
- fi
- if test "$ac_cv_prog_cc_stack_protector" = yes; then
- STACK_PROTECTOR_FLAGS=-fstack-protector-all
- fi
-fi
-if test "$BUILD_ALT_DIR" = "f"; then
- if test "$USE_VAC_CC" = "1"; then
- CFLAGS="$CFLAGS -O2 -qnoipa -Q -qunroll -qmaxmem=-1 -qstrict"
- else
- CFLAGS="$CFLAGS -O2 $OPTFLAGS"
- fi
- if test "$ac_cv_prog_cc_stack_protector" = yes; then
- STACK_PROTECTOR_FLAGS=-fstack-protector
- fi
-fi
-if test "$BUILD_ALT_DIR" = "r"; then
- if test "$USE_VAC_CC" = "1"; then
- CFLAGS="$CFLAGS -O2 -qnoipa -Q -qunroll -qmaxmem=-1 -qstrict"
- else
- CFLAGS="$CFLAGS -O2 $OPTFLAGS"
- fi
- if test "$ac_cv_prog_cc_stack_protector" = yes; then
- STACK_PROTECTOR_FLAGS=-fstack-protector
- fi
-fi
-if test "$BUILD_ALT_DIR" = "m"; then
- CFLAGS="$CFLAGS -O2 $OPTFLAGS"
- if test "$ac_cv_prog_cc_stack_protector" = yes; then
- STACK_PROTECTOR_FLAGS=-fstack-protector
- fi
-fi
-AC_SUBST(STACK_PROTECTOR_FLAGS)
-
-if test "${PAL_LIB_PERF}" = "_perf" ; then
-CFLAGS="$CFLAGS -DPAL_PERF"
-fi
-
-dnl We still have some changes to make to CFLAGS. Save the current
-dnl set of flags till later.
-CFLAGS_NO_PIC="$CFLAGS"
-AC_SUBST(CFLAGS_NO_PIC)
-if test "$USE_VAC_CC" = "1"; then
- CFLAGS="$CFLAGS -DPIC -DPLATFORM_UNIX"
-else
- CFLAGS="$CFLAGS -fPIC -DPIC -DPLATFORM_UNIX"
-fi
-
-if test X"$CORIOLIS_BUILD" = "X1"; then
- CFLAGS="$CFLAGS -DCORIOLIS"
-fi
-if test X"$CORECLR_BUILD" = "X1"; then
- CFLAGS="$CFLAGS -fstack-check -DCORECLR"
-else
- CFLAGS="$CFLAGS -DENABLE_DOWNLEVEL_FOR_NLS"
-fi
-
-CFLAGS="$CFLAGS -DFEATURE_PAL_INLINABLE_TLS"
-if test X"$FEATURE_DTRACE" = "X1"; then
- CFLAGS="$CFLAGS -DFEATURE_DTRACE"
-fi
-
-ac_saved_cflags=$CFLAGS
-
-dnl Checks for programs go here.
-AC_PROG_CC
-AC_PROG_CPP
-AC_PROG_CXX
-AC_PROG_INSTALL
-
-dnl command to do partial linking (join multiple .o files in a single .o file)
-if test "$_BIT64" = "1" && test "$platform_name" = "SunOS"; then
- LDPARTIAL="/usr/local64/bin/ld -r"
-else
- LDPARTIAL="ld -r"
-fi
-AC_SUBST(LDPARTIAL)
-
-dnl Define linker prefix command for purify
-AC_SUBST(PURIFY_CMD)
-
-dnl gcc -M lets the preprocessor generate a list of dependencies. we want
-dnl to use this for "make depend", but we need to do something else if
-dnl $CC isn't gcc. So we need a test to detect availability of gcc -M
-MDTOOL=mdtool_gcc
-dnl MDTOOL=mdtool_dummy
-AC_SUBST(MDTOOL)
-
-dnl Checks for libraries go here.
-
-dnl On FreeBSD, the option -pthread must be passed to gcc in order to link with
-dnl libc_r (thread-safe version of libc, which also includes pthread functions).
-dnl It's unclear how to check for the validity of -pthread because it isn't a
-dnl library flag, so we'll just check for the presence of pthread_self in
-dnl libc_r instead.
-if test "$USE_VAC_CC" = "1"; then
- PTHREAD_OPTIONS=
-else
- AC_CHECK_LIB(c_r, pthread_self, has_pthread_flag=yes, has_pthread_flag=no)
-
- if test $has_pthread_flag = yes; then
- PTHREAD_OPTIONS="-pthread"
- else
- PTHREAD_OPTIONS=
- fi
-fi
-AC_SUBST(PTHREAD_OPTIONS)
-
-dnl Autoconf doesn't have any way to validate flags to the linker. This is a
-dnl bit of a hack, but it's probably better to do this than to switch on the
-dnl result of uname.
-dnl This doesn't work in Autoconf 2.5, which passes $LIBS to the compiler
-dnl when it does AC_TRY_LINK_FUNC.
-AC_MSG_CHECKING(for linker support for -soname)
-saved_libs=$LIBS
-LIBS="$LIBS -soname libfoo.so"
-AC_TRY_LINK_FUNC(malloc, has_soname=yes, has_soname=no)
-LIBS=$saved_libs
-if test $has_soname = yes; then
- AC_MSG_RESULT(yes)
- CC_SONAME="-Wl,-soname,\$(MODULE_NAME)"
-else
- AC_MSG_RESULT(no)
- CC_SONAME=
-fi
-dnl We'll substitute CC_SONAME below, after we have a chance to set it on
-dnl Autoconf 2.5.2 platforms.
-
-dnl Figure out what our C runtime library is. At the same time, we can
-dnl determine the flags that we need to pass to the compiler to get the
-dnl linker to produce a shared library, and also set the extension for
-dnl the library. Also, since this section notices if we're on Mac OS X,
-dnl set a flag that tells us that we can use CoreFoundation, and another
-dnl which determines whether we should use dlcompat.
-
-DLCOMPAT_DIR=
-DLCOMPAT_OBJ=
-DLCOMPAT_INC=
-ASMFLAGS=
-ASM_WITH_CPP_FLAGS="-x assembler-with-cpp"
-
-dnl gcc -M generates make-friendly dependencies;
-dnl -MM ignores system includes (#include )
-MDTOOL_CFLAGS="-MM"
-
-dnl We need LIBS w/o the pthread libraries for pthread checks performed
-dnl later on
-no_pthread_libs="$LIBS"
-
-dnl On some platforms (e.g., AIX) libc_r contains an entry for sigreturn
-dnl even though that function does not actually exist. On those platforms
-dnl the following shoudl be set to "yes"
-ac_bad_sigreturn_in_libc_r=no
-
-dnl consolidate platform-dependent (rather than feature-dependent) stuff
-dnl here.
-if test "$platform_name" = "AIX"; then
- if test "$USE_VAC_CC" = "1"; then
- ASM_WITH_CPP_FLAGS=
- MDTOOL_CFLAGS="-M"
- C_RUNTIME=c_r
- SHARED_LIB="-L/usr/lib -L/usr/vacpp/lib -L/usr/vac/lib -G -bM:SRE -bnoentry"
- else
- C_RUNTIME=c
- SHARED_LIB=-shared
- fi
-
- SHARED_LIB_EXTENSION=.a
- FRAMEWORKS=
- dnl __STDC__=2 is necessary to prevent the AIX headers from defining
- dnl a random sigsetjmp macro, which would cause endless redefinition
- dnl warnings
- dnl _LARGE_THREADS increases the maximum number of threads in
- dnl pthread.h to 32767
- if test "$USE_VAC_CC" = "1"; then
- CFLAGS="$ac_saved_cflags -qchars=signed -qenum=4 -D_LARGE_THREADS"
- else
- CFLAGS="$ac_saved_cflags -fsigned-char -Wno-format -D__STDC__=2 -D_LARGE_THREADS"
- fi
-
- dnl AIX has libpthreads.
- LIBS="$LIBS -lpthreads"
-
- if test "$USE_VAC_CC" = "1"; then
- EXTRA_LIBS="-lC_r -lpthreads"
- else
- EXTRA_LIBS="-lpthreads"
- fi
-
- ASMFLAGS="-Wa,-mppc"
- ac_bad_sigreturn_in_libc_r=yes
- AC_DEFINE(PAL_PTRACE(cmd, pid, addr, data), ptrace((cmd), (pid), (int*)(addr), (data), NULL))
- AC_DEFINE(PAL_PT_ATTACH, PT_ATTACH)
- AC_DEFINE(PAL_PT_DETACH, PT_DETACH)
- AC_DEFINE(PAL_PT_READ_D, PT_READ_D)
- AC_DEFINE(PAL_PT_WRITE_D, PT_WRITE_D)
- AC_DEFINE(RETURNS_NEW_HANDLES_ON_REPEAT_DLOPEN)
- AC_DEFINE(WRITE_0_BYTES_HANGS_TTY)
- dnl close(fd) blocks if there is any outstanding syscall on fd
- AC_DEFINE(CLOSE_BLOCKS_ON_OUTSTANDING_SYSCALLS)
- dnl a sendto with a To not matching the socket family returns EHOSTUNREACH
- AC_DEFINE(SENDTO_RETURNS_UNREACH_ON_WRONG_AF)
- AC_DEFINE(USER_H_DEFINES_DEBUG)
- AC_DEFINE(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX)
- AC_DEFINE(SIGWAIT_FAILS_WHEN_PASSED_FULL_SIGSET)
- AC_MSG_RESULT(AIX)
-elif test "$platform_name" = "HP-UX"; then
- C_RUNTIME=c
- FRAMEWORKS=
- CFLAGS="$ac_saved_cflags -fno-strict-aliasing"
- LIBS="$LIBS -lpthread -lrt"
- EXTRA_LIBS="-lpthread -lrt"
- SHARED_LIB_EXTENSION=.sl
- dnl SO_RCVTIMEO and SO_SNDTIMEO are not supported by get/setsockopt
- AC_DEFINE(SO_TIMEO_NOT_SUPPORTED)
- if test `uname -m` = "ia64"; then
- SHARED_LIB="-shared"
- LDFLAGS="$LDFLAGS -L/usr/local/lib/hpux64/ -L/usr/lib/hpux64/ /usr/lib/hpux64/libunwind.so"
- LIBS="$LIBS -lxnet"
- EXTRA_LIBS="$EXTRA_LIBS -lxnet"
- AC_MSG_RESULT(HPUX-Itanium)
- else
- SHARED_LIB="-Wl,-b -nostartfiles"
- AC_MSG_RESULT(HPUX - PA-RISC)
- fi
- dnl PRIV_RTSCHED / PRIV_RTPRIO are required to call pthread_setschedparam on HPUX
- AC_DEFINE(SET_SCHEDPARAM_NEEDS_PRIVS)
-elif test "$platform_name" = "FreeBSD"; then
- C_RUNTIME=c_r
- SHARED_LIB=-shared
- SHARED_LIB_EXTENSION=.so
- FRAMEWORKS=
- CFLAGS=$ac_saved_cflags
- EXTRA_LIBS=
- AC_DEFINE(PAL_PTRACE(cmd, pid, addr, data), ptrace((cmd), (pid), (caddr_t)(addr), (data)))
- AC_DEFINE(PAL_PT_ATTACH, PT_ATTACH)
- AC_DEFINE(PAL_PT_DETACH, PT_DETACH)
- AC_DEFINE(PAL_PT_READ_D, PT_READ_D)
- AC_DEFINE(PAL_PT_WRITE_D, PT_WRITE_D)
- dnl For FreeBSD 4.x, we run all threads at the same priority
- dnl except for TIME_CRITICAL and IDLE (see bug 235413).
- dnl This should not be needed with the FreeBSD 5.x ULE scheduler
- AC_DEFINE(PAL_IGNORE_NORMAL_THREAD_PRIORITY, 1)
- dnl SO_RCVTIMEO and SO_SNDTIMEO are ignored by FreeBSD 4.9 and 5.2
- AC_DEFINE(SO_TIMEO_NOT_SUPPORTED)
- dnl On BSD 5.2, we are capable of using signals for thread suspension.
- dnl AC_DEFINE(USE_SIGNALS_FOR_THREAD_SUSPENSION)
- AC_DEFINE(SELF_SUSPEND_FAILS_WITH_NATIVE_SUSPENSION)
- dnl When using native suspension on BSD, we must protect against
- dnl being suspended while blocked on a mutex.
- AC_DEFINE(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX)
- AC_DEFINE(SYS_PARAM_DEFINES_MAXHOSTNAMELEN)
- AC_MSG_RESULT(FREEBSD)
-elif test "$platform_name" = "Darwin"; then
- dnl libSystem is Darwin's C runtime.
- C_RUNTIME=System
- SHARED_LIB="-dynamiclib -single_module"
- SHARED_LIB_EXTENSION=.dylib
- FRAMEWORKS="-framework CoreFoundation -framework Security -framework Kerberos -framework CoreServices"
- AC_DEFINE(HAVE_COREFOUNDATION)
- AC_CHECK_LIB(System, _NSGetEnviron, AC_DEFINE(HAVE__NSGETENVIRON))
- CFLAGS=$ac_saved_cflags
- if test "$_BUILDARCH" = rotor_x86; then
- CC="$CC -arch i386"
- CXX="$CXX -arch i386"
- elif test "$_BUILDARCH" = rotor_amd64; then
- CC="$CC -arch x86_64"
- CXX="$CXX -arch x86_64"
- CFLAGS="$CFLAGS -DBIT64 -D_WIN64 -D_AMD64_"
- elif test "$_BUILDARCH" = ppc; then
- CC="$CC -arch ppc"
- CXX="$CXX -arch ppc"
- elif test "$_BUILDARCH" = ppc64; then
- CC="$CC -arch ppc64"
- CXX="$CXX -arch ppc64"
- CFLAGS="$CFLAGS -DBIT64 -D_WIN64"
- fi
- CFLAGS="$CFLAGS -no-cpp-precomp $SDKINCLUDE"
- CXXFLAGS="-fvisibility-inlines-hidden"
- EXTRA_LIBS="-sub_library libSystem -lssl -lcrypto"
- CC_SONAME="-install_name \$(MODULE_NAME)"
- AC_DEFINE(PAL_PTRACE(cmd, pid, addr, data), ptrace((cmd), (pid), (caddr_t)(addr), (data)))
- AC_DEFINE(PAL_PT_ATTACH, PT_ATTACH)
- AC_DEFINE(PAL_PT_DETACH, PT_DETACH)
- AC_DEFINE(PAL_PT_READ_D, PT_READ_D)
- AC_DEFINE(PAL_PT_WRITE_D, PT_WRITE_D)
- AC_DEFINE(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX)
- AC_MSG_RESULT(MACOSX)
-elif test "$platform_name" = "SunOS"; then
- C_RUNTIME=c
- SHARED_LIB=-shared
- SHARED_LIB_EXTENSION=.so
- FRAMEWORKS=
- dnl 64-bit Solaris changes
- if test "$_BIT64" = "1"; then
- CFLAGS="$ac_saved_cflags -DBIT64 -D_WIN64"
- CC=/usr/local64/bin/gcc
- CXX=/usr/local64/bin/g++
- else
- CFLAGS=$ac_saved_cflags
- fi
- LIBS="$LIBS -lrt -lsocket -lthread"
- EXTRA_LIBS="-lrt -lsocket -lthread"
- AC_DEFINE(PAL_PTRACE(cmd, pid, addr, data), ptrace((cmd), (pid), (int)(addr), (data)))
- AC_DEFINE(PAL_PT_ATTACH, PTRACE_ATTACH)
- AC_DEFINE(PAL_PT_DETACH, PTRACE_DETACH)
- AC_DEFINE(PAL_PT_READ_D, PTRACE_PEEKDATA)
- AC_DEFINE(PAL_PT_WRITE_D, PTRACE_POKEDATA)
- dnl use of directio is currently disabled
- AC_DEFINE(DIRECTIO_DISABLED)
- dnl SO_RCVTIMEO and SO_SNDTIMEO are not supported by get/setsockopt
- AC_DEFINE(SO_TIMEO_NOT_SUPPORTED)
- AC_DEFINE(NETDB_DEFINES_MAXHOSTNAMELEN)
- AC_MSG_RESULT(SOLARIS)
-else
- AC_MSG_ERROR(Unknown Platform!)
-fi
-
-AC_SUBST(CC_SONAME)
-
-AC_SUBST(C_RUNTIME)
-AC_SUBST(SHARED_LIB)
-AC_SUBST(SHARED_LIB_EXTENSION)
-AC_SUBST(FRAMEWORKS)
-AC_SUBST(DLCOMPAT_DIR)
-
-AC_SUBST(DLCOMPAT_OBJ)
-
-AC_SUBST(DLCOMPAT_INC)
-
-AC_SUBST(CFLAGS)
-AC_SUBST(EXTRA_LIBS)
-AC_SUBST(ASMFLAGS)
-AC_SUBST(ASM_WITH_CPP_FLAGS)
-AC_SUBST(MDTOOL_CFLAGS)
-
-dnl Checks for header files go here.
-AC_HEADER_STDC
-AC_CHECK_HEADERS(wchar.h ieeefp.h alloca.h stdint.h inttypes.h)
-AC_CHECK_HEADERS(stropts.h sys/vmparam.h sys/filio.h sys/sockio.h)
-AC_CHECK_HEADERS(crt_externs.h sys/time.h pthread_np.h)
-AC_CHECK_HEADERS(sys/lwp.h procfs.h sys/semaphore.h)
-AC_CHECK_HEADERS(sys/param.h netdb.h mach/vm_types.h mach/vm_param.h)
-
-dnl Checking for availability of kqueue/kevent
-dnl Note: we are not just checking for sys/event.h, since this header name
-dnl is generic enough that it could be reused for other purposes on systems
-dnl that don't have kqueue/kevent support
-AC_MSG_CHECKING(for availability of kqueue/kevent)
-define([kqueue_testcode], [
- #include
- #include
- #include
- #include
-
- int main()
- {
- int ikq;
- int iRet;
- struct kevent ke, keChangeList;
- struct timespec ts = { 0, 0 };
-
- EV_SET(&keChangeList, stdin, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0);
- ikq = kqueue();
- iRet = kevent(ikq, &keChangeList, 1, &ke, 1, &ts);
-
- return 0;
- }
-])
-AC_LINK_IFELSE([kqueue_testcode], have_kqueue=yes, have_kqueue=no)
-if test $have_kqueue = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_KQUEUE,1)
-else
- AC_MSG_RESULT(no)
- AC_DEFINE(HAVE_KQUEUE,0)
-fi
-
-dnl Checks for typedefs, structures, and compiler characteristics go here.
-dnl Check if pthread_rwlock_t exists.
-AC_MSG_CHECKING(for pthread_rwlock_t)
-AC_EGREP_CPP(pthread_rwlock_t, [
- #define _GNU_SOURCE 1
- #include
- int main(void) { exit(0); }
-], ac_has_pthread_rwlock_t=yes, ac_has_pthread_rwlock_t=no)
-if test $ac_has_pthread_rwlock_t = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PTHREAD_RWLOCK_T)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check if in_addr_t exists.
-AC_MSG_CHECKING(for in_addr_t)
-AC_EGREP_CPP(in_addr_t, [
- #include
- int main(void) { exit(0); }
-], ac_has_in_addr_t=yes, ac_has_in_addr_t=no)
-if test $ac_has_in_addr_t = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_IN_ADDR_T)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check if socklen_t exists.
-AC_MSG_CHECKING(for socklen_t)
-AC_EGREP_CPP(socklen_t, [
- #include
- int main(void) { exit(0); }
-], ac_has_socklen_t=yes, ac_has_socklen_t=no)
-if test $ac_has_socklen_t = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SOCKLEN_T)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check if struct sockaddr_ext exists
-AC_MSG_CHECKING(for struct sockaddr_ext)
-AC_TRY_COMPILE([#include ],
- [struct sockaddr_ext sa;],
- ac_has_sockaddr_ext=yes, ac_has_sockaddr_ext=no)
-if test $ac_has_sockaddr_ext = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SOCKADDR_EXT)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check if siginfo_t exists.
-AC_MSG_CHECKING(for siginfo_t)
-AC_EGREP_CPP(siginfo_t, [
- #include
- int main(void) { exit(0); }
-], ac_has_siginfo_t=yes, ac_has_siginfo_t=no)
-if test $ac_has_siginfo_t = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SIGINFO_T)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check if ucontext_t exists
-AC_MSG_CHECKING(for ucontext_t)
-AC_EGREP_CPP(ucontext_t, [
- #include
- int main(void) { exit(0); }
-], ac_has_ucontext_t=yes, ac_has_ucontext_t=no)
-if test $ac_has_ucontext_t = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_UCONTEXT_T)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check if prwatch_t exists
-AC_MSG_CHECKING(for prwatch_t)
-AC_EGREP_CPP(prwatch_t, [
- #undef _LARGEFILE64_SOURCE
- #undef _FILE_OFFSET_BITS
- #include
- int main(void) { exit(0); }
-], ac_has_prwatch_t=yes, ac_has_prwatch_t=no)
-if test $ac_has_prwatch_t = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PRWATCH_T)
-else
- AC_MSG_RESULT(no)
-fi
-
-
-dnl Check the size of off_t. If it's 32 bits or less, we'll
-dnl avoid right-shifting off_t values by 32 in some places.
-AC_CHECK_SIZEOF(off_t)
-
-dnl Check if the stat structure supports time in nsecs.
-dnl This could be in one of two ways: either the structure has a field
-dnl called 'st_atimespec', or a field called 'st_atimensec'.
-AC_MSG_CHECKING(for timespec fields in struct stat)
-AC_TRY_COMPILE([#include
-#include ], [struct stat s; s.st_atimespec;],
-ac_stat_struct_timespec=yes, ac_stat_struct_timespec=no)
-if test $ac_stat_struct_timespec = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_STAT_TIMESPEC)
-else
- AC_MSG_RESULT(no)
- AC_MSG_CHECKING(for nsec fields in struct stat)
- AC_TRY_COMPILE([#include
- #include ], [struct stat s; s.st_atimensec;],
- ac_stat_struct_nsec=yes, ac_stat_struct_nsec=no)
-
- if test $ac_stat_struct_nsec = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_STAT_NSEC)
- else
- AC_MSG_RESULT(no)
- fi
-fi
-
-dnl Check if struct sockaddr has an sa_len field.
-AC_MSG_CHECKING(for sa_len field in struct sockaddr)
-AC_TRY_COMPILE([#include
- #include ], [struct sockaddr s; s.sa_len;],
- ac_struct_sockaddr_sa_len=yes, ac_struct_sockaddr_sa_len=no)
-if test $ac_struct_sockaddr_sa_len = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check whether getpwuid_r exists.
-AC_MSG_CHECKING(whether getpwuid_r exists)
-AC_TRY_LINK([#include
- #include ], [getpwuid_r(0, 0, 0, 0, 0);],
- ac_getpwuid_r_exists=yes, ac_getpwuid_r_exists=no)
-if test $ac_getpwuid_r_exists = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_GETPWUID_R)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check whether getpwuid_r returns ERANGE or sets errno to ERANGE
-AC_MSG_CHECKING(whether getpwuid_r sets errno)
-define([getpwuid_r_testcode], [
- #include
- #include
- #include
- #include
-
- int main(void)
- {
- struct passwd sPasswd;
- struct passwd *pPasswd;
- char buf[[1]];
- int bufLen = sizeof(buf)/sizeof(buf[[0]]);
- int euid = geteuid();
- int ret = 0;
-
- errno = 0; // clear errno
- ret = getpwuid_r(euid, &sPasswd, buf, bufLen, &pPasswd);
- if (0 != ret)
- {
- if (ERANGE == errno)
- {
- return 0;
- }
- }
-
- return 1; // assume errno is NOT set for all other cases
- }
-])
-
-if test $ac_getpwuid_r_exists = no; then
- ac_getpwuid_r_sets_errno=no
-else
- AC_LINK_IFELSE([getpwuid_r_testcode],,[AC_MSG_ERROR([Failed to compile and link code for testing getpwuid_r])])
- AC_RUN_IFELSE([getpwuid_r_testcode], ac_getpwuid_r_sets_errno=yes, ac_getpwuid_r_sets_errno=no, ac_getpwuid_r_sets_errno=no)
-fi
-
-if test $ac_getpwuid_r_sets_errno = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(GETPWUID_R_SETS_ERRNO)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check whether a CRT file operation (such as fwrite) depends on the error value set
-dnl by a previous file operation.
-AC_MSG_CHECKING(whether C runtime file operations depend on the existing file error status)
-define([file_ops_check_previous_ferror_code], [
- #include
-
- int main()
- {
- FILE *fp = NULL;
- char *fileName = "/dev/zero";
- char buf[[10]];
-
- /*
- * Open the file in append mode and try to read some text.
- * And, make sure ferror() is set.
- */
- fp = fopen (fileName, "a");
- if ( (NULL == fp) ||
- (fread (buf, sizeof(buf), 1, fp) > 0) ||
- (!ferror(fp))
- )
- {
- return 1;
- }
-
- /*
- * Now that ferror() is set, try to close the file.
- * If we get an error, we can conclude that this
- * fgets() depended on the previous ferror().
- */
- if ( fclose(fp) != 0 )
- {
- return 1;
- }
-
- return 0;
- }
-])
-
-AC_LINK_IFELSE([file_ops_check_previous_ferror_code],,[AC_MSG_ERROR([Failed to compile and link code for testing file operations])])
-AC_RUN_IFELSE([file_ops_check_previous_ferror_code], ac_file_ops_check_previous_ferror=no, ac_file_ops_check_previous_ferror=yes, ac_file_ops_check_previous_ferror=yes)
-
-if test $ac_file_ops_check_previous_ferror = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check if realpath requires that the last path component exist.
-AC_MSG_CHECKING(whether realpath requires that the last path component exist)
-AC_TRY_RUN([
- #include
- #include
-
- int main(void) {
- char *path;
-#ifdef PATH_MAX
- char resolvedPath[PATH_MAX];
-#elif defined(MAXPATHLEN)
- char resolvedPath[MAXPATHLEN];
-#else
- char resolvedPath[1024];
-#endif
- path = realpath("a_nonexistent_file", resolvedPath);
- if (path == NULL) {
- exit(1);
- }
- exit(0);
- }
- ],
- ac_realpath_last_must_exist=no, ac_realpath_last_must_exist=yes,
- ac_realpath_last_must_exist=no)
-if test $ac_realpath_last_must_exist = yes; then
- AC_MSG_RESULT(yes)
-else
- AC_DEFINE(REALPATH_SUPPORTS_NONEXISTENT_FILES)
- AC_MSG_RESULT(no)
-fi
-
-dnl Check to see if the BSD struct reg is supported.
-AC_MSG_CHECKING(whether the BSD struct reg is supported)
-AC_TRY_COMPILE([#include ], [struct reg regs;],
-ac_regs_struct_t=yes, ac_regs_struct_t=no)
-if test $ac_regs_struct_t = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_BSD_REGS_T)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check for the existence of struct pt_regs (ptrace registers).
-AC_MSG_CHECKING(for struct pt_regs)
-AC_TRY_COMPILE([#include ], [struct pt_regs registers;],
- has_pt_regs=yes, has_pt_regs=no)
-if test $has_pt_regs = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PT_REGS)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Check to see if mcontext_t has named registers.
-if test $ac_has_ucontext_t = yes; then
- AC_MSG_CHECKING(whether mcontext_t contains a gregset_t)
- AC_TRY_COMPILE([#include ],
- [ucontext_t context; context.uc_mcontext.gregs[0] = 0;],
- has_gregset_t=yes, has_gregset_t=no)
- if test $has_gregset_t = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_GREGSET_T)
- else
- AC_MSG_RESULT(no)
- fi
-fi
-
-dnl Check whether or not it is safe to free NULL
-dnl This test is just a screening for old non-C99 compilers.
-dnl Even if free(NULL) is not safely supported, this test does
-dnl not necessarily detect it, since the behavior in such a case
-dnl would be undefined
-AC_MSG_CHECKING(whether or not it is safe to free NULL)
-AC_RUN_IFELSE([
-#include
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-
-int main()
-{
- int i;
- char **pp;
-
- pp = (char **)malloc(10 * sizeof(char *));
- if (pp)
- {
- for (i=0;i<10;i++)
- {
- *(pp+i) = (char*)malloc(i*i+1);
- free(NULL);
- }
- }
- free(NULL);
- if (pp)
- {
- for (i=0;i<10;i++)
- {
- free(*(pp+i));
- free(NULL);
- }
- }
- free(pp);
- exit(0);
-};
-], free_null_supported=yes, free_null_supported=no, free_null_supported=dontknow)
-if test $free_null_supported = yes; then
- AC_MSG_RESULT(yes)
-else
- if test $free_null_supported = no; then
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(This platform does not seem to safely support calling free on a NULL pointer: can't continue)
- else
- AC_MSG_RESULT(WARNING: cross-compiling not supported)
- fi
-fi
-
-dnl This check is done because FreeBSD's sscanf doesn't seem to support
-dnl the "%ll" (long long) prefix but has "%q" instead.
-AC_MSG_CHECKING(supported behavior of sscanf(%ll))
-AC_TRY_RUN([
- #include
- int main(void)
- {
- long long n = 0;
- sscanf("5000000000", "%qu", &n);
- exit (n == 5000000000);
- }
- ],
- ac_sscanf_support_ll=yes, ac_sscanf_support_ll=no,
- ac_sscanf_support_ll=no)
-if test $ac_sscanf_support_ll = yes; then
- AC_DEFINE(SSCANF_SUPPORT_ll)
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Checking whether sscanf is able to parse a float from "12.34e"
-AC_MSG_CHECKING(whether sscanf is able to parse a float from "12.34e")
-define([sscanf_float_e_limitation_testcode], [
-#include
-
-int main()
-{
- int ret;
- float f = 0;
- char * strin = "12.34e";
-
- ret = sscanf (strin, "%e", &f);
- if (ret <= 0)
- exit (1);
- exit(0);
-};
-])
-AC_LINK_IFELSE([sscanf_float_e_limitation_testcode],,[AC_MSG_ERROR([Failed to compile and link test code])])
-AC_RUN_IFELSE([sscanf_float_e_limitation_testcode], has_sscanf_float_e_limitation=no, has_sscanf_float_e_limitation=yes, has_sscanf_float_e_limitation=dontknow)
-if test $has_sscanf_float_e_limitation = yes; then
- AC_MSG_RESULT(no)
- AC_DEFINE(SSCANF_CANNOT_HANDLE_MISSING_EXPONENT,1)
-else
- if test $has_sscanf_float_e_limitation = no; then
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(WARNING: cross-compiling not supported)
- fi
-fi
-
-dnl snprintf has trouble when printing "%#x" with large values
-dnl of 'n' on some systems.
-AC_MSG_CHECKING(whether snprintf supports large values of n)
-AC_TRY_RUN([
- #include
-
- int main(void) {
- char buf[256] = { 0 };
- snprintf(buf, 0x7fffffff, "%#x", 0x12345678);
- if (buf[0] == '\0') {
- exit(1);
- }
- exit(0);
- }
-], has_large_snprintf=yes, has_large_snprintf=no, has_large_snprintf=yes)
-if test $has_large_snprintf = yes; then
- AC_DEFINE(HAVE_LARGE_SNPRINTF_SUPPORT)
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Checking whether select() on an open fifo that hasn't been
-dnl written to returns that it has data available.
-AC_MSG_CHECKING(for broken select() behavior with fifos)
-define([broken_select_testcode], [
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
-
- int main(void) {
- int fd, numFDs;
- fd_set readFDs, writeFDs, exceptFDs;
- struct timeval time = { 0 };
- char * filename = NULL;
-
- filename = (char *)malloc(L_tmpnam * sizeof(char)); /* ok to leak this at exit */
- if (NULL == filename) {
- exit(1);
- }
-
- /* On some platforms (e.g. HP-UX) the multithreading c-runtime does not
- support the tmpnam(NULL) semantics, and it returns NULL. Therefore
- we need to use the tmpnam(pbuffer) version.
- */
- if (NULL == tmpnam(filename)) {
- exit(1);
- }
- if (mkfifo(filename, S_IRWXU) != 0) {
- if (unlink(filename) != 0) {
- exit(1);
- }
- if (mkfifo(filename, S_IRWXU) != 0) {
- exit(1);
- }
- }
- fd = open(filename, O_RDWR | O_NONBLOCK);
- if (fd == -1) {
- exit(1);
- }
-
- FD_ZERO(&readFDs);
- FD_ZERO(&writeFDs);
- FD_ZERO(&exceptFDs);
- FD_SET(fd, &readFDs);
- numFDs = select(fd + 1, &readFDs, &writeFDs, &exceptFDs, &time);
-
- close(fd);
- unlink(filename);
-
- /* numFDs is zero if select() works correctly */
- exit(numFDs);
- }
-])
-AC_LINK_IFELSE([broken_select_testcode],,[AC_MSG_ERROR([Failed to compile and link test code])])
-AC_RUN_IFELSE([broken_select_testcode], has_broken_fifo_select=no, has_broken_fifo_select=yes, has_broken_fifo_select=dontknow)
-case $has_broken_fifo_select in
- yes) AC_DEFINE(HAVE_BROKEN_FIFO_SELECT)
- AC_MSG_RESULT(yes)
- ;;
- no) AC_MSG_RESULT(no)
- ;;
- *) AC_MSG_RESULT(WARNING: cross-compiling not supported)
- ;;
-esac
-
-dnl Checking whether kevent() on a fifo returns EV_ERROR.
-AC_MSG_CHECKING(for broken kevent() behavior with fifos)
-define([broken_kevent_testcode], [
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
-
- int main(void)
- {
- int ikq;
- int iRet;
- int fd;
- struct kevent ke, keChangeList;
- struct timespec ts = { 0, 0 };
-
- char * filename = NULL;
-
- filename = (char *)malloc(L_tmpnam * sizeof(char)); /* ok to leak this at exit */
- if (NULL == filename)
- {
- exit(1);
- }
-
- /* On some platforms (e.g. HP-UX) the multithreading c-runtime does not
- support the tmpnam(NULL) semantics, and it returns NULL. Therefore
- we need to use the tmpnam(pbuffer) version.
- */
- if (NULL == tmpnam(filename)) {
- exit(1);
- }
- if (mkfifo(filename, S_IRWXU) != 0) {
- if (unlink(filename) != 0) {
- exit(1);
- }
- if (mkfifo(filename, S_IRWXU) != 0) {
- exit(1);
- }
- }
- fd = open(filename, O_RDWR | O_NONBLOCK);
- if (fd == -1) {
- exit(1);
- }
-
- EV_SET(&keChangeList, fd, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, NULL);
- ikq = kqueue();
- iRet = kevent(ikq, &keChangeList, 1, &ke, 1, &ts);
-
- close(fd);
- unlink(filename);
-
- /* iRet is zero is kevent() works correctly */
- exit(iRet);
- }
-])
-AC_LINK_IFELSE([broken_kevent_testcode],,[AC_MSG_ERROR([Failed to compile and link test code])])
-AC_RUN_IFELSE([broken_kevent_testcode], has_broken_fifo_kevent=no, has_broken_fifo_kevent=yes, has_broken_fifo_kevent=dontknow)
-case $has_broken_fifo_kevent in
- yes) AC_DEFINE(HAVE_BROKEN_FIFO_KEVENT)
- AC_MSG_RESULT(yes)
- ;;
- no) AC_MSG_RESULT(no)
- ;;
- *) AC_MSG_RESULT(WARNING: cross-compiling not supported)
- ;;
-esac
-
-if test $ac_cv_sizeof_off_t -gt 4; then
- dnl Check whether ftruncate'ing a zero-byte file to a very large length
- dnl fails as expected. Mac OS X's ftruncate returns success in that
- dnl case, even though it actually fails.
- AC_MSG_CHECKING(whether ftruncate correctly fails for very large lengths)
- AC_TRY_RUN([
- #include
- #include
- #include
- #include
-
- /* INT64_MAX */
- #define OFFSET 9223372036854775807
-
- int main(void) {
- int fd;
- off_t result;
- char filename[1024];
-
- strcpy(filename, "ftruncate_test");
- fd = mkstemp(filename);
- if (fd == -1) {
- exit(1);
- }
-
- result = ftruncate(fd, OFFSET);
- unlink(filename);
- close(fd);
-
- if (result != -1) {
- exit(1);
- }
- exit(0);
- }
- ], has_ftruncate_large_length_support=yes,
- has_ftruncate_large_length_support=no,
- has_ftruncate_large_length_support=no)
- if test $has_ftruncate_large_length_support = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_FTRUNCATE_LARGE_LENGTH_SUPPORT)
- else
- AC_MSG_RESULT(no)
- fi
-fi
-
-dnl A different Mac OS X issue causes ftruncate to return failure for a request
-dnl that exceeds the amount of disk space available while in fact the file has
-dnl been extended to fill the remaining space.
-dnl Note that it's important to call unlink() before close() in the test below
-dnl to avoid actually creating a huge file if the issue exists.
-AC_MSG_CHECKING(whether ftruncate incorrectly deals with requests larger than available space)
-AC_TRY_RUN([
- #include
- #include
- #include
- #include
- #include
-
- int main(void)
- {
- int fd;
- struct stat sStat;
- int has_bug = 0;
-
- fd = open("ftruncate_test2", O_CREAT | O_EXCL | O_RDWR, 0777);
- if (fd != -1)
- {
- if (ftruncate(fd, 0x7fffffffffffffffULL) == -1)
- {
- if (fstat(fd, &sStat) != -1)
- has_bug = sStat.st_size != 0;
- }
-
- unlink("ftruncate_test2");
- close(fd);
- }
-
- exit(has_bug ? 0 : 1);
- }
- ], has_ftruncate_length_bug=yes,
- has_ftruncate_length_bug=no,
- has_ftruncate_length_bug=no)
-if test $has_ftruncate_length_bug = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAS_FTRUNCATE_LENGTH_BUG)
-else
- AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING(for yield system call)
-AC_TRY_COMPILE([#include ], [int foo = SYS_yield;],
- ac_has_sys_yield=yes, ac_has_sys_yield=no)
-if test $ac_has_sys_yield = yes; then
- AC_DEFINE(HAVE_YIELD_SYSCALL)
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Checks for library functions go here.
-AC_CHECK_FUNCS(gmtime_r timegm _snwprintf _snprintf)
-AC_CHECK_FUNCS(futimes sysctl sysconf directio vm_allocate)
-AC_CHECK_FUNCS(setcontext getcontext copysign)
-AC_CHECK_FUNCS(gethrtime read_real_time)
-AC_CHECK_FUNCS(fsync)
-
-AC_MSG_CHECKING(for gettimeofday)
-dnl
-dnl Not using AC CHECK FUNC for gettimeofday because of unreliability of the
-dnl configure check for this function on some platform (hp-ux), and because
-dnl some platform may implement a non functional gettimeofday that always
-dnl returns error
-dnl
-define([gettimeofday_testcode], [
- #include
- #include
- #include
-
- int main()
- {
- int ret;
- struct timeval tv;
- ret = gettimeofday(&tv, NULL);
-
- exit(ret);
- }
-])
-AC_RUN_IFELSE([gettimeofday_testcode], has_working_gettimeofday=yes, has_working_gettimeofday=no, has_working_gettimeofday=dontknow)
-if test $has_working_gettimeofday = yes; then
- AC_DEFINE(HAVE_WORKING_GETTIMEOFDAY, 1)
- AC_MSG_RESULT(yes)
-elif test $has_working_gettimeofday = no; then
- AC_MSG_RESULT(no)
-else
- AC_MSG_RESULT(WARNING: cross-compiling not supported)
-fi
-
-AC_MSG_CHECKING(for clock_gettime)
-dnl
-dnl Not using AC CHECK FUNC for clock_gettime because of unreliability of the
-dnl configure check for this function on some platform (hp-ux), and because
-dnl some platform may implement a non functional clock_gettime that always
-dnl returns error
-dnl
-define([clock_gettime_testcode], [
- #include
- #include
- #include
-
- int main()
- {
- int ret;
- struct timespec ts;
- ret = clock_gettime(CLOCK_REALTIME, &ts);
-
- exit(ret);
- }
-])
-AC_RUN_IFELSE([clock_gettime_testcode], has_working_clock_gettime=yes, has_working_clock_gettime=no, has_working_clock_gettime=dontknow)
-if test $has_working_clock_gettime = yes; then
- AC_DEFINE(HAVE_WORKING_CLOCK_GETTIME, 1)
- AC_MSG_RESULT(yes)
-elif test $has_working_clock_gettime = no; then
- AC_MSG_RESULT(no)
-else
- AC_MSG_RESULT(WARNING: cross-compiling not supported)
-fi
-
-AC_MSG_CHECKING(for CLOCK_MONOTONIC)
-if test $has_working_clock_gettime = yes; then
- define([clock_monotonic_testcode], [
- #include
- #include
- #include
-
- int main()
- {
- int ret;
- struct timespec ts;
- ret = clock_gettime(CLOCK_MONOTONIC, &ts);
-
- exit(ret);
- }
- ])
- AC_RUN_IFELSE([clock_monotonic_testcode], has_clock_monotonic=yes, has_clock_monotonic=no, has_clock_monotonic=dontknow)
- if test $has_clock_monotonic = yes; then
- AC_DEFINE(HAVE_CLOCK_MONOTONIC, 1)
- AC_MSG_RESULT(yes)
- elif test $has_clock_monotonic = no; then
- AC_MSG_RESULT(no)
- else
- AC_MSG_RESULT(WARNING: cross-compiling not supported)
- fi
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Since autoconf 2.57 has problem checking utimes function on HPUX
-dnl using AC_CHECK_FUNC, we use AC_TRY_LINK to check utimes function
-dnl if AC_CHECK_FUNC cannot find it.
-AC_CHECK_FUNC(utimes, ac_has_utimes=yes, ac_has_utimes=no)
-if test $ac_has_utimes = yes; then
- AC_DEFINE(HAVE_UTIMES)
-else
- AC_MSG_CHECKING(utimes using ac_try_link)
- AC_TRY_LINK([#include ], [utimes("foo", 0);],
- ac_has_utimes=yes, ac_has_utimes=no)
- if test $ac_has_utimes = yes; then
- AC_DEFINE(HAVE_UTIMES)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-fi
-
-AC_MSG_CHECKING(for POLLRDNORM)
-AC_TRY_COMPILE([#include ], [int foo = (int) POLLRDNORM;],
- ac_has_pollrdnorm=yes, ac_has_pollrdnorm=no)
-if test $ac_has_pollrdnorm = yes; then
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-AC_CHECK_FUNC(poll, ac_has_poll=yes, ac_has_poll=no)
-if test $ac_has_poll = yes -a $ac_has_pollrdnorm = yes; then
- POLL_DIR=
- POLL_OBJ=
- AC_DEFINE(HAVE_POLL)
- dnl Check for INFTIM.
- AC_MSG_CHECKING(for INFTIM)
- if test "$platform_name" = "SunOS"; then
- AC_TRY_COMPILE([#include ], [int foo = (int) INFTIM;],
- ac_has_inftim=yes, ac_has_inftim=no)
- else
- AC_TRY_COMPILE([#include ], [int foo = (int) INFTIM;],
- ac_has_inftim=yes, ac_has_inftim=no)
- fi
- if test $ac_has_inftim = yes; then
- AC_DEFINE(HAVE_INFTIM)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-else
- POLL_DIR=poll
- POLL_OBJ="pollobjs.o"
-fi
-AC_SUBST(POLL_DIR)
-AC_SUBST(POLL_OBJ)
-
-AC_MSG_CHECKING(for CHAR_BIT)
-AC_TRY_COMPILE([#include ], [int i = CHAR_BIT;],
- ac_has_char_bits=yes, ac_has_char_bits=no)
-if test $ac_has_char_bits = yes; then
- AC_DEFINE(HAVE_CHAR_BIT)
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-AC_CHECK_FUNC(strtok_r, AC_DEFINE(HAVE_STRTOK_R))
-if test $ac_cv_func_strtok_r != yes; then
- AC_MSG_ERROR(strtok_r is required)
-fi
-
-AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R))
-if test $ac_cv_func_localtime_r != yes; then
- AC_MSG_CHECKING(localtime_r using ac_try_link)
- AC_TRY_LINK([#include ], [struct tm timer; localtime_r(0, &timer);],
- ac_cv_func_localtime_r=yes, ac_cv_func_localtime_r=no)
- if test $ac_cv_func_localtime_r = yes; then
- AC_DEFINE(HAVE_LOCALTIME_R)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_ERROR(localtime_r is required)
- fi
-fi
-
-AC_CHECK_FUNC(ctime_r, AC_DEFINE(HAVE_CTIME_R))
-if test $ac_cv_func_ctime_r != yes; then
- AC_MSG_CHECKING(ctime_r using ac_try_link)
- AC_TRY_LINK([#include ], [struct tm timer; ctime_r(0, &timer);],
- ac_cv_func_ctime_r=yes, ac_cv_func_ctime_r=no)
- if test $ac_cv_func_ctime_r = yes; then
- AC_DEFINE(HAVE_CTIME_R)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_ERROR(ctime_r is required)
- fi
-fi
-
-dnl Solaris uses statvfs instead of statfs. It still has statfs
-dnl but it's deprecated, so we prefer statvfs if it's available.
-dnl We also check if the statvfs64() prototype takes a statvfs64
-dnl struct since it does not on Solaris.
-AC_CHECK_FUNC(statvfs, AC_DEFINE(HAVE_STATVFS))
-if test $ac_cv_func_statvfs != yes; then
- AC_CHECK_FUNC(statfs, AC_DEFINE(HAVE_STATFS))
- if test $ac_cv_func_statfs != yes; then
- AC_MSG_ERROR(Either statfs or statvfs is required)
- fi
-else
- AC_MSG_CHECKING(whether statvfs64 prototype is broken)
- saved_cflags="$CFLAGS"
- CFLAGS="-Werror -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $CFLAGS"
- define([statvfs64_testcode], [
- #include
- #include
-
- int main(void) {
- char NameBuffer[[64]];
- struct statvfs infoBuffer;
- statvfs(NameBuffer, &infoBuffer);
- return 0;
- }
- ])
- AC_COMPILE_IFELSE([statvfs64_testcode],,)
- warn_str=`/usr/bin/tail -20 config.log | grep "statvfs64' from incompatible pointer"`
- if test "$warn_str" = ""; then
- AC_MSG_RESULT(no)
- else
- AC_MSG_RESULT(yes)
- AC_DEFINE(STATVFS64_PROTOTYPE_BROKEN)
- fi
- CFLAGS="$saved_cflags"
-fi
-
-dnl Check for thread self calls
-AC_CHECK_FUNCS(thread_self _lwp_self)
-
-dnl We need to figure out how to suspend and resume threads.
-dnl First, check if we have Mach threads
-AC_CHECK_FUNC(pthread_mach_thread_np, ac_has_mach_threads=yes,
- ac_has_mach_threads=no)
-if test $ac_has_mach_threads = yes; then
- AC_DEFINE(HAVE_MACH_THREADS)
-else
- dnl Perhaps we have Solaris threads. Try thr_suspend and thr_continue.
- AC_CHECK_FUNC(thr_suspend, ac_has_thr_suspend=yes, ac_has_thr_suspend=no)
- AC_CHECK_FUNC(thr_continue, ac_has_thr_continue=yes, ac_has_thr_continue=no)
- if test $ac_has_thr_suspend = yes -a $ac_has_thr_continue = yes; then
- AC_DEFINE(HAVE_SOLARIS_THREADS)
- else
- dnl freebsd has pthread_resume_np and pthread_suspend_np in libc_r
- dnl make sure that the pthread library is not in LIBS
- saved_libs="$LIBS"
- LIBS="$no_pthread_libs"
- AC_CHECK_LIB(c_r, pthread_resume_np, ac_pthread_resume_np=yes, ac_pthread_resume_np=no)
- if test $ac_pthread_resume_np = yes; then
- AC_DEFINE(HAVE_PTHREAD_RESUME_NP)
- fi
- AC_CHECK_LIB(c_r, pthread_suspend_np, ac_pthread_suspend_np=yes, ac_pthread_suspend_np=no)
- if test $ac_pthread_suspend_np = yes; then
- AC_DEFINE(HAVE_PTHREAD_SUSPEND_NP)
- fi
- LIBS="$saved_libs"
- dnl check the following pthread functions for AIX and HPUX
- AC_CHECK_FUNCS(pthread_suspend_np pthread_resume pthread_continue_np)
- if test "$platform_name" = "AIX"; then
- dnl On AIX pthread_continue and pthread_suspend are not functional, so don't test for them
- AC_CHECK_FUNCS(pthread_resume_np)
- elif test "$platform_name" = "HP-UX"; then
- dnl pthread_resume_np on HPUX has an extra flag parameter, so don't test for it
- AC_CHECK_FUNCS(pthread_suspend pthread_continue)
- else
- AC_CHECK_FUNCS(pthread_suspend pthread_continue pthread_resume_np)
- fi
- fi
-fi
-
-dnl Check to see if the system can return the thread priority boundaries
-dnl For these tests we need to pass PTHREAD_OPTIONS to the compiler
-dnl To do that we'll save CFLAG and restore afterwards
-saved_cflags="$CFLAGS"
-CFLAGS="$CFLAGS $PTHREAD_OPTIONS"
-AC_MSG_CHECKING([for sched_get_priority_[min|max] functionality])
-AC_TRY_RUN([
-#include
-#include
-
-int main(void)
-{
- int policy;
- struct sched_param schedParam;
- int max_priority;
- int min_priority;
-
- if (0 != pthread_getschedparam(pthread_self(), &policy, &schedParam))
- {
- exit(1);
- }
-
- max_priority = sched_get_priority_max(policy);
- min_priority = sched_get_priority_min(policy);
-
- exit(-1 == max_priority || -1 == min_priority);
-}
- ], ac_has_sched_get_priorty=yes, ac_has_sched_get_priorty=no,
- ac_has_sched_get_priorty=no)
-if test $ac_has_sched_get_priorty = yes; then
- AC_DEFINE(HAVE_SCHED_GET_PRIORITY)
- AC_MSG_RESULT(yes)
-else
- if test "$platform_name" = "AIX"; then
- AC_DEFINE(PAL_THREAD_PRIORITY_MAX, 127)
- AC_DEFINE(PAL_THREAD_PRIORITY_MIN, 1)
- AC_MSG_RESULT(no; using AIX values of 1-127)
- else
- AC_MSG_RESULT(no; don't know proper values for this platform)
- fi
-fi
-CFLAGS="$saved_cflags"
-
-dnl Check for pthread_mutex_init. If it exists, we presume we also
-dnl have pthread condition variables. These allow us to implement an
-dnl alternative to posix or SYSV semaphores on platforms where we're
-dnl not going to use signals (i.e. those with Mach exceptions).
-AC_CHECK_FUNC(pthread_mutex_init, ac_has_pthread_mutexes=yes,
- ac_has_pthread_mutexes=no)
-if test $ac_has_pthread_mutexes = yes; then
- AC_DEFINE(HAS_PTHREAD_MUTEXES)
-fi
-
-dnl Check for semget. If it exists we can use SYSV semaphores.
-AC_CHECK_FUNC(semget, ac_has_semget=yes, ac_has_semget=no)
-if test $ac_has_semget = yes; then
- AC_DEFINE(HAS_SYSV_SEMAPHORES)
-fi
-
-dnl Check for thread_set_exception_ports. If it exists, we have Mach
-dnl exceptions, and we'll use those in place of our signal handlers.
-AC_CHECK_FUNC(thread_set_exception_ports, ac_has_mach_exceptions=yes,
- ac_has_mach_exceptions=no)
-if test $ac_has_mach_exceptions = yes; then
- AC_DEFINE(HAVE_MACH_EXCEPTIONS)
-fi
-
-dnl Check for vm_read_overwrite. If it exists, we have Mach VM
-dnl read/write functions, and we'll use those in place of ptrace.
-AC_CHECK_FUNC(vm_read_overwrite, ac_has_vm_read_overwrite=yes,
- ac_has_vm_read_overwrite=no)
-if test $ac_has_vm_read_overwrite = yes; then
- AC_DEFINE(HAVE_VM_READ)
-fi
-
-if test $ac_bad_sigreturn_in_libc_r = no; then
- dnl Check for sigreturn in libc_r. If it's there, we can call it. If not,
- dnl check for _thread_sys_sigreturn. FreeBSD 4.4 doesn't alias
- dnl _thread_sys_sigreturn to sigreturn in libc_r.
- AC_CHECK_LIB(c_r, sigreturn, ac_has_sigreturn=yes, ac_has_sigreturn=no, $PTHREAD_OPTIONS)
- if test $ac_has_sigreturn = yes; then
- AC_DEFINE(HAVE_SIGRETURN)
- else
- dnl Check for _thread_sys_sigreturn now.
- AC_CHECK_LIB(c_r, _thread_sys_sigreturn, ac_has_thread_sys_sigreturn=yes,
- ac_has_thread_sys_sigreturn=no, -pthread)
- if test $ac_has_thread_sys_sigreturn = yes; then
- AC_DEFINE(HAVE__THREAD_SYS_SIGRETURN)
- fi
- fi
-fi
-
-dnl Determine whether tzname is supported. tzname is not the
-dnl preferred means of reading time zone names on Unix, but
-dnl its (at times incorrect) distinction between standard and
-dnl daylight saving times is required for the PAL.
-AC_MSG_CHECKING(for tzname global variable)
-AC_TRY_LINK([#include ], [char *c = tzname[0];],
-ac_tzname_var=yes, ac_tzname_var=no)
-if test $ac_tzname_var = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_TZNAME)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Figure out where to get the offset of this timezone.
-dnl Many SysV systems have an extern timezone, while BSD
-dnl systems typically have a tm_gmtoff field in struct tm.
-dnl We prefer the BSD version, but we can use the SysV one
-dnl if necessary.
-dnl The SysV solution is insufficient for cases in which a
-dnl timezone's GMT offset is dependent on the current date,
-dnl as is the case for countries whose time zone has varied
-dnl over the years.
-AC_MSG_CHECKING(for tm_gmtoff field in struct tm)
-AC_TRY_COMPILE([#include ], [struct tm t; t.tm_gmtoff;],
-ac_tm_struct_gmtoff=yes, ac_tm_struct_gmtoff=no)
-if test $ac_tm_struct_gmtoff = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_TM_GMTOFF)
-else
- AC_MSG_RESULT(no)
- AC_MSG_CHECKING(for timezone global variable)
- AC_TRY_LINK([#include ], [extern long int timezone;],
- ac_timezone_var=yes, ac_timezone_var=no)
- if test $ac_timezone_var = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_TIMEZONE_VAR)
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Either tm_gmtoff in struct tm or extern timezone is required)
- fi
-fi
-
-dnl Checking whether mmap() can shared-map from /dev/zero
-AC_MSG_CHECKING(for mmap(MAP_SHARED) of /dev/zero)
-AC_TRY_RUN([
- #include
- #include
- #include
- #include
-
- int main(void) {
- int devzero;
- void *retval;
-
- devzero = open("/dev/zero", O_RDWR);
- if (-1 == devzero) {
- exit(1);
- }
- retval = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, devzero, 0);
- if (retval == (void *)-1) {
- exit(1);
- }
- exit(0);
- }
-], has_mmap_dev_zero=yes, has_mmap_dev_zero=no,
- has_mmap_dev_zero=no)
-if test $has_mmap_dev_zero = yes; then
- AC_DEFINE(HAVE_MMAP_DEV_ZERO)
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl Checking whether mmap uses its hint parameter
-AC_MSG_CHECKING(whether mmap uses its hint parameter)
-AC_TRY_RUN([
- #include
- #include
- #include
- #include
- #include
-
- #ifndef MAP_ANON
- #define MAP_ANON MAP_ANONYMOUS
- #endif
-
- int main(void) {
- void *hint, *ptr;
- int pagesize;
- int fd;
-
- pagesize = getpagesize();
- fd = open("/etc/passwd", O_RDONLY);
- if (fd == -1) {
- exit(1);
- }
- ptr = mmap(NULL, pagesize, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
- if (ptr == MAP_FAILED) {
- exit(1);
- }
- hint = mmap(NULL, pagesize, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
- if (hint == MAP_FAILED) {
- exit(1);
- }
- if (munmap(ptr, pagesize) != 0) {
- exit(1);
- }
- if (munmap(hint, pagesize) != 0) {
- exit(1);
- }
- ptr = mmap(hint, pagesize, PROT_NONE, MAP_PRIVATE, fd, 0);
- if (ptr == MAP_FAILED || ptr != hint) {
- exit(1);
- }
- exit(0);
- }
-], mmap_ignores_hint=no, mmap_ignores_hint=yes, mmap_ignores_hint=yes)
-if test $mmap_ignores_hint = yes; then
- AC_DEFINE(MMAP_IGNORES_HINT)
- AC_MSG_RESULT(no)
-else
- AC_MSG_RESULT(yes)
- dnl Check whether mmap ignores its protection parameter when mapping
- dnl anonymous pages.
- AC_MSG_CHECKING(whether mmap ignores PROT_NONE when mapping anonymously)
- AC_TRY_RUN([
- #include
- #include
- #include
- #include
- #include
-
- #ifndef MAP_ANON
- #define MAP_ANON MAP_ANONYMOUS
- #endif
-
- int handle_signal(int signal) {
- /* If we reach this, we've crashed due to mmap honoring
- PROT_NONE. */
- _exit(1);
- }
-
- int main(void) {
- int *ptr;
- struct sigaction action;
-
- ptr = (int *) mmap(NULL, getpagesize(), PROT_NONE,
- MAP_ANON | MAP_PRIVATE, -1, 0);
- if (ptr == (int *) MAP_FAILED) {
- exit(0);
- }
- action.sa_handler = &handle_signal;
- action.sa_flags = 0;
- sigemptyset(&action.sa_mask);
- if (sigaction(SIGBUS, &action, NULL) != 0) {
- exit(0);
- }
- if (sigaction(SIGSEGV, &action, NULL) != 0) {
- exit(0);
- }
- /* This will drop us into the signal handler if PROT_NONE
- is honored. */
- *ptr = 123;
- exit(0);
- }
- ], has_mmap_protections=no, has_mmap_protections=yes,
- has_mmap_protections=no)
- if test $has_mmap_protections = yes; then
- AC_MSG_RESULT(no)
- else
- AC_DEFINE(MMAP_ANON_IGNORES_PROTECTION)
- AC_MSG_RESULT(yes)
- fi
-fi
-
-dnl Checking whether it is legal to call mmap(MAP_FIXED) on an already mapped region
-AC_MSG_CHECKING(whether it is legal to call mmap(MAP_FIXED) on an already mapped region)
-define([mmap_remap_testcode], [
- #include
- #include
- #include
- #include
-
- #ifndef MAP_ANON
- #define MAP_ANON MAP_ANONYMOUS
- #endif
-
- int main()
- {
- int iRet = 0;
- void * pAddr = MAP_FAILED;
- int MemSize = 1024;
-
- MemSize = getpagesize();
- pAddr = mmap(0x0, MemSize, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0);
- if (pAddr == MAP_FAILED)
- exit(1);
-
- pAddr = mmap(pAddr, MemSize, PROT_WRITE | PROT_READ, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
- if (pAddr == MAP_FAILED)
- iRet = 1;
-
- munmap(pAddr, MemSize); // don't care of this
- exit (iRet);
- }
-])
-AC_LINK_IFELSE([mmap_remap_testcode],,[AC_MSG_ERROR([Failed to compile and link test code])])
-AC_RUN_IFELSE([mmap_remap_testcode], mmap_allows_remap=yes, mmap_allows_remap=no, mmap_allows_remap=dontknow)
-if test $mmap_allows_remap = yes; then
- AC_MSG_RESULT(yes)
-else
- if test $mmap_allows_remap = no; then
- AC_DEFINE(MMAP_DOESNOT_ALLOW_REMAP,1)
- AC_MSG_RESULT(no)
- else
- AC_MSG_RESULT(WARNING: cross-compiling not supported)
- fi
-fi
-
-dnl Checking whether a file region may be shared-mapped twice in the same process
-AC_MSG_CHECKING(whether a file region may be shared-mapped twice in the same process)
-define([mmap_multiple_shared_mappings_testcode], [
-#include
-#include
-#include