From 6cb12f010d5e1e2eb3e447a5f2ff7723fe3beb54 Mon Sep 17 00:00:00 2001 From: "N. Brouard" Date: Mon, 22 Dec 2014 13:50:56 +0000 Subject: [PATCH] Summary: Testing uname and compiler version and if compiled 32 or 64 Testing on Linux 64 --- src/imach.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/imach.c b/src/imach.c index c3cc6d6..dd297e6 100644 --- a/src/imach.c +++ b/src/imach.c @@ -1,6 +1,9 @@ /* $Id$ $State$ $Log$ + Revision 1.166 2014/12/22 11:40:47 brouard + *** empty log message *** + Revision 1.165 2014/12/16 11:20:36 brouard Summary: After compiling on Visual C @@ -517,6 +520,7 @@ #include #include +#include #include #include /* extern int errno; */ @@ -535,6 +539,7 @@ #include #endif + #ifdef NLOPT #include typedef struct { @@ -5415,6 +5420,65 @@ calandcheckages(int imx, int maxwav, double *agemin, double *agemax, int *nberr, 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 *****************/ @@ -5592,6 +5656,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); -- 2.43.0