From 7e1629bdf1454f21fe48a8d3fe5b06be3a5b2552 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 22 Mar 2017 17:44:33 +0000 Subject: Switch compiler detection to use a more reliable method. Its clear that parsing version output is not reliable enough so switch to using a method which is less likely to break. --- make/test/clock_gettime.cpp | 1 + make/test/compiler.cpp | 2 ++ make/test/compiler_info.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 make/test/compiler_info.cpp (limited to 'make/test') diff --git a/make/test/clock_gettime.cpp b/make/test/clock_gettime.cpp index 91d8cd412..d111d591f 100644 --- a/make/test/clock_gettime.cpp +++ b/make/test/clock_gettime.cpp @@ -1,6 +1,7 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2013 Peter Powell * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public diff --git a/make/test/compiler.cpp b/make/test/compiler.cpp index e2cbd9f64..f01423325 100644 --- a/make/test/compiler.cpp +++ b/make/test/compiler.cpp @@ -1,6 +1,8 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2016 Attila Molnar + * Copyright (C) 2014-2015 Peter Powell * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public diff --git a/make/test/compiler_info.cpp b/make/test/compiler_info.cpp new file mode 100644 index 000000000..10b156fc8 --- /dev/null +++ b/make/test/compiler_info.cpp @@ -0,0 +1,41 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2017 Peter Powell + * + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. + * + * This program 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 General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#include + +#if defined __INTEL_COMPILER // Also defines __clang__ and __GNUC__ +# define INSPIRCD_COMPILER_NAME "Intel" +# define INSPIRCD_COMPILER_VERSION (__INTEL_COMPILER / 100) << '.' << (__INTEL_COMPILER % 100) +#elif defined __clang__ // Also defines __GNUC__ +# if defined __apple_build_version__ +# define INSPIRCD_COMPILER_NAME "AppleClang" +# else +# define INSPIRCD_COMPILER_NAME "Clang" +# endif +# define INSPIRCD_COMPILER_VERSION __clang_major__ << '.' << __clang_minor__ +#elif defined __GNUC__ +# define INSPIRCD_COMPILER_NAME "GCC" +# define INSPIRCD_COMPILER_VERSION __GNUC__ << '.' << __GNUC_MINOR__ +#endif + +int main() { + std::cout << "NAME " << INSPIRCD_COMPILER_NAME << std::endl + << "VERSION " << INSPIRCD_COMPILER_VERSION << std::endl; + return 0; +} -- cgit v1.2.3