If labels are found on the tests, then print a time summary for all the tests run...
[cmake.git] / bootstrap
blob70142968581da79d4edee5f840c9574ca1d1bf68
1 #!/bin/sh
3 #=========================================================================
5 # Program: CMake - Cross-Platform Makefile Generator
6 # Module: $RCSfile: bootstrap,v $
7 # Language: Bourne Shell
8 # Date: $Date: 2009-08-11 13:54:56 $
9 # Version: $Revision: 1.123 $
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 # Version number extraction function.
21 cmake_version_component()
23 cat "${cmake_source_dir}/CMakeLists.txt" | sed -n "
24 /^SET(CMake_VERSION_${1}/ {s/SET(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
28 cmake_date_stamp_component()
30 cat "${cmake_source_dir}/Source/kwsys/kwsysDateStamp.cmake" | sed -n "
31 /KWSYS_DATE_STAMP_${1}/ {s/^.* \([0-9][0-9]*\))$/\1/;p;}
35 # Detect system and directory information.
36 cmake_system=`uname`
37 cmake_source_dir=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
38 cmake_source_dir=`(cd "${cmake_source_dir}";pwd)`
39 cmake_binary_dir=`pwd`
40 cmake_version_major="`cmake_version_component MAJOR`"
41 cmake_version_minor="`cmake_version_component MINOR`"
42 if echo "${cmake_version_minor}" | grep "[0-9]*[13579]" > /dev/null 2>&1; then
43 cmake_version_patch="`cmake_date_stamp_component YEAR``cmake_date_stamp_component MONTH``cmake_date_stamp_component DAY`"
44 else
45 cmake_version_patch="`cmake_version_component PATCH`"
47 cmake_version="${cmake_version_major}.${cmake_version_minor}"
48 cmake_version_full="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
49 cmake_data_dir="/share/cmake-${cmake_version}"
50 cmake_doc_dir="/doc/cmake-${cmake_version}"
51 cmake_man_dir="/man"
52 cmake_init_file=""
53 cmake_bootstrap_system_libs=""
54 cmake_bootstrap_qt_gui=""
55 cmake_bootstrap_qt_qmake=""
57 # Determine whether this is a Cygwin environment.
58 if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
59 cmake_system_cygwin=true
60 else
61 cmake_system_cygwin=false
64 # Determine whether this is a MinGW environment.
65 if echo "${cmake_system}" | grep MINGW >/dev/null 2>&1; then
66 cmake_system_mingw=true
67 else
68 cmake_system_mingw=false
71 # Determine whether this is OS X
72 if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then
73 cmake_system_darwin=true
74 else
75 cmake_system_darwin=false
78 # Determine whether this is BeOS
79 if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
80 cmake_system_beos=true
81 else
82 cmake_system_beos=false
85 # Determine whether this is Haiku
86 if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
87 cmake_system_haiku=true
88 else
89 cmake_system_haiku=false
92 # Determine whether this is OpenVMS
93 if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then
94 cmake_system_openvms=true
95 else
96 cmake_system_openvms=false
99 # Choose the generator to use for bootstrapping.
100 if ${cmake_system_mingw}; then
101 # Bootstrapping from an MSYS prompt.
102 cmake_bootstrap_generator="MSYS Makefiles"
103 else
104 # Bootstrapping from a standard UNIX prompt.
105 cmake_bootstrap_generator="Unix Makefiles"
108 # Choose tools and extensions for this platform.
109 if ${cmake_system_openvms}; then
110 _tmp="_tmp"
111 _cmk="_cmk"
112 _diff=`which diff`
113 else
114 _tmp=".tmp"
115 _cmk=".cmk"
116 _diff="diff"
119 # Construct bootstrap directory name.
120 cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}"
122 # Helper function to fix windows paths.
123 cmake_fix_slashes ()
125 echo "$1" | sed 's/\\/\//g'
128 # Choose the default install prefix.
129 if ${cmake_system_mingw}; then
130 if [ "x${PROGRAMFILES}" != "x" ]; then
131 cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
132 elif [ "x${ProgramFiles}" != "x" ]; then
133 cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
134 elif [ "x${SYSTEMDRIVE}" != "x" ]; then
135 cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
136 elif [ "x${SystemDrive}" != "x" ]; then
137 cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
138 else
139 cmake_default_prefix="c:/Program Files/CMake"
141 else
142 cmake_default_prefix="/usr/local"
145 CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
146 CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
147 CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
149 CMAKE_PROBLEMATIC_FILES="\
150 CMakeCache.txt \
151 CMakeSystem.cmake \
152 CMakeCCompiler.cmake \
153 CMakeCXXCompiler.cmake \
154 Source/cmConfigure.h \
155 Source/CTest/Curl/config.h \
156 Utilities/cmexpat/expatConfig.h \
157 Utilities/cmexpat/expatDllConfig.h \
160 CMAKE_UNUSED_SOURCES="\
161 cmGlobalXCodeGenerator \
162 cmLocalXCodeGenerator \
163 cmXCodeObject \
164 cmXCode21Object \
165 cmSourceGroup \
168 CMAKE_CXX_SOURCES="\
169 cmake \
170 cmakemain \
171 cmakewizard \
172 cmCommandArgumentLexer \
173 cmCommandArgumentParser \
174 cmCommandArgumentParserHelper \
175 cmDefinitions \
176 cmDepends \
177 cmDependsC \
178 cmDocumentationFormatter \
179 cmDocumentationFormatterText \
180 cmPolicies \
181 cmProperty \
182 cmPropertyMap \
183 cmPropertyDefinition \
184 cmPropertyDefinitionMap \
185 cmMakeDepend \
186 cmMakefile \
187 cmExportFileGenerator \
188 cmExportInstallFileGenerator \
189 cmInstallDirectoryGenerator \
190 cmGeneratedFileStream \
191 cmGeneratorExpression \
192 cmGlobalGenerator \
193 cmLocalGenerator \
194 cmInstallGenerator \
195 cmInstallExportGenerator \
196 cmInstallFilesGenerator \
197 cmInstallScriptGenerator \
198 cmInstallTargetGenerator \
199 cmScriptGenerator \
200 cmSourceFile \
201 cmSourceFileLocation \
202 cmSystemTools \
203 cmTestGenerator \
204 cmVersion \
205 cmFileTimeComparison \
206 cmGlobalUnixMakefileGenerator3 \
207 cmLocalUnixMakefileGenerator3 \
208 cmMakefileExecutableTargetGenerator \
209 cmMakefileLibraryTargetGenerator \
210 cmMakefileTargetGenerator \
211 cmMakefileUtilityTargetGenerator \
212 cmBootstrapCommands \
213 cmCommands \
214 cmTarget \
215 cmTest \
216 cmCustomCommand \
217 cmDocumentVariables \
218 cmCacheManager \
219 cmListFileCache \
220 cmComputeLinkDepends \
221 cmComputeLinkInformation \
222 cmOrderDirectories \
223 cmComputeTargetDepends \
224 cmComputeComponentGraph \
225 cmExprLexer \
226 cmExprParser \
227 cmExprParserHelper \
230 if ${cmake_system_mingw}; then
231 CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
232 cmGlobalMSYSMakefileGenerator \
233 cmGlobalMinGWMakefileGenerator \
234 cmWin32ProcessExecution"
237 CMAKE_C_SOURCES="\
238 cmListFileLexer \
241 if ${cmake_system_mingw}; then
242 KWSYS_C_SOURCES="\
243 ProcessWin32 \
244 String \
245 System"
246 KWSYS_C_MINGW_SOURCES="\
247 ProcessFwd9x \
248 EncodeExecutable"
249 KWSYS_C_GENERATED_SOURCES="\
250 cmsysProcessFwd9xEnc"
251 else
252 KWSYS_C_SOURCES="\
253 ProcessUNIX \
254 String \
255 System"
256 KWSYS_C_MINGW_SOURCES=""
257 KWSYS_C_GENERATED_SOURCES=""
260 KWSYS_CXX_SOURCES="\
261 Directory \
262 Glob \
263 RegularExpression \
264 SystemTools"
266 KWSYS_FILES="\
267 auto_ptr.hxx \
268 Directory.hxx \
269 Glob.hxx \
270 Process.h \
271 RegularExpression.hxx \
272 String.h \
273 String.hxx \
274 System.h \
275 SystemTools.hxx"
277 KWSYS_IOS_FILES="
278 fstream \
279 iosfwd \
280 iostream \
281 sstream"
283 # Display CMake bootstrap usage
284 cmake_usage()
286 echo '
287 Usage: '"$0"' [options]
288 Options: [defaults in brackets after descriptions]
289 Configuration:
290 --help print this message
291 --version only print version information
292 --verbose display more information
293 --parallel=n bootstrap cmake in parallel, where n is
294 number of nodes [1]
295 --init=FILE use FILE for cmake initialization
296 --system-libs use system-installed third-party libraries
297 (for use only by package maintainers)
298 --no-system-libs use cmake-provided third-party libraries
299 (default)
300 --qt-gui build the Qt-based GUI (requires Qt >= 4.2)
301 --no-qt-gui do not build the Qt-based GUI (default)
302 --qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt
304 Directory and file names:
305 --prefix=PREFIX install files in tree rooted at PREFIX
306 [${cmake_default_prefix}]
307 --datadir=DIR install data files in PREFIX/DIR
308 [/share/CMake]
309 --docdir=DIR install documentation files in PREFIX/DIR
310 [/doc/CMake]
311 --mandir=DIR install man pages files in PREFIX/DIR/manN
312 [/man]
314 exit 10
317 # Display CMake bootstrap usage
318 cmake_version_display()
320 echo "CMake ${cmake_version_full}, Copyright (c) 2000-2009 Kitware, Inc., Insight Consortium"
323 # Display CMake bootstrap error, display the log file and exit
324 cmake_error()
326 res=$1
327 shift 1
328 echo "---------------------------------------------"
329 echo "Error when bootstrapping CMake:"
330 echo "$*"
331 echo "---------------------------------------------"
332 if [ -f cmake_bootstrap.log ]; then
333 echo "Log of errors: `pwd`/cmake_bootstrap.log"
334 #cat cmake_bootstrap.log
335 echo "---------------------------------------------"
337 exit ${res}
340 # Replace KWSYS_NAMESPACE with cmsys
341 cmake_replace_string ()
343 INFILE="$1"
344 OUTFILE="$2"
345 SEARCHFOR="$3"
346 REPLACEWITH="$4"
347 if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
348 cat "${INFILE}" |
349 sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" > "${OUTFILE}${_tmp}"
350 if [ -f "${OUTFILE}${_tmp}" ]; then
351 if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
352 #echo "Files are the same"
353 rm -f "${OUTFILE}${_tmp}"
354 else
355 mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
358 else
359 cmake_error 1 "Cannot find file ${INFILE}"
363 cmake_kwsys_config_replace_string ()
365 INFILE="$1"
366 OUTFILE="$2"
367 shift 2
368 APPEND="$*"
369 if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
370 echo "${APPEND}" > "${OUTFILE}${_tmp}"
371 cat "${INFILE}" |
372 sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
373 s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
374 s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
375 s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
376 s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
377 s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
378 s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
379 s/@KWSYS_IOS_USE_SSTREAM@/${KWSYS_IOS_USE_SSTREAM}/g;
380 s/@KWSYS_IOS_USE_STRSTREAM_H@/${KWSYS_IOS_USE_STRSTREAM_H}/g;
381 s/@KWSYS_IOS_USE_STRSTREA_H@/${KWSYS_IOS_USE_STRSTREA_H}/g;
382 s/@KWSYS_STL_HAVE_STD@/${KWSYS_STL_HAVE_STD}/g;
383 s/@KWSYS_STL_STRING_HAVE_ISTREAM@/${KWSYS_STL_STRING_HAVE_ISTREAM}/g;
384 s/@KWSYS_STL_STRING_HAVE_OSTREAM@/${KWSYS_STL_STRING_HAVE_OSTREAM}/g;
385 s/@KWSYS_STL_STRING_HAVE_NEQ_CHAR@/${KWSYS_STL_STRING_HAVE_NEQ_CHAR}/g;
386 s/@KWSYS_STL_HAS_ITERATOR_TRAITS@/${KWSYS_STL_HAS_ITERATOR_TRAITS}/g;
387 s/@KWSYS_STL_HAS_ITERATOR_CATEGORY@/${KWSYS_STL_HAS_ITERATOR_CATEGORY}/g;
388 s/@KWSYS_STL_HAS___ITERATOR_CATEGORY@/${KWSYS_STL_HAS___ITERATOR_CATEGORY}/g;
389 s/@KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}/g;
390 s/@KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE}/g;
391 s/@KWSYS_STL_HAS_ALLOCATOR_REBIND@/${KWSYS_STL_HAS_ALLOCATOR_REBIND}/g;
392 s/@KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@/${KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT}/g;
393 s/@KWSYS_STL_HAS_ALLOCATOR_OBJECTS@/${KWSYS_STL_HAS_ALLOCATOR_OBJECTS}/g;
394 s/@KWSYS_CXX_HAS_CSTDDEF@/${KWSYS_CXX_HAS_CSTDDEF}/g;
395 s/@KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@/${KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS}/g;
396 s/@KWSYS_CXX_HAS_MEMBER_TEMPLATES@/${KWSYS_CXX_HAS_MEMBER_TEMPLATES}/g;
397 s/@KWSYS_CXX_HAS_FULL_SPECIALIZATION@/${KWSYS_CXX_HAS_FULL_SPECIALIZATION}/g;
398 s/@KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@/${KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP}/g;
399 s/@KWSYS_STAT_HAS_ST_MTIM@/${KWSYS_STAT_HAS_ST_MTIM}/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}"
404 else
405 mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
408 else
409 cmake_error 2 "Cannot find file ${INFILE}"
412 # Write string into a file
413 cmake_report ()
415 FILE=$1
416 shift
417 echo "$*" >> ${FILE}
420 # Escape spaces in strings
421 cmake_escape ()
423 echo $1 | sed "s/ /\\\\ /g"
426 # Write message to the log
427 cmake_log ()
429 echo "$*" >> cmake_bootstrap.log
432 # Return temp file
433 cmake_tmp_file ()
435 echo "cmake_bootstrap_$$_test"
438 # Run a compiler test. First argument is compiler, second one are compiler
439 # flags, third one is test source file to be compiled
440 cmake_try_run ()
442 COMPILER=$1
443 FLAGS=$2
444 TESTFILE=$3
445 if [ ! -f "${TESTFILE}" ]; then
446 echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
447 exit 4
449 TMPFILE=`cmake_tmp_file`
450 echo "Try: ${COMPILER}"
451 echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
452 echo "---------- file -----------------------"
453 cat "${TESTFILE}"
454 echo "------------------------------------------"
455 "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
456 RES=$?
457 if [ "${RES}" -ne "0" ]; then
458 echo "Test failed to compile"
459 return 1
461 if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
462 echo "Test failed to produce executable"
463 return 2
465 ./${TMPFILE}
466 RES=$?
467 rm -f "${TMPFILE}"
468 if [ "${RES}" -ne "0" ]; then
469 echo "Test produced non-zero return code"
470 return 3
472 echo "Test succeded"
473 return 0
476 # Run a make test. First argument is the make interpreter.
477 cmake_try_make ()
479 MAKE_PROC="$1"
480 MAKE_FLAGS="$2"
481 echo "Try: ${MAKE_PROC}"
482 "${MAKE_PROC}" ${MAKE_FLAGS}
483 RES=$?
484 if [ "${RES}" -ne "0" ]; then
485 echo "${MAKE_PROC} does not work"
486 return 1
488 if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
489 echo "${COMPILER} does not produce output"
490 return 2
492 ./test
493 RES=$?
494 rm -f "test"
495 if [ "${RES}" -ne "0" ]; then
496 echo "${MAKE_PROC} produces strange executable"
497 return 3
499 echo "${MAKE_PROC} works"
500 return 0
503 # Parse arguments
504 cmake_verbose=
505 cmake_parallel_make=
506 cmake_prefix_dir="${cmake_default_prefix}"
507 for a in "$@"; do
508 if echo $a | grep "^--prefix=" > /dev/null 2> /dev/null; then
509 cmake_prefix_dir=`echo $a | sed "s/^--prefix=//"`
510 cmake_prefix_dir=`cmake_fix_slashes "${cmake_prefix_dir}"`
512 if echo $a | grep "^--parallel=" > /dev/null 2> /dev/null; then
513 cmake_parallel_make=`echo $a | sed "s/^--parallel=//" | grep "[0-9][0-9]*"`
515 if echo $a | grep "^--datadir=" > /dev/null 2> /dev/null; then
516 cmake_data_dir=`echo $a | sed "s/^--datadir=//"`
518 if echo $a | grep "^--docdir=" > /dev/null 2> /dev/null; then
519 cmake_doc_dir=`echo $a | sed "s/^--docdir=//"`
521 if echo $a | grep "^--mandir=" > /dev/null 2> /dev/null; then
522 cmake_man_dir=`echo $a | sed "s/^--mandir=//"`
524 if echo $a | grep "^--init=" > /dev/null 2> /dev/null; then
525 cmake_init_file=`echo $a | sed "s/^--init=//"`
527 if echo $a | grep "^--system-libs" > /dev/null 2> /dev/null; then
528 cmake_bootstrap_system_libs="-DCMAKE_USE_SYSTEM_LIBRARIES=1"
530 if echo $a | grep "^--no-system-libs" > /dev/null 2> /dev/null; then
531 cmake_bootstrap_system_libs="-DCMAKE_USE_SYSTEM_LIBRARIES=0"
533 if echo $a | grep "^--qt-gui" > /dev/null 2> /dev/null; then
534 cmake_bootstrap_qt_gui="1"
536 if echo $a | grep "^--no-qt-gui" > /dev/null 2> /dev/null; then
537 cmake_bootstrap_qt_gui="0"
539 if echo $a | grep "^--qt-qmake=" > /dev/null 2> /dev/null; then
540 cmake_bootstrap_qt_qmake=`echo $a | sed "s/^--qt-qmake=//"`
542 if echo $a | grep "^--help" > /dev/null 2> /dev/null; then
543 cmake_usage
545 if echo $a | grep "^--version" > /dev/null 2> /dev/null; then
546 cmake_version_display
547 exit 2
549 if echo $a | grep "^--verbose" > /dev/null 2> /dev/null; then
550 cmake_verbose=TRUE
552 done
554 # If verbose, display some information about bootstrap
555 if [ -n "${cmake_verbose}" ]; then
556 echo "---------------------------------------------"
557 echo "Source directory: ${cmake_source_dir}"
558 echo "Binary directory: ${cmake_binary_dir}"
559 echo "Prefix directory: ${cmake_prefix_dir}"
560 echo "System: ${cmake_system}"
561 if [ "x${cmake_parallel_make}" != "x" ]; then
562 echo "Doing parallel make: ${cmake_parallel_make}"
564 echo ""
567 echo "---------------------------------------------"
568 # Get CMake version
569 echo "`cmake_version_display`"
571 # Check for in-source build
572 cmake_in_source_build=
573 if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
574 -f "${cmake_binary_dir}/Source/cmake.h" ]; then
575 if [ -n "${cmake_verbose}" ]; then
576 echo "Warning: This is an in-source build"
578 cmake_in_source_build=TRUE
581 # If this is not an in-source build, then Bootstrap stuff should not exist.
582 if [ -z "${cmake_in_source_build}" ]; then
583 # Did somebody bootstrap in the source tree?
584 if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then
585 cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
586 Looks like somebody did bootstrap CMake in the source tree, but now you are
587 trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
588 directory from the source tree."
590 # Is there a cache in the source tree?
591 for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
592 if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
593 cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
594 Looks like somebody tried to build CMake in the source tree, but now you are
595 trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
596 from the source tree."
598 done
601 # Make bootstrap directory
602 [ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
603 if [ ! -d "${cmake_bootstrap_dir}" ]; then
604 cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
606 cd "${cmake_bootstrap_dir}"
608 [ -d "cmsys" ] || mkdir "cmsys"
609 if [ ! -d "cmsys" ]; then
610 cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
613 for a in stl ios; do
614 [ -d "cmsys/${a}" ] || mkdir "cmsys/${a}"
615 if [ ! -d "cmsys/${a}" ]; then
616 cmake_error 5 "Cannot create directory ${cmake_bootstrap_dir}/cmsys/${a}"
618 done
620 # Delete all the bootstrap files
621 rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
622 rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
623 rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
625 # If exist compiler flags, set them
626 cmake_c_flags=${CFLAGS}
627 cmake_cxx_flags=${CXXFLAGS}
628 cmake_ld_flags=${LDFLAGS}
630 # Add Cygwin-specific flags
631 if ${cmake_system_cygwin}; then
632 cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
635 # Add Carbon framework on Darwin
636 if ${cmake_system_darwin}; then
637 cmake_ld_flags="${LDFLAGS} -framework Carbon"
640 # Add BeOS toolkits...
641 if ${cmake_system_beos}; then
642 cmake_ld_flags="${LDFLAGS} -lroot -lbe"
645 # Add Haiku toolkits...
646 if ${cmake_system_haiku}; then
647 cmake_ld_flags="${LDFLAGS} -lroot -lbe"
650 # Test C compiler
651 cmake_c_compiler=
653 # If CC is set, use that for compiler, otherwise use list of known compilers
654 if [ -n "${CC}" ]; then
655 cmake_c_compilers="${CC}"
656 else
657 cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
660 # Check if C compiler works
661 TMPFILE=`cmake_tmp_file`
662 echo '
663 #ifdef __cplusplus
664 # error "The CMAKE_C_COMPILER is set to a C++ compiler"
665 #endif
667 #include<stdio.h>
669 #if defined(__CLASSIC_C__)
670 int main(argc, argv)
671 int argc;
672 char* argv[];
673 #else
674 int main(int argc, char* argv[])
675 #endif
677 printf("%d%c", (argv != 0), (char)0x0a);
678 return argc-1;
680 ' > "${TMPFILE}.c"
681 for a in ${cmake_c_compilers}; do
682 if [ -z "${cmake_c_compiler}" ] && \
683 cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
684 cmake_c_compiler="${a}"
686 done
687 rm -f "${TMPFILE}.c"
689 if [ -z "${cmake_c_compiler}" ]; then
690 cmake_error 6 "Cannot find appropriate C compiler on this system.
691 Please specify one using environment variable CC.
692 See cmake_bootstrap.log for compilers attempted.
695 echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
697 # Test CXX compiler
698 cmake_cxx_compiler=
700 # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
702 # If CC is set, use that for compiler, otherwise use list of known compilers
703 if [ -n "${CXX}" ]; then
704 cmake_cxx_compilers="${CXX}"
705 else
706 cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
709 # Check if C++ compiler works
710 TMPFILE=`cmake_tmp_file`
711 echo '
712 #if defined(TEST1)
713 # include <iostream>
714 #else
715 # include <iostream.h>
716 #endif
718 class NeedCXX
720 public:
721 NeedCXX() { this->Foo = 1; }
722 int GetFoo() { return this->Foo; }
723 private:
724 int Foo;
726 int main()
728 NeedCXX c;
729 #ifdef TEST3
730 cout << c.GetFoo() << endl;
731 #else
732 std::cout << c.GetFoo() << std::endl;
733 #endif
734 return 0;
736 ' > "${TMPFILE}.cxx"
737 for a in ${cmake_cxx_compilers}; do
738 for b in 1 2 3; do
739 if [ -z "${cmake_cxx_compiler}" ] && \
740 cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
741 cmake_cxx_compiler="${a}"
743 done
744 done
745 rm -f "${TMPFILE}.cxx"
747 if [ -z "${cmake_cxx_compiler}" ]; then
748 cmake_error 7 "Cannot find appropriate C++ compiler on this system.
749 Please specify one using environment variable CXX.
750 See cmake_bootstrap.log for compilers attempted."
752 echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
754 # Test Make
756 cmake_make_processor=
757 cmake_make_flags=
759 # If MAKE is set, use that for make processor, otherwise use list of known make
760 if [ -n "${MAKE}" ]; then
761 cmake_make_processors="${MAKE}"
762 else
763 cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
766 TMPFILE="`cmake_tmp_file`_dir"
767 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
768 mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
769 cd "${cmake_bootstrap_dir}/${TMPFILE}"
770 echo '
771 test: test.c
772 "'"${cmake_c_compiler}"'" -o test test.c
773 '>"Makefile"
774 echo '
775 #include <stdio.h>
776 int main(){ printf("1%c", (char)0x0a); return 0; }
777 ' > "test.c"
778 cmake_original_make_flags="${cmake_make_flags}"
779 if [ "x${cmake_parallel_make}" != "x" ]; then
780 cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
782 for a in ${cmake_make_processors}; do
783 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log 2>&1; then
784 cmake_make_processor="${a}"
786 done
787 cmake_full_make_flags="${cmake_make_flags}"
788 if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
789 if [ -z "${cmake_make_processor}" ]; then
790 cmake_make_flags="${cmake_original_make_flags}"
791 for a in ${cmake_make_processors}; do
792 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log 2>&1; then
793 cmake_make_processor="${a}"
795 done
798 cd "${cmake_bootstrap_dir}"
799 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
801 if [ -z "${cmake_make_processor}" ]; then
802 cmake_error 8 "Cannot find appropriate Makefile processor on this system.
803 Please specify one using environment variable MAKE."
805 echo "Makefile processor on this system is: ${cmake_make_processor}"
806 if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
807 echo "---------------------------------------------"
808 echo "Makefile processor ${cmake_make_processor} does not support parallel build"
809 echo "---------------------------------------------"
812 # Ok, we have CC, CXX, and MAKE.
814 # Test C++ compiler features
816 # Are we GCC?
818 TMPFILE=`cmake_tmp_file`
819 echo '
820 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
821 #include <iostream>
822 int main() { std::cout << "This is GNU" << std::endl; return 0;}
823 #endif
824 ' > ${TMPFILE}.cxx
825 cmake_cxx_compiler_is_gnu=0
826 if cmake_try_run "${cmake_cxx_compiler}" \
827 "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
828 cmake_cxx_compiler_is_gnu=1
830 if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then
831 echo "${cmake_cxx_compiler} is GNU compiler"
832 else
833 echo "${cmake_cxx_compiler} is not GNU compiler"
835 rm -f "${TMPFILE}.cxx"
837 if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
838 # Check for non-GNU compiler flags
840 # If we are on IRIX, check for -LANG:std
841 cmake_test_flags="-LANG:std"
842 if [ "x${cmake_system}" = "xIRIX64" ]; then
843 TMPFILE=`cmake_tmp_file`
844 echo '
845 #include <iostream>
846 int main() { std::cout << "No need for '"${cmake_test_flags}"'" << std::endl; return 0;}
847 ' > ${TMPFILE}.cxx
848 cmake_need_lang_std=0
849 if cmake_try_run "${cmake_cxx_compiler}" \
850 "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
852 else
853 if cmake_try_run "${cmake_cxx_compiler}" \
854 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
855 cmake_need_lang_std=1
858 if [ "x${cmake_need_lang_std}" = "x1" ]; then
859 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
860 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
861 else
862 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
864 rm -f "${TMPFILE}.cxx"
866 cmake_test_flags=
868 # If we are on OSF, check for -timplicit_local -no_implicit_include
869 cmake_test_flags="-timplicit_local -no_implicit_include"
870 if [ "x${cmake_system}" = "xOSF1" ]; then
871 TMPFILE=`cmake_tmp_file`
872 echo '
873 #include <iostream>
874 int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
875 ' > ${TMPFILE}.cxx
876 cmake_need_flags=1
877 if cmake_try_run "${cmake_cxx_compiler}" \
878 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
880 else
881 cmake_need_flags=0
883 if [ "x${cmake_need_flags}" = "x1" ]; then
884 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
885 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
886 else
887 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
889 rm -f "${TMPFILE}.cxx"
891 cmake_test_flags=
893 # If we are on OSF, check for -std strict_ansi -nopure_cname
894 cmake_test_flags="-std strict_ansi -nopure_cname"
895 if [ "x${cmake_system}" = "xOSF1" ]; then
896 TMPFILE=`cmake_tmp_file`
897 echo '
898 #include <iostream>
899 int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
900 ' > ${TMPFILE}.cxx
901 cmake_need_flags=1
902 if cmake_try_run "${cmake_cxx_compiler}" \
903 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
905 else
906 cmake_need_flags=0
908 if [ "x${cmake_need_flags}" = "x1" ]; then
909 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
910 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
911 else
912 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
914 rm -f "${TMPFILE}.cxx"
916 cmake_test_flags=
918 # If we are on HP-UX, check for -Ae for the C compiler.
919 cmake_test_flags="-Ae"
920 if [ "x${cmake_system}" = "xHP-UX" ]; then
921 TMPFILE=`cmake_tmp_file`
922 echo '
923 int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
924 ' > ${TMPFILE}.c
925 cmake_need_Ae=0
926 if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
928 else
929 if cmake_try_run "${cmake_c_compiler}" \
930 "${cmake_c_flags} ${cmake_test_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
931 cmake_need_Ae=1
934 if [ "x${cmake_need_Ae}" = "x1" ]; then
935 cmake_c_flags="${cmake_c_flags} ${cmake_test_flags}"
936 echo "${cmake_c_compiler} needs ${cmake_test_flags}"
937 else
938 echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
940 rm -f "${TMPFILE}.c"
942 cmake_test_flags=
945 # Test for kwsys features
946 KWSYS_NAME_IS_KWSYS=0
947 KWSYS_BUILD_SHARED=0
948 KWSYS_LFS_AVAILABLE=0
949 KWSYS_LFS_REQUESTED=0
950 KWSYS_IOS_USE_STRSTREAM_H=0
951 KWSYS_IOS_USE_STRSTREA_H=0
952 KWSYS_IOS_HAVE_STD=0
953 KWSYS_IOS_USE_SSTREAM=0
954 KWSYS_IOS_USE_ANSI=0
955 KWSYS_STL_HAVE_STD=0
956 KWSYS_STAT_HAS_ST_MTIM=0
957 KWSYS_STL_STRING_HAVE_NEQ_CHAR=0
958 KWSYS_STL_HAS_ITERATOR_TRAITS=0
959 KWSYS_STL_HAS_ITERATOR_CATEGORY=0
960 KWSYS_STL_HAS___ITERATOR_CATEGORY=0
961 KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=0
962 KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=0
963 KWSYS_STL_HAS_ALLOCATOR_REBIND=0
964 KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=0
965 KWSYS_STL_HAS_ALLOCATOR_OBJECTS=0
966 KWSYS_CXX_HAS_CSTDDEF=0
967 KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0
968 KWSYS_CXX_HAS_MEMBER_TEMPLATES=0
969 KWSYS_CXX_HAS_FULL_SPECIALIZATION=0
970 KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=0
972 # Hardcode these kwsys features. They work on all known UNIX compilers anyway.
973 KWSYS_STL_STRING_HAVE_ISTREAM=1
974 KWSYS_STL_STRING_HAVE_OSTREAM=1
976 if cmake_try_run "${cmake_cxx_compiler}" \
977 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
978 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
979 KWSYS_STL_HAVE_STD=1
980 echo "${cmake_cxx_compiler} has STL in std:: namespace"
981 else
982 echo "${cmake_cxx_compiler} does not have STL in std:: namespace"
985 if cmake_try_run "${cmake_cxx_compiler}" \
986 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
987 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
988 KWSYS_IOS_USE_ANSI=1
989 echo "${cmake_cxx_compiler} has ANSI streams"
990 else
991 echo "${cmake_cxx_compiler} does not have ANSI streams"
994 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
995 if cmake_try_run "${cmake_cxx_compiler}" \
996 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
997 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
998 KWSYS_IOS_HAVE_STD=1
999 echo "${cmake_cxx_compiler} has streams in std:: namespace"
1000 else
1001 echo "${cmake_cxx_compiler} does not have streams in std:: namespace"
1003 if cmake_try_run "${cmake_cxx_compiler}" \
1004 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
1005 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1006 KWSYS_IOS_USE_SSTREAM=1
1007 echo "${cmake_cxx_compiler} has sstream"
1008 else
1009 echo "${cmake_cxx_compiler} does not have sstream"
1013 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
1014 if cmake_try_run "${cmake_cxx_compiler}" \
1015 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
1016 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1017 KWSYS_IOS_USE_STRSTREAM_H=1
1018 echo "${cmake_cxx_compiler} has strstream.h"
1019 else
1020 echo "${cmake_cxx_compiler} does not have strstream.h"
1022 if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
1023 if cmake_try_run "${cmake_cxx_compiler}" \
1024 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
1025 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1026 KWSYS_IOS_USE_STRSTREA_H=1
1027 echo "${cmake_cxx_compiler} has strstrea.h"
1028 else
1029 echo "${cmake_cxx_compiler} does not have strstrea.h"
1034 if cmake_try_run "${cmake_cxx_compiler}" \
1035 "${cmake_cxx_flags} -DTEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1036 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1037 KWSYS_STL_STRING_HAVE_NEQ_CHAR=1
1038 echo "${cmake_cxx_compiler} has operator!=(string, char*)"
1039 else
1040 echo "${cmake_cxx_compiler} does not have operator!=(string, char*)"
1043 if cmake_try_run "${cmake_cxx_compiler}" \
1044 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_TRAITS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1045 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1046 KWSYS_STL_HAS_ITERATOR_TRAITS=1
1047 echo "${cmake_cxx_compiler} has stl iterator_traits"
1048 else
1049 echo "${cmake_cxx_compiler} does not have stl iterator_traits"
1052 if [ "x${KWSYS_STL_HAS_ITERATOR_TRAITS}" = "x0" ]; then
1053 if cmake_try_run "${cmake_cxx_compiler}" \
1054 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1055 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1056 KWSYS_STL_HAS_ITERATOR_CATEGORY=1
1057 echo "${cmake_cxx_compiler} has old iterator_category"
1058 else
1059 echo "${cmake_cxx_compiler} does not have old iterator_category"
1061 if [ "x${KWSYS_STL_HAS_ITERATOR_CATEGORY}" = "x0" ]; then
1062 if cmake_try_run "${cmake_cxx_compiler}" \
1063 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS___ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1064 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1065 KWSYS_STL_HAS___ITERATOR_CATEGORY=1
1066 echo "${cmake_cxx_compiler} has old __iterator_category"
1067 else
1068 echo "${cmake_cxx_compiler} does not have old __iterator_category"
1073 if cmake_try_run "${cmake_cxx_compiler}" \
1074 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1075 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1076 KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=1
1077 echo "${cmake_cxx_compiler} has standard template allocator"
1078 else
1079 echo "${cmake_cxx_compiler} does not have standard template allocator"
1082 if [ "x${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}" = "x1" ]; then
1083 if cmake_try_run "${cmake_cxx_compiler}" \
1084 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1085 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1086 KWSYS_STL_HAS_ALLOCATOR_REBIND=1
1087 echo "${cmake_cxx_compiler} has allocator<>::rebind<>"
1088 else
1089 echo "${cmake_cxx_compiler} does not have allocator<>::rebind<>"
1092 if cmake_try_run "${cmake_cxx_compiler}" \
1093 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1094 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1095 KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=1
1096 echo "${cmake_cxx_compiler} has non-standard allocator<>::max_size argument"
1097 else
1098 echo "${cmake_cxx_compiler} does not have non-standard allocator<>::max_size argument"
1100 else
1101 if cmake_try_run "${cmake_cxx_compiler}" \
1102 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1103 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1104 KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=1
1105 echo "${cmake_cxx_compiler} has old non-template allocator"
1106 else
1107 echo "${cmake_cxx_compiler} does not have old non-template allocator"
1111 if cmake_try_run "${cmake_cxx_compiler}" \
1112 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1113 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1114 KWSYS_STL_HAS_ALLOCATOR_OBJECTS=1
1115 echo "${cmake_cxx_compiler} has stl containers supporting allocator objects"
1116 else
1117 echo "${cmake_cxx_compiler} does not have stl containers supporting allocator objects"
1120 if cmake_try_run "${cmake_cxx_compiler}" \
1121 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_CSTDDEF" \
1122 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1123 KWSYS_CXX_HAS_CSTDDEF=1
1124 echo "${cmake_cxx_compiler} has header cstddef"
1125 else
1126 echo "${cmake_cxx_compiler} does not have header cstddef"
1129 if cmake_try_run "${cmake_cxx_compiler}" \
1130 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS" \
1131 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1132 echo "${cmake_cxx_compiler} does not require template friends to use <>"
1133 else
1134 KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=1
1135 echo "${cmake_cxx_compiler} requires template friends to use <>"
1138 if cmake_try_run "${cmake_cxx_compiler}" \
1139 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES" \
1140 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1141 KWSYS_CXX_HAS_MEMBER_TEMPLATES=1
1142 echo "${cmake_cxx_compiler} supports member templates"
1143 else
1144 echo "${cmake_cxx_compiler} does not support member templates"
1147 if cmake_try_run "${cmake_cxx_compiler}" \
1148 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION" \
1149 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1150 KWSYS_CXX_HAS_FULL_SPECIALIZATION=1
1151 echo "${cmake_cxx_compiler} has standard template specialization syntax"
1152 else
1153 echo "${cmake_cxx_compiler} does not have standard template specialization syntax"
1156 if cmake_try_run "${cmake_cxx_compiler}" \
1157 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP" \
1158 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1159 KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=1
1160 echo "${cmake_cxx_compiler} has argument dependent lookup"
1161 else
1162 echo "${cmake_cxx_compiler} does not have argument dependent lookup"
1165 if cmake_try_run "${cmake_cxx_compiler}" \
1166 "${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \
1167 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1168 KWSYS_STAT_HAS_ST_MTIM=1
1169 echo "${cmake_cxx_compiler} has struct stat with st_mtim member"
1170 else
1171 echo "${cmake_cxx_compiler} does not have struct stat with st_mtim member"
1174 # Just to be safe, let us store compiler and flags to the header file
1176 cmake_bootstrap_version='$Revision: 1.123 $'
1177 cmake_compiler_settings_comment="/*
1178 * Generated by ${cmake_source_dir}/bootstrap
1179 * Version: ${cmake_bootstrap_version}
1181 * Source directory: ${cmake_source_dir}
1182 * Binary directory: ${cmake_bootstrap_dir}
1184 * C compiler: ${cmake_c_compiler}
1185 * C flags: ${cmake_c_flags}
1187 * C++ compiler: ${cmake_cxx_compiler}
1188 * C++ flags: ${cmake_cxx_flags}
1190 * Make: ${cmake_make_processor}
1192 * Sources:
1193 * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
1194 * kwSys Sources:
1195 * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}
1199 cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}"
1201 if [ "x$KWSYS_STL_HAVE_STD" = "x1" ]; then
1202 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_STD_NAMESPACE */"
1203 else
1204 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_STD_NAMESPACE 1"
1207 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
1208 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */"
1209 else
1210 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STREAM_HEADERS 1"
1213 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x1" ]; then
1214 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STRING_STREAM */"
1215 else
1216 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STRING_STREAM 1"
1219 # Test for ansi FOR scope
1220 if cmake_try_run "${cmake_cxx_compiler}" \
1221 "${cmake_cxx_flags}" \
1222 "${cmake_source_dir}/Modules/TestForAnsiForScope.cxx" >> cmake_bootstrap.log 2>&1; then
1223 cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_FOR_SCOPE */"
1224 echo "${cmake_cxx_compiler} has ANSI for scoping"
1225 else
1226 cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_FOR_SCOPE 1"
1227 echo "${cmake_cxx_compiler} does not have ANSI for scoping"
1230 # When bootstrapping on MinGW with MSYS we must convert the source
1231 # directory to a windows path.
1232 if ${cmake_system_mingw}; then
1233 cmake_root_dir=`cd "${cmake_source_dir}"; pwd -W`
1234 else
1235 cmake_root_dir="${cmake_source_dir}"
1238 # Write CMake version
1239 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
1240 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
1241 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
1242 cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\""
1243 cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
1244 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
1246 # Regenerate configured headers
1247 for h in Configure VersionConfig; do
1248 if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then
1249 rm -f cm${h}.h${_tmp}
1250 else
1251 mv -f cm${h}.h${_tmp} cm${h}.h
1253 done
1255 # Prepare KWSYS
1256 cmake_kwsys_config_replace_string \
1257 "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
1258 "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
1259 "${cmake_compiler_settings_comment}"
1260 cmake_kwsys_config_replace_string \
1261 "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
1262 "${cmake_bootstrap_dir}/cmsys/Configure.h" \
1263 "${cmake_compiler_settings_comment}"
1265 for a in ${KWSYS_FILES}; do
1266 cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
1267 "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
1268 done
1270 for a in ${KWSYS_IOS_FILES}; do
1271 cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_ios_${a}.h.in" \
1272 "${cmake_bootstrap_dir}/cmsys/ios/${a}" KWSYS_NAMESPACE cmsys
1273 done
1275 cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_stl.hxx.in" \
1276 "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" KWSYS_STL_HEADER_EXTRA ""
1278 cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" \
1279 "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" KWSYS_NAMESPACE cmsys
1281 for a in string vector map algorithm; do
1282 cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" \
1283 "${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
1284 done
1286 # Generate Makefile
1287 dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
1288 objs=""
1289 for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_GENERATED_SOURCES}; do
1290 objs="${objs} ${a}.o"
1291 done
1293 # Generate dependencies for cmBootstrapCommands.cxx
1294 for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
1295 cmBootstrapCommandsDeps="${cmBootstrapCommandsDeps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
1296 done
1297 cmBootstrapCommandsDeps=`echo $cmBootstrapCommandsDeps`
1299 if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
1300 cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
1303 if [ "x${cmake_c_flags}" != "x" ]; then
1304 cmake_c_flags="${cmake_c_flags} "
1307 if [ "x${cmake_cxx_flags}" != "x" ]; then
1308 cmake_cxx_flags="${cmake_cxx_flags} "
1311 cmake_c_flags_String="-DKWSYS_STRING_C"
1312 cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
1313 -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
1314 cmake_cxx_flags="${cmake_cxx_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
1315 -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
1316 echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
1317 echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
1318 for a in ${CMAKE_CXX_SOURCES}; do
1319 src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
1320 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1321 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1322 done
1323 echo "cmBootstrapCommands.o : $cmBootstrapCommandsDeps" >> "${cmake_bootstrap_dir}/Makefile"
1324 for a in ${CMAKE_C_SOURCES}; do
1325 src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
1326 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1327 echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1328 done
1329 for a in ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}; do
1330 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
1331 src_flags=`eval echo \\${cmake_c_flags_\${a}}`
1332 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1333 echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1334 done
1335 for a in ${KWSYS_CXX_SOURCES}; do
1336 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
1337 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1338 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1339 done
1340 if ${cmake_system_mingw}; then
1341 src=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9xEnc.c"`
1342 in=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9x.exe"`
1343 cmd=`cmake_escape "${cmake_bootstrap_dir}/cmsysEncodeExecutable.exe"`
1344 a="cmsysProcessFwd9xEnc"
1345 echo "${cmd} : EncodeExecutable.o" >> "${cmake_bootstrap_dir}/Makefile"
1346 echo " ${cmake_c_compiler} ${cmake_ld_flags} ${cmake_c_flags} EncodeExecutable.o -o ${cmd}" >> "${cmake_bootstrap_dir}/Makefile"
1347 echo "${in} : ProcessFwd9x.o" >> "${cmake_bootstrap_dir}/Makefile"
1348 echo " ${cmake_c_compiler} ${cmake_ld_flags} ${cmake_c_flags} ProcessFwd9x.o -o ${in}" >> "${cmake_bootstrap_dir}/Makefile"
1349 echo "${src} : ${cmd} ${in}" >> "${cmake_bootstrap_dir}/Makefile"
1350 echo " ${cmd} ${in} ${src} cmsys ProcessFwd9x" >> "${cmake_bootstrap_dir}/Makefile"
1351 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1352 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"
1354 echo '
1355 rebuild_cache:
1356 cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
1357 ' >> "${cmake_bootstrap_dir}/Makefile"
1359 # Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake.
1360 echo '
1361 # Generated by '"${cmake_source_dir}"'/bootstrap
1362 # Default cmake settings. These may be overridden any settings below.
1363 SET (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
1364 SET (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
1365 SET (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
1366 SET (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
1367 ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1369 # Add configuration settings given as command-line options.
1370 if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then
1371 echo '
1372 SET (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
1373 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1375 if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then
1376 echo '
1377 SET (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
1378 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1381 # Add user-specified settings. Handle relative-path case for
1382 # specification of cmake_init_file.
1384 cd "${cmake_binary_dir}"
1385 if [ -f "${cmake_init_file}" ]; then
1386 cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1390 echo "---------------------------------------------"
1392 # Run make to build bootstrap cmake
1393 if [ "x${cmake_parallel_make}" != "x" ]; then
1394 ${cmake_make_processor} ${cmake_make_flags}
1395 else
1396 ${cmake_make_processor}
1398 RES=$?
1399 if [ "${RES}" -ne "0" ]; then
1400 cmake_error 9 "Problem while running ${cmake_make_processor}"
1402 cd "${cmake_binary_dir}"
1404 # Set C, CXX, and MAKE environment variables, so that real real cmake will be
1405 # build with same compiler and make
1406 CC="${cmake_c_compiler}"
1407 CXX="${cmake_cxx_compiler}"
1408 MAKE="${cmake_make_processor}"
1409 export CC
1410 export CXX
1411 export MAKE
1413 # Run bootstrap CMake to configure real CMake
1414 "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_bootstrap_system_libs}
1415 RES=$?
1416 if [ "${RES}" -ne "0" ]; then
1417 cmake_error 11 "Problem while running initial CMake"
1420 echo "---------------------------------------------"
1422 # And we are done. Now just run make
1423 echo "CMake has bootstrapped. Now run ${cmake_make_processor}."