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}/CMakeLists.txt" | sed -n "
22 /^SET(CMake_VERSION_${1}/ {s/SET(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
26 cmake_date_stamp_component()
28 cat "${cmake_source_dir}/Source/kwsys/kwsysDateStamp.cmake" | sed -n "
29 /KWSYS_DATE_STAMP_${1}/ {s/^.* \([0-9][0-9]*\))$/\1/;p;}
35 echo "$1" | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
38 # Detect system and directory information.
40 cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
41 cmake_binary_dir=`pwd`
43 # Load version information.
44 cmake_version_major="`cmake_version_component MAJOR`"
45 cmake_version_minor="`cmake_version_component MINOR`"
46 cmake_version_patch="`cmake_version_component PATCH`"
47 cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
48 cmake_version_tweak="`cmake_version_component TWEAK`"
49 if [ "x$cmake_version_tweak" = "x" ]; then
50 cmake_version_tweak="`cmake_date_stamp_component YEAR``cmake_date_stamp_component MONTH``cmake_date_stamp_component DAY`"
52 if [ "$cmake_version_tweak" != "0" ]; then
53 cmake_version="${cmake_version}.${cmake_version_tweak}"
56 cmake_data_dir="/share/cmake-${cmake_version_major}.${cmake_version_minor}"
57 cmake_doc_dir="/doc/cmake-${cmake_version_major}.${cmake_version_minor}"
60 cmake_bootstrap_system_libs=""
61 cmake_bootstrap_qt_gui=""
62 cmake_bootstrap_qt_qmake=""
64 # Determine whether this is a Cygwin environment.
65 if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
66 cmake_system_cygwin=true
68 cmake_system_cygwin=false
71 # Determine whether this is a MinGW environment.
72 if echo "${cmake_system}" | grep MINGW >/dev/null 2>&1; then
73 cmake_system_mingw=true
75 cmake_system_mingw=false
78 # Determine whether this is OS X
79 if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then
80 cmake_system_darwin=true
82 cmake_system_darwin=false
85 # Determine whether this is BeOS
86 if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
87 cmake_system_beos=true
89 cmake_system_beos=false
92 # Determine whether this is Haiku
93 if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
94 cmake_system_haiku=true
96 cmake_system_haiku=false
99 # Determine whether this is OpenVMS
100 if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then
101 cmake_system_openvms=true
103 cmake_system_openvms=false
106 # Choose the generator to use for bootstrapping.
107 if ${cmake_system_mingw}; then
108 # Bootstrapping from an MSYS prompt.
109 cmake_bootstrap_generator="MSYS Makefiles"
111 # Bootstrapping from a standard UNIX prompt.
112 cmake_bootstrap_generator="Unix Makefiles"
115 # Choose tools and extensions for this platform.
116 if ${cmake_system_openvms}; then
126 # Construct bootstrap directory name.
127 cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}"
129 # Helper function to fix windows paths.
130 case "${cmake_system}" in
134 cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//'
140 echo "$1" | sed 's/\\/\//g'
145 # Choose the default install prefix.
146 if ${cmake_system_mingw}; then
147 if [ "x${PROGRAMFILES}" != "x" ]; then
148 cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
149 elif [ "x${ProgramFiles}" != "x" ]; then
150 cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
151 elif [ "x${SYSTEMDRIVE}" != "x" ]; then
152 cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
153 elif [ "x${SystemDrive}" != "x" ]; then
154 cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
156 cmake_default_prefix="c:/Program Files/CMake"
158 elif ${cmake_system_haiku}; then
159 cmake_default_prefix=`/bin/finddir B_COMMON_DIRECTORY`
161 cmake_default_prefix="/usr/local"
164 CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
165 CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
166 CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
168 CMAKE_PROBLEMATIC_FILES="\
171 CMakeCCompiler.cmake \
172 CMakeCXXCompiler.cmake \
173 Source/cmConfigure.h \
174 Source/CTest/Curl/config.h \
175 Utilities/cmexpat/expatConfig.h \
176 Utilities/cmexpat/expatDllConfig.h \
179 CMAKE_UNUSED_SOURCES="\
180 cmGlobalXCodeGenerator \
181 cmLocalXCodeGenerator \
192 cmCommandArgumentLexer \
193 cmCommandArgumentParser \
194 cmCommandArgumentParserHelper \
198 cmDocumentationFormatter \
199 cmDocumentationFormatterText \
203 cmPropertyDefinition \
204 cmPropertyDefinitionMap \
207 cmExportFileGenerator \
208 cmExportInstallFileGenerator \
209 cmInstallDirectoryGenerator \
210 cmGeneratedFileStream \
212 cmGeneratorExpression \
216 cmInstallExportGenerator \
217 cmInstallFilesGenerator \
218 cmInstallScriptGenerator \
219 cmInstallTargetGenerator \
222 cmSourceFileLocation \
226 cmFileTimeComparison \
227 cmGlobalUnixMakefileGenerator3 \
228 cmLocalUnixMakefileGenerator3 \
229 cmMakefileExecutableTargetGenerator \
230 cmMakefileLibraryTargetGenerator \
231 cmMakefileTargetGenerator \
232 cmMakefileUtilityTargetGenerator \
234 cmBootstrapCommands \
239 cmCustomCommandGenerator \
240 cmDocumentVariables \
243 cmComputeLinkDepends \
244 cmComputeLinkInformation \
246 cmComputeTargetDepends \
247 cmComputeComponentGraph \
253 if ${cmake_system_mingw}; then
254 CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
255 cmGlobalMSYSMakefileGenerator \
256 cmGlobalMinGWMakefileGenerator \
257 cmWin32ProcessExecution"
264 if ${cmake_system_mingw}; then
269 KWSYS_C_MINGW_SOURCES="\
272 KWSYS_C_GENERATED_SOURCES="\
273 cmsysProcessFwd9xEnc"
279 KWSYS_C_MINGW_SOURCES=""
280 KWSYS_C_GENERATED_SOURCES=""
294 RegularExpression.hxx \
306 # Display CMake bootstrap usage
310 Usage: '"$0"' [<options>...] [-- <cmake-options>...]
311 Options: [defaults in brackets after descriptions]
313 --help print this message
314 --version only print version information
315 --verbose display more information
316 --parallel=n bootstrap cmake in parallel, where n is
318 --enable-ccache Enable ccache when building cmake
319 --init=FILE load FILE as script to populate cache
320 --system-libs use all system-installed third-party libraries
321 (for use only by package maintainers)
322 --no-system-libs use all cmake-provided third-party libraries
324 --system-curl use system-installed curl library
325 --no-system-curl use cmake-provided curl library (default)
326 --system-expat use system-installed expat library
327 --no-system-expat use cmake-provided expat library (default)
328 --system-zlib use system-installed zlib library
329 --no-system-zlib use cmake-provided zlib library (default)
330 --system-bzip2 use system-installed bzip2 library
331 --no-system-bzip2 use cmake-provided bzip2 library (default)
332 --system-libarchive use system-installed libarchive library
333 --no-system-libarchive use cmake-provided libarchive library (default)
335 --qt-gui build the Qt-based GUI (requires Qt >= 4.2)
336 --no-qt-gui do not build the Qt-based GUI (default)
337 --qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt
339 Directory and file names:
340 --prefix=PREFIX install files in tree rooted at PREFIX
341 [${cmake_default_prefix}]
342 --datadir=DIR install data files in PREFIX/DIR
344 --docdir=DIR install documentation files in PREFIX/DIR
346 --mandir=DIR install man pages files in PREFIX/DIR/manN
352 # Display CMake bootstrap usage
353 cmake_version_display()
355 echo "CMake ${cmake_version}, Copyright 2000-2011 Kitware, Inc."
358 # Display CMake bootstrap error, display the log file and exit
363 echo "---------------------------------------------"
364 echo "Error when bootstrapping CMake:"
366 echo "---------------------------------------------"
367 if [ -f cmake_bootstrap.log ]; then
368 echo "Log of errors: `pwd`/cmake_bootstrap.log"
369 #cat cmake_bootstrap.log
370 echo "---------------------------------------------"
375 # Replace KWSYS_NAMESPACE with cmsys
376 cmake_replace_string ()
382 if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
384 sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" > "${OUTFILE}${_tmp}"
385 if [ -f "${OUTFILE}${_tmp}" ]; then
386 if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
387 #echo "Files are the same"
388 rm -f "${OUTFILE}${_tmp}"
390 mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
394 cmake_error 1 "Cannot find file ${INFILE}"
398 cmake_kwsys_config_replace_string ()
404 if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
405 echo "${APPEND}" > "${OUTFILE}${_tmp}"
407 sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
408 s/@KWSYS_DO_NOT_CLEAN_PUTENV@/0/g;
409 s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
410 s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
411 s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
412 s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
413 s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
414 s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
415 s/@KWSYS_IOS_USE_SSTREAM@/${KWSYS_IOS_USE_SSTREAM}/g;
416 s/@KWSYS_IOS_USE_STRSTREAM_H@/${KWSYS_IOS_USE_STRSTREAM_H}/g;
417 s/@KWSYS_IOS_USE_STRSTREA_H@/${KWSYS_IOS_USE_STRSTREA_H}/g;
418 s/@KWSYS_IOS_HAVE_BINARY@/${KWSYS_IOS_HAVE_BINARY}/g;
419 s/@KWSYS_STL_HAVE_STD@/${KWSYS_STL_HAVE_STD}/g;
420 s/@KWSYS_STL_STRING_HAVE_ISTREAM@/${KWSYS_STL_STRING_HAVE_ISTREAM}/g;
421 s/@KWSYS_STL_STRING_HAVE_OSTREAM@/${KWSYS_STL_STRING_HAVE_OSTREAM}/g;
422 s/@KWSYS_STL_STRING_HAVE_NEQ_CHAR@/${KWSYS_STL_STRING_HAVE_NEQ_CHAR}/g;
423 s/@KWSYS_STL_HAS_ITERATOR_TRAITS@/${KWSYS_STL_HAS_ITERATOR_TRAITS}/g;
424 s/@KWSYS_STL_HAS_ITERATOR_CATEGORY@/${KWSYS_STL_HAS_ITERATOR_CATEGORY}/g;
425 s/@KWSYS_STL_HAS___ITERATOR_CATEGORY@/${KWSYS_STL_HAS___ITERATOR_CATEGORY}/g;
426 s/@KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}/g;
427 s/@KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE}/g;
428 s/@KWSYS_STL_HAS_ALLOCATOR_REBIND@/${KWSYS_STL_HAS_ALLOCATOR_REBIND}/g;
429 s/@KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@/${KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT}/g;
430 s/@KWSYS_STL_HAS_ALLOCATOR_OBJECTS@/${KWSYS_STL_HAS_ALLOCATOR_OBJECTS}/g;
431 s/@KWSYS_CXX_HAS_CSTDDEF@/${KWSYS_CXX_HAS_CSTDDEF}/g;
432 s/@KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@/${KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS}/g;
433 s/@KWSYS_CXX_HAS_MEMBER_TEMPLATES@/${KWSYS_CXX_HAS_MEMBER_TEMPLATES}/g;
434 s/@KWSYS_CXX_HAS_FULL_SPECIALIZATION@/${KWSYS_CXX_HAS_FULL_SPECIALIZATION}/g;
435 s/@KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@/${KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP}/g;
436 s/@KWSYS_STAT_HAS_ST_MTIM@/${KWSYS_STAT_HAS_ST_MTIM}/g;}" >> "${OUTFILE}${_tmp}"
437 if [ -f "${OUTFILE}${_tmp}" ]; then
438 if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
439 #echo "Files are the same"
440 rm -f "${OUTFILE}${_tmp}"
442 mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
446 cmake_error 2 "Cannot find file ${INFILE}"
449 # Write string into a file
457 # Escape spaces in strings
460 echo $1 | sed "s/ /\\\\ /g"
463 # Write message to the log
466 echo "$*" >> cmake_bootstrap.log
472 echo "cmake_bootstrap_$$_test"
475 # Run a compiler test. First argument is compiler, second one are compiler
476 # flags, third one is test source file to be compiled
482 if [ ! -f "${TESTFILE}" ]; then
483 echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
486 TMPFILE=`cmake_tmp_file`
487 echo "Try: ${COMPILER}"
488 echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
489 echo "---------- file -----------------------"
491 echo "------------------------------------------"
492 "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
494 if [ "${RES}" -ne "0" ]; then
495 echo "Test failed to compile"
498 if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
499 echo "Test failed to produce executable"
505 if [ "${RES}" -ne "0" ]; then
506 echo "Test produced non-zero return code"
513 # Run a make test. First argument is the make interpreter.
518 echo "Try: ${MAKE_PROC}"
519 "${MAKE_PROC}" ${MAKE_FLAGS}
521 if [ "${RES}" -ne "0" ]; then
522 echo "${MAKE_PROC} does not work"
525 if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
526 echo "${COMPILER} does not produce output"
532 if [ "${RES}" -ne "0" ]; then
533 echo "${MAKE_PROC} produces strange executable"
536 echo "${MAKE_PROC} works"
543 cmake_ccache_enabled=
544 cmake_prefix_dir="${cmake_default_prefix}"
545 while test $# != 0; do
547 --prefix=*) cmake_prefix_dir=`cmake_fix_slashes "${1#*=}"` ;;
548 --parallel=*) cmake_parallel_make="${1#*=}" ;;
549 --datadir=*) cmake_data_dir="${1#*=}" ;;
550 --docdir=*) cmake_doc_dir="${1#*=}" ;;
551 --mandir=*) cmake_man_dir="${1#*=}" ;;
552 --init=*) cmake_init_file="${1#*=}" ;;
553 --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
554 --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
555 --system-bzip2|--system-curl|--system-expat|--system-libarchive|--system-zlib)
556 cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper ${1#--system-}`=1" ;;
557 --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-libarchive|--no-system-zlib)
558 cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper ${1#--no-system-}`=0" ;;
559 --qt-gui) cmake_bootstrap_qt_gui="1" ;;
560 --no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
561 --qt-qmake=*) cmake_bootstrap_qt_qmake="${1#*=}" ;;
562 --help) cmake_usage ;;
563 --version) cmake_version_display ; exit 2 ;;
564 --verbose) cmake_verbose=TRUE ;;
565 --enable-ccache) cmake_ccache_enabled=TRUE ;;
567 *) die "Unknown option: $1" ;;
572 # If verbose, display some information about bootstrap
573 if [ -n "${cmake_verbose}" ]; then
574 echo "---------------------------------------------"
575 echo "Source directory: ${cmake_source_dir}"
576 echo "Binary directory: ${cmake_binary_dir}"
577 echo "Prefix directory: ${cmake_prefix_dir}"
578 echo "System: ${cmake_system}"
579 if [ "x${cmake_parallel_make}" != "x" ]; then
580 echo "Doing parallel make: ${cmake_parallel_make}"
585 echo "---------------------------------------------"
587 echo "`cmake_version_display`"
589 # Check for in-source build
590 cmake_in_source_build=
591 if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
592 -f "${cmake_binary_dir}/Source/cmake.h" ]; then
593 if [ -n "${cmake_verbose}" ]; then
594 echo "Warning: This is an in-source build"
596 cmake_in_source_build=TRUE
599 # If this is not an in-source build, then Bootstrap stuff should not exist.
600 if [ -z "${cmake_in_source_build}" ]; then
601 # Did somebody bootstrap in the source tree?
602 if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then
603 cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
604 Looks like somebody did bootstrap CMake in the source tree, but now you are
605 trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
606 directory from the source tree."
608 # Is there a cache in the source tree?
609 for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
610 if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
611 cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
612 Looks like somebody tried to build CMake in the source tree, but now you are
613 trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
614 from the source tree."
619 # Make bootstrap directory
620 [ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
621 if [ ! -d "${cmake_bootstrap_dir}" ]; then
622 cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
624 cd "${cmake_bootstrap_dir}"
626 [ -d "cmsys" ] || mkdir "cmsys"
627 if [ ! -d "cmsys" ]; then
628 cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
632 [ -d "cmsys/${a}" ] || mkdir "cmsys/${a}"
633 if [ ! -d "cmsys/${a}" ]; then
634 cmake_error 5 "Cannot create directory ${cmake_bootstrap_dir}/cmsys/${a}"
638 # Delete all the bootstrap files
639 rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
640 rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
641 rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
643 # If exist compiler flags, set them
644 cmake_c_flags=${CFLAGS}
645 cmake_cxx_flags=${CXXFLAGS}
646 cmake_ld_flags=${LDFLAGS}
648 # Add Cygwin-specific flags
649 if ${cmake_system_cygwin}; then
650 cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
653 # Add CoreFoundation framework on Darwin
654 if ${cmake_system_darwin}; then
655 cmake_ld_flags="${LDFLAGS} -framework CoreFoundation"
658 # Add BeOS toolkits...
659 if ${cmake_system_beos}; then
660 cmake_ld_flags="${LDFLAGS} -lroot -lbe"
663 # Add Haiku toolkits...
664 if ${cmake_system_haiku}; then
665 cmake_ld_flags="${LDFLAGS} -lroot -lbe"
668 #-----------------------------------------------------------------------------
669 # Detect known toolchains on some platforms.
671 case "${cmake_system}" in
672 *AIX*) cmake_toolchains='XL GNU' ;;
673 *CYGWIN*) cmake_toolchains='GNU' ;;
674 *Darwin*) cmake_toolchains='GNU Clang' ;;
675 *Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;;
676 *MINGW*) cmake_toolchains='GNU' ;;
679 # Toolchain compiler name table.
680 cmake_toolchain_Clang_CC='clang'
681 cmake_toolchain_Clang_CXX='clang++'
682 cmake_toolchain_GNU_CC='gcc'
683 cmake_toolchain_GNU_CXX='g++'
684 cmake_toolchain_PGI_CC='pgcc'
685 cmake_toolchain_PGI_CXX='pgCC'
686 cmake_toolchain_PathScale_CC='pathcc'
687 cmake_toolchain_PathScale_CXX='pathCC'
688 cmake_toolchain_XL_CC='xlc'
689 cmake_toolchain_XL_CXX='xlC'
691 cmake_toolchain_try()
694 TMPFILE=`cmake_tmp_file`
696 eval "tc_CC=\${cmake_toolchain_${tc}_CC}"
697 echo 'int main() { return 0; }' > "${TMPFILE}.c"
698 cmake_try_run "$tc_CC" "" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1
701 test "${tc_result_CC}" = "0" || return 1
703 eval "tc_CXX=\${cmake_toolchain_${tc}_CXX}"
704 echo 'int main() { return 0; }' > "${TMPFILE}.cpp"
705 cmake_try_run "$tc_CXX" "" "${TMPFILE}.cpp" >> cmake_bootstrap.log 2>&1
707 rm -f "${TMPFILE}.cpp"
708 test "${tc_result_CXX}" = "0" || return 1
710 cmake_toolchain="$tc"
713 cmake_toolchain_detect()
716 for tc in ${cmake_toolchains}; do
717 echo "Checking for $tc toolchain" >> cmake_bootstrap.log 2>&1
718 cmake_toolchain_try "$tc" &&
719 echo "Found $tc toolchain" &&
724 if [ -z "${CC}" -a -z "${CXX}" ]; then
725 cmake_toolchain_detect
728 #-----------------------------------------------------------------------------
732 # If CC is set, use that for compiler, otherwise use list of known compilers
733 if [ -n "${cmake_toolchain}" ]; then
734 eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
735 elif [ -n "${CC}" ]; then
736 cmake_c_compilers="${CC}"
738 cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
741 # Check if C compiler works
742 TMPFILE=`cmake_tmp_file`
745 # error "The CMAKE_C_COMPILER is set to a C++ compiler"
750 #if defined(__CLASSIC_C__)
755 int main(int argc, char* argv[])
758 printf("%d%c", (argv != 0), (char)0x0a);
762 for a in ${cmake_c_compilers}; do
763 if [ -z "${cmake_c_compiler}" ] && \
764 cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
765 cmake_c_compiler="${a}"
770 if [ -z "${cmake_c_compiler}" ]; then
771 cmake_error 6 "Cannot find appropriate C compiler on this system.
772 Please specify one using environment variable CC.
773 See cmake_bootstrap.log for compilers attempted.
776 echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
778 #-----------------------------------------------------------------------------
782 # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
784 # If CC is set, use that for compiler, otherwise use list of known compilers
785 if [ -n "${cmake_toolchain}" ]; then
786 eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
787 elif [ -n "${CXX}" ]; then
788 cmake_cxx_compilers="${CXX}"
790 cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
793 # Check if C++ compiler works
794 TMPFILE=`cmake_tmp_file`
799 # include <iostream.h>
805 NeedCXX() { this->Foo = 1; }
806 int GetFoo() { return this->Foo; }
814 cout << c.GetFoo() << endl;
816 std::cout << c.GetFoo() << std::endl;
821 for a in ${cmake_cxx_compilers}; do
823 if [ -z "${cmake_cxx_compiler}" ] && \
824 cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
825 cmake_cxx_compiler="${a}"
829 rm -f "${TMPFILE}.cxx"
831 if [ -z "${cmake_cxx_compiler}" ]; then
832 cmake_error 7 "Cannot find appropriate C++ compiler on this system.
833 Please specify one using environment variable CXX.
834 See cmake_bootstrap.log for compilers attempted."
836 echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
838 #-----------------------------------------------------------------------------
841 cmake_make_processor=
844 # If MAKE is set, use that for make processor, otherwise use list of known make
845 if [ -n "${MAKE}" ]; then
846 cmake_make_processors="${MAKE}"
848 cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
851 TMPFILE="`cmake_tmp_file`_dir"
852 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
853 mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
854 cd "${cmake_bootstrap_dir}/${TMPFILE}"
857 "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
861 int main(){ printf("1%c", (char)0x0a); return 0; }
863 cmake_original_make_flags="${cmake_make_flags}"
864 if [ "x${cmake_parallel_make}" != "x" ]; then
865 cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
867 for a in ${cmake_make_processors}; do
868 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
869 cmake_make_processor="${a}"
872 cmake_full_make_flags="${cmake_make_flags}"
873 if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
874 if [ -z "${cmake_make_processor}" ]; then
875 cmake_make_flags="${cmake_original_make_flags}"
876 for a in ${cmake_make_processors}; do
877 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
878 cmake_make_processor="${a}"
883 cd "${cmake_bootstrap_dir}"
885 if [ -z "${cmake_make_processor}" ]; then
886 cmake_error 8 "Cannot find appropriate Makefile processor on this system.
887 Please specify one using environment variable MAKE."
889 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
890 echo "Makefile processor on this system is: ${cmake_make_processor}"
891 if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
892 echo "---------------------------------------------"
893 echo "Makefile processor ${cmake_make_processor} does not support parallel build"
894 echo "---------------------------------------------"
897 # Ok, we have CC, CXX, and MAKE.
899 # Test C++ compiler features
903 TMPFILE=`cmake_tmp_file`
905 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
907 int main() { std::cout << "This is GNU" << std::endl; return 0;}
910 cmake_cxx_compiler_is_gnu=0
911 if cmake_try_run "${cmake_cxx_compiler}" \
912 "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
913 cmake_cxx_compiler_is_gnu=1
915 if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then
916 echo "${cmake_cxx_compiler} is GNU compiler"
918 echo "${cmake_cxx_compiler} is not GNU compiler"
920 rm -f "${TMPFILE}.cxx"
922 if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
923 # Check for non-GNU compiler flags
925 # If we are on IRIX, check for -LANG:std
926 cmake_test_flags="-LANG:std"
927 if [ "x${cmake_system}" = "xIRIX64" ]; then
928 TMPFILE=`cmake_tmp_file`
931 int main() { std::cout << "No need for '"${cmake_test_flags}"'" << std::endl; return 0;}
933 cmake_need_lang_std=0
934 if cmake_try_run "${cmake_cxx_compiler}" \
935 "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
938 if cmake_try_run "${cmake_cxx_compiler}" \
939 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
940 cmake_need_lang_std=1
943 if [ "x${cmake_need_lang_std}" = "x1" ]; then
944 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
945 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
947 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
949 rm -f "${TMPFILE}.cxx"
953 # If we are on OSF, check for -timplicit_local -no_implicit_include
954 cmake_test_flags="-timplicit_local -no_implicit_include"
955 if [ "x${cmake_system}" = "xOSF1" ]; then
956 TMPFILE=`cmake_tmp_file`
959 int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
962 if cmake_try_run "${cmake_cxx_compiler}" \
963 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
968 if [ "x${cmake_need_flags}" = "x1" ]; then
969 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
970 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
972 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
974 rm -f "${TMPFILE}.cxx"
978 # If we are on OSF, check for -std strict_ansi -nopure_cname
979 cmake_test_flags="-std strict_ansi -nopure_cname"
980 if [ "x${cmake_system}" = "xOSF1" ]; then
981 TMPFILE=`cmake_tmp_file`
984 int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
987 if cmake_try_run "${cmake_cxx_compiler}" \
988 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
993 if [ "x${cmake_need_flags}" = "x1" ]; then
994 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
995 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
997 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
999 rm -f "${TMPFILE}.cxx"
1003 # If we are on HP-UX, check for -Ae for the C compiler.
1004 cmake_test_flags="-Ae"
1005 if [ "x${cmake_system}" = "xHP-UX" ]; then
1006 TMPFILE=`cmake_tmp_file`
1008 int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
1011 if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
1014 if cmake_try_run "${cmake_c_compiler}" \
1015 "${cmake_c_flags} ${cmake_test_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
1019 if [ "x${cmake_need_Ae}" = "x1" ]; then
1020 cmake_c_flags="${cmake_c_flags} ${cmake_test_flags}"
1021 echo "${cmake_c_compiler} needs ${cmake_test_flags}"
1023 echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
1025 rm -f "${TMPFILE}.c"
1030 # Test for kwsys features
1031 KWSYS_NAME_IS_KWSYS=0
1032 KWSYS_BUILD_SHARED=0
1033 KWSYS_LFS_AVAILABLE=0
1034 KWSYS_LFS_REQUESTED=0
1035 KWSYS_IOS_USE_STRSTREAM_H=0
1036 KWSYS_IOS_USE_STRSTREA_H=0
1037 KWSYS_IOS_HAVE_STD=0
1038 KWSYS_IOS_USE_SSTREAM=0
1039 KWSYS_IOS_USE_ANSI=0
1040 KWSYS_IOS_HAVE_BINARY=0
1041 KWSYS_STL_HAVE_STD=0
1042 KWSYS_STAT_HAS_ST_MTIM=0
1043 KWSYS_STL_STRING_HAVE_NEQ_CHAR=0
1044 KWSYS_STL_HAS_ITERATOR_TRAITS=0
1045 KWSYS_STL_HAS_ITERATOR_CATEGORY=0
1046 KWSYS_STL_HAS___ITERATOR_CATEGORY=0
1047 KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=0
1048 KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=0
1049 KWSYS_STL_HAS_ALLOCATOR_REBIND=0
1050 KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=0
1051 KWSYS_STL_HAS_ALLOCATOR_OBJECTS=0
1052 KWSYS_CXX_HAS_CSTDDEF=0
1053 KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0
1054 KWSYS_CXX_HAS_MEMBER_TEMPLATES=0
1055 KWSYS_CXX_HAS_FULL_SPECIALIZATION=0
1056 KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=0
1058 # Hardcode these kwsys features. They work on all known UNIX compilers anyway.
1059 KWSYS_STL_STRING_HAVE_ISTREAM=1
1060 KWSYS_STL_STRING_HAVE_OSTREAM=1
1062 if cmake_try_run "${cmake_cxx_compiler}" \
1063 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
1064 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1065 KWSYS_STL_HAVE_STD=1
1066 echo "${cmake_cxx_compiler} has STL in std:: namespace"
1068 echo "${cmake_cxx_compiler} does not have STL in std:: namespace"
1071 if cmake_try_run "${cmake_cxx_compiler}" \
1072 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
1073 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1074 KWSYS_IOS_USE_ANSI=1
1075 echo "${cmake_cxx_compiler} has ANSI streams"
1077 echo "${cmake_cxx_compiler} does not have ANSI streams"
1080 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
1081 if cmake_try_run "${cmake_cxx_compiler}" \
1082 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
1083 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1084 KWSYS_IOS_HAVE_STD=1
1085 echo "${cmake_cxx_compiler} has streams in std:: namespace"
1087 echo "${cmake_cxx_compiler} does not have streams in std:: namespace"
1089 if cmake_try_run "${cmake_cxx_compiler}" \
1090 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
1091 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1092 KWSYS_IOS_USE_SSTREAM=1
1093 echo "${cmake_cxx_compiler} has sstream"
1095 echo "${cmake_cxx_compiler} does not have sstream"
1099 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
1100 if cmake_try_run "${cmake_cxx_compiler}" \
1101 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
1102 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1103 KWSYS_IOS_USE_STRSTREAM_H=1
1104 echo "${cmake_cxx_compiler} has strstream.h"
1106 echo "${cmake_cxx_compiler} does not have strstream.h"
1108 if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
1109 if cmake_try_run "${cmake_cxx_compiler}" \
1110 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
1111 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1112 KWSYS_IOS_USE_STRSTREA_H=1
1113 echo "${cmake_cxx_compiler} has strstrea.h"
1115 echo "${cmake_cxx_compiler} does not have strstrea.h"
1120 if cmake_try_run "${cmake_cxx_compiler}" \
1121 "${cmake_cxx_flags} -DTEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1122 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1123 KWSYS_STL_STRING_HAVE_NEQ_CHAR=1
1124 echo "${cmake_cxx_compiler} has operator!=(string, char*)"
1126 echo "${cmake_cxx_compiler} does not have operator!=(string, char*)"
1129 if cmake_try_run "${cmake_cxx_compiler}" \
1130 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_TRAITS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1131 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1132 KWSYS_STL_HAS_ITERATOR_TRAITS=1
1133 echo "${cmake_cxx_compiler} has stl iterator_traits"
1135 echo "${cmake_cxx_compiler} does not have stl iterator_traits"
1138 if [ "x${KWSYS_STL_HAS_ITERATOR_TRAITS}" = "x0" ]; then
1139 if cmake_try_run "${cmake_cxx_compiler}" \
1140 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1141 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1142 KWSYS_STL_HAS_ITERATOR_CATEGORY=1
1143 echo "${cmake_cxx_compiler} has old iterator_category"
1145 echo "${cmake_cxx_compiler} does not have old iterator_category"
1147 if [ "x${KWSYS_STL_HAS_ITERATOR_CATEGORY}" = "x0" ]; then
1148 if cmake_try_run "${cmake_cxx_compiler}" \
1149 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS___ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1150 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1151 KWSYS_STL_HAS___ITERATOR_CATEGORY=1
1152 echo "${cmake_cxx_compiler} has old __iterator_category"
1154 echo "${cmake_cxx_compiler} does not have old __iterator_category"
1159 if cmake_try_run "${cmake_cxx_compiler}" \
1160 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1161 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1162 KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=1
1163 echo "${cmake_cxx_compiler} has standard template allocator"
1165 echo "${cmake_cxx_compiler} does not have standard template allocator"
1168 if [ "x${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}" = "x1" ]; then
1169 if cmake_try_run "${cmake_cxx_compiler}" \
1170 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1171 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1172 KWSYS_STL_HAS_ALLOCATOR_REBIND=1
1173 echo "${cmake_cxx_compiler} has allocator<>::rebind<>"
1175 echo "${cmake_cxx_compiler} does not have allocator<>::rebind<>"
1178 if cmake_try_run "${cmake_cxx_compiler}" \
1179 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1180 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1181 KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=1
1182 echo "${cmake_cxx_compiler} has non-standard allocator<>::max_size argument"
1184 echo "${cmake_cxx_compiler} does not have non-standard allocator<>::max_size argument"
1187 if cmake_try_run "${cmake_cxx_compiler}" \
1188 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1189 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1190 KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=1
1191 echo "${cmake_cxx_compiler} has old non-template allocator"
1193 echo "${cmake_cxx_compiler} does not have old non-template allocator"
1197 if cmake_try_run "${cmake_cxx_compiler}" \
1198 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1199 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1200 KWSYS_STL_HAS_ALLOCATOR_OBJECTS=1
1201 echo "${cmake_cxx_compiler} has stl containers supporting allocator objects"
1203 echo "${cmake_cxx_compiler} does not have stl containers supporting allocator objects"
1206 if cmake_try_run "${cmake_cxx_compiler}" \
1207 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_CSTDDEF" \
1208 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1209 KWSYS_CXX_HAS_CSTDDEF=1
1210 echo "${cmake_cxx_compiler} has header cstddef"
1212 echo "${cmake_cxx_compiler} does not have header cstddef"
1215 if cmake_try_run "${cmake_cxx_compiler}" \
1216 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS" \
1217 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1218 echo "${cmake_cxx_compiler} does not require template friends to use <>"
1220 KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=1
1221 echo "${cmake_cxx_compiler} requires template friends to use <>"
1224 if cmake_try_run "${cmake_cxx_compiler}" \
1225 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES" \
1226 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1227 KWSYS_CXX_HAS_MEMBER_TEMPLATES=1
1228 echo "${cmake_cxx_compiler} supports member templates"
1230 echo "${cmake_cxx_compiler} does not support member templates"
1233 if cmake_try_run "${cmake_cxx_compiler}" \
1234 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION" \
1235 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1236 KWSYS_CXX_HAS_FULL_SPECIALIZATION=1
1237 echo "${cmake_cxx_compiler} has standard template specialization syntax"
1239 echo "${cmake_cxx_compiler} does not have standard template specialization syntax"
1242 if cmake_try_run "${cmake_cxx_compiler}" \
1243 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP" \
1244 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1245 KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=1
1246 echo "${cmake_cxx_compiler} has argument dependent lookup"
1248 echo "${cmake_cxx_compiler} does not have argument dependent lookup"
1251 if cmake_try_run "${cmake_cxx_compiler}" \
1252 "${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \
1253 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1254 KWSYS_STAT_HAS_ST_MTIM=1
1255 echo "${cmake_cxx_compiler} has struct stat with st_mtim member"
1257 echo "${cmake_cxx_compiler} does not have struct stat with st_mtim member"
1260 if cmake_try_run "${cmake_cxx_compiler}" \
1261 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_BINARY -DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI} -DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD}" \
1262 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1263 KWSYS_IOS_HAVE_BINARY=1
1264 echo "${cmake_cxx_compiler} has ios::binary openmode"
1266 echo "${cmake_cxx_compiler} does not have ios::binary openmode"
1269 # Just to be safe, let us store compiler and flags to the header file
1271 cmake_bootstrap_version='$Revision$'
1272 cmake_compiler_settings_comment="/*
1273 * Generated by ${cmake_source_dir}/bootstrap
1274 * Version: ${cmake_bootstrap_version}
1276 * Source directory: ${cmake_source_dir}
1277 * Binary directory: ${cmake_bootstrap_dir}
1279 * C compiler: ${cmake_c_compiler}
1280 * C flags: ${cmake_c_flags}
1282 * C++ compiler: ${cmake_cxx_compiler}
1283 * C++ flags: ${cmake_cxx_flags}
1285 * Make: ${cmake_make_processor}
1288 * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
1290 * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}
1294 cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}"
1296 if [ "x$KWSYS_STL_HAVE_STD" = "x1" ]; then
1297 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_STD_NAMESPACE */"
1299 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_STD_NAMESPACE 1"
1302 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
1303 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */"
1305 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STREAM_HEADERS 1"
1308 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x1" ]; then
1309 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STRING_STREAM */"
1311 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STRING_STREAM 1"
1314 # Test for ansi FOR scope
1315 if cmake_try_run "${cmake_cxx_compiler}" \
1316 "${cmake_cxx_flags}" \
1317 "${cmake_source_dir}/Modules/TestForAnsiForScope.cxx" >> cmake_bootstrap.log 2>&1; then
1318 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_FOR_SCOPE */"
1319 echo "${cmake_cxx_compiler} has ANSI for scoping"
1321 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_FOR_SCOPE 1"
1322 echo "${cmake_cxx_compiler} does not have ANSI for scoping"
1325 # When bootstrapping on MinGW with MSYS we must convert the source
1326 # directory to a windows path.
1327 if ${cmake_system_mingw}; then
1328 cmake_root_dir=`cd "${cmake_source_dir}"; pwd -W`
1330 cmake_root_dir="${cmake_source_dir}"
1333 # Write CMake version
1334 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
1335 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
1336 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
1337 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_TWEAK ${cmake_version_tweak}"
1338 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
1339 cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\""
1340 cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
1341 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
1343 # Regenerate configured headers
1344 for h in Configure VersionConfig; do
1345 if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then
1346 rm -f cm${h}.h${_tmp}
1348 mv -f cm${h}.h${_tmp} cm${h}.h
1353 cmake_kwsys_config_replace_string \
1354 "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
1355 "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
1356 "${cmake_compiler_settings_comment}"
1357 cmake_kwsys_config_replace_string \
1358 "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
1359 "${cmake_bootstrap_dir}/cmsys/Configure.h" \
1360 "${cmake_compiler_settings_comment}"
1362 for a in ${KWSYS_FILES}; do
1363 cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
1364 "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
1367 for a in ${KWSYS_IOS_FILES}; do
1368 cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_ios_${a}.h.in" \
1369 "${cmake_bootstrap_dir}/cmsys/ios/${a}" KWSYS_NAMESPACE cmsys
1372 cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_stl.hxx.in" \
1373 "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" KWSYS_STL_HEADER_EXTRA ""
1375 cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" \
1376 "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" KWSYS_NAMESPACE cmsys
1378 for a in string vector map algorithm; do
1379 cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" \
1380 "${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
1384 dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
1386 for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_GENERATED_SOURCES}; do
1387 objs="${objs} ${a}.o"
1390 # Generate dependencies for cmBootstrapCommands.cxx
1391 for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
1392 cmBootstrapCommandsDeps="${cmBootstrapCommandsDeps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
1394 cmBootstrapCommandsDeps=`echo $cmBootstrapCommandsDeps`
1396 if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
1397 cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
1400 if [ "x${cmake_c_flags}" != "x" ]; then
1401 cmake_c_flags="${cmake_c_flags} "
1404 if [ "x${cmake_cxx_flags}" != "x" ]; then
1405 cmake_cxx_flags="${cmake_cxx_flags} "
1408 cmake_c_flags_String="-DKWSYS_STRING_C"
1409 cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
1410 -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
1411 cmake_cxx_flags="${cmake_cxx_flags} -I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
1412 -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
1413 echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
1414 echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
1415 for a in ${CMAKE_CXX_SOURCES}; do
1416 src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
1417 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1418 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1420 echo "cmBootstrapCommands.o : $cmBootstrapCommandsDeps" >> "${cmake_bootstrap_dir}/Makefile"
1421 for a in ${CMAKE_C_SOURCES}; do
1422 src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
1423 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1424 echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1426 for a in ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}; do
1427 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
1428 src_flags=`eval echo \\${cmake_c_flags_\${a}}`
1429 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1430 echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1432 for a in ${KWSYS_CXX_SOURCES}; do
1433 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
1434 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1435 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1437 if ${cmake_system_mingw}; then
1438 src=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9xEnc.c"`
1439 in=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9x.exe"`
1440 cmd=`cmake_escape "${cmake_bootstrap_dir}/cmsysEncodeExecutable.exe"`
1441 a="cmsysProcessFwd9xEnc"
1442 echo "${cmd} : EncodeExecutable.o" >> "${cmake_bootstrap_dir}/Makefile"
1443 echo " ${cmake_c_compiler} ${cmake_ld_flags} ${cmake_c_flags} EncodeExecutable.o -o ${cmd}" >> "${cmake_bootstrap_dir}/Makefile"
1444 echo "${in} : ProcessFwd9x.o" >> "${cmake_bootstrap_dir}/Makefile"
1445 echo " ${cmake_c_compiler} ${cmake_ld_flags} ${cmake_c_flags} ProcessFwd9x.o -o ${in}" >> "${cmake_bootstrap_dir}/Makefile"
1446 echo "${src} : ${cmd} ${in}" >> "${cmake_bootstrap_dir}/Makefile"
1447 echo " ${cmd} ${in} ${src} cmsys ProcessFwd9x" >> "${cmake_bootstrap_dir}/Makefile"
1448 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1449 echo " ${cmake_c_compiler} ${cmake_c_flags} -I`cmake_escape \"${cmake_source_dir}/Source/kwsys\"` -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1453 cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
1454 ' >> "${cmake_bootstrap_dir}/Makefile"
1456 # Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake.
1458 # Generated by '"${cmake_source_dir}"'/bootstrap
1459 # Default cmake settings. These may be overridden any settings below.
1460 SET (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
1461 SET (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
1462 SET (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
1463 SET (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
1464 ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1466 # Add configuration settings given as command-line options.
1467 if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then
1469 SET (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
1470 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1472 if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then
1474 SET (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
1475 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1478 # Add user-specified settings. Handle relative-path case for
1479 # specification of cmake_init_file.
1481 cd "${cmake_binary_dir}"
1482 if [ -f "${cmake_init_file}" ]; then
1483 cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1487 echo "---------------------------------------------"
1489 # Run make to build bootstrap cmake
1490 if [ "x${cmake_parallel_make}" != "x" ]; then
1491 ${cmake_make_processor} ${cmake_make_flags}
1493 ${cmake_make_processor}
1496 if [ "${RES}" -ne "0" ]; then
1497 cmake_error 9 "Problem while running ${cmake_make_processor}"
1499 cd "${cmake_binary_dir}"
1501 # Set C, CXX, and MAKE environment variables, so that real real cmake will be
1502 # build with same compiler and make
1503 CC="${cmake_c_compiler}"
1504 CXX="${cmake_cxx_compiler}"
1505 if [ -n "${cmake_ccache_enabled}" ]; then
1509 MAKE="${cmake_make_processor}"
1514 # Run bootstrap CMake to configure real CMake
1515 cmake_options="-DCMAKE_BOOTSTRAP=1"
1516 if [ -n "${cmake_verbose}" ]; then
1517 cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
1519 "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@"
1521 if [ "${RES}" -ne "0" ]; then
1522 cmake_error 11 "Problem while running initial CMake"
1525 echo "---------------------------------------------"
1527 # And we are done. Now just run make
1528 echo "CMake has bootstrapped. Now run ${cmake_make_processor}."