From 8a4dcc025fb58802bd75aaa11f3a5dfd671f8101 Mon Sep 17 00:00:00 2001 From: brouard Date: Sat, 7 Sep 2024 14:43:16 +0200 Subject: [PATCH] * src/imach.c: Adapting to mingw64-clang --- src/imach.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/imach.c b/src/imach.c index f6eb307..9fa2988 100644 --- a/src/imach.c +++ b/src/imach.c @@ -1348,9 +1348,9 @@ Important routines #include #include -#if defined(__GNUC__) -#include /* Doesn't work on Windows */ -#endif +/* #if defined(__GNUC__) */ +/* #include /\* Doesn't work on Windows *\/ */ +/* #endif */ #include #include @@ -14187,12 +14187,16 @@ void syscompilerinfo(int logged) #if defined __INTEL_COMPILER #if defined(__GNUC__) - struct utsname sysInfo; /* For Intel on Linux and OS/X */ + struct utsname sysInfo; /* For Intel on Linux and OS/X but not not on linux mingw-w64*/ #endif #elif defined(__GNUC__) #ifndef __APPLE__ -#include /* Only on gnu */ +#ifndef __MINGW32__ +#include /* Only on gnu */ +/* #include */ /* Only on gnu */ + #endif #endif +#ifndef __MINGW32__ struct utsname sysInfo; int cross = CROSS; if (cross){ @@ -14200,6 +14204,7 @@ void syscompilerinfo(int logged) if(logged) fprintf(ficlog, "Cross-"); } #endif +#endif printf("Compiled with:");if(logged)fprintf(ficlog,"Compiled with:"); #if defined(__clang__) @@ -14210,6 +14215,9 @@ void syscompilerinfo(int logged) #endif #if defined(__GNUC__) || defined(__GNUG__) printf(" GNU GCC/G++");if(logged)fprintf(ficlog," GNU GCC/G++");/* GNU GCC/G++. --------------------------------------------- */ +#if defined(__MINGW32__) + printf(" with MINGW");if(logged)fprintf(ficlog," with MINGW");/* With MINGW. --------------------------------------------- */ +#endif #endif #if defined(__HP_cc) || defined(__HP_aCC) printf(" Hewlett-Packard C/aC++");if(logged)fprintf(fcilog," Hewlett-Packard C/aC++"); /* Hewlett-Packard C/aC++. ---------------------------------- */ @@ -14273,14 +14281,16 @@ void syscompilerinfo(int logged) printf(" using GNU C version %d.\n", __GNUC_VERSION__); if(logged) fprintf(ficlog, " using GNU C version %d.\n", __GNUC_VERSION__); +#ifndef __MINGW32__ if (uname(&sysInfo) != -1) { printf("Running on: %s %s %s %s %s\n",sysInfo.sysname, sysInfo.nodename, sysInfo.release, sysInfo.version, sysInfo.machine); if(logged) fprintf(ficlog,"Running on: %s %s %s %s %s\n ",sysInfo.sysname, sysInfo.nodename, sysInfo.release, sysInfo.version, sysInfo.machine); } else perror("uname() error"); +#endif //#ifndef __INTEL_COMPILER -#if !defined (__INTEL_COMPILER) && !defined(__APPLE__) +#if !defined (__INTEL_COMPILER) && !defined(__APPLE__)&& !defined(__MINGW32__) /* MING hasn't yet libc version */ printf("GNU libc version: %s\n", gnu_get_libc_version()); if(logged) fprintf(ficlog,"GNU libc version: %s\n", gnu_get_libc_version()); #endif @@ -14893,7 +14903,8 @@ int main(int argc, char *argv[]) split(pathtot,path,optionfile,optionfilext,optionfilefiname); printf("\npathtot=%s,\npath=%s,\noptionfile=%s \noptionfilext=%s \noptionfilefiname=%s\n",pathtot,path,optionfile,optionfilext,optionfilefiname); #ifdef WIN32 - _chdir(path); /* Can be a relative path */ + /*_chdir(path);*/ /* Can be a relative path */ + chdir(path); /* Can be a relative path */ if(_getcwd(pathcd,MAXLINE) > 0) /* So pathcd is the full path */ #else chdir(path); /* Can be a relative path */ @@ -15739,7 +15750,8 @@ This file: %s
Title=%s
Datafile=%s strcpy(pathr,path); strcat(pathr,optionfilefiname); #ifdef WIN32 - _chdir(optionfilefiname); /* Move to directory named optionfile */ + /*_chdir(optionfilefiname);*/ /* Move to directory named optionfile */ + chdir(optionfilefiname); /* Move to directory named optionfile */ #else chdir(optionfilefiname); /* Move to directory named optionfile */ #endif @@ -17146,7 +17158,8 @@ Please run with mle=-1 to get a correct covariance matrix.\n",ageminpar,agemaxpa printf("Before Current directory %s!\n",pathcd); #ifdef WIN32 - if (_chdir(pathcd) != 0) + /* if (_chdir(pathcd) != 0) */ + if (chdir(pathcd) != 0) printf("Can't move to directory %s!\n",path); if(_getcwd(pathcd,MAXLINE) > 0) #else -- 2.43.0