[geany/geany] 42c02d: Merge pull request #1155 from b4n/cxx-check

Colomban Wendling git-noreply at xxxxx
Sat Aug 20 17:55:26 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 20 Aug 2016 17:55:26 UTC
Commit:      42c02db149391e32801543f3b6dbebcf43b4ff3b
             https://github.com/geany/geany/commit/42c02db149391e32801543f3b6dbebcf43b4ff3b

Log Message:
-----------
Merge pull request #1155 from b4n/cxx-check

Test whether the C++ compiler works by compiling a test program


Modified Paths:
--------------
    configure.ac
    m4/geany-prog-cxx.m4

Modified: configure.ac
6 lines changed, 1 insertions(+), 5 deletions(-)
===================================================================
@@ -30,11 +30,7 @@ AC_PROG_CC_C99
 AM_PROG_CC_C_O
 
 AC_PROG_CXX
-# check for C++ compiler explicitly and fail if none is found, do this check
-# after AC_PROG_CXX has set the CXX environment variable
-if ! which $CXX >/dev/null 2>&1; then
-	AC_MSG_ERROR([No C++ compiler found. Please install a C++ compiler.])
-fi
+GEANY_PROG_CXX
 
 AC_PROG_INSTALL
 AC_PROG_LN_S


Modified: m4/geany-prog-cxx.m4
20 lines changed, 20 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,20 @@
+dnl GEANY_PROG_CXX
+dnl Check for a working C++ compiler.
+dnl like AC_PROG_CXX, but makes sure the compiler actually works instead of
+dnl falling back on a reasonable default only.
+dnl
+dnl You must call AC_PROG_CXX yourself before this macro.
+AC_DEFUN([GEANY_PROG_CXX],
+[
+	AC_REQUIRE([AC_PROG_CXX])
+
+	AC_LANG_PUSH([C++])
+	AC_MSG_CHECKING([whether the C++ compiler works])
+	AC_COMPILE_IFELSE(
+			[AC_LANG_PROGRAM([[class Test {public: static int main() {return 0;}};]],
+			                 [[Test::main();]])],
+			[AC_MSG_RESULT([yes])],
+			[AC_MSG_RESULT([no])
+			 AC_MSG_ERROR([The C++ compiler $CXX does not work. Please install a working C++ compiler or define CXX to the appropriate value.])])
+	AC_LANG_POP([C++])
+])



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list