summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/CMakeLists.txt17
-rw-r--r--compiler-rt/ConfigureChecks.cmake16
-rw-r--r--compiler-rt/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake18
-rw-r--r--compiler-rt/config.h.cmake3
-rw-r--r--compiler-rt/lib/CMakeLists.txt4
-rw-r--r--compiler-rt/lib/divdc3.c4
-rw-r--r--compiler-rt/lib/divsc3.c4
-rw-r--r--compiler-rt/lib/divxc3.c4
-rw-r--r--compiler-rt/lib/floatundidf.c2
-rw-r--r--compiler-rt/lib/int_lib.h28
-rw-r--r--compiler-rt/lib/muldc3.c4
-rw-r--r--compiler-rt/lib/mulsc3.c4
-rw-r--r--compiler-rt/lib/mulxc3.c4
13 files changed, 103 insertions, 9 deletions
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 49f21a09927..791ed6fbd83 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -8,14 +8,13 @@ set(PACKAGE_VERSION 1.0svn)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
-if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
- message(FATAL_ERROR "In-source builds are not allowed.
-CMake would overwrite the makefiles distributed with Compiler-RT.
-Please create a directory and run cmake from there, passing the path
-to this source directory as the last argument.
-This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
-Please delete them.")
-endif()
+SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules )
+
+# Disallow in-source build
+INCLUDE( MacroEnsureOutOfSourceBuild )
+MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
+ "${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
+ )
install(DIRECTORY include
DESTINATION .
@@ -30,3 +29,5 @@ ADD_SUBDIRECTORY( lib )
# Tests are being ignored for until the very basics are working.
# ADD_SUBDIRECTORY( test )
+INCLUDE( ConfigureChecks.cmake )
+CONFIGURE_FILE( config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
diff --git a/compiler-rt/ConfigureChecks.cmake b/compiler-rt/ConfigureChecks.cmake
new file mode 100644
index 00000000000..24ec55718bc
--- /dev/null
+++ b/compiler-rt/ConfigureChecks.cmake
@@ -0,0 +1,16 @@
+INCLUDE( CheckIncludeFile )
+INCLUDE( CheckFunctionExists )
+
+SET( PACKAGE ${PACKAGE_NAME} )
+SET( VERSION ${PACKAGE_VERSION} )
+
+SET( BINARYDIR ${CMAKE_BINARY_DIR} )
+SET( SOURCEDIR ${CMAKE_SOURCE_DIR} )
+
+# HEADER FILES
+CHECK_INCLUDE_FILE( sys/byteorder.h HAVE_SYS_BYTEORDER_H )
+
+# FUNCTIONS
+#CHECK_FUNCTION_EXISTS( strlcpy HAVE_STRLCPY )
+
+#Example ConfigureChecks.cmake
diff --git a/compiler-rt/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake b/compiler-rt/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
new file mode 100644
index 00000000000..a0669365bf9
--- /dev/null
+++ b/compiler-rt/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
@@ -0,0 +1,18 @@
+# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
+
+macro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage )
+
+string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource )
+if( _insource )
+ message( SEND_ERROR "${_errorMessage}" )
+ message( FATAL_ERROR
+ "In-source builds are not allowed.
+ CMake would overwrite the makefiles distributed with Compiler-RT.
+ Please create a directory and run cmake from there, passing the path
+ to this source directory as the last argument.
+ This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
+ Please delete them."
+ )
+endif( _insource )
+
+endmacro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD )
diff --git a/compiler-rt/config.h.cmake b/compiler-rt/config.h.cmake
new file mode 100644
index 00000000000..85049236916
--- /dev/null
+++ b/compiler-rt/config.h.cmake
@@ -0,0 +1,3 @@
+#cmakedefine HAVE_SYS_BYTEORDER_H ${HAVE_SYS_BYTEORDER}
+
+#Example config.h.cmake
diff --git a/compiler-rt/lib/CMakeLists.txt b/compiler-rt/lib/CMakeLists.txt
index 56a9b94ae8d..ec789504ab1 100644
--- a/compiler-rt/lib/CMakeLists.txt
+++ b/compiler-rt/lib/CMakeLists.txt
@@ -1,6 +1,10 @@
#
# Create a library called "CompilerRT" which includes the source files.
+#INCLUDE_DIRECTORIES(
+# ${CMAKE_CURRENT_BINARY_DIR}
+#)
+
# Generic functions needed for each architecture
SET( SRCS
diff --git a/compiler-rt/lib/divdc3.c b/compiler-rt/lib/divdc3.c
index 1b19e665f61..ccdf526a886 100644
--- a/compiler-rt/lib/divdc3.c
+++ b/compiler-rt/lib/divdc3.c
@@ -15,6 +15,10 @@
#include <math.h>
#include <complex.h>
+#if !defined(INFINITY) && defined(HUGE_VAL)
+#define INFINITY HUGE_VAL
+#endif
+
// Returns: the quotient of (a + ib) / (c + id)
double _Complex
diff --git a/compiler-rt/lib/divsc3.c b/compiler-rt/lib/divsc3.c
index bea15cdc4e0..f2529970c28 100644
--- a/compiler-rt/lib/divsc3.c
+++ b/compiler-rt/lib/divsc3.c
@@ -15,6 +15,10 @@
#include <math.h>
#include <complex.h>
+#if !defined(INFINITY) && defined(HUGE_VAL)
+#define INFINITY HUGE_VAL
+#endif
+
// Returns: the quotient of (a + ib) / (c + id)
float _Complex
diff --git a/compiler-rt/lib/divxc3.c b/compiler-rt/lib/divxc3.c
index 4ee09b9dbb6..982397f5f12 100644
--- a/compiler-rt/lib/divxc3.c
+++ b/compiler-rt/lib/divxc3.c
@@ -17,6 +17,10 @@
#include <math.h>
#include <complex.h>
+#if !defined(INFINITY) && defined(HUGE_VAL)
+#define INFINITY HUGE_VAL
+#endif
+
// Returns: the quotient of (a + ib) / (c + id)
long double _Complex
diff --git a/compiler-rt/lib/floatundidf.c b/compiler-rt/lib/floatundidf.c
index f019d693ba5..708d614aca4 100644
--- a/compiler-rt/lib/floatundidf.c
+++ b/compiler-rt/lib/floatundidf.c
@@ -98,4 +98,4 @@ __floatundidf(du_int a)
fb.u.low = (su_int)a; // mantissa-low
return fb.f;
}
-#endif \ No newline at end of file
+#endif
diff --git a/compiler-rt/lib/int_lib.h b/compiler-rt/lib/int_lib.h
index 7d09c856f5e..e8365506f3a 100644
--- a/compiler-rt/lib/int_lib.h
+++ b/compiler-rt/lib/int_lib.h
@@ -20,6 +20,34 @@
#include <limits.h>
+// TODO: Improve this to minimal pre-processor hackish'ness.
+#if defined (__SVR4) && defined (__sun)
+// config.h build via CMake.
+//#include <config.h>
+
+// Solaris header for endian and byte swap
+//#if defined HAVE_SYS_BYTEORDER_H
+#include <sys/byteorder.h>
+
+// Solaris defines endian by setting _LITTLE_ENDIAN or _BIG_ENDIAN
+#ifdef _BIG_ENDIAN
+# define IS_BIG_ENDIAN
+#endif
+#ifdef _LITTLE_ENDIAN
+# define IS_LITTLE_ENDIAN
+#endif
+
+#ifdef IS_BIG_ENDIAN
+#define __BIG_ENDIAN__ 1
+#define __LITTLE_ENDIAN__ 0
+#endif
+#ifdef IS_LITTLE_ENDIAN
+#define __BIG_ENDIAN__ 0
+#define __LITTLE_ENDIAN__ 1
+#endif
+
+#endif //End of Solaris ifdef.
+
#ifdef __LITTLE_ENDIAN__
#if __LITTLE_ENDIAN__
#define _YUGA_LITTLE_ENDIAN 1
diff --git a/compiler-rt/lib/muldc3.c b/compiler-rt/lib/muldc3.c
index b945e8e3827..3549823c2ef 100644
--- a/compiler-rt/lib/muldc3.c
+++ b/compiler-rt/lib/muldc3.c
@@ -15,6 +15,10 @@
#include <math.h>
#include <complex.h>
+#if !defined(INFINITY) && defined(HUGE_VAL)
+#define INFINITY HUGE_VAL
+#endif
+
// Returns: the product of a + ib and c + id
double _Complex
diff --git a/compiler-rt/lib/mulsc3.c b/compiler-rt/lib/mulsc3.c
index bc47a47ea41..c723032cd73 100644
--- a/compiler-rt/lib/mulsc3.c
+++ b/compiler-rt/lib/mulsc3.c
@@ -15,6 +15,10 @@
#include <math.h>
#include <complex.h>
+#if !defined(INFINITY) && defined(HUGE_VAL)
+#define INFINITY HUGE_VAL
+#endif
+
// Returns: the product of a + ib and c + id
float _Complex
diff --git a/compiler-rt/lib/mulxc3.c b/compiler-rt/lib/mulxc3.c
index e38ab0dcf6e..840e458b9ae 100644
--- a/compiler-rt/lib/mulxc3.c
+++ b/compiler-rt/lib/mulxc3.c
@@ -17,6 +17,10 @@
#include <math.h>
#include <complex.h>
+#if !defined(INFINITY) && defined(HUGE_VAL)
+#define INFINITY HUGE_VAL
+#endif
+
// Returns: the product of a + ib and c + id
long double _Complex
OpenPOWER on IntegriCloud