CMake: defines and uses macro add_llvm_definitions for keeping track
of compiler parameters explicitly added by the build
specification. This macro replaces the cmake built-in
`add_definitions'.

Detects glibc and defines _GNU_SOURCE accordingly.

Resolves bug 3882.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68428 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 9e5bcd8..5ab3935 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -52,6 +52,11 @@
 check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
 check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
 
+check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)
+if( LLVM_USING_GLIBC )
+  add_llvm_definitions( -D_GNU_SOURCE )
+endif()
+
 include(CheckCXXCompilerFlag)
 check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG)