Revision: 65368
          http://sourceforge.net/p/brlcad/code/65368
Author:   starseeker
Date:     2015-06-17 21:18:30 +0000 (Wed, 17 Jun 2015)
Log Message:
-----------
Take a fairly major whack at config_win.h - untested.  This will almost 
certainly break something...

Modified Paths:
--------------
    brlcad/trunk/CMakeLists.txt
    brlcad/trunk/include/common.h
    brlcad/trunk/include/config_win.h.in

Modified: brlcad/trunk/CMakeLists.txt
===================================================================
--- brlcad/trunk/CMakeLists.txt 2015-06-17 21:14:03 UTC (rev 65367)
+++ brlcad/trunk/CMakeLists.txt 2015-06-17 21:18:30 UTC (rev 65368)
@@ -1545,6 +1545,7 @@
   CHECK_CXX_FLAG("std=gnu++98" BUILD_TYPES Debug)
   CHECK_CXX_FLAG("std=gnu++98" BUILD_TYPES Release VARS CXX03_FLAG)
 endif()
+CHECK_C_FLAG("Za" BUILD_TYPES ALL)
 
 # What POSIX do we want to target, initially?  See
 # http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
@@ -1793,6 +1794,9 @@
 # Solaris lexer library
 BRLCAD_CHECK_LIBRARY(SOLARIS_LEXER l yyless)
 
+# Windows ws2_32 library
+BRLCAD_CHECK_LIBRARY(WS2_32 ws2_32 gethostname)
+
 # timeSetEvent in Windows memory management
 if("${HAVE_TIMESETEVENT}" MATCHES "^${HAVE_TIMESETEVENT}$")
   set(CMAKE_REQUIRED_LIBRARIES_BAK ${CMAKE_REQUIRED_LIBRARIES})
@@ -2016,7 +2020,7 @@
 BRLCAD_FUNCTION_EXISTS(getegid HAVE_GETEGID)
 BRLCAD_FUNCTION_EXISTS(getenv_s HAVE_GETENV_S)
 BRLCAD_FUNCTION_EXISTS(geteuid HAVE_GETEUID)
-BRLCAD_FUNCTION_EXISTS(gethostname HAVE_GETHOSTNAME)
+BRLCAD_FUNCTION_EXISTS(gethostname HAVE_GETHOSTNAME REQUIRED_LIBS 
${WS2_32_LIBRARY})
 BRLCAD_FUNCTION_EXISTS(getloadavg HAVE_GETLOADAVG)
 BRLCAD_FUNCTION_EXISTS(getopt_long HAVE_GETOPT_LONG)
 BRLCAD_FUNCTION_EXISTS(getprogname HAVE_GETPROGNAME) # bsd
@@ -2132,6 +2136,78 @@
   CONFIG_H_APPEND(BRLCAD "#define F_OK 0\n")
 endif(HAVE__ACCESS)
 
