[numerics] fix missing includes and strdup detection for *BSD
#define _XOPEN_SOURCE 700
-#if (__linux || __APPLE__)
+#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
+#include <unistd.h>
+#endif
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200112L)
#elif _MSC_VER
#define strdup _strdup
#else
@@ -14,13 +22,13 @@ static inline char* strdup(const char* src)
return dest;
}
#endif
+
#include "SiconosConfig.h" // for HAVE_GAMS_C_API
#include <math.h>
+
#ifdef HAVE_GAMS_C_API
#include <stdio.h>
-#include <string.h>
#include <assert.h>
-#include <stdlib.h>
#include <stdbool.h>
#include <float.h>
