3 #=========================================================================
5 # Program: CMake - Cross-Platform Makefile Generator
6 # Module: $RCSfile: bootstrap,v $
7 # Language: Bourne Shell
8 # Date: $Date: 2005-03-09 20:51:30 $
9 # Version: $Revision: 1.51 $
11 # Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
12 # See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
14 # This software is distributed WITHOUT ANY WARRANTY; without even
15 # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 # PURPOSE. See the above copyright notices for more information.
18 #=========================================================================
20 CMAKE_KNOWN_C_COMPILERS
="cc gcc xlc icc tcc"
21 CMAKE_KNOWN_CXX_COMPILERS
="aCC xlC CC g++ c++ icc como "
22 CMAKE_KNOWN_MAKE_PROCESSORS
="gmake make"
24 CMAKE_PROBLEMATIC_FILES
="\
27 CMakeCCompiler.cmake \
28 CMakeCXXCompiler.cmake \
29 Source/cmConfigure.h \
30 Source/CTest/Curl/config.h \
31 Utilities/cmexpat/expatConfig.h \
32 Utilities/cmexpat/expatDllConfig.h \
43 cmGeneratedFileStream \
48 cmGlobalUnixMakefileGenerator \
49 cmGlobalXCodeGenerator \
50 cmLocalXCodeGenerator \
52 cmLocalUnixMakefileGenerator \
53 cmLocalUnixMakefileGenerator2 \
60 cmOrderLinkDirectories \
78 RegularExpression.hxx \
89 cmake_source_dir
=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
90 cmake_source_dir
=`(cd "${cmake_source_dir}";pwd)`
91 cmake_binary_dir
=`pwd`
92 cmake_bootstrap_dir
="${cmake_binary_dir}/Bootstrap.cmk"
93 cmake_data_dir
="/share/CMake"
94 cmake_doc_dir
="/doc/CMake"
98 # Display CMake bootstrap usage
103 Options: [defaults in brackets after descriptions]
105 --help print this message
106 --version only print version information
107 --verbose display more information
108 --parallel=n bootstrap cmake in parallel, where n is
110 --init=FILE use FILE for cmake initialization
112 Directory and file names:
113 --prefix=PREFIX install files in tree rooted at PREFIX
115 --datadir=DIR install data files in PREFIX/DIR
117 --docdir=DIR install documentation files in PREFIX/DIR
119 --mandir=DIR install man pages files in PREFIX/DIR/manN
125 # Display CMake bootstrap usage
130 for a
in MAJOR MINOR PATCH
; do
131 CMake_VERSION
=`cat "${cmake_source_dir}/CMakeLists.txt" | \
132 grep "SET(CMake_VERSION_${a} *[0-9]*)" | sed "s/SET(CMake_VERSION_${a} *\([0-9]*\))/\1/"`
133 CMAKE_VERSION
="${CMAKE_VERSION}.${CMake_VERSION}"
135 CMAKE_VERSION
=`echo $CMAKE_VERSION | sed "s/\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1.\2-\3/"`
136 echo "CMake ${CMAKE_VERSION}, Copyright (c) 2002 Kitware, Inc., Insight Consortium"
139 # Display CMake bootstrap error, display the log file and exit
144 echo "---------------------------------------------"
145 echo "Error when bootstrapping CMake:"
147 echo "---------------------------------------------"
148 if [ -f cmake_bootstrap.log
]; then
149 echo "Log of errors: `pwd`/cmake_bootstrap.log"
150 #cat cmake_bootstrap.log
151 echo "---------------------------------------------"
156 # Replace KWSYS_NAMESPACE with cmsys
157 cmake_replace_string
()
163 if [ -f "${INFILE}" ]; then
165 sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" > "${OUTFILE}.tmp"
166 if [ -f "${OUTFILE}.tmp" ]; then
167 if diff "${OUTFILE}" "${OUTFILE}.tmp" > /dev
/null
2> /dev
/null
; then
168 #echo "Files are the same"
169 rm -f "${OUTFILE}.tmp"
171 mv -f "${OUTFILE}.tmp" "${OUTFILE}"
175 cmake_error
1 "Cannot find file ${INFILE}"
179 cmake_kwsys_config_replace_string
()
185 if [ -f "${INFILE}" ]; then
186 echo "${APPEND}" > "${OUTFILE}.tmp"
188 sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
189 s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
190 s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
191 s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
192 s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
193 s/@KWSYS_IOS_USE_SSTREAM@/${KWSYS_IOS_USE_SSTREAM}/g;
194 s/@KWSYS_IOS_USE_STRSTREAM_H@/${KWSYS_IOS_USE_STRSTREAM_H}/g;
195 s/@KWSYS_IOS_USE_STRSTREA_H@/${KWSYS_IOS_USE_STRSTREA_H}/g;
196 s/@KWSYS_STL_HAVE_STD@/${KWSYS_STL_HAVE_STD}/g;
197 s/@KWSYS_STAT_HAS_ST_MTIM@/${KWSYS_STAT_HAS_ST_MTIM}/g;}" >> "${OUTFILE}.tmp"
198 if [ -f "${OUTFILE}.tmp" ]; then
199 if diff "${OUTFILE}" "${OUTFILE}.tmp" > /dev
/null
2> /dev
/null
; then
200 #echo "Files are the same"
201 rm -f "${OUTFILE}.tmp"
203 mv -f "${OUTFILE}.tmp" "${OUTFILE}"
207 cmake_error
2 "Cannot find file ${INFILE}"
210 # Write string into a file
218 # Escape spaces in strings
221 echo $1 |
sed "s/ /\\\\ /g"
224 # Write message to the log
227 echo "$*" >> cmake_bootstrap.log
233 echo "cmake_bootstrap_$$.test"
236 # Run a compiler test. First argument is compiler, second one are compiler
237 # flags, third one is test source file to be compiled
243 if [ ! -f "${TESTFILE}" ]; then
244 echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
247 TMPFILE
=`cmake_tmp_file`
248 echo "Try: ${COMPILER}"
249 echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
250 echo "---------- file -----------------------"
252 echo "------------------------------------------"
253 "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
255 if [ "${RES}" -ne "0" ]; then
256 echo "Test failed to compile"
259 if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
260 echo "Test failed to produce executable"
266 if [ "${RES}" -ne "0" ]; then
267 echo "Test produced non-zero return code"
274 # Run a make test. First argument is the make interpreter.
279 echo "Try: ${MAKE_PROC}"
280 "${MAKE_PROC}" ${MAKE_FLAGS}
282 if [ "${RES}" -ne "0" ]; then
283 echo "${MAKE_PROC} does not work"
286 if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
287 echo "${COMPILER} does not produce output"
293 if [ "${RES}" -ne "0" ]; then
294 echo "${MAKE_PROC} produces strange executable"
297 echo "${MAKE_PROC} works"
304 cmake_prefix_dir
="/usr/local"
306 if echo $a |
grep "^--prefix=" > /dev
/null
2> /dev
/null
; then
307 cmake_prefix_dir
=`echo $a | sed "s/^--prefix=//"`
309 if echo $a |
grep "^--parallel=" > /dev
/null
2> /dev
/null
; then
310 cmake_parallel_make
=`echo $a | sed "s/^--parallel=//" | grep "[0-9][0-9]*"`
312 if echo $a |
grep "^--datadir=" > /dev
/null
2> /dev
/null
; then
313 cmake_data_dir
=`echo $a | sed "s/^--datadir=//"`
315 if echo $a |
grep "^--docdir=" > /dev
/null
2> /dev
/null
; then
316 cmake_doc_dir
=`echo $a | sed "s/^--docdir=//"`
318 if echo $a |
grep "^--mandir=" > /dev
/null
2> /dev
/null
; then
319 cmake_man_dir
=`echo $a | sed "s/^--mandir=//"`
321 if echo $a |
grep "^--init=" > /dev
/null
2> /dev
/null
; then
322 cmake_init_file
=`echo $a | sed "s/^--init=//"`
324 if echo $a |
grep "^--help" > /dev
/null
2> /dev
/null
; then
327 if echo $a |
grep "^--version" > /dev
/null
2> /dev
/null
; then
331 if echo $a |
grep "^--verbose" > /dev
/null
2> /dev
/null
; then
336 # If verbose, display some information about bootstrap
337 if [ -n "${cmake_verbose}" ]; then
338 echo "---------------------------------------------"
339 echo "Source directory: ${cmake_source_dir}"
340 echo "Binary directory: ${cmake_binary_dir}"
341 echo "Prefix directory: ${cmake_prefix_dir}"
342 echo "System: ${cmake_system}"
343 if [ "x${cmake_parallel_make}" != "x" ]; then
344 echo "Doing parallel make: ${cmake_parallel_make}"
349 echo "---------------------------------------------"
351 echo "`cmake_version`"
353 # Check for in-source build
354 cmake_in_source_build
=
355 if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
356 -f "${cmake_binary_dir}/Source/cmake.h" ]; then
357 if [ -n "${cmake_verbose}" ]; then
358 echo "Warning: This is an in-source build"
360 cmake_in_source_build
=TRUE
363 # If this is not an in-source build, then Bootstrap stuff should not exist.
364 if [ -z "${cmake_in_source_build}" ]; then
365 # Did somebody bootstrap in the source tree?
366 if [ -d "${cmake_source_dir}/Bootstrap.cmk" ]; then
367 cmake_error
10 "Found directory \"${cmake_source_dir}/Bootstrap.cmk\".
368 Looks like somebody did bootstrap CMake in the source tree, but now you are
369 trying to do bootstrap in the binary tree. Please remove Bootstrap.cmk
370 directory from the source tree."
372 # Is there a cache in the source tree?
373 for cmake_problematic_file
in ${CMAKE_PROBLEMATIC_FILES}; do
374 if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
375 cmake_error
10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
376 Looks like somebody tried to build CMake in the source tree, but now you are
377 trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
378 from the source tree."
383 # Make bootstrap directory
384 [ -d "${cmake_bootstrap_dir}" ] || mkdir
"${cmake_bootstrap_dir}"
385 if [ ! -d "${cmake_bootstrap_dir}" ]; then
386 cmake_error
3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
388 cd "${cmake_bootstrap_dir}"
390 [ -d "cmsys" ] || mkdir
"cmsys"
391 if [ ! -d "cmsys" ]; then
392 cmake_error
4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
396 [ -d "cmsys/${a}" ] || mkdir
"cmsys/${a}"
397 if [ ! -d "cmsys/${a}" ]; then
398 cmake_error
5 "Cannot create directory ${cmake_bootstrap_dir}/cmsys/${a}"
402 # Delete all the bootstrap files
403 rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
404 rm -f "${cmake_bootstrap_dir}/cmConfigure.h.tmp"
406 # If exist compiler flags, set them
407 cmake_c_flags
=${CFLAGS}
408 cmake_cxx_flags
=${CXXFLAGS}
413 # If CC is set, use that for compiler, otherwise use list of known compilers
414 if [ -n "${CC}" ]; then
415 cmake_c_compilers
="${CC}"
417 cmake_c_compilers
="${CMAKE_KNOWN_C_COMPILERS}"
420 # Check if C compiler works
421 TMPFILE
=`cmake_tmp_file`
422 cat > "${TMPFILE}.c" <<EOF
430 for a
in ${cmake_c_compilers}; do
431 if [ -z "${cmake_c_compiler}" ] && \
432 cmake_try_run
"${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log
2>&1; then
433 cmake_c_compiler
="${a}"
438 if [ -z "${cmake_c_compiler}" ]; then
439 cmake_error
6 "Cannot find appropriate C compiler on this system.
440 Please specify one using environment variable CC.
441 See cmake_bootstrap.log for compilers attempted.
444 echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
449 # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
451 # If CC is set, use that for compiler, otherwise use list of known compilers
452 if [ -n "${CXX}" ]; then
453 cmake_cxx_compilers
="${CXX}"
455 cmake_cxx_compilers
="${CMAKE_KNOWN_CXX_COMPILERS}"
458 # Check if C++ compiler works
459 TMPFILE
=`cmake_tmp_file`
460 cat > "${TMPFILE}.cxx" <<EOF
464 # include <iostream.h>
470 NeedCXX() { this->Foo = 1; }
471 int GetFoo() { return this->Foo; }
479 cout << c.GetFoo() << endl;
481 std::cout << c.GetFoo() << std::endl;
486 for a
in ${cmake_cxx_compilers}; do
488 if [ -z "${cmake_cxx_compiler}" ] && \
489 cmake_try_run
"${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log
2>&1; then
490 cmake_cxx_compiler
="${a}"
494 rm -f "${TMPFILE}.cxx"
496 if [ -z "${cmake_cxx_compiler}" ]; then
497 cmake_error
7 "Cannot find appropriate C++ compiler on this system.
498 Please specify one using environment variable CXX.
499 See cmake_bootstrap.log for compilers attempted."
501 echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
505 cmake_make_processor
=
508 # If MAKE is set, use that for make processor, otherwise use list of known make
509 if [ -n "${MAKE}" ]; then
510 cmake_make_processors
="${MAKE}"
512 cmake_make_processors
="${CMAKE_KNOWN_MAKE_PROCESSORS}"
515 TMPFILE
="`cmake_tmp_file`_dir"
516 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
517 mkdir
"${cmake_bootstrap_dir}/${TMPFILE}"
518 cd "${cmake_bootstrap_dir}/${TMPFILE}"
521 "${cmake_c_compiler}" -o test test.c
525 int main(){ printf("1\n"); return 0; }
527 cmake_original_make_flags
="${cmake_make_flags}"
528 if [ "x${cmake_parallel_make}" != "x" ]; then
529 cmake_make_flags
="${cmake_make_flags} -j ${cmake_parallel_make}"
531 for a
in ${cmake_make_processors}; do
532 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log
2>&1; then
533 cmake_make_processor
="${a}"
536 cmake_full_make_flags
="${cmake_make_flags}"
537 if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
538 if [ -z "${cmake_make_processor}" ]; then
539 cmake_make_flags
="${cmake_original_make_flags}"
540 for a
in ${cmake_make_processors}; do
541 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log
2>&1; then
542 cmake_make_processor
="${a}"
547 cd "${cmake_bootstrap_dir}"
548 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
550 if [ -z "${cmake_make_processor}" ]; then
551 cmake_error
8 "Cannot find appropriate Makefile processor on this system.
552 Please specify one using environment variable MAKE."
554 echo "Makefile processor on this system is: ${cmake_make_processor}"
555 if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
556 echo "---------------------------------------------"
557 echo "Makefile processor ${cmake_make_processor} does not support parallel build"
558 echo "---------------------------------------------"
561 # Ok, we have CC, CXX, and MAKE.
563 # Test C++ compiler features
567 TMPFILE
=`cmake_tmp_file`
568 cat > ${TMPFILE}.cxx
<<EOF
569 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
571 int main() { std::cout << "This is GNU" << std::endl; return 0;}
574 cmake_cxx_compiler_is_gnu
=0
575 if cmake_try_run
"${cmake_cxx_compiler}" \
576 "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log
2>&1; then
577 cmake_cxx_compiler_is_gnu
=1
579 if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then
580 echo "${cmake_cxx_compiler} is GNU compiler"
582 echo "${cmake_cxx_compiler} is not GNU compiler"
584 rm -f "${TMPFILE}.cxx"
586 if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
587 # Check for non-GNU compiler flags
589 # If we are on IRIX, check for -LANG:std
590 cmake_test_flags
="-LANG:std"
591 if [ "x${cmake_system}" = "xIRIX64" ]; then
592 TMPFILE
=`cmake_tmp_file`
593 cat > ${TMPFILE}.cxx
<<EOF
595 int main() { std::cout << "No need for ${cmake_test_flags}" << std::endl; return 0;}
597 cmake_need_lang_std
=0
598 if cmake_try_run
"${cmake_cxx_compiler}" \
599 "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log
2>&1; then
602 if cmake_try_run
"${cmake_cxx_compiler}" \
603 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log
2>&1; then
604 cmake_need_lang_std
=1
607 if [ "x${cmake_need_lang_std}" = "x1" ]; then
608 cmake_cxx_flags
="${cmake_cxx_flags} ${cmake_test_flags}"
609 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
611 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
613 rm -f "${TMPFILE}.cxx"
617 # If we are on OSF, check for -timplicit_local -no_implicit_include
618 cmake_test_flags
="-timplicit_local -no_implicit_include"
619 if [ "x${cmake_system}" = "xOSF1" ]; then
620 TMPFILE
=`cmake_tmp_file`
621 cat > ${TMPFILE}.cxx
<<EOF
623 int main() { std::cout << "We need ${cmake_test_flags}" << std::endl; return 0;}
626 if cmake_try_run
"${cmake_cxx_compiler}" \
627 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log
2>&1; then
632 if [ "x${cmake_need_flags}" = "x1" ]; then
633 cmake_cxx_flags
="${cmake_cxx_flags} ${cmake_test_flags}"
634 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
636 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
638 rm -f "${TMPFILE}.cxx"
642 # If we are on OSF, check for -std strict_ansi -nopure_cname
643 cmake_test_flags
="-std strict_ansi -nopure_cname"
644 if [ "x${cmake_system}" = "xOSF1" ]; then
645 TMPFILE
=`cmake_tmp_file`
646 cat > ${TMPFILE}.cxx
<<EOF
648 int main() { std::cout << "We need ${cmake_test_flags}" << std::endl; return 0;}
651 if cmake_try_run
"${cmake_cxx_compiler}" \
652 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log
2>&1; then
657 if [ "x${cmake_need_flags}" = "x1" ]; then
658 cmake_cxx_flags
="${cmake_cxx_flags} ${cmake_test_flags}"
659 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
661 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
663 rm -f "${TMPFILE}.cxx"
667 # If we are on HP-UX, check for -Ae for the C compiler.
668 cmake_test_flags
="-Ae"
669 if [ "x${cmake_system}" = "xHP-UX" ]; then
670 TMPFILE
=`cmake_tmp_file`
671 cat > ${TMPFILE}.c
<<EOF
672 int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
675 if cmake_try_run
"${cmake_c_compiler}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log
2>&1; then
678 if cmake_try_run
"${cmake_c_compiler}" \
679 "${cmake_c_flags} ${cmake_test_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log
2>&1; then
683 if [ "x${cmake_need_Ae}" = "x1" ]; then
684 cmake_c_flags
="${cmake_c_flags} ${cmake_test_flags}"
685 echo "${cmake_c_compiler} needs ${cmake_test_flags}"
687 echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
694 # Test for kwsys features
695 KWSYS_NAME_IS_KWSYS
=0
697 KWSYS_IOS_USE_STRSTREAM_H
=0
698 KWSYS_IOS_USE_STRSTREA_H
=0
700 KWSYS_IOS_USE_SSTREAM
=0
703 KWSYS_STAT_HAS_ST_MTIM
=0
705 if cmake_try_run
"${cmake_cxx_compiler}" \
706 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
707 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log
2>&1; then
709 echo "${cmake_cxx_compiler} has STL in std:: namespace"
711 echo "${cmake_cxx_compiler} does not have STL in std:: namespace"
714 if cmake_try_run
"${cmake_cxx_compiler}" \
715 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
716 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log
2>&1; then
718 echo "${cmake_cxx_compiler} has ANSI streams"
720 echo "${cmake_cxx_compiler} does not have ANSI streams"
723 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
724 if cmake_try_run
"${cmake_cxx_compiler}" \
725 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
726 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log
2>&1; then
728 echo "${cmake_cxx_compiler} has streams in std:: namespace"
730 echo "${cmake_cxx_compiler} does not have streams in std:: namespace"
732 if cmake_try_run
"${cmake_cxx_compiler}" \
733 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
734 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log
2>&1; then
735 KWSYS_IOS_USE_SSTREAM
=1
736 echo "${cmake_cxx_compiler} has sstream"
738 echo "${cmake_cxx_compiler} does not have sstream"
742 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
743 if cmake_try_run
"${cmake_cxx_compiler}" \
744 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
745 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log
2>&1; then
746 KWSYS_IOS_USE_STRSTREAM_H
=1
747 echo "${cmake_cxx_compiler} has strstream.h"
749 echo "${cmake_cxx_compiler} does not have strstream.h"
751 if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
752 if cmake_try_run
"${cmake_cxx_compiler}" \
753 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
754 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log
2>&1; then
755 KWSYS_IOS_USE_STRSTREA_H
=1
756 echo "${cmake_cxx_compiler} has strstrea.h"
758 echo "${cmake_cxx_compiler} does not have strstrea.h"
763 if cmake_try_run
"${cmake_cxx_compiler}" \
764 "${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \
765 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log
2>&1; then
766 KWSYS_STAT_HAS_ST_MTIM
=1
767 echo "${cmake_cxx_compiler} has struct stat with st_mtim member"
769 echo "${cmake_cxx_compiler} does not have struct stat with st_mtim member"
772 # Just to be safe, let us store compiler and flags to the header file
774 cmake_bootstrap_version
='$Revision: 1.51 $'
775 cmake_compiler_settings_comment
="/*
776 * Generated by ${cmake_source_dir}/bootstrap
777 * Version: ${cmake_bootstrap_version}
779 * Source directory: ${cmake_source_dir}
780 * Binary directory: ${cmake_bootstrap_dir}
782 * C compiler: ${cmake_c_compiler}
783 * C flags: ${cmake_c_flags}
785 * C++ compiler: ${cmake_cxx_compiler}
786 * C++ flags: ${cmake_cxx_flags}
788 * Make: ${cmake_make_processor}
791 * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
793 * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
797 cmake_report cmConfigure.h.tmp
"${cmake_compiler_settings_comment}"
799 if [ "x$KWSYS_STL_HAVE_STD" = "x1" ]; then
800 cmake_report cmConfigure.h.tmp
"/* #undef CMAKE_NO_STD_NAMESPACE */"
802 cmake_report cmConfigure.h.tmp
"#define CMAKE_NO_STD_NAMESPACE 1"
805 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
806 cmake_report cmConfigure.h.tmp
"/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */"
808 cmake_report cmConfigure.h.tmp
"#define CMAKE_NO_ANSI_STREAM_HEADERS 1"
811 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x1" ]; then
812 cmake_report cmConfigure.h.tmp
"/* #undef CMAKE_NO_ANSI_STRING_STREAM */"
814 cmake_report cmConfigure.h.tmp
"#define CMAKE_NO_ANSI_STRING_STREAM 1"
817 # Test for ansi FOR scope
818 if cmake_try_run
"${cmake_cxx_compiler}" \
819 "${cmake_cxx_flags}" \
820 "${cmake_source_dir}/Modules/TestForAnsiForScope.cxx" >> cmake_bootstrap.log
2>&1; then
821 cmake_report cmConfigure.h.tmp
"/* #undef CMAKE_NO_ANSI_FOR_SCOPE */"
822 echo "${cmake_cxx_compiler} has ANSI for scoping"
824 cmake_report cmConfigure.h.tmp
"#define CMAKE_NO_ANSI_FOR_SCOPE 1"
825 echo "${cmake_cxx_compiler} does not have ANSI for scoping"
828 # Write CMake version
829 for a
in MAJOR MINOR PATCH
; do
830 CMake_VERSION
=`cat "${cmake_source_dir}/CMakeLists.txt" | \
831 grep "SET(CMake_VERSION_${a} *[0-9]*)" | sed "s/SET(CMake_VERSION_${a} *\([0-9]*\))/\1/"`
832 cmake_report cmConfigure.h.tmp
"#define CMake_VERSION_${a} ${CMake_VERSION}"
834 cmake_report cmConfigure.h.tmp
"#define CMAKE_ROOT_DIR \"${cmake_source_dir}\""
835 cmake_report cmConfigure.h.tmp
"#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
836 cmake_report cmConfigure.h.tmp
"#define CMAKE_BOOTSTRAP"
838 # Regenerate real cmConfigure.h
839 if diff cmConfigure.h cmConfigure.h.tmp
> /dev
/null
2> /dev
/null
; then
840 rm -f cmConfigure.h.tmp
842 mv -f cmConfigure.h.tmp cmConfigure.h
846 cmake_kwsys_config_replace_string \
847 "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
848 "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
849 "${cmake_compiler_settings_comment}"
850 cmake_kwsys_config_replace_string \
851 "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
852 "${cmake_bootstrap_dir}/cmsys/Configure.h" \
853 "${cmake_compiler_settings_comment}"
855 for a
in ${KWSYS_FILES}; do
856 cmake_replace_string
"${cmake_source_dir}/Source/kwsys/${a}.in" \
857 "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
860 for a
in ${KWSYS_IOS_FILES}; do
861 cmake_replace_string
"${cmake_source_dir}/Source/kwsys/kwsys_ios_${a}.h.in" \
862 "${cmake_bootstrap_dir}/cmsys/ios/${a}" KWSYS_NAMESPACE cmsys
865 cmake_replace_string
"${cmake_source_dir}/Source/kwsys/kwsys_stl.h.in" \
866 "${cmake_bootstrap_dir}/cmsys/stl/stl.h.in" KWSYS_NAMESPACE cmsys
868 for a
in string vector map
; do
869 cmake_replace_string
"${cmake_bootstrap_dir}/cmsys/stl/stl.h.in" \
870 "${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
874 dep="cmConfigure.h cmsys
/Configure.hxx cmsys
/Configure.h
`cmake_escape \"${cmake_source_dir}\"`/Source
/*.h
"
876 for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
877 objs="${objs} ${a}.o
"
880 # Generate dependencies for cmBootstrapCommands.cxx
881 for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
882 cmBootstrapCommandsDeps
="${cmBootstrapCommandsDeps} `cmake_escape "${cmake_source_dir}/Source
/$file"`"
884 cmBootstrapCommandsDeps
=`echo $cmBootstrapCommandsDeps`
886 if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
887 cmake_cxx_flags
="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
890 if [ "x${cmake_c_flags}" != "x" ]; then
891 cmake_c_flags
="${cmake_c_flags} "
894 if [ "x${cmake_cxx_flags}" != "x" ]; then
895 cmake_cxx_flags
="${cmake_cxx_flags} "
898 cmake_c_flags
="${cmake_c_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
899 -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
900 cmake_cxx_flags
="${cmake_cxx_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
901 -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
902 echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
903 echo " ${cmake_cxx_compiler} ${LDFLAGS} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
904 for a
in ${CMAKE_CXX_SOURCES}; do
905 src
=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
906 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
907 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
909 echo "cmBootstrapCommands.o : $cmBootstrapCommandsDeps" >> "${cmake_bootstrap_dir}/Makefile"
910 for a
in ${CMAKE_C_SOURCES}; do
911 src
=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
912 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
913 echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
915 for a
in ${KWSYS_C_SOURCES}; do
916 src
=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
917 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
918 echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
920 for a
in ${KWSYS_CXX_SOURCES}; do
921 src
=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
922 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
923 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
925 cat>>"${cmake_bootstrap_dir}/Makefile"<<EOF
927 cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
930 # Write our default settings to Bootstrap.cmk/InitialCacheFlags.cmake.
931 cat > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" <<EOF
932 # Generated by ${cmake_source_dir}/bootstrap
933 # Default cmake settings. These may be overridden any settings below.
934 SET (CMAKE_INSTALL_PREFIX "${cmake_prefix_dir}" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
935 SET (CMAKE_DOC_DIR "${cmake_doc_dir}" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
936 SET (CMAKE_MAN_DIR "${cmake_man_dir}" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
937 SET (CMAKE_DATA_DIR "${cmake_data_dir}" CACHE PATH "Install location for data (relative to prefix)." FORCE)
940 # Add user-specified settings. Handle relative-path case for
941 # specification of cmake_init_file.
943 cd "${cmake_binary_dir}"
944 if [ -f "${cmake_init_file}" ]; then
945 cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
949 echo "---------------------------------------------"
951 # Run make to build bootstrap cmake
952 if [ "x${cmake_parallel_make}" != "x" ]; then
953 ${cmake_make_processor} ${cmake_make_flags}
955 ${cmake_make_processor}
958 if [ "${RES}" -ne "0" ]; then
959 cmake_error
9 "Problem while running ${cmake_make_processor}"
961 cd "${cmake_binary_dir}"
963 # Set C, CXX, and MAKE environment variables, so that real real cmake will be
964 # build with same compiler and make
965 CC
="${cmake_c_compiler}"
966 CXX
="${cmake_cxx_compiler}"
967 MAKE
="${cmake_make_processor}"
972 # Run bootstrap CMake to configure real CMake
973 "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
975 if [ "${RES}" -ne "0" ]; then
976 cmake_error
11 "Problem while running initial CMake"
979 echo "---------------------------------------------"
981 # And we are done. Now just run make
982 echo "CMake has bootstrapped. Now run ${cmake_make_processor}."