+# if we've got _chmod, need some additional defines - TODO, should this
+# be tested for somehow?
+if(HAVE__CHMOD)
+CONFIG_H_APPEND(BRLCAD "
+/* for _chmod() */
+#ifndef S_IFMT
+#  define S_IFMT _S_IFMT
+#endif
+#ifndef S_IFDIR
+#  define S_IFDIR _S_IFDIR
+#endif
+#ifndef S_IFCHR
+#  define S_IFCHR _S_IFCHR
+#endif
+#ifndef S_IFREG
+#  define S_IFREG _S_IFREG
+#endif
+
+#ifndef S_IREAD
+#  define S_IREAD _S_IREAD
+#endif
+#ifndef S_IWRITE
+#  define S_IWRITE _S_IWRITE
+#endif
+#ifndef S_IEXEC
+#  define S_IEXEC _S_IEXEC
+#endif
+
+#ifndef S_IRUSR
+#  define S_IRUSR      S_IREAD
+#endif
+#ifndef S_IWUSR
+#  define S_IWUSR      S_IWRITE
+#endif
+#ifndef S_IXUSR
+#  define S_IXUSR      S_IEXEC
+#endif
+#ifndef S_IRWXU
+#  define S_IRWXU      ((S_IRUSR)|(S_IWUSR)|(S_IXUSR))
+#endif
+
+#ifndef S_IRGRP
+#  define S_IRGRP      ((S_IRUSR)>>3)
+#endif
+#ifndef S_IWGRP
+#  define S_IWGRP      ((S_IWUSR)>>3)
+#endif
+#ifndef S_IXGRP
+#  define S_IXGRP      ((S_IXUSR)>>3)
+#endif
+#ifndef S_IROTH
+#  define S_IROTH      ((S_IRUSR)>>6)
+#endif
+#ifndef S_IWOTH
+#  define S_IWOTH      ((S_IWUSR)>>6)
+#endif
+#ifndef S_IXOTH
+#  define S_IXOTH      ((S_IXUSR)>>6)
+#endif
+
+#ifndef S_ISDIR
+#  define S_ISDIR(x)   ((x) & S_IFDIR)
+#endif
+#ifndef S_ISREG
+#  define S_ISREG(x)   ((x) & S_IFREG)
+#endif
+#ifndef S_ISLNK
+#  define S_ISLNK(x)   (0)
+#endif
+")
+endif(HAVE__CHMOD)
+
 BRLCAD_PFUNCTION_EXISTS(nextafter)
 BRLCAD_PFUNCTION_EXISTS(execvp)
 BRLCAD_PFUNCTION_EXISTS(fdopen)
@@ -2148,6 +2224,36 @@
 BRLCAD_PFUNCTION_EXISTS(sys_nerr)
 BRLCAD_PFUNCTION_EXISTS(getcwd)
 
+# for _fileno
+if(HAVE__FILENO)
+CONFIG_H_APPEND(BRLCAD "
+/*
+ * defines for stdin/stdout/stderr file numbers
+ */
+#if !defined(STDIN_FILENO) && defined(_STDIN_FILENO)
+#  define STDIN_FILENO _STDIN_FILENO
+#endif
+#if !defined(STDIN_FILENO) && HAVE__FILENO
+#  define STDIN_FILENO _fileno(stdin)
+#endif
+
+#if !defined(STDOUT_FILENO) && defined(_STDOUT_FILENO)
+#  define STDOUT_FILENO _STDOUT_FILENO
+#endif
+#if !defined(STDOUT_FILENO) && HAVE__FILENO
+#  define STDOUT_FILENO _fileno(stdout)
+#endif
+
+#if !defined(STDERR_FILENO) && defined(_STDERR_FILENO)
+#  define STDERR_FILENO _STDERR_FILENO
+#endif
+#if !defined(STDERR_FILENO) && HAVE__FILENO
+#  define STDERR_FILENO _fileno(stderr)
+#endif
+
+")
+endif(HAVE__FILENO)
+
 # strcasecmp/stricmp
 BRLCAD_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
 if(HAVE__STRICMP)

Modified: brlcad/trunk/include/common.h
===================================================================
--- brlcad/trunk/include/common.h       2015-06-17 21:14:03 UTC (rev 65367)
+++ brlcad/trunk/include/common.h       2015-06-17 21:18:30 UTC (rev 65368)
@@ -43,6 +43,7 @@
 
 #  if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__) && 
!defined(CMAKE_HEADERS)
 #    include "config_win.h"
+#    include "brlcad_config.h"
 #  else
 #    include "brlcad_config.h"
 #  endif  /* _WIN32 */

Modified: brlcad/trunk/include/config_win.h.in
===================================================================
--- brlcad/trunk/include/config_win.h.in        2015-06-17 21:14:03 UTC (rev 
65367)
+++ brlcad/trunk/include/config_win.h.in        2015-06-17 21:18:30 UTC (rev 
65368)
@@ -32,9 +32,6 @@
 #include <fcntl.h>
 #include <errno.h>
 
-/* !!! this should not be here, should fix the build system settings */
-#define __STDC__ 1
-
 /* 4127 conditional expression is constant
  * 4244 conversion from type 1 to type 2
  * 4305 truncation
@@ -42,7 +39,7 @@
  * 4018 signed/unsigned mismatch
  * 4996 deprecation warning on non-secure functions
  */
-#pragma warning( disable : 4127 4244 4312 4996 )
+/*#pragma warning( disable : 4127 4244 4312 4996 )*/
 /* #pragma warning( disable : 4244 4305 4018) */
 
 /*
@@ -97,7 +94,7 @@
 
 #define YY_NO_UNISTD_H         1
 #define YYTOKENTYPE            1
-
+#if 0
 /* it we're compiling c++ sources, there's a possibility that we'll be
  * including libc++ headers (e.g., iostream) where these underscore IO
  * function hacks become counterproductive.
@@ -160,7 +157,7 @@
 #define sys_errlist _sys_errlist
 #define sys_nerr _sys_nerr
 #define getcwd _getcwd
-
+#endif
 /* set up stat */
 #if defined(SIZEOF_VOID_P) && SIZEOF_VOID_P == 8
 #   define stat _stati64
@@ -182,7 +179,7 @@
 #   define lseek _lseek
 #endif
 
-#cmakedefine fmax __max
+/*#cmakedefine fmax __max*/
 #define ioctl ioctlsocket
 
 #define SHARED_PTR_BOOST       1
@@ -205,7 +202,7 @@
 typedef unsigned int uid_t;
 typedef int mode_t;
 
-
+#if 0
 /*
  * for chmod()
  */
@@ -296,16 +293,16 @@
 #define W_OK 2
 #define X_OK 1
 #define F_OK 0
-
+#endif
 /*
  * faking it
  */
 
-#define fork() -1
+/*#define fork() -1*/
 #define getprogname() _pgmptr
-#cmakedefine rint(_X) (floor((_X) + 0.5))
+/*#cmakedefine rint(_X) (floor((_X) + 0.5))*/
 #define sleep(_SECONDS) (Sleep(1000 * (_SECONDS)))
-
+#if 0
 #ifndef __cplusplus
 /*  Microsoft specific inline specifier */
 #   define inline __inline
@@ -341,6 +338,7 @@
 #ifndef STDERR_FILENO
 #  define STDERR_FILENO _fileno(stderr)
 #endif
+#endif
 
 #endif /* if defined(_WIN32) */
 #endif /* ifndef IGNORE_CONFIG_H */

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to