summaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2017-05-14 17:41:55 (GMT)
committerBrad King <brad.king@kitware.com>2017-05-31 17:06:00 (GMT)
commit6181a9e00ef50a44d873c771c028f2ca88fd6be5 (patch)
tree35d6df5b00df061abea8755d9cfb3deb77274453 /bootstrap
parentd375618921e16c229e748c87ea16190f2de74337 (diff)
downloadCMake-6181a9e00ef50a44d873c771c028f2ca88fd6be5.zip
CMake-6181a9e00ef50a44d873c771c028f2ca88fd6be5.tar.gz
CMake-6181a9e00ef50a44d873c771c028f2ca88fd6be5.tar.bz2
bootstrap: prefer to use standard flags for C and CXX
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap65
1 files changed, 37 insertions, 28 deletions
diff --git a/bootstrap b/bootstrap
index b1f8670..a9cf0b2 100755
--- a/bootstrap
+++ b/bootstrap
@@ -6,6 +6,17 @@ die() {
echo "$@" 1>&2 ; exit 1
}
+# Compile flag extraction function.
+cmake_extract_standard_flags()
+{
+ cd "${cmake_source_dir}/Modules/Compiler/"
+ for file in ${1:-*}-${2}.cmake; do
+ cat "${file}" \
+ | sed -n "s/ *set *( *CMAKE_${2}${3}_EXTENSION_COMPILE_OPTION *\"\{0,1\}\([^\")]*\).*/\1/p" \
+ | tr ';' ' '
+ done
+}
+
# Version number extraction function.
cmake_version_component()
{
@@ -954,6 +965,17 @@ for a in ${cmake_c_compilers}; do
cmake_c_compiler="${a}"
fi
done
+for std in 11 99 90; do
+ try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`"
+ for flag in $try_flags; do
+ echo "Checking whether ${cmake_c_compiler} supports ${flag}" >> cmake_bootstrap.log 2>&1
+ if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags} ${flag}" \
+ "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
+ cmake_c_flags="${cmake_c_flags} ${flag}"
+ break 2
+ fi
+ done
+done
rm -f "${TMPFILE}.c"
if [ -z "${cmake_c_compiler}" ]; then
@@ -988,6 +1010,10 @@ echo '
# include <iostream.h>
#endif
+#if __cplusplus >= 201103L && defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
+#error "SunPro <= 5.13 C++ 11 mode not supported due to bug in move semantics."
+#endif
+
class NeedCXX
{
public:
@@ -1015,6 +1041,17 @@ for a in ${cmake_cxx_compilers}; do
fi
done
done
+for std in 14 11 98; do
+ try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
+ for flag in $try_flags; do
+ echo "Checking for wheter ${cmake_cxx_flags} supports ${flag}" >> cmake_bootstrap.log 2>&1
+ if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags} ${flag} -DTEST1" \
+ "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
+ cmake_cxx_flags="${cmake_cxx_flags} ${flag} "
+ break 2
+ fi
+ done
+done
rm -f "${TMPFILE}.cxx"
if [ -z "${cmake_cxx_compiler}" ]; then
@@ -1240,34 +1277,6 @@ if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
fi
-if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
- # Are we SolarisStudio?
-
- TMPFILE=`cmake_tmp_file`
- echo '
- #if defined(__SUNPRO_CC)
- #include <iostream>
- int main() { std::cout << "This is SolarisStudio" << std::endl; return 0;}
- #endif
- ' > ${TMPFILE}.cxx
- cmake_cxx_compiler_is_solarisstudio=0
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} " "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
- cmake_cxx_compiler_is_solarisstudio=1
- fi
- if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then
- echo "${cmake_cxx_compiler} is SolarisStudio compiler"
- else
- echo "${cmake_cxx_compiler} is not SolarisStudio compiler"
- fi
- rm -f "${TMPFILE}.cxx"
-
- if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then
- cmake_cxx_flags="${cmake_cxx_flags} -library=stlport4"
- fi
-fi
-
-
# Test for kwsys features
KWSYS_NAME_IS_KWSYS=0
KWSYS_BUILD_SHARED=0