2 #=============================================================================
3 # CMake - Cross Platform Makefile Generator
4 # Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
6 # Distributed under the OSI-approved BSD License (the "License");
7 # see accompanying file Copyright.txt for details.
9 # This software is distributed WITHOUT ANY WARRANTY; without even the
10 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # See the License for more information.
12 #=============================================================================
15 echo "$@" 1>&2 ; exit 1
18 # Version number extraction function.
19 cmake_version_component()
21 cat "${cmake_source_dir}/Source/CMakeVersion.cmake" | sed -n "
22 /^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
28 echo "$1" | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
31 # Detect system and directory information.
33 cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
34 cmake_binary_dir=`pwd`
36 # Load version information.
37 cmake_version_major="`cmake_version_component MAJOR`"
38 cmake_version_minor="`cmake_version_component MINOR`"
39 cmake_version_patch="`cmake_version_component PATCH`"
40 cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
41 cmake_version_tweak="`cmake_version_component TWEAK`"
42 if [ "$cmake_version_tweak" != "0" ]; then
43 cmake_version="${cmake_version}.${cmake_version_tweak}"
46 cmake_data_dir="share/cmake-${cmake_version_major}.${cmake_version_minor}"
47 cmake_doc_dir="doc/cmake-${cmake_version_major}.${cmake_version_minor}"
50 cmake_bootstrap_system_libs=""
51 cmake_bootstrap_qt_gui=""
52 cmake_bootstrap_qt_qmake=""
54 # Determine whether this is a Cygwin environment.
55 if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
56 cmake_system_cygwin=true
58 cmake_system_cygwin=false
61 # Determine whether this is a MinGW environment.
62 if echo "${cmake_system}" | grep MINGW >/dev/null 2>&1; then
63 cmake_system_mingw=true
65 cmake_system_mingw=false
68 # Determine whether this is OS X
69 if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then
70 cmake_system_darwin=true
72 cmake_system_darwin=false
75 # Determine whether this is BeOS
76 if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
77 cmake_system_beos=true
79 cmake_system_beos=false
82 # Determine whether this is Haiku
83 if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
84 cmake_system_haiku=true
86 cmake_system_haiku=false
89 # Determine whether this is OpenVMS
90 if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then
91 cmake_system_openvms=true
93 cmake_system_openvms=false
96 # Determine whether this is Linux
97 if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then
98 cmake_system_linux=true
99 # find out if it is a HP PA-RISC machine
100 if uname -m | grep parisc >/dev/null 2>&1; then
101 cmake_machine_parisc=true
103 cmake_machine_parisc=false
106 cmake_system_linux=false
109 # Choose the generator to use for bootstrapping.
110 if ${cmake_system_mingw}; then
111 # Bootstrapping from an MSYS prompt.
112 cmake_bootstrap_generator="MSYS Makefiles"
114 # Bootstrapping from a standard UNIX prompt.
115 cmake_bootstrap_generator="Unix Makefiles"
118 # Choose tools and extensions for this platform.
119 if ${cmake_system_openvms}; then
129 # Construct bootstrap directory name.
130 cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}"
132 # Helper function to fix windows paths.
133 case "${cmake_system}" in
137 cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//'
143 echo "$1" | sed 's/\\/\//g'
148 # Choose the default install prefix.
149 if ${cmake_system_mingw}; then
150 if [ "x${PROGRAMFILES}" != "x" ]; then
151 cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
152 elif [ "x${ProgramFiles}" != "x" ]; then
153 cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
154 elif [ "x${SYSTEMDRIVE}" != "x" ]; then
155 cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
156 elif [ "x${SystemDrive}" != "x" ]; then
157 cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
159 cmake_default_prefix="c:/Program Files/CMake"
161 elif ${cmake_system_haiku}; then
162 cmake_default_prefix=`finddir B_COMMON_DIRECTORY`
163 cmake_man_dir="documentation/man"
164 cmake_doc_dir="documentation/doc/cmake-${cmake_version}"
166 cmake_default_prefix="/usr/local"
169 CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
170 CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
171 CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
173 CMAKE_PROBLEMATIC_FILES="\
176 CMakeCCompiler.cmake \
177 CMakeCXXCompiler.cmake \
178 */CMakeSystem.cmake \
179 */CMakeCCompiler.cmake \
180 */CMakeCXXCompiler.cmake \
181 Source/cmConfigure.h \
182 Source/CTest/Curl/config.h \
183 Utilities/cmexpat/expatConfig.h \
184 Utilities/cmexpat/expatDllConfig.h \
187 CMAKE_UNUSED_SOURCES="\
188 cmGlobalXCodeGenerator \
189 cmLocalXCodeGenerator \
200 cmCommandArgumentLexer \
201 cmCommandArgumentParser \
202 cmCommandArgumentParserHelper \
206 cmDocumentationFormatter \
207 cmDocumentationFormatterText \
211 cmPropertyDefinition \
212 cmPropertyDefinitionMap \
215 cmExportFileGenerator \
216 cmExportInstallFileGenerator \
217 cmExportTryCompileFileGenerator \
220 cmInstallDirectoryGenerator \
221 cmGeneratedFileStream \
223 cmGeneratorExpressionDAGChecker \
224 cmGeneratorExpressionEvaluator \
225 cmGeneratorExpressionLexer \
226 cmGeneratorExpressionParser \
227 cmGeneratorExpression \
231 cmInstallExportGenerator \
232 cmInstallFilesGenerator \
233 cmInstallScriptGenerator \
234 cmInstallTargetGenerator \
237 cmSourceFileLocation \
241 cmFileTimeComparison \
242 cmGlobalUnixMakefileGenerator3 \
243 cmLocalUnixMakefileGenerator3 \
244 cmMakefileExecutableTargetGenerator \
245 cmMakefileLibraryTargetGenerator \
246 cmMakefileTargetGenerator \
247 cmMakefileUtilityTargetGenerator \
248 cmOSXBundleGenerator \
250 cmBootstrapCommands1 \
251 cmBootstrapCommands2 \
256 cmCustomCommandGenerator \
257 cmDocumentVariables \
260 cmComputeLinkDepends \
261 cmComputeLinkInformation \
263 cmComputeTargetDepends \
264 cmComputeComponentGraph \
268 cmGlobalNinjaGenerator \
269 cmLocalNinjaGenerator \
270 cmNinjaTargetGenerator \
271 cmNinjaNormalTargetGenerator \
272 cmNinjaUtilityTargetGenerator \
275 if ${cmake_system_mingw}; then
276 CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
277 cmGlobalMSYSMakefileGenerator \
278 cmGlobalMinGWMakefileGenerator \
279 cmWin32ProcessExecution"
286 if ${cmake_system_mingw}; then
309 RegularExpression.hxx \
321 # Display CMake bootstrap usage
325 Usage: '"$0"' [<options>...] [-- <cmake-options>...]
326 Options: [defaults in brackets after descriptions]
328 --help print this message
329 --version only print version information
330 --verbose display more information
331 --parallel=n bootstrap cmake in parallel, where n is
333 --enable-ccache Enable ccache when building cmake
334 --init=FILE load FILE as script to populate cache
335 --system-libs use all system-installed third-party libraries
336 (for use only by package maintainers)
337 --no-system-libs use all cmake-provided third-party libraries
339 --system-curl use system-installed curl library
340 --no-system-curl use cmake-provided curl library (default)
341 --system-expat use system-installed expat library
342 --no-system-expat use cmake-provided expat library (default)
343 --system-zlib use system-installed zlib library
344 --no-system-zlib use cmake-provided zlib library (default)
345 --system-bzip2 use system-installed bzip2 library
346 --no-system-bzip2 use cmake-provided bzip2 library (default)
347 --system-libarchive use system-installed libarchive library
348 --no-system-libarchive use cmake-provided libarchive library (default)
350 --qt-gui build the Qt-based GUI (requires Qt >= 4.2)
351 --no-qt-gui do not build the Qt-based GUI (default)
352 --qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt
354 Directory and file names:
355 --prefix=PREFIX install files in tree rooted at PREFIX
356 ['"${cmake_default_prefix}"']
357 --datadir=DIR install data files in PREFIX/DIR
358 ['"${cmake_data_dir}"']
359 --docdir=DIR install documentation files in PREFIX/DIR
360 ['"${cmake_doc_dir}"']
361 --mandir=DIR install man pages files in PREFIX/DIR/manN
362 ['"${cmake_man_dir}"']
367 # Display CMake bootstrap usage
368 cmake_version_display()
370 echo "CMake ${cmake_version}, Copyright 2000-2012 Kitware, Inc."
373 # Display CMake bootstrap error, display the log file and exit
378 echo "---------------------------------------------"
379 echo "Error when bootstrapping CMake:"
381 echo "---------------------------------------------"
382 if [ -f cmake_bootstrap.log ]; then
383 echo "Log of errors: `pwd`/cmake_bootstrap.log"
384 #cat cmake_bootstrap.log
385 echo "---------------------------------------------"
390 # Replace KWSYS_NAMESPACE with cmsys
391 cmake_replace_string ()
397 if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
399 sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" > "${OUTFILE}${_tmp}"
400 if [ -f "${OUTFILE}${_tmp}" ]; then
401 if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
402 #echo "Files are the same"
403 rm -f "${OUTFILE}${_tmp}"
405 mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
409 cmake_error 1 "Cannot find file ${INFILE}"
413 cmake_kwsys_config_replace_string ()
419 if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
420 echo "${APPEND}" > "${OUTFILE}${_tmp}"
422 sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
423 s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
424 s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
425 s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
426 s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
427 s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
428 s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
429 s/@KWSYS_IOS_USE_SSTREAM@/${KWSYS_IOS_USE_SSTREAM}/g;
430 s/@KWSYS_IOS_USE_STRSTREAM_H@/${KWSYS_IOS_USE_STRSTREAM_H}/g;
431 s/@KWSYS_IOS_USE_STRSTREA_H@/${KWSYS_IOS_USE_STRSTREA_H}/g;
432 s/@KWSYS_IOS_HAVE_BINARY@/${KWSYS_IOS_HAVE_BINARY}/g;
433 s/@KWSYS_STL_HAVE_STD@/${KWSYS_STL_HAVE_STD}/g;
434 s/@KWSYS_STL_STRING_HAVE_ISTREAM@/${KWSYS_STL_STRING_HAVE_ISTREAM}/g;
435 s/@KWSYS_STL_STRING_HAVE_OSTREAM@/${KWSYS_STL_STRING_HAVE_OSTREAM}/g;
436 s/@KWSYS_STL_STRING_HAVE_NEQ_CHAR@/${KWSYS_STL_STRING_HAVE_NEQ_CHAR}/g;
437 s/@KWSYS_STL_HAS_ITERATOR_TRAITS@/${KWSYS_STL_HAS_ITERATOR_TRAITS}/g;
438 s/@KWSYS_STL_HAS_ITERATOR_CATEGORY@/${KWSYS_STL_HAS_ITERATOR_CATEGORY}/g;
439 s/@KWSYS_STL_HAS___ITERATOR_CATEGORY@/${KWSYS_STL_HAS___ITERATOR_CATEGORY}/g;
440 s/@KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}/g;
441 s/@KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE}/g;
442 s/@KWSYS_STL_HAS_ALLOCATOR_REBIND@/${KWSYS_STL_HAS_ALLOCATOR_REBIND}/g;
443 s/@KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@/${KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT}/g;
444 s/@KWSYS_STL_HAS_ALLOCATOR_OBJECTS@/${KWSYS_STL_HAS_ALLOCATOR_OBJECTS}/g;
445 s/@KWSYS_CXX_HAS_CSTDDEF@/${KWSYS_CXX_HAS_CSTDDEF}/g;
446 s/@KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@/${KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS}/g;
447 s/@KWSYS_CXX_HAS_MEMBER_TEMPLATES@/${KWSYS_CXX_HAS_MEMBER_TEMPLATES}/g;
448 s/@KWSYS_CXX_HAS_FULL_SPECIALIZATION@/${KWSYS_CXX_HAS_FULL_SPECIALIZATION}/g;
449 s/@KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@/${KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP}/g;
450 s/@KWSYS_STAT_HAS_ST_MTIM@/${KWSYS_STAT_HAS_ST_MTIM}/g;}" >> "${OUTFILE}${_tmp}"
451 if [ -f "${OUTFILE}${_tmp}" ]; then
452 if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
453 #echo "Files are the same"
454 rm -f "${OUTFILE}${_tmp}"
456 mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
460 cmake_error 2 "Cannot find file ${INFILE}"
463 # Write string into a file
471 # Escape spaces in strings
474 echo $1 | sed "s/ /\\\\ /g"
477 # Strip prefix from argument
480 echo "$1" | sed "s/^${2-[^=]*=}//"
483 # Write message to the log
486 echo "$*" >> cmake_bootstrap.log
492 echo "cmake_bootstrap_$$_test"
495 # Run a compiler test. First argument is compiler, second one are compiler
496 # flags, third one is test source file to be compiled
502 if [ ! -f "${TESTFILE}" ]; then
503 echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
506 TMPFILE=`cmake_tmp_file`
507 echo "Try: ${COMPILER}"
508 echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
509 echo "---------- file -----------------------"
511 echo "------------------------------------------"
512 "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
514 if [ "${RES}" -ne "0" ]; then
515 echo "Test failed to compile"
518 if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
519 echo "Test failed to produce executable"
525 if [ "${RES}" -ne "0" ]; then
526 echo "Test produced non-zero return code"
533 # Run a make test. First argument is the make interpreter.
538 echo "Try: ${MAKE_PROC}"
539 "${MAKE_PROC}" ${MAKE_FLAGS}
541 if [ "${RES}" -ne "0" ]; then
542 echo "${MAKE_PROC} does not work"
545 if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
546 echo "${COMPILER} does not produce output"
552 if [ "${RES}" -ne "0" ]; then
553 echo "${MAKE_PROC} produces strange executable"
556 echo "${MAKE_PROC} works"
563 cmake_ccache_enabled=
564 cmake_prefix_dir="${cmake_default_prefix}"
565 while test $# != 0; do
567 --prefix=*) dir=`cmake_arg "$1"`
568 cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;;
569 --parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;;
570 --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;;
571 --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;;
572 --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;;
573 --init=*) cmake_init_file=`cmake_arg "$1"` ;;
574 --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
575 --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
576 --system-bzip2|--system-curl|--system-expat|--system-libarchive|--system-zlib)
577 lib=`cmake_arg "$1" "--system-"`
578 cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
579 --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-libarchive|--no-system-zlib)
580 lib=`cmake_arg "$1" "--no-system-"`
581 cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
582 --qt-gui) cmake_bootstrap_qt_gui="1" ;;
583 --no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
584 --qt-qmake=*) cmake_bootstrap_qt_qmake=`cmake_arg "$1"` ;;
585 --help) cmake_usage ;;
586 --version) cmake_version_display ; exit 2 ;;
587 --verbose) cmake_verbose=TRUE ;;
588 --enable-ccache) cmake_ccache_enabled=TRUE ;;
590 *) die "Unknown option: $1" ;;
595 # If verbose, display some information about bootstrap
596 if [ -n "${cmake_verbose}" ]; then
597 echo "---------------------------------------------"
598 echo "Source directory: ${cmake_source_dir}"
599 echo "Binary directory: ${cmake_binary_dir}"
600 echo "Prefix directory: ${cmake_prefix_dir}"
601 echo "System: ${cmake_system}"
602 if [ "x${cmake_parallel_make}" != "x" ]; then
603 echo "Doing parallel make: ${cmake_parallel_make}"
608 echo "---------------------------------------------"
610 echo "`cmake_version_display`"
612 # Check for in-source build
613 cmake_in_source_build=
614 if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
615 -f "${cmake_binary_dir}/Source/cmake.h" ]; then
616 if [ -n "${cmake_verbose}" ]; then
617 echo "Warning: This is an in-source build"
619 cmake_in_source_build=TRUE
622 # If this is not an in-source build, then Bootstrap stuff should not exist.
623 if [ -z "${cmake_in_source_build}" ]; then
624 # Did somebody bootstrap in the source tree?
625 if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then
626 cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
627 Looks like somebody did bootstrap CMake in the source tree, but now you are
628 trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
629 directory from the source tree."
631 # Is there a cache in the source tree?
632 for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
633 if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
634 cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
635 Looks like somebody tried to build CMake in the source tree, but now you are
636 trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
637 from the source tree."
642 # Make bootstrap directory
643 [ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
644 if [ ! -d "${cmake_bootstrap_dir}" ]; then
645 cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
647 cd "${cmake_bootstrap_dir}"
649 [ -d "cmsys" ] || mkdir "cmsys"
650 if [ ! -d "cmsys" ]; then
651 cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
655 [ -d "cmsys/${a}" ] || mkdir "cmsys/${a}"
656 if [ ! -d "cmsys/${a}" ]; then
657 cmake_error 5 "Cannot create directory ${cmake_bootstrap_dir}/cmsys/${a}"
661 # Delete all the bootstrap files
662 rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
663 rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
664 rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
666 # If exist compiler flags, set them
667 cmake_c_flags=${CFLAGS}
668 cmake_cxx_flags=${CXXFLAGS}
669 cmake_ld_flags=${LDFLAGS}
671 # Add Cygwin-specific flags
672 if ${cmake_system_cygwin}; then
673 cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
676 # Add CoreFoundation framework on Darwin
677 if ${cmake_system_darwin}; then
678 cmake_ld_flags="${LDFLAGS} -framework CoreFoundation"
681 # Add BeOS toolkits...
682 if ${cmake_system_beos}; then
683 cmake_ld_flags="${LDFLAGS} -lroot -lbe"
686 # Add Haiku toolkits...
687 if ${cmake_system_haiku}; then
688 cmake_ld_flags="${LDFLAGS} -lroot -lbe"
691 if ${cmake_system_linux}; then
692 # avoid binutils problem with large binaries, e.g. when building CMake in debug mode
693 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230
694 if ${cmake_machine_parisc}; then
695 # if -O[s23] is given the effect is inverted, so do not use the flag then
696 if [ "`echo "${CXXFLAGS}" | sed -r '/^(.* )?(-O[s234])( .*)?$/s/.*/-Os/'`" != "-Os" ]; then
697 cmake_ld_flags="${LDFLAGS} -Wl,--unique=.text.*"
702 #-----------------------------------------------------------------------------
703 # Detect known toolchains on some platforms.
705 case "${cmake_system}" in
706 *AIX*) cmake_toolchains='XL GNU' ;;
707 *CYGWIN*) cmake_toolchains='GNU' ;;
708 *Darwin*) cmake_toolchains='GNU Clang' ;;
709 *Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;;
710 *MINGW*) cmake_toolchains='GNU' ;;
713 # Toolchain compiler name table.
714 cmake_toolchain_Clang_CC='clang'
715 cmake_toolchain_Clang_CXX='clang++'
716 cmake_toolchain_GNU_CC='gcc'
717 cmake_toolchain_GNU_CXX='g++'
718 cmake_toolchain_PGI_CC='pgcc'
719 cmake_toolchain_PGI_CXX='pgCC'
720 cmake_toolchain_PathScale_CC='pathcc'
721 cmake_toolchain_PathScale_CXX='pathCC'
722 cmake_toolchain_XL_CC='xlc'
723 cmake_toolchain_XL_CXX='xlC'
725 cmake_toolchain_try()
728 TMPFILE=`cmake_tmp_file`
730 eval "tc_CC=\${cmake_toolchain_${tc}_CC}"
731 echo 'int main() { return 0; }' > "${TMPFILE}.c"
732 cmake_try_run "$tc_CC" "" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1
735 test "${tc_result_CC}" = "0" || return 1
737 eval "tc_CXX=\${cmake_toolchain_${tc}_CXX}"
738 echo 'int main() { return 0; }' > "${TMPFILE}.cpp"
739 cmake_try_run "$tc_CXX" "" "${TMPFILE}.cpp" >> cmake_bootstrap.log 2>&1
741 rm -f "${TMPFILE}.cpp"
742 test "${tc_result_CXX}" = "0" || return 1
744 cmake_toolchain="$tc"
747 cmake_toolchain_detect()
750 for tc in ${cmake_toolchains}; do
751 echo "Checking for $tc toolchain" >> cmake_bootstrap.log 2>&1
752 cmake_toolchain_try "$tc" &&
753 echo "Found $tc toolchain" &&
758 if [ -z "${CC}" -a -z "${CXX}" ]; then
759 cmake_toolchain_detect
762 #-----------------------------------------------------------------------------
766 # If CC is set, use that for compiler, otherwise use list of known compilers
767 if [ -n "${cmake_toolchain}" ]; then
768 eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
769 elif [ -n "${CC}" ]; then
770 cmake_c_compilers="${CC}"
772 cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
775 # Check if C compiler works
776 TMPFILE=`cmake_tmp_file`
779 # error "The CMAKE_C_COMPILER is set to a C++ compiler"
784 #if defined(__CLASSIC_C__)
789 int main(int argc, char* argv[])
792 printf("%d%c", (argv != 0), (char)0x0a);
796 for a in ${cmake_c_compilers}; do
797 if [ -z "${cmake_c_compiler}" ] && \
798 cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
799 cmake_c_compiler="${a}"
804 if [ -z "${cmake_c_compiler}" ]; then
805 cmake_error 6 "Cannot find appropriate C compiler on this system.
806 Please specify one using environment variable CC.
807 See cmake_bootstrap.log for compilers attempted.
810 echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
812 #-----------------------------------------------------------------------------
816 # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
818 # If CC is set, use that for compiler, otherwise use list of known compilers
819 if [ -n "${cmake_toolchain}" ]; then
820 eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
821 elif [ -n "${CXX}" ]; then
822 cmake_cxx_compilers="${CXX}"
824 cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
827 # Check if C++ compiler works
828 TMPFILE=`cmake_tmp_file`
833 # include <iostream.h>
839 NeedCXX() { this->Foo = 1; }
840 int GetFoo() { return this->Foo; }
848 cout << c.GetFoo() << endl;
850 std::cout << c.GetFoo() << std::endl;
855 for a in ${cmake_cxx_compilers}; do
857 if [ -z "${cmake_cxx_compiler}" ] && \
858 cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
859 cmake_cxx_compiler="${a}"
863 rm -f "${TMPFILE}.cxx"
865 if [ -z "${cmake_cxx_compiler}" ]; then
866 cmake_error 7 "Cannot find appropriate C++ compiler on this system.
867 Please specify one using environment variable CXX.
868 See cmake_bootstrap.log for compilers attempted."
870 echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
872 #-----------------------------------------------------------------------------
875 cmake_make_processor=
878 # If MAKE is set, use that for make processor, otherwise use list of known make
879 if [ -n "${MAKE}" ]; then
880 cmake_make_processors="${MAKE}"
882 cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
885 TMPFILE="`cmake_tmp_file`_dir"
886 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
887 mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
888 cd "${cmake_bootstrap_dir}/${TMPFILE}"
891 "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
895 int main(){ printf("1%c", (char)0x0a); return 0; }
897 cmake_original_make_flags="${cmake_make_flags}"
898 if [ "x${cmake_parallel_make}" != "x" ]; then
899 cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
901 for a in ${cmake_make_processors}; do
902 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
903 cmake_make_processor="${a}"
906 cmake_full_make_flags="${cmake_make_flags}"
907 if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
908 if [ -z "${cmake_make_processor}" ]; then
909 cmake_make_flags="${cmake_original_make_flags}"
910 for a in ${cmake_make_processors}; do
911 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
912 cmake_make_processor="${a}"
917 cd "${cmake_bootstrap_dir}"
919 if [ -z "${cmake_make_processor}" ]; then
920 cmake_error 8 "Cannot find appropriate Makefile processor on this system.
921 Please specify one using environment variable MAKE."
923 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
924 echo "Makefile processor on this system is: ${cmake_make_processor}"
925 if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
926 echo "---------------------------------------------"
927 echo "Makefile processor ${cmake_make_processor} does not support parallel build"
928 echo "---------------------------------------------"
931 # Ok, we have CC, CXX, and MAKE.
933 # Test C++ compiler features
937 TMPFILE=`cmake_tmp_file`
939 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
941 int main() { std::cout << "This is GNU" << std::endl; return 0;}
944 cmake_cxx_compiler_is_gnu=0
945 if cmake_try_run "${cmake_cxx_compiler}" \
946 "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
947 cmake_cxx_compiler_is_gnu=1
949 if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then
950 echo "${cmake_cxx_compiler} is GNU compiler"
952 echo "${cmake_cxx_compiler} is not GNU compiler"
954 rm -f "${TMPFILE}.cxx"
956 if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
957 # Check for non-GNU compiler flags
959 # If we are on IRIX, check for -LANG:std
960 cmake_test_flags="-LANG:std"
961 if [ "x${cmake_system}" = "xIRIX64" ]; then
962 TMPFILE=`cmake_tmp_file`
965 int main() { std::cout << "No need for '"${cmake_test_flags}"'" << std::endl; return 0;}
967 cmake_need_lang_std=0
968 if cmake_try_run "${cmake_cxx_compiler}" \
969 "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
972 if cmake_try_run "${cmake_cxx_compiler}" \
973 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
974 cmake_need_lang_std=1
977 if [ "x${cmake_need_lang_std}" = "x1" ]; then
978 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
979 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
981 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
983 rm -f "${TMPFILE}.cxx"
987 # If we are on OSF, check for -timplicit_local -no_implicit_include
988 cmake_test_flags="-timplicit_local -no_implicit_include"
989 if [ "x${cmake_system}" = "xOSF1" ]; then
990 TMPFILE=`cmake_tmp_file`
993 int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
996 if cmake_try_run "${cmake_cxx_compiler}" \
997 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
1002 if [ "x${cmake_need_flags}" = "x1" ]; then
1003 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
1004 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
1006 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
1008 rm -f "${TMPFILE}.cxx"
1012 # If we are on OSF, check for -std strict_ansi -nopure_cname
1013 cmake_test_flags="-std strict_ansi -nopure_cname"
1014 if [ "x${cmake_system}" = "xOSF1" ]; then
1015 TMPFILE=`cmake_tmp_file`
1018 int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
1021 if cmake_try_run "${cmake_cxx_compiler}" \
1022 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
1027 if [ "x${cmake_need_flags}" = "x1" ]; then
1028 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
1029 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
1031 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
1033 rm -f "${TMPFILE}.cxx"
1037 # If we are on HP-UX, check for -Ae for the C compiler.
1038 cmake_test_flags="-Ae"
1039 if [ "x${cmake_system}" = "xHP-UX" ]; then
1040 TMPFILE=`cmake_tmp_file`
1042 int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
1045 if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
1048 if cmake_try_run "${cmake_c_compiler}" \
1049 "${cmake_c_flags} ${cmake_test_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
1053 if [ "x${cmake_need_Ae}" = "x1" ]; then
1054 cmake_c_flags="${cmake_c_flags} ${cmake_test_flags}"
1055 echo "${cmake_c_compiler} needs ${cmake_test_flags}"
1057 echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
1059 rm -f "${TMPFILE}.c"
1064 # Test for kwsys features
1065 KWSYS_NAME_IS_KWSYS=0
1066 KWSYS_BUILD_SHARED=0
1067 KWSYS_LFS_AVAILABLE=0
1068 KWSYS_LFS_REQUESTED=0
1069 KWSYS_IOS_USE_STRSTREAM_H=0
1070 KWSYS_IOS_USE_STRSTREA_H=0
1071 KWSYS_IOS_HAVE_STD=0
1072 KWSYS_IOS_USE_SSTREAM=0
1073 KWSYS_IOS_USE_ANSI=0
1074 KWSYS_IOS_HAVE_BINARY=0
1075 KWSYS_STL_HAVE_STD=0
1076 KWSYS_STAT_HAS_ST_MTIM=0
1077 KWSYS_STL_STRING_HAVE_NEQ_CHAR=0
1078 KWSYS_STL_HAS_ITERATOR_TRAITS=0
1079 KWSYS_STL_HAS_ITERATOR_CATEGORY=0
1080 KWSYS_STL_HAS___ITERATOR_CATEGORY=0
1081 KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=0
1082 KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=0
1083 KWSYS_STL_HAS_ALLOCATOR_REBIND=0
1084 KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=0
1085 KWSYS_STL_HAS_ALLOCATOR_OBJECTS=0
1086 KWSYS_CXX_HAS_SETENV=0
1087 KWSYS_CXX_HAS_UNSETENV=0
1088 KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0
1089 KWSYS_CXX_HAS_UTIMENSAT=0
1090 KWSYS_CXX_HAS_UTIMES=0
1091 KWSYS_CXX_HAS_CSTDDEF=0
1092 KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0
1093 KWSYS_CXX_HAS_MEMBER_TEMPLATES=0
1094 KWSYS_CXX_HAS_FULL_SPECIALIZATION=0
1095 KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=0
1097 # Hardcode these kwsys features. They work on all known UNIX compilers anyway.
1098 KWSYS_STL_STRING_HAVE_ISTREAM=1
1099 KWSYS_STL_STRING_HAVE_OSTREAM=1
1101 if cmake_try_run "${cmake_cxx_compiler}" \
1102 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_SETENV" \
1103 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1104 KWSYS_CXX_HAS_SETENV=1
1105 echo "${cmake_cxx_compiler} has setenv"
1107 echo "${cmake_cxx_compiler} does not have setenv"
1110 if cmake_try_run "${cmake_cxx_compiler}" \
1111 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_UNSETENV" \
1112 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1113 KWSYS_CXX_HAS_UNSETENV=1
1114 echo "${cmake_cxx_compiler} has unsetenv"
1116 echo "${cmake_cxx_compiler} does not have unsetenv"
1119 if cmake_try_run "${cmake_cxx_compiler}" \
1120 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H" \
1121 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1122 KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=1
1123 echo "${cmake_cxx_compiler} has environ in stdlib.h"
1125 echo "${cmake_cxx_compiler} does not have environ in stdlib.h"
1128 if cmake_try_run "${cmake_cxx_compiler}" \
1129 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
1130 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1131 KWSYS_STL_HAVE_STD=1
1132 echo "${cmake_cxx_compiler} has STL in std:: namespace"
1134 echo "${cmake_cxx_compiler} does not have STL in std:: namespace"
1137 if cmake_try_run "${cmake_cxx_compiler}" \
1138 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
1139 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1140 KWSYS_IOS_USE_ANSI=1
1141 echo "${cmake_cxx_compiler} has ANSI streams"
1143 echo "${cmake_cxx_compiler} does not have ANSI streams"
1146 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
1147 if cmake_try_run "${cmake_cxx_compiler}" \
1148 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
1149 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1150 KWSYS_IOS_HAVE_STD=1
1151 echo "${cmake_cxx_compiler} has streams in std:: namespace"
1153 echo "${cmake_cxx_compiler} does not have streams in std:: namespace"
1155 if cmake_try_run "${cmake_cxx_compiler}" \
1156 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
1157 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1158 KWSYS_IOS_USE_SSTREAM=1
1159 echo "${cmake_cxx_compiler} has sstream"
1161 echo "${cmake_cxx_compiler} does not have sstream"
1165 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
1166 if cmake_try_run "${cmake_cxx_compiler}" \
1167 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
1168 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1169 KWSYS_IOS_USE_STRSTREAM_H=1
1170 echo "${cmake_cxx_compiler} has strstream.h"
1172 echo "${cmake_cxx_compiler} does not have strstream.h"
1174 if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
1175 if cmake_try_run "${cmake_cxx_compiler}" \
1176 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
1177 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1178 KWSYS_IOS_USE_STRSTREA_H=1
1179 echo "${cmake_cxx_compiler} has strstrea.h"
1181 echo "${cmake_cxx_compiler} does not have strstrea.h"
1186 if cmake_try_run "${cmake_cxx_compiler}" \
1187 "${cmake_cxx_flags} -DTEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1188 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1189 KWSYS_STL_STRING_HAVE_NEQ_CHAR=1
1190 echo "${cmake_cxx_compiler} has operator!=(string, char*)"
1192 echo "${cmake_cxx_compiler} does not have operator!=(string, char*)"
1195 if cmake_try_run "${cmake_cxx_compiler}" \
1196 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_TRAITS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1197 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1198 KWSYS_STL_HAS_ITERATOR_TRAITS=1
1199 echo "${cmake_cxx_compiler} has stl iterator_traits"
1201 echo "${cmake_cxx_compiler} does not have stl iterator_traits"
1204 if [ "x${KWSYS_STL_HAS_ITERATOR_TRAITS}" = "x0" ]; then
1205 if cmake_try_run "${cmake_cxx_compiler}" \
1206 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1207 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1208 KWSYS_STL_HAS_ITERATOR_CATEGORY=1
1209 echo "${cmake_cxx_compiler} has old iterator_category"
1211 echo "${cmake_cxx_compiler} does not have old iterator_category"
1213 if [ "x${KWSYS_STL_HAS_ITERATOR_CATEGORY}" = "x0" ]; then
1214 if cmake_try_run "${cmake_cxx_compiler}" \
1215 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS___ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1216 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1217 KWSYS_STL_HAS___ITERATOR_CATEGORY=1
1218 echo "${cmake_cxx_compiler} has old __iterator_category"
1220 echo "${cmake_cxx_compiler} does not have old __iterator_category"
1225 if cmake_try_run "${cmake_cxx_compiler}" \
1226 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1227 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1228 KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=1
1229 echo "${cmake_cxx_compiler} has standard template allocator"
1231 echo "${cmake_cxx_compiler} does not have standard template allocator"
1234 if [ "x${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}" = "x1" ]; then
1235 if cmake_try_run "${cmake_cxx_compiler}" \
1236 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1237 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1238 KWSYS_STL_HAS_ALLOCATOR_REBIND=1
1239 echo "${cmake_cxx_compiler} has allocator<>::rebind<>"
1241 echo "${cmake_cxx_compiler} does not have allocator<>::rebind<>"
1244 if cmake_try_run "${cmake_cxx_compiler}" \
1245 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1246 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1247 KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=1
1248 echo "${cmake_cxx_compiler} has non-standard allocator<>::max_size argument"
1250 echo "${cmake_cxx_compiler} does not have non-standard allocator<>::max_size argument"
1253 if cmake_try_run "${cmake_cxx_compiler}" \
1254 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1255 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1256 KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=1
1257 echo "${cmake_cxx_compiler} has old non-template allocator"
1259 echo "${cmake_cxx_compiler} does not have old non-template allocator"
1263 if cmake_try_run "${cmake_cxx_compiler}" \
1264 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1265 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1266 KWSYS_STL_HAS_ALLOCATOR_OBJECTS=1
1267 echo "${cmake_cxx_compiler} has stl containers supporting allocator objects"
1269 echo "${cmake_cxx_compiler} does not have stl containers supporting allocator objects"
1272 if cmake_try_run "${cmake_cxx_compiler}" \
1273 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_CSTDDEF" \
1274 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1275 KWSYS_CXX_HAS_CSTDDEF=1
1276 echo "${cmake_cxx_compiler} has header cstddef"
1278 echo "${cmake_cxx_compiler} does not have header cstddef"
1281 if cmake_try_run "${cmake_cxx_compiler}" \
1282 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS" \
1283 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1284 echo "${cmake_cxx_compiler} does not require template friends to use <>"
1286 KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=1
1287 echo "${cmake_cxx_compiler} requires template friends to use <>"
1290 if cmake_try_run "${cmake_cxx_compiler}" \
1291 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES" \
1292 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1293 KWSYS_CXX_HAS_MEMBER_TEMPLATES=1
1294 echo "${cmake_cxx_compiler} supports member templates"
1296 echo "${cmake_cxx_compiler} does not support member templates"
1299 if cmake_try_run "${cmake_cxx_compiler}" \
1300 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION" \
1301 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1302 KWSYS_CXX_HAS_FULL_SPECIALIZATION=1
1303 echo "${cmake_cxx_compiler} has standard template specialization syntax"
1305 echo "${cmake_cxx_compiler} does not have standard template specialization syntax"
1308 if cmake_try_run "${cmake_cxx_compiler}" \
1309 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP" \
1310 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1311 KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=1
1312 echo "${cmake_cxx_compiler} has argument dependent lookup"
1314 echo "${cmake_cxx_compiler} does not have argument dependent lookup"
1317 if cmake_try_run "${cmake_cxx_compiler}" \
1318 "${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \
1319 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1320 KWSYS_STAT_HAS_ST_MTIM=1
1321 echo "${cmake_cxx_compiler} has struct stat with st_mtim member"
1323 echo "${cmake_cxx_compiler} does not have struct stat with st_mtim member"
1326 if cmake_try_run "${cmake_cxx_compiler}" \
1327 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_BINARY -DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI} -DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD}" \
1328 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1329 KWSYS_IOS_HAVE_BINARY=1
1330 echo "${cmake_cxx_compiler} has ios::binary openmode"
1332 echo "${cmake_cxx_compiler} does not have ios::binary openmode"
1335 # Just to be safe, let us store compiler and flags to the header file
1337 cmake_bootstrap_version='$Revision$'
1338 cmake_compiler_settings_comment="/*
1339 * Generated by ${cmake_source_dir}/bootstrap
1340 * Version: ${cmake_bootstrap_version}
1342 * Source directory: ${cmake_source_dir}
1343 * Binary directory: ${cmake_bootstrap_dir}
1345 * C compiler: ${cmake_c_compiler}
1346 * C flags: ${cmake_c_flags}
1348 * C++ compiler: ${cmake_cxx_compiler}
1349 * C++ flags: ${cmake_cxx_flags}
1351 * Make: ${cmake_make_processor}
1354 * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
1356 * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
1360 cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}"
1362 if [ "x$KWSYS_STL_HAVE_STD" = "x1" ]; then
1363 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_STD_NAMESPACE */"
1365 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_STD_NAMESPACE 1"
1368 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
1369 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */"
1371 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STREAM_HEADERS 1"
1374 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x1" ]; then
1375 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STRING_STREAM */"
1377 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STRING_STREAM 1"
1380 # Test for ansi FOR scope
1381 if cmake_try_run "${cmake_cxx_compiler}" \
1382 "${cmake_cxx_flags}" \
1383 "${cmake_source_dir}/Modules/TestForAnsiForScope.cxx" >> cmake_bootstrap.log 2>&1; then
1384 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_FOR_SCOPE */"
1385 echo "${cmake_cxx_compiler} has ANSI for scoping"
1387 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_FOR_SCOPE 1"
1388 echo "${cmake_cxx_compiler} does not have ANSI for scoping"
1391 # When bootstrapping on MinGW with MSYS we must convert the source
1392 # directory to a windows path.
1393 if ${cmake_system_mingw}; then
1394 cmake_root_dir=`cd "${cmake_source_dir}"; pwd -W`
1396 cmake_root_dir="${cmake_source_dir}"
1399 # Write CMake version
1400 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
1401 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
1402 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
1403 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_TWEAK ${cmake_version_tweak}"
1404 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
1405 cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\""
1406 cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/${cmake_data_dir}\""
1407 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
1409 # Regenerate configured headers
1410 for h in Configure VersionConfig; do
1411 if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then
1412 rm -f cm${h}.h${_tmp}
1414 mv -f cm${h}.h${_tmp} cm${h}.h
1419 cmake_kwsys_config_replace_string \
1420 "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
1421 "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
1422 "${cmake_compiler_settings_comment}"
1423 cmake_kwsys_config_replace_string \
1424 "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
1425 "${cmake_bootstrap_dir}/cmsys/Configure.h" \
1426 "${cmake_compiler_settings_comment}"
1428 for a in ${KWSYS_FILES}; do
1429 cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
1430 "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
1433 for a in ${KWSYS_IOS_FILES}; do
1434 cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_ios_${a}.h.in" \
1435 "${cmake_bootstrap_dir}/cmsys/ios/${a}" KWSYS_NAMESPACE cmsys
1438 cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_stl.hxx.in" \
1439 "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" KWSYS_STL_HEADER_EXTRA ""
1441 cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" \
1442 "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" KWSYS_NAMESPACE cmsys
1444 for a in string vector set map algorithm; do
1445 cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" \
1446 "${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
1450 dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
1452 for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
1453 objs="${objs} ${a}.o"
1456 # Generate dependencies for cmBootstrapCommands1.cxx
1457 for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands1.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
1458 cmBootstrapCommands1Deps="${cmBootstrapCommands1Deps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
1460 cmBootstrapCommands1Deps=`echo $cmBootstrapCommands1Deps`
1461 for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands2.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
1462 cmBootstrapCommands2Deps="${cmBootstrapCommands2Deps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
1464 cmBootstrapCommands2Deps=`echo $cmBootstrapCommands2Deps`
1466 if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
1467 cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
1470 if [ "x${cmake_c_flags}" != "x" ]; then
1471 cmake_c_flags="${cmake_c_flags} "
1474 if [ "x${cmake_cxx_flags}" != "x" ]; then
1475 cmake_cxx_flags="${cmake_cxx_flags} "
1478 cmake_c_flags_String="-DKWSYS_STRING_C"
1479 cmake_cxx_flags_SystemTools="
1480 -DKWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV}
1481 -DKWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV}
1482 -DKWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}
1483 -DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
1484 -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
1486 cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
1487 -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
1488 cmake_cxx_flags="${cmake_cxx_flags} -I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
1489 -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
1490 echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
1491 echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
1492 for a in ${CMAKE_CXX_SOURCES}; do
1493 src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
1494 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1495 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1497 echo "cmBootstrapCommands1.o : $cmBootstrapCommands1Deps" >> "${cmake_bootstrap_dir}/Makefile"
1498 echo "cmBootstrapCommands2.o : $cmBootstrapCommands2Deps" >> "${cmake_bootstrap_dir}/Makefile"
1499 for a in ${CMAKE_C_SOURCES}; do
1500 src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
1501 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1502 echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1504 for a in ${KWSYS_C_SOURCES}; do
1505 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
1506 src_flags=`eval echo \\${cmake_c_flags_\${a}}`
1507 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1508 echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1510 for a in ${KWSYS_CXX_SOURCES}; do
1511 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
1512 src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
1513 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1514 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1518 cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
1519 ' >> "${cmake_bootstrap_dir}/Makefile"
1521 # Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake.
1523 # Generated by '"${cmake_source_dir}"'/bootstrap
1524 # Default cmake settings. These may be overridden any settings below.
1525 set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
1526 set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
1527 set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
1528 set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
1529 ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1531 # Add configuration settings given as command-line options.
1532 if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then
1534 set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
1535 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1537 if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then
1539 set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
1540 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1543 # Add user-specified settings. Handle relative-path case for
1544 # specification of cmake_init_file.
1546 cd "${cmake_binary_dir}"
1547 if [ -f "${cmake_init_file}" ]; then
1548 cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1552 echo "---------------------------------------------"
1554 # Run make to build bootstrap cmake
1555 if [ "x${cmake_parallel_make}" != "x" ]; then
1556 ${cmake_make_processor} ${cmake_make_flags}
1558 ${cmake_make_processor}
1561 if [ "${RES}" -ne "0" ]; then
1562 cmake_error 9 "Problem while running ${cmake_make_processor}"
1564 cd "${cmake_binary_dir}"
1566 # Set C, CXX, and MAKE environment variables, so that real real cmake will be
1567 # build with same compiler and make
1568 CC="${cmake_c_compiler}"
1569 CXX="${cmake_cxx_compiler}"
1570 if [ -n "${cmake_ccache_enabled}" ]; then
1574 MAKE="${cmake_make_processor}"
1579 # Run bootstrap CMake to configure real CMake
1580 cmake_options="-DCMAKE_BOOTSTRAP=1"
1581 if [ -n "${cmake_verbose}" ]; then
1582 cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
1584 "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@"
1586 if [ "${RES}" -ne "0" ]; then
1587 cmake_error 11 "Problem while running initial CMake"
1590 echo "---------------------------------------------"
1592 # And we are done. Now just run make
1593 echo "CMake has bootstrapped. Now run ${cmake_make_processor}."