summaryrefslogtreecommitdiff
path: root/make
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-02-20 00:49:14 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-02-20 00:49:14 +0100
commit8ff409cb9a393559ebda3990ab2926c9a42d87a1 (patch)
tree0bcb602efb916fc4d85f261a66b159cbebf37823 /make
parent7bea24293aae2edb54f748101b45f52aca027a96 (diff)
parent755c259b639050378159837facb5fbfa2447b3b8 (diff)
Merge pull request #997 from SaberUK/master+compiler-detection
Improve compiler detection in configure; update supported compiler tests.
Diffstat (limited to 'make')
-rw-r--r--make/configure.pm20
-rw-r--r--make/template/main.mk6
-rw-r--r--make/test/compiler.cpp6
3 files changed, 20 insertions, 12 deletions
diff --git a/make/configure.pm b/make/configure.pm
index 8653edaac..2cd5beb60 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -93,6 +93,13 @@ sub __get_template_settings($$$) {
return %settings;
}
+sub __test_compiler($) {
+ my $compiler = shift;
+ return 0 unless run_test("`$compiler`", !system "$compiler -v >/dev/null 2>&1");
+ return 0 unless run_test("`$compiler`", test_file($compiler, 'compiler.cpp', '-fno-rtti'), 'compatible');
+ return 1;
+}
+
sub cmd_clean {
unlink CONFIGURE_CACHE_FILE;
}
@@ -177,9 +184,10 @@ sub cmd_update {
exit 0;
}
-sub run_test($$) {
- my ($what, $result) = @_;
- print_format "Checking whether <|GREEN $what|> is available ... ";
+sub run_test($$;$) {
+ my ($what, $result, $adjective) = @_;
+ $adjective ||= 'available';
+ print_format "Checking whether <|GREEN $what|> is $adjective ... ";
print_format $result ? "<|GREEN yes|>\n" : "<|RED no|>\n";
return $result;
}
@@ -244,10 +252,8 @@ sub get_compiler_info($) {
sub find_compiler {
my @compilers = qw(c++ g++ clang++ icpc);
foreach my $compiler (shift || @compilers) {
- return $compiler if run_test "`$compiler`", test_file $compiler, 'compiler.cpp';
- if ($^O eq 'darwin') {
- return $compiler if run_test "`xcrun $compiler`", test_file "xcrun $compiler", 'compiler.cpp';
- }
+ return $compiler if __test_compiler $compiler;
+ return "xcrun $compiler" if $^O eq 'darwin' && __test_compiler "xcrun $compiler";
}
}
diff --git a/make/template/main.mk b/make/template/main.mk
index 39e2b1c23..9ac43e3bb 100644
--- a/make/template/main.mk
+++ b/make/template/main.mk
@@ -37,7 +37,7 @@ COMPILER = @COMPILER_NAME@
SYSTEM = @SYSTEM_NAME@
BUILDPATH ?= $(PWD)/build
SOCKETENGINE = @SOCKETENGINE@
-CORECXXFLAGS = -fPIC -fvisibility-inlines-hidden -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter -Wshadow
+CORECXXFLAGS = -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter -Wshadow
LDLIBS = -lstdc++
CORELDFLAGS = -rdynamic -L. $(LDFLAGS)
PICLDFLAGS = -fPIC -shared -rdynamic $(LDFLAGS)
@@ -60,10 +60,6 @@ INSTMODE_LIB = 0640
@ENDIF
@ENDIF
-@IFNEQ $(SYSTEM)-$(COMPILER) darwin-GCC
- CORECXXFLAGS += -fvisibility=hidden
-@ENDIF
-
@IFNEQ $(SYSTEM) darwin
LDLIBS += -pthread
@ENDIF
diff --git a/make/test/compiler.cpp b/make/test/compiler.cpp
index 1c3e1d875..d78f07830 100644
--- a/make/test/compiler.cpp
+++ b/make/test/compiler.cpp
@@ -18,11 +18,17 @@
#include <iostream>
#if defined _LIBCPP_VERSION
+# include <type_traits>
# include <unordered_map>
#else
+# include <tr1/type_traits>
# include <tr1/unordered_map>
#endif
+#if defined __APPLE__ && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ == 1
+# error "LLVM-GCC 4.2.1 has broken visibility support."
+#endif
+
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;