--- imach/src/imach.c 2014/12/22 11:40:47 1.166 +++ imach/src/imach.c 2014/12/22 13:50:56 1.167 @@ -1,6 +1,11 @@ -/* $Id: imach.c,v 1.166 2014/12/22 11:40:47 brouard Exp $ +/* $Id: imach.c,v 1.167 2014/12/22 13:50:56 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.167 2014/12/22 13:50:56 brouard + Summary: Testing uname and compiler version and if compiled 32 or 64 + + Testing on Linux 64 + Revision 1.166 2014/12/22 11:40:47 brouard *** empty log message *** @@ -520,6 +525,7 @@ #include #include +#include #include #include /* extern int errno; */ @@ -538,6 +544,7 @@ #include #endif + #ifdef NLOPT #include typedef struct { @@ -580,11 +587,11 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.166 2014/12/22 11:40:47 brouard Exp $ */ +/* $Id: imach.c,v 1.167 2014/12/22 13:50:56 brouard Exp $ */ /* $State: Exp $ */ char version[]="Imach version 0.99, September 2014,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121)"; -char fullversion[]="$Revision: 1.166 $ $Date: 2014/12/22 11:40:47 $"; +char fullversion[]="$Revision: 1.167 $ $Date: 2014/12/22 13:50:56 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -5418,6 +5425,65 @@ calandcheckages(int imx, int maxwav, dou return (1); } +syscompilerinfo() + { + /* #include "syscompilerinfo.h"*/ +#include +#if defined(__GNUC__) +# if defined(__GNUC_PATCHLEVEL__) +# define __GNUC_VERSION__ (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) +# else +# define __GNUC_VERSION__ (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100) +# endif +#endif + +// http://stackoverflow.com/questions/4605842/how-to-identify-platform-compiler-from-preprocessor-macros +#ifdef _WIN32 // note the underscore: without it, it's not msdn official! + // Windows (x64 and x86) +#elif __unix__ // all unices, not all compilers + // Unix +#elif __linux__ + // linux +#elif __APPLE__ + // Mac OS, not sure if this is covered by __posix__ and/or __unix__ though... +#endif + +/* __MINGW32__ */ +/* __CYGWIN__ */ +/* __MINGW64__ */ +// http://msdn.microsoft.com/en-us/library/b0084kay.aspx +/* _MSC_VER //the Visual C++ compiler is 17.00.51106.1, the _MSC_VER macro evaluates to 1700. Type cl /? */ +/* _MSC_FULL_VER //the Visual C++ compiler is 15.00.20706.01, the _MSC_FULL_VER macro evaluates to 150020706 */ +/* _WIN64 // Defined for applications for Win64. */ +/* _M_X64 // Defined for compilations that target x64 processors. */ +/* _DEBUG // Defined when you compile with /LDd, /MDd, and /MTd. */ +#include +#if UINTPTR_MAX == 0xffffffff + printf("32-bit \n"); /* 32-bit */ +#elif UINTPTR_MAX == 0xffffffffffffffff + printf("64-bit \n");/* 64-bit */ +#else + printf("wtf-bit \n"); /* wtf */ +#endif + +struct utsname sysInfo; + + if (uname(&sysInfo) != -1) { + puts(sysInfo.sysname); + puts(sysInfo.nodename); + puts(sysInfo.release); + puts(sysInfo.version); + puts(sysInfo.machine); + } + else + perror("uname() error"); + printf("GNU C version %d\n", __GNUC_VERSION__); + printf("GNU libc version: %s\n", gnu_get_libc_version()); + + } /***********************************************/ /**************** Main Program *****************/ @@ -5595,6 +5661,8 @@ int main(int argc, char *argv[]) optionfilext=%s\n\ optionfilefiname='%s'\n",pathimach,pathtot,path,optionfile,optionfilext,optionfilefiname); + syscompilerinfo(); + printf("Local time (at start):%s",strstart); fprintf(ficlog,"Local time (at start): %s",strstart); fflush(ficlog);