#At file:///home/os136802/mysql/develop/repo/falcon-sunstudio/
2816 Olav Sandstaa 2008-09-12
Bug#39419 Falcon should not be compiled if compiler or options do not support
exceptions
Adds a check to configure that will verify that the compiler with the
given compiler options will produce code that handles exceptions. This
test is done by actually running a small program that throws and
catches an exception. If this program does not work correctly, Falcon
will not be included in the build.
Note that the checks for determining the correct options for
exceptions support had to be moved to an earlier place in configure.
modified:
storage/falcon/plug.in
=== modified file 'storage/falcon/plug.in'
=== modified file 'storage/falcon/plug.in'
--- a/storage/falcon/plug.in 2008-08-20 13:27:29 +0000
+++ b/storage/falcon/plug.in 2008-09-12 20:55:47 +0000
@@ -57,6 +57,52 @@
with_plugin_falcon="no"
fi
+
+# Determine compiler flags for exception support that will be used by Falcon
+AC_LANG_PUSH([C++])
+ac_save_CXXFLAGS="$CXXFLAGS"
+
+AC_CACHE_CHECK([compiler flag to enable exceptions],
+ falcon_cxx_enable_exceptions,[
+ CXXFLAGS="$ac_save_CXXFLAGS -fexceptions -lstdc++"
+ AC_TRY_LINK([],
+ [int i = 0;
+ i++;],
+ falcon_cxx_enable_exceptions="-fexceptions -lstdc++",
+ falcon_cxx_enable_exceptions=""
+ )
+ ])
+
+# CXXFLAGS including exception support that will be use when compiling Falcon
+CXXFLAGS="$ac_save_CXXFLAGS $falcon_cxx_enable_exceptions"
+
+# Check that exceptions works in an executable by actually running a
+# compiled program and throwing and catching an exception
+AC_CACHE_CHECK([if compiler and compiler options support C++ exceptions for Falcon],
+ falcon_supported_by_compiler,[
+AC_TRY_RUN([
+ int main() {
+ try {
+ throw 1;
+ }
+ catch (int) {
+ return 0;
+ }
+ return -1;
+ }
+], falcon_supported_by_compiler="yes",
+ falcon_supported_by_compiler="no", )
+])
+
+CXXFLAGS=$ac_save_CXXFLAGS
+AC_LANG_POP([C++])
+
+if test "$falcon_supported_by_compiler" != "yes"; then
+ mysql_plugin_falcon="no"
+ with_plugin_falcon="no"
+fi
+
+
# Generate Makefile for TransformLib.
MYSQL_PLUGIN_ACTIONS(falcon,[
AC_CONFIG_FILES(storage/falcon/TransformLib/Makefile)
@@ -74,17 +120,6 @@
)
])
- AC_CACHE_CHECK([compiler flag to enable exceptions],
- falcon_cxx_enable_exceptions,[
- CXXFLAGS="$ac_save_CXXFLAGS -fexceptions -lstdc++"
- AC_TRY_LINK([],
- [int i = 0;
- i++;],
- falcon_cxx_enable_exceptions="-fexceptions -lstdc++",
- falcon_cxx_enable_exceptions=""
- )
- ])
-
AC_CACHE_CHECK([compiler flag to silence offsetof warnings],
falcon_cxx_no_invalid_offsetof,[
CXXFLAGS="$ac_save_CXXFLAGS -Wno-invalid-offsetof"
| Thread |
|---|
| • bzr commit into mysql-6.0-falcon branch (olav:2816) Bug#39419 | Olav Sandstaa | 12 Sep |