From bb238532ff25f003c97a90d37569f16e1753b642 Mon Sep 17 00:00:00 2001
From: Luis Antonio Obis Aparicio <luis.antonio.obis@gmail.com>
Date: Thu, 18 Jul 2024 18:05:22 +0200
Subject: [PATCH] explicitly include unistd.h

---
 source/framework/core/inc/TRestMetadata.h        | 4 ++++
 source/framework/core/src/TRestGDMLParser.cxx    | 3 ---
 source/framework/core/src/startup.cpp            | 4 ----
 source/framework/tools/inc/TRestTools.h          | 4 ++++
 source/framework/tools/src/TRestStringOutput.cxx | 5 -----
 5 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/source/framework/core/inc/TRestMetadata.h b/source/framework/core/inc/TRestMetadata.h
index e0e51018d..32f6c2032 100644
--- a/source/framework/core/inc/TRestMetadata.h
+++ b/source/framework/core/inc/TRestMetadata.h
@@ -43,6 +43,10 @@
 #include "TRestVersion.h"
 #include "tinyxml.h"
 
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
 /* We keep using REST_RELEASE, REST_VERSION(2,X,Y) and REST_VERSION_CODE
    to determine the installed REST version and avoid too much prototyping
 
diff --git a/source/framework/core/src/TRestGDMLParser.cxx b/source/framework/core/src/TRestGDMLParser.cxx
index e50764303..b0023d864 100644
--- a/source/framework/core/src/TRestGDMLParser.cxx
+++ b/source/framework/core/src/TRestGDMLParser.cxx
@@ -1,9 +1,6 @@
 #include "TRestGDMLParser.h"
 
 #include <filesystem>
-#ifdef __APPLE__
-#include <unistd.h>
-#endif
 
 using namespace std;
 
diff --git a/source/framework/core/src/startup.cpp b/source/framework/core/src/startup.cpp
index 8e2481208..64c50a159 100644
--- a/source/framework/core/src/startup.cpp
+++ b/source/framework/core/src/startup.cpp
@@ -4,10 +4,6 @@
 #include <Windows.h>
 #endif  // WIN32
 
-#ifdef __APPLE__
-#include <unistd.h>
-#endif
-
 #include "RVersion.h"
 #include "TEnv.h"
 #include "TRestDataBase.h"
diff --git a/source/framework/tools/inc/TRestTools.h b/source/framework/tools/inc/TRestTools.h
index 81069d187..68f2fa9e3 100644
--- a/source/framework/tools/inc/TRestTools.h
+++ b/source/framework/tools/inc/TRestTools.h
@@ -42,6 +42,10 @@
 #define EXTERN_IMP
 #endif
 
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
 const std::string PARAMETER_NOT_FOUND_STR = "NO_SUCH_PARA";
 const double PARAMETER_NOT_FOUND_DBL = -99999999;
 
diff --git a/source/framework/tools/src/TRestStringOutput.cxx b/source/framework/tools/src/TRestStringOutput.cxx
index fe9b3041a..b6500881e 100644
--- a/source/framework/tools/src/TRestStringOutput.cxx
+++ b/source/framework/tools/src/TRestStringOutput.cxx
@@ -1,5 +1,4 @@
 #include "TRestStringOutput.h"
-
 #include "TRestStringHelper.h"
 
 using namespace std;
@@ -9,10 +8,6 @@ using namespace std;
 #include <conio.h>
 #endif  // WIN32
 
-#ifdef __APPLE__
-#include <unistd.h>
-#endif
-
 int Console::GetWidth() {
 #ifdef WIN32
     CONSOLE_SCREEN_BUFFER_INFO csbi;
-- 
GitLab