/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Copyright (c) 2011-2021 The plumed team (see the PEOPLE file at the root of the distribution for a list of names) See http://www.plumed.org for more information. This file is part of plumed, version 2. plumed is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. plumed is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with plumed. If not, see . +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ #include "Config.h" #include "version.h" #include #include namespace PLMD { namespace config { // This is a fix to allow conda to correctly replace paths in binary files. // These functions should not be static or they will be optimized away! const char* plumed_root() {return "@PLUMED_ROOT@";} const char* plumed_soext() {return "@SOEXT@";} const char* plumed_htmldir() {return "@htmldir@";} const char* plumed_includedir() {return "@includedir@";} const char* plumed_program_name() {return "@program_name@";} std::string getSoExt() { return plumed_soext(); } bool isInstalled() { return @ISINSTALLED@; } std::string getPlumedRoot() { char *env = std::getenv("PLUMED_ROOT"); std::string ss; if( env == NULL) { ss=plumed_root(); } else { ss=std::string( env ); } return ss; } std::string getPlumedHtmldir() { if(!isInstalled()) return getPlumedRoot(); char *env = std::getenv("PLUMED_HTMLDIR"); std::string ss; if( env == NULL) { ss=plumed_htmldir(); } else { ss=std::string( env ); } return ss; } std::string getPlumedIncludedir() { if(!isInstalled()) return getPlumedRoot()+"/src/include"; char *env = std::getenv("PLUMED_INCLUDEDIR"); std::string ss; if( env == NULL) { ss=plumed_includedir(); } else { ss=std::string( env ); } return ss; } std::string getPlumedProgramName() { if(!isInstalled()) return "plumed"; char *env = std::getenv("PLUMED_PROGRAM_NAME"); std::string ss; if( env == NULL) { ss=plumed_program_name(); } else { ss=std::string( env ); } return ss; } std::string getEnvCommand() { return "env PLUMED_ROOT=\""+getPlumedRoot()+"\""+ " env PLUMED_HTMLDIR=\""+getPlumedHtmldir()+"\""+ " env PLUMED_INCLUDEDIR=\""+getPlumedIncludedir()+"\""+ " env PLUMED_PROGRAM_NAME=\""+getPlumedProgramName()+"\""+ " env PLUMED_IS_INSTALLED=\""+(@ISINSTALLED@?"yes":"no")+"\""; } std::string getVersion() { return PLUMED_VERSION_SHORT; } std::string getVersionLong() { return PLUMED_VERSION_LONG; } std::string getVersionGit() { return PLUMED_VERSION_GIT; } std::string getMakefile() { static const unsigned char confu [] = { #include "Makefile.conf.xxd" , 0x00 }; auto conf=(char*)confu; return std::string(conf,conf+std::strlen(conf)); } bool hasMatheval() { #if __PLUMED_HAS_MATHEVAL return true; #else return false; #endif } bool hasDlopen() { #if __PLUMED_HAS_DLOPEN return true; #else return false; #endif } bool hasCregex() { #if __PLUMED_HAS_CREGEX return true; #else return false; #endif } bool hasMolfile() { #if __PLUMED_HAS_MOLFILE_PLUGINS return true; #else return false; #endif } bool hasExternalMolfile() { #if __PLUMED_HAS_EXTERNAL_MOLFILE_PLUGINS return true; #else return false; #endif } bool hasZlib() { #if __PLUMED_HAS_ZLIB return true; #else return false; #endif } bool hasXdrfile() { #if __PLUMED_HAS_XDRFILE return true; #else return false; #endif } std::string getCompilationDate() { return __DATE__; } std::string getCompilationTime() { return __TIME__; } } }