]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Quest for platform independence [7] finalize Windows/MinGW support
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Oct 2012 20:24:53 +0000 (20:24 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Oct 2012 20:24:53 +0000 (20:24 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@27034 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/checks/check_for_system_features.cmake
deal.II/include/deal.II/base/config.h.in
deal.II/source/base/utilities.cc

index 696f4ac21c9de88fb00f5e3ed316f2f493ff110b..da87dbc9c1cbe44e92818354bdf2230dad907ade 100644 (file)
 # Check for various system features:
 #
 
-
 INCLUDE(TestBigEndian)
+TEST_BIG_ENDIAN(DEAL_II_WORDS_BIGENDIAN)
+
 
 #
 # Check for various posix (and linux) specific header files:
 #
 
-CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
 CHECK_INCLUDE_FILE("sys/resource.h"  HAVE_SYS_RESOURCE_H)
 CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
 CHECK_INCLUDE_FILE("sys/times.h" HAVE_SYS_TIMES_H)
@@ -31,13 +31,23 @@ CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
 
 
 #
-# Check for various posix specific functions:
+# Check for various posix specific functions. On a posix system they should
+# be all defined in unistd.h. On other platforms, most notably
+# Windows/MinGW unistd.h is available but not all posix functions. So test
+# for each funtion as well.
 #
 
+CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
 CHECK_FUNCTION_EXISTS(gethostname HAVE_GETHOSTNAME)
 CHECK_FUNCTION_EXISTS(getpid HAVE_GETPID)
 CHECK_FUNCTION_EXISTS(rand_r HAVE_RAND_R)
 CHECK_FUNCTION_EXISTS(times HAVE_TIMES)
 
-TEST_BIG_ENDIAN(DEAL_II_WORDS_BIGENDIAN)
 
+#
+# Export DEAL_II_MSVC if we are on a Windows platform.
+#
+
+IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
+  SET(DEAL_II_MSVC TRUE)
+ENDIF()
index f46af94bd7677326a089844fac475277c936e078..9c1205a3d065ec73d1c4a4b88e3e30fbd55f9f45 100644 (file)
 /* Defined if deal.II was configured with LAPACK support */
 #cmakedefine HAVE_LIBLAPACK
 
-/* Define to 1 if you have the `daxpy_' function. */
+/* Defined if you have the `daxpy_' function. */
 #cmakedefine HAVE_DAXPY_
 
-/* Define to 1 if you have the `dgeevx_' function. */
+/* Defined if you have the `dgeevx_' function. */
 #cmakedefine HAVE_DGEEVX_
 
-/* Define to 1 if you have the `dgeev_' function. */
+/* Defined if you have the `dgeev_' function. */
 #cmakedefine HAVE_DGEEV_
 
-/* Define to 1 if you have the `dgelsd_' function. */
+/* Defined if you have the `dgelsd_' function. */
 #cmakedefine HAVE_DGELSD_
 
-/* Define to 1 if you have the `dgemm_' function. */
+/* Defined if you have the `dgemm_' function. */
 #cmakedefine HAVE_DGEMM_
 
-/* Define to 1 if you have the `dgemv_' function. */
+/* Defined if you have the `dgemv_' function. */
 #cmakedefine HAVE_DGEMV_
 
-/* Define to 1 if you have the `dgeqrf_' function. */
+/* Defined if you have the `dgeqrf_' function. */
 #cmakedefine HAVE_DGEQRF_
 
-/* Define to 1 if you have the `dgesdd_' function. */
+/* Defined if you have the `dgesdd_' function. */
 #cmakedefine HAVE_DGESDD_
 
-/* Define to 1 if you have the `dgesvd_' function. */
+/* Defined if you have the `dgesvd_' function. */
 #cmakedefine HAVE_DGESVD_
 
-/* Define to 1 if you have the `dgetrf_' function. */
+/* Defined if you have the `dgetrf_' function. */
 #cmakedefine HAVE_DGETRF_
 
-/* Define to 1 if you have the `dgetri_' function. */
+/* Defined if you have the `dgetri_' function. */
 #cmakedefine HAVE_DGETRI_
 
-/* Define to 1 if you have the `dgetrs_' function. */
+/* Defined if you have the `dgetrs_' function. */
 #cmakedefine HAVE_DGETRS_
 
-/* Define to 1 if you have the `dorgqr_' function. */
+/* Defined if you have the `dorgqr_' function. */
 #cmakedefine HAVE_DORGQR_
 
-/* Define to 1 if you have the `dormqr_' function. */
+/* Defined if you have the `dormqr_' function. */
 #cmakedefine HAVE_DORMQR_
 
-/* Define to 1 if you have the `dstev_' function. */
+/* Defined if you have the `dstev_' function. */
 #cmakedefine HAVE_DSTEV_
 
-/* Define to 1 if you have the `dsyevx_' function. */
+/* Defined if you have the `dsyevx_' function. */
 #cmakedefine HAVE_DSYEVX_
 
-/* Define to 1 if you have the `dsygvx_' function. */
+/* Defined if you have the `dsygvx_' function. */
 #cmakedefine HAVE_DSYGVX_
 
-/* Define to 1 if you have the `sgeevx_' function. */
+/* Defined if you have the `sgeevx_' function. */
 #cmakedefine HAVE_SGEEVX_
 
-/* Define to 1 if you have the `sgeev_' function. */
+/* Defined if you have the `sgeev_' function. */
 #cmakedefine HAVE_SGEEV_
 
-/* Define to 1 if you have the `sgelsd_' function. */
+/* Defined if you have the `sgelsd_' function. */
 #cmakedefine HAVE_SGELSD_
 
-/* Define to 1 if you have the `sgemm_' function. */
+/* Defined if you have the `sgemm_' function. */
 #cmakedefine HAVE_SGEMM_
 
-/* Define to 1 if you have the `sgemv_' function. */
+/* Defined if you have the `sgemv_' function. */
 #cmakedefine HAVE_SGEMV_
 
-/* Define to 1 if you have the `sgeqrf_' function. */
+/* Defined if you have the `sgeqrf_' function. */
 #cmakedefine HAVE_SGEQRF_
 
-/* Define to 1 if you have the `sgesdd_' function. */
+/* Defined if you have the `sgesdd_' function. */
 #cmakedefine HAVE_SGESDD_
 
-/* Define to 1 if you have the `sgesvd_' function. */
+/* Defined if you have the `sgesvd_' function. */
 #cmakedefine HAVE_SGESVD_
 
-/* Define to 1 if you have the `sgetrf_' function. */
+/* Defined if you have the `sgetrf_' function. */
 #cmakedefine HAVE_SGETRF_
 
-/* Define to 1 if you have the `sgetri_' function. */
+/* Defined if you have the `sgetri_' function. */
 #cmakedefine HAVE_SGETRI_
 
-/* Define to 1 if you have the `sgetrs_' function. */
+/* Defined if you have the `sgetrs_' function. */
 #cmakedefine HAVE_SGETRS_
 
-/* Define to 1 if you have the `sorgqr_' function. */
+/* Defined if you have the `sorgqr_' function. */
 #cmakedefine HAVE_SORGQR_
 
-/* Define to 1 if you have the `sormqr_' function. */
+/* Defined if you have the `sormqr_' function. */
 #cmakedefine HAVE_SORMQR_
 
-/* Define to 1 if you have the `sstev_' function. */
+/* Defined if you have the `sstev_' function. */
 #cmakedefine HAVE_SSTEV_
 
-/* Define to 1 if you have the `ssyevx_' function. */
+/* Defined if you have the `ssyevx_' function. */
 #cmakedefine HAVE_SSYEVX_
 
-/* Define to 1 if you have the `ssygvx_' function. */
+/* Defined if you have the `ssygvx_' function. */
 #cmakedefine HAVE_SSYGVX_
 
 /* Defined if you have the `strtrs_' function. */
  * Configured in check_for_system_features: *
  ********************************************/
 
+/* Defined if the system stores words with the most significant byte first */
+#cmakedefine DEAL_II_WORDS_BIGENDIAN
 
-/* Defined if you have the <unistd.h> header file. */
-#cmakedefine HAVE_UNISTD_H
 
 /* Defined if you have the <sys/resource.h> header file */
 #cmakedefine HAVE_SYS_RESOURCE_H
 
-/* Defined if you have the <sys/times.h> header file. */
-#cmakedefine HAVE_SYS_TIMES_H
-
 /* Defined if you have the <sys/time.h> header file. */
 #cmakedefine HAVE_SYS_TIME_H
 
+/* Defined if you have the <sys/times.h> header file. */
+#cmakedefine HAVE_SYS_TIMES_H
+
 /* Defined if you have the <sys/types.h> header file. */
 #cmakedefine HAVE_SYS_TYPES_H
 
+
+/* Defined if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H
+
 /* Defined if you have the "gethostname" function. */
 #cmakedefine HAVE_GETHOSTNAME
 
 /* Defined if you have the "times" function. */
 #cmakedefine HAVE_TIMES
 
-/* Defined if the system stores words with the most significant byte first */
-#cmakedefine DEAL_II_WORDS_BIGENDIAN
 
+/* Defined if the deal.II was configured on a native Windows platform. */
+#cmakedefine DEAL_II_MSVC
 
 
 
index 6996f21d2d981773a780c6d2c14706030520ecc4..6483621e6f948a9689d60dd136ce9ffdae311ddc 100644 (file)
@@ -512,9 +512,13 @@ namespace Utilities
 
     std::string get_hostname ()
     {
+#if defined(HAVE_UNISTD_H) && defined(HAVE_GETHOSTNAME)
       const unsigned int N=1024;
       char hostname[N];
       gethostname (&(hostname[0]), N-1);
+#else
+      std::string hostname("unknown");
+#endif
       return hostname;
     }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.