From 2adb94db3032332ad2235aa032bb195aba89687c Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 1 Oct 2014 19:52:27 +0100 Subject: Improve build system compiler detection. - Check the CXX environment variable inside find_compiler instead of doing it separately. - Use a test file instead of checking for version output. This ensures we are using a working compiler. - Pipe the output through run_test which makes debugging problems considerably easier. - Detect Xcode versions of Clang properly by returning the LLVM version number instead of the Xcode one. --- configure | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'configure') diff --git a/configure b/configure index de45bdc79..a9a97dca5 100755 --- a/configure +++ b/configure @@ -131,19 +131,13 @@ if ($interactive) { } } -$config{CXX} = defined $ENV{CXX} && !system("$ENV{CXX} -v > /dev/null 2>&1") ? $ENV{CXX} : find_compiler(); -if ($config{CXX} eq "") { - print "A C++ compiler could not be detected on your system!\n"; - print "Set the CXX environment variable to the full path if this is incorrect.\n"; +$config{CXX} = find_compiler($config{CXX} || $ENV{CXX}); +unless ($config{CXX}) { + print "A suitable C++ compiler could not be detected on your system!\n"; + print "Set the CXX environment variable to the compiler binary path if this is incorrect.\n"; exit 1; } - my %compiler = get_compiler_info($config{CXX}); -if ($compiler{UNSUPPORTED}) { - print "Your C++ compiler is too old to build InspIRCd!\n"; - print "Reason: $compiler{REASON}\n"; - exit 1; -} $config{HAS_CLOCK_GETTIME} = run_test 'clock_gettime()', test_file($config{CXX}, 'clock_gettime.cpp', '-lrt'); $config{HAS_EVENTFD} = run_test 'eventfd()', test_file($config{CXX}, 'eventfd.cpp'); -- cgit v1.2.3