Imported Upstream version 2.8.11.2
[platform/upstream/cmake.git] / bootstrap
1 #!/bin/sh
2 #=============================================================================
3 # CMake - Cross Platform Makefile Generator
4 # Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
5 #
6 # Distributed under the OSI-approved BSD License (the "License");
7 # see accompanying file Copyright.txt for details.
8 #
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 #=============================================================================
13
14 die() {
15   echo "$@" 1>&2 ; exit 1
16 }
17
18 # Version number extraction function.
19 cmake_version_component()
20 {
21   cat "${cmake_source_dir}/Source/CMakeVersion.cmake" | sed -n "
22 /^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
23 "
24 }
25
26 cmake_toupper()
27 {
28     echo "$1" | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
29 }
30
31 # Detect system and directory information.
32 cmake_system=`uname`
33 cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
34 cmake_binary_dir=`pwd`
35
36 # Load version information.
37 cmake_version_major="`cmake_version_component MAJOR`"
38 cmake_version_minor="`cmake_version_component MINOR`"
39 cmake_version_patch="`cmake_version_component PATCH`"
40 cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
41 cmake_version_tweak="`cmake_version_component TWEAK`"
42 if [ "$cmake_version_tweak" != "0" ]; then
43   cmake_version="${cmake_version}.${cmake_version_tweak}"
44 fi
45
46 cmake_data_dir="/share/cmake-${cmake_version_major}.${cmake_version_minor}"
47 cmake_doc_dir="/doc/cmake-${cmake_version_major}.${cmake_version_minor}"
48 cmake_man_dir="/man"
49 cmake_init_file=""
50 cmake_bootstrap_system_libs=""
51 cmake_bootstrap_qt_gui=""
52 cmake_bootstrap_qt_qmake=""
53
54 # Determine whether this is a Cygwin environment.
55 if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
56   cmake_system_cygwin=true
57 else
58   cmake_system_cygwin=false
59 fi
60
61 # Determine whether this is a MinGW environment.
62 if echo "${cmake_system}" | grep MINGW >/dev/null 2>&1; then
63   cmake_system_mingw=true
64 else
65   cmake_system_mingw=false
66 fi
67
68 # Determine whether this is OS X
69 if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then
70   cmake_system_darwin=true
71 else
72   cmake_system_darwin=false
73 fi
74
75 # Determine whether this is BeOS
76 if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
77   cmake_system_beos=true
78 else
79   cmake_system_beos=false
80 fi
81
82 # Determine whether this is Haiku
83 if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
84   cmake_system_haiku=true
85 else
86   cmake_system_haiku=false
87 fi
88
89 # Determine whether this is OpenVMS
90 if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then
91   cmake_system_openvms=true
92 else
93   cmake_system_openvms=false
94 fi
95
96 # Determine whether this is Linux
97 if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then
98   cmake_system_linux=true
99   # find out if it is a HP PA-RISC machine
100   if uname -m | grep parisc >/dev/null 2>&1; then
101     cmake_machine_parisc=true
102   else
103     cmake_machine_parisc=false
104   fi
105 else
106   cmake_system_linux=false
107 fi
108
109 # Choose the generator to use for bootstrapping.
110 if ${cmake_system_mingw}; then
111   # Bootstrapping from an MSYS prompt.
112   cmake_bootstrap_generator="MSYS Makefiles"
113 else
114   # Bootstrapping from a standard UNIX prompt.
115   cmake_bootstrap_generator="Unix Makefiles"
116 fi
117
118 # Choose tools and extensions for this platform.
119 if ${cmake_system_openvms}; then
120   _tmp="_tmp"
121   _cmk="_cmk"
122   _diff=`which diff`
123 else
124   _tmp=".tmp"
125   _cmk=".cmk"
126   _diff="diff"
127 fi
128
129 # Construct bootstrap directory name.
130 cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}"
131
132 # Helper function to fix windows paths.
133 case "${cmake_system}" in
134 *MINGW*)
135   cmake_fix_slashes()
136   {
137     cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//'
138   }
139   ;;
140 *)
141   cmake_fix_slashes()
142   {
143     echo "$1" | sed 's/\\/\//g'
144   }
145   ;;
146 esac
147
148 # Choose the default install prefix.
149 if ${cmake_system_mingw}; then
150   if [ "x${PROGRAMFILES}" != "x" ]; then
151     cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
152   elif [ "x${ProgramFiles}" != "x" ]; then
153     cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
154   elif [ "x${SYSTEMDRIVE}" != "x" ]; then
155     cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
156   elif [ "x${SystemDrive}" != "x" ]; then
157     cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
158   else
159     cmake_default_prefix="c:/Program Files/CMake"
160   fi
161 elif ${cmake_system_haiku}; then
162   cmake_default_prefix=`finddir B_COMMON_DIRECTORY`
163   cmake_man_dir="/documentation/man"
164   cmake_doc_dir="/documentation/doc/cmake-${cmake_version}"
165 else
166   cmake_default_prefix="/usr/local"
167 fi
168
169 CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
170 CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
171 CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
172
173 CMAKE_PROBLEMATIC_FILES="\
174   CMakeCache.txt \
175   CMakeSystem.cmake \
176   CMakeCCompiler.cmake \
177   CMakeCXXCompiler.cmake \
178   */CMakeSystem.cmake \
179   */CMakeCCompiler.cmake \
180   */CMakeCXXCompiler.cmake \
181   Source/cmConfigure.h \
182   Source/CTest/Curl/config.h \
183   Utilities/cmexpat/expatConfig.h \
184   Utilities/cmexpat/expatDllConfig.h \
185   "
186
187 CMAKE_UNUSED_SOURCES="\
188   cmGlobalXCodeGenerator \
189   cmLocalXCodeGenerator \
190   cmXCodeObject \
191   cmXCode21Object \
192   cmSourceGroup \
193 "
194
195 CMAKE_CXX_SOURCES="\
196   cmStandardIncludes \
197   cmake  \
198   cmakemain \
199   cmakewizard  \
200   cmCommandArgumentLexer \
201   cmCommandArgumentParser \
202   cmCommandArgumentParserHelper \
203   cmDefinitions \
204   cmDepends \
205   cmDependsC \
206   cmDocumentationFormatter \
207   cmDocumentationFormatterText \
208   cmPolicies \
209   cmProperty \
210   cmPropertyMap \
211   cmPropertyDefinition \
212   cmPropertyDefinitionMap \
213   cmMakeDepend \
214   cmMakefile \
215   cmExportFileGenerator \
216   cmExportInstallFileGenerator \
217   cmExportTryCompileFileGenerator \
218   cmExportSet \
219   cmExportSetMap \
220   cmInstallDirectoryGenerator \
221   cmGeneratedFileStream \
222   cmGeneratorTarget \
223   cmGeneratorExpressionDAGChecker \
224   cmGeneratorExpressionEvaluator \
225   cmGeneratorExpressionLexer \
226   cmGeneratorExpressionParser \
227   cmGeneratorExpression \
228   cmGlobalGenerator \
229   cmLocalGenerator \
230   cmInstallGenerator \
231   cmInstallExportGenerator \
232   cmInstallFilesGenerator \
233   cmInstallScriptGenerator \
234   cmInstallTargetGenerator \
235   cmScriptGenerator \
236   cmSourceFile \
237   cmSourceFileLocation \
238   cmSystemTools \
239   cmTestGenerator \
240   cmVersion \
241   cmFileTimeComparison \
242   cmGlobalUnixMakefileGenerator3 \
243   cmLocalUnixMakefileGenerator3 \
244   cmMakefileExecutableTargetGenerator \
245   cmMakefileLibraryTargetGenerator \
246   cmMakefileTargetGenerator \
247   cmMakefileUtilityTargetGenerator \
248   cmOSXBundleGenerator \
249   cmNewLineStyle \
250   cmBootstrapCommands \
251   cmCommands \
252   cmTarget \
253   cmTest \
254   cmCustomCommand \
255   cmCustomCommandGenerator \
256   cmDocumentVariables \
257   cmCacheManager \
258   cmListFileCache \
259   cmComputeLinkDepends \
260   cmComputeLinkInformation \
261   cmOrderDirectories \
262   cmComputeTargetDepends \
263   cmComputeComponentGraph \
264   cmExprLexer \
265   cmExprParser \
266   cmExprParserHelper \
267   cmGlobalNinjaGenerator \
268   cmLocalNinjaGenerator \
269   cmNinjaTargetGenerator \
270   cmNinjaNormalTargetGenerator \
271   cmNinjaUtilityTargetGenerator \
272 "
273
274 if ${cmake_system_mingw}; then
275   CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
276     cmGlobalMSYSMakefileGenerator \
277     cmGlobalMinGWMakefileGenerator \
278     cmWin32ProcessExecution"
279 fi
280
281 CMAKE_C_SOURCES="\
282   cmListFileLexer \
283   "
284
285 if ${cmake_system_mingw}; then
286   KWSYS_C_SOURCES="\
287     ProcessWin32 \
288     String \
289     System"
290 else
291   KWSYS_C_SOURCES="\
292     ProcessUNIX \
293     String \
294     System"
295 fi
296
297 KWSYS_CXX_SOURCES="\
298   Directory \
299   Glob \
300   RegularExpression \
301   SystemTools"
302
303 KWSYS_FILES="\
304   auto_ptr.hxx \
305   Directory.hxx \
306   Glob.hxx \
307   Process.h \
308   RegularExpression.hxx \
309   String.h \
310   String.hxx \
311   System.h \
312   SystemTools.hxx"
313
314 KWSYS_IOS_FILES="
315   fstream \
316   iosfwd \
317   iostream \
318   sstream"
319
320 # Display CMake bootstrap usage
321 cmake_usage()
322 {
323 echo '
324 Usage: '"$0"' [<options>...] [-- <cmake-options>...]
325 Options: [defaults in brackets after descriptions]
326 Configuration:
327   --help                  print this message
328   --version               only print version information
329   --verbose               display more information
330   --parallel=n            bootstrap cmake in parallel, where n is
331                           number of nodes [1]
332   --enable-ccache         Enable ccache when building cmake
333   --init=FILE             load FILE as script to populate cache
334   --system-libs           use all system-installed third-party libraries
335                           (for use only by package maintainers)
336   --no-system-libs        use all cmake-provided third-party libraries
337                           (default)
338   --system-curl           use system-installed curl library
339   --no-system-curl        use cmake-provided curl library (default)
340   --system-expat          use system-installed expat library
341   --no-system-expat       use cmake-provided expat library (default)
342   --system-zlib           use system-installed zlib library
343   --no-system-zlib        use cmake-provided zlib library (default)
344   --system-bzip2          use system-installed bzip2 library
345   --no-system-bzip2       use cmake-provided bzip2 library (default)
346   --system-libarchive     use system-installed libarchive library
347   --no-system-libarchive  use cmake-provided libarchive library (default)
348
349   --qt-gui                build the Qt-based GUI (requires Qt >= 4.2)
350   --no-qt-gui             do not build the Qt-based GUI (default)
351   --qt-qmake=<qmake>      use <qmake> as the qmake executable to find Qt
352
353 Directory and file names:
354   --prefix=PREFIX         install files in tree rooted at PREFIX
355                           [${cmake_default_prefix}]
356   --datadir=DIR           install data files in PREFIX/DIR
357                           [/share/CMake]
358   --docdir=DIR            install documentation files in PREFIX/DIR
359                           [/doc/CMake]
360   --mandir=DIR            install man pages files in PREFIX/DIR/manN
361                           [/man]
362 '
363   exit 10
364 }
365
366 # Display CMake bootstrap usage
367 cmake_version_display()
368 {
369   echo "CMake ${cmake_version}, Copyright 2000-2012 Kitware, Inc."
370 }
371
372 # Display CMake bootstrap error, display the log file and exit
373 cmake_error()
374 {
375   res=$1
376   shift 1
377   echo "---------------------------------------------"
378   echo "Error when bootstrapping CMake:"
379   echo "$*"
380   echo "---------------------------------------------"
381   if [ -f cmake_bootstrap.log ]; then
382     echo "Log of errors: `pwd`/cmake_bootstrap.log"
383     #cat cmake_bootstrap.log
384     echo "---------------------------------------------"
385   fi
386   exit ${res}
387 }
388
389 # Replace KWSYS_NAMESPACE with cmsys
390 cmake_replace_string ()
391 {
392   INFILE="$1"
393   OUTFILE="$2"
394   SEARCHFOR="$3"
395   REPLACEWITH="$4"
396   if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
397     cat "${INFILE}" |
398       sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" > "${OUTFILE}${_tmp}"
399     if [ -f "${OUTFILE}${_tmp}" ]; then
400       if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
401         #echo "Files are the same"
402         rm -f "${OUTFILE}${_tmp}"
403       else
404         mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
405       fi
406     fi
407   else
408     cmake_error 1 "Cannot find file ${INFILE}"
409   fi
410 }
411
412 cmake_kwsys_config_replace_string ()
413 {
414   INFILE="$1"
415   OUTFILE="$2"
416   shift 2
417   APPEND="$*"
418   if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
419     echo "${APPEND}" > "${OUTFILE}${_tmp}"
420     cat "${INFILE}" |
421       sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
422                 s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
423                 s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
424                 s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
425                 s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
426                 s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
427                 s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
428                 s/@KWSYS_IOS_USE_SSTREAM@/${KWSYS_IOS_USE_SSTREAM}/g;
429                 s/@KWSYS_IOS_USE_STRSTREAM_H@/${KWSYS_IOS_USE_STRSTREAM_H}/g;
430                 s/@KWSYS_IOS_USE_STRSTREA_H@/${KWSYS_IOS_USE_STRSTREA_H}/g;
431                 s/@KWSYS_IOS_HAVE_BINARY@/${KWSYS_IOS_HAVE_BINARY}/g;
432                 s/@KWSYS_STL_HAVE_STD@/${KWSYS_STL_HAVE_STD}/g;
433                 s/@KWSYS_STL_STRING_HAVE_ISTREAM@/${KWSYS_STL_STRING_HAVE_ISTREAM}/g;
434                 s/@KWSYS_STL_STRING_HAVE_OSTREAM@/${KWSYS_STL_STRING_HAVE_OSTREAM}/g;
435                 s/@KWSYS_STL_STRING_HAVE_NEQ_CHAR@/${KWSYS_STL_STRING_HAVE_NEQ_CHAR}/g;
436                 s/@KWSYS_STL_HAS_ITERATOR_TRAITS@/${KWSYS_STL_HAS_ITERATOR_TRAITS}/g;
437                 s/@KWSYS_STL_HAS_ITERATOR_CATEGORY@/${KWSYS_STL_HAS_ITERATOR_CATEGORY}/g;
438                 s/@KWSYS_STL_HAS___ITERATOR_CATEGORY@/${KWSYS_STL_HAS___ITERATOR_CATEGORY}/g;
439                 s/@KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}/g;
440                 s/@KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE}/g;
441                 s/@KWSYS_STL_HAS_ALLOCATOR_REBIND@/${KWSYS_STL_HAS_ALLOCATOR_REBIND}/g;
442                 s/@KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@/${KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT}/g;
443                 s/@KWSYS_STL_HAS_ALLOCATOR_OBJECTS@/${KWSYS_STL_HAS_ALLOCATOR_OBJECTS}/g;
444                 s/@KWSYS_CXX_HAS_CSTDDEF@/${KWSYS_CXX_HAS_CSTDDEF}/g;
445                 s/@KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@/${KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS}/g;
446                 s/@KWSYS_CXX_HAS_MEMBER_TEMPLATES@/${KWSYS_CXX_HAS_MEMBER_TEMPLATES}/g;
447                 s/@KWSYS_CXX_HAS_FULL_SPECIALIZATION@/${KWSYS_CXX_HAS_FULL_SPECIALIZATION}/g;
448                 s/@KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@/${KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP}/g;
449                 s/@KWSYS_STAT_HAS_ST_MTIM@/${KWSYS_STAT_HAS_ST_MTIM}/g;}" >> "${OUTFILE}${_tmp}"
450     if [ -f "${OUTFILE}${_tmp}" ]; then
451       if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
452         #echo "Files are the same"
453         rm -f "${OUTFILE}${_tmp}"
454       else
455         mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
456       fi
457     fi
458   else
459     cmake_error 2 "Cannot find file ${INFILE}"
460   fi
461 }
462 # Write string into a file
463 cmake_report ()
464 {
465   FILE=$1
466   shift
467   echo "$*" >> ${FILE}
468 }
469
470 # Escape spaces in strings
471 cmake_escape ()
472 {
473   echo $1 | sed "s/ /\\\\ /g"
474 }
475
476 # Strip prefix from argument
477 cmake_arg ()
478 {
479   echo "$1" | sed "s/^${2-[^=]*=}//"
480 }
481
482 # Write message to the log
483 cmake_log ()
484 {
485   echo "$*" >> cmake_bootstrap.log
486 }
487
488 # Return temp file
489 cmake_tmp_file ()
490 {
491   echo "cmake_bootstrap_$$_test"
492 }
493
494 # Run a compiler test. First argument is compiler, second one are compiler
495 # flags, third one is test source file to be compiled
496 cmake_try_run ()
497 {
498   COMPILER=$1
499   FLAGS=$2
500   TESTFILE=$3
501   if [ ! -f "${TESTFILE}" ]; then
502     echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
503     exit 4
504   fi
505   TMPFILE=`cmake_tmp_file`
506   echo "Try: ${COMPILER}"
507   echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
508   echo "----------  file   -----------------------"
509   cat "${TESTFILE}"
510   echo "------------------------------------------"
511   "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
512   RES=$?
513   if [ "${RES}" -ne "0" ]; then
514     echo "Test failed to compile"
515     return 1
516   fi
517   if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
518     echo "Test failed to produce executable"
519     return 2
520   fi
521   ./${TMPFILE}
522   RES=$?
523   rm -f "${TMPFILE}"
524   if [ "${RES}" -ne "0" ]; then
525     echo "Test produced non-zero return code"
526     return 3
527   fi
528   echo "Test succeded"
529   return 0
530 }
531
532 # Run a make test. First argument is the make interpreter.
533 cmake_try_make ()
534 {
535   MAKE_PROC="$1"
536   MAKE_FLAGS="$2"
537   echo "Try: ${MAKE_PROC}"
538   "${MAKE_PROC}" ${MAKE_FLAGS}
539   RES=$?
540   if [ "${RES}" -ne "0" ]; then
541     echo "${MAKE_PROC} does not work"
542     return 1
543   fi
544   if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
545     echo "${COMPILER} does not produce output"
546     return 2
547   fi
548   ./test
549   RES=$?
550   rm -f "test"
551   if [ "${RES}" -ne "0" ]; then
552     echo "${MAKE_PROC} produces strange executable"
553     return 3
554   fi
555   echo "${MAKE_PROC} works"
556   return 0
557 }
558
559 # Parse arguments
560 cmake_verbose=
561 cmake_parallel_make=
562 cmake_ccache_enabled=
563 cmake_prefix_dir="${cmake_default_prefix}"
564 while test $# != 0; do
565   case "$1" in
566   --prefix=*) dir=`cmake_arg "$1"`
567               cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;;
568   --parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;;
569   --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;;
570   --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;;
571   --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;;
572   --init=*) cmake_init_file=`cmake_arg "$1"` ;;
573   --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
574   --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
575   --system-bzip2|--system-curl|--system-expat|--system-libarchive|--system-zlib)
576     lib=`cmake_arg "$1" "--system-"`
577     cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
578   --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-libarchive|--no-system-zlib)
579     lib=`cmake_arg "$1" "--no-system-"`
580     cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
581   --qt-gui) cmake_bootstrap_qt_gui="1" ;;
582   --no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
583   --qt-qmake=*) cmake_bootstrap_qt_qmake=`cmake_arg "$1"` ;;
584   --help) cmake_usage ;;
585   --version) cmake_version_display ; exit 2 ;;
586   --verbose) cmake_verbose=TRUE ;;
587   --enable-ccache) cmake_ccache_enabled=TRUE ;;
588   --) shift; break ;;
589   *) die "Unknown option: $1" ;;
590   esac
591   shift
592 done
593
594 # If verbose, display some information about bootstrap
595 if [ -n "${cmake_verbose}" ]; then
596   echo "---------------------------------------------"
597   echo "Source directory: ${cmake_source_dir}"
598   echo "Binary directory: ${cmake_binary_dir}"
599   echo "Prefix directory: ${cmake_prefix_dir}"
600   echo "System:           ${cmake_system}"
601   if [ "x${cmake_parallel_make}" != "x" ]; then
602     echo "Doing parallel make: ${cmake_parallel_make}"
603   fi
604   echo ""
605 fi
606
607 echo "---------------------------------------------"
608 # Get CMake version
609 echo "`cmake_version_display`"
610
611 # Check for in-source build
612 cmake_in_source_build=
613 if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
614      -f "${cmake_binary_dir}/Source/cmake.h" ]; then
615   if [ -n "${cmake_verbose}" ]; then
616     echo "Warning: This is an in-source build"
617   fi
618   cmake_in_source_build=TRUE
619 fi
620
621 # If this is not an in-source build, then Bootstrap stuff should not exist.
622 if [ -z "${cmake_in_source_build}" ]; then
623   # Did somebody bootstrap in the source tree?
624   if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then
625     cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
626 Looks like somebody did bootstrap CMake in the source tree, but now you are
627 trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
628 directory from the source tree."
629   fi
630   # Is there a cache in the source tree?
631   for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
632     if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
633       cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
634 Looks like somebody tried to build CMake in the source tree, but now you are
635 trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
636 from the source tree."
637     fi
638   done
639 fi
640
641 # Make bootstrap directory
642 [ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
643 if [ ! -d "${cmake_bootstrap_dir}" ]; then
644   cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
645 fi
646 cd "${cmake_bootstrap_dir}"
647
648 [ -d "cmsys" ] || mkdir "cmsys"
649 if [ ! -d "cmsys" ]; then
650   cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
651 fi
652
653 for a in stl ios; do
654   [ -d "cmsys/${a}" ] || mkdir "cmsys/${a}"
655   if [ ! -d "cmsys/${a}" ]; then
656     cmake_error 5 "Cannot create directory ${cmake_bootstrap_dir}/cmsys/${a}"
657   fi
658 done
659
660 # Delete all the bootstrap files
661 rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
662 rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
663 rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
664
665 # If exist compiler flags, set them
666 cmake_c_flags=${CFLAGS}
667 cmake_cxx_flags=${CXXFLAGS}
668 cmake_ld_flags=${LDFLAGS}
669
670 # Add Cygwin-specific flags
671 if ${cmake_system_cygwin}; then
672   cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
673 fi
674
675 # Add CoreFoundation framework on Darwin
676 if ${cmake_system_darwin}; then
677   cmake_ld_flags="${LDFLAGS} -framework CoreFoundation"
678 fi
679
680 # Add BeOS toolkits...
681 if ${cmake_system_beos}; then
682   cmake_ld_flags="${LDFLAGS} -lroot -lbe"
683 fi
684
685 # Add Haiku toolkits...
686 if ${cmake_system_haiku}; then
687   cmake_ld_flags="${LDFLAGS} -lroot -lbe"
688 fi
689
690 if ${cmake_system_linux}; then
691   # avoid binutils problem with large binaries, e.g. when building CMake in debug mode
692   # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230
693   if ${cmake_machine_parisc}; then
694     cmake_ld_flags="${LDFLAGS} -Wl,--unique=.text.*"
695   fi
696 fi
697
698 #-----------------------------------------------------------------------------
699 # Detect known toolchains on some platforms.
700 cmake_toolchains=''
701 case "${cmake_system}" in
702   *AIX*)   cmake_toolchains='XL GNU' ;;
703   *CYGWIN*) cmake_toolchains='GNU' ;;
704   *Darwin*) cmake_toolchains='GNU Clang' ;;
705   *Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;;
706   *MINGW*) cmake_toolchains='GNU' ;;
707 esac
708
709 # Toolchain compiler name table.
710 cmake_toolchain_Clang_CC='clang'
711 cmake_toolchain_Clang_CXX='clang++'
712 cmake_toolchain_GNU_CC='gcc'
713 cmake_toolchain_GNU_CXX='g++'
714 cmake_toolchain_PGI_CC='pgcc'
715 cmake_toolchain_PGI_CXX='pgCC'
716 cmake_toolchain_PathScale_CC='pathcc'
717 cmake_toolchain_PathScale_CXX='pathCC'
718 cmake_toolchain_XL_CC='xlc'
719 cmake_toolchain_XL_CXX='xlC'
720
721 cmake_toolchain_try()
722 {
723   tc="$1"
724   TMPFILE=`cmake_tmp_file`
725
726   eval "tc_CC=\${cmake_toolchain_${tc}_CC}"
727   echo 'int main() { return 0; }' > "${TMPFILE}.c"
728   cmake_try_run "$tc_CC" "" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1
729   tc_result_CC="$?"
730   rm -f "${TMPFILE}.c"
731   test "${tc_result_CC}" = "0" || return 1
732
733   eval "tc_CXX=\${cmake_toolchain_${tc}_CXX}"
734   echo 'int main() { return 0; }' > "${TMPFILE}.cpp"
735   cmake_try_run "$tc_CXX" "" "${TMPFILE}.cpp" >> cmake_bootstrap.log 2>&1
736   tc_result_CXX="$?"
737   rm -f "${TMPFILE}.cpp"
738   test "${tc_result_CXX}" = "0" || return 1
739
740   cmake_toolchain="$tc"
741 }
742
743 cmake_toolchain_detect()
744 {
745   cmake_toolchain=
746   for tc in ${cmake_toolchains}; do
747     echo "Checking for $tc toolchain" >> cmake_bootstrap.log 2>&1
748     cmake_toolchain_try "$tc" &&
749     echo "Found $tc toolchain" &&
750     break
751   done
752 }
753
754 if [ -z "${CC}" -a -z "${CXX}" ]; then
755   cmake_toolchain_detect
756 fi
757
758 #-----------------------------------------------------------------------------
759 # Test C compiler
760 cmake_c_compiler=
761
762 # If CC is set, use that for compiler, otherwise use list of known compilers
763 if [ -n "${cmake_toolchain}" ]; then
764   eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
765 elif [ -n "${CC}" ]; then
766   cmake_c_compilers="${CC}"
767 else
768   cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
769 fi
770
771 # Check if C compiler works
772 TMPFILE=`cmake_tmp_file`
773 echo '
774 #ifdef __cplusplus
775 # error "The CMAKE_C_COMPILER is set to a C++ compiler"
776 #endif
777
778 #include<stdio.h>
779
780 #if defined(__CLASSIC_C__)
781 int main(argc, argv)
782   int argc;
783   char* argv[];
784 #else
785 int main(int argc, char* argv[])
786 #endif
787 {
788   printf("%d%c", (argv != 0), (char)0x0a);
789   return argc-1;
790 }
791 ' > "${TMPFILE}.c"
792 for a in ${cmake_c_compilers}; do
793   if [ -z "${cmake_c_compiler}" ] && \
794     cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
795     cmake_c_compiler="${a}"
796   fi
797 done
798 rm -f "${TMPFILE}.c"
799
800 if [ -z "${cmake_c_compiler}" ]; then
801   cmake_error 6 "Cannot find appropriate C compiler on this system.
802 Please specify one using environment variable CC.
803 See cmake_bootstrap.log for compilers attempted.
804 "
805 fi
806 echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
807
808 #-----------------------------------------------------------------------------
809 # Test CXX compiler
810 cmake_cxx_compiler=
811
812 # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
813
814 # If CC is set, use that for compiler, otherwise use list of known compilers
815 if [ -n "${cmake_toolchain}" ]; then
816   eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
817 elif [ -n "${CXX}" ]; then
818   cmake_cxx_compilers="${CXX}"
819 else
820   cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
821 fi
822
823 # Check if C++ compiler works
824 TMPFILE=`cmake_tmp_file`
825 echo '
826 #if defined(TEST1)
827 # include <iostream>
828 #else
829 # include <iostream.h>
830 #endif
831
832 class NeedCXX
833 {
834 public:
835   NeedCXX() { this->Foo = 1; }
836   int GetFoo() { return this->Foo; }
837 private:
838   int Foo;
839 };
840 int main()
841 {
842   NeedCXX c;
843 #ifdef TEST3
844   cout << c.GetFoo() << endl;
845 #else
846   std::cout << c.GetFoo() << std::endl;
847 #endif
848   return 0;
849 }
850 ' > "${TMPFILE}.cxx"
851 for a in ${cmake_cxx_compilers}; do
852   for b in 1 2 3; do
853     if [ -z "${cmake_cxx_compiler}" ] && \
854       cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
855       cmake_cxx_compiler="${a}"
856     fi
857   done
858 done
859 rm -f "${TMPFILE}.cxx"
860
861 if [ -z "${cmake_cxx_compiler}" ]; then
862   cmake_error 7 "Cannot find appropriate C++ compiler on this system.
863 Please specify one using environment variable CXX.
864 See cmake_bootstrap.log for compilers attempted."
865 fi
866 echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
867
868 #-----------------------------------------------------------------------------
869 # Test Make
870
871 cmake_make_processor=
872 cmake_make_flags=
873
874 # If MAKE is set, use that for make processor, otherwise use list of known make
875 if [ -n "${MAKE}" ]; then
876   cmake_make_processors="${MAKE}"
877 else
878   cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
879 fi
880
881 TMPFILE="`cmake_tmp_file`_dir"
882 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
883 mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
884 cd "${cmake_bootstrap_dir}/${TMPFILE}"
885 echo '
886 test: test.c
887         "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
888 '>"Makefile"
889 echo '
890 #include <stdio.h>
891 int main(){ printf("1%c", (char)0x0a); return 0; }
892 ' > "test.c"
893 cmake_original_make_flags="${cmake_make_flags}"
894 if [ "x${cmake_parallel_make}" != "x" ]; then
895   cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
896 fi
897 for a in ${cmake_make_processors}; do
898   if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
899     cmake_make_processor="${a}"
900   fi
901 done
902 cmake_full_make_flags="${cmake_make_flags}"
903 if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
904   if [ -z "${cmake_make_processor}" ]; then
905     cmake_make_flags="${cmake_original_make_flags}"
906     for a in ${cmake_make_processors}; do
907       if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
908         cmake_make_processor="${a}"
909       fi
910     done
911   fi
912 fi
913 cd "${cmake_bootstrap_dir}"
914
915 if [ -z "${cmake_make_processor}" ]; then
916   cmake_error 8 "Cannot find appropriate Makefile processor on this system.
917 Please specify one using environment variable MAKE."
918 fi
919 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
920 echo "Makefile processor on this system is: ${cmake_make_processor}"
921 if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
922   echo "---------------------------------------------"
923   echo "Makefile processor ${cmake_make_processor} does not support parallel build"
924   echo "---------------------------------------------"
925 fi
926
927 # Ok, we have CC, CXX, and MAKE.
928
929 # Test C++ compiler features
930
931 # Are we GCC?
932
933 TMPFILE=`cmake_tmp_file`
934 echo '
935 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
936 #include <iostream>
937 int main() { std::cout << "This is GNU" << std::endl; return 0;}
938 #endif
939 ' > ${TMPFILE}.cxx
940 cmake_cxx_compiler_is_gnu=0
941 if cmake_try_run "${cmake_cxx_compiler}" \
942   "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
943   cmake_cxx_compiler_is_gnu=1
944 fi
945 if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then
946   echo "${cmake_cxx_compiler} is GNU compiler"
947 else
948   echo "${cmake_cxx_compiler} is not GNU compiler"
949 fi
950 rm -f "${TMPFILE}.cxx"
951
952 if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
953   # Check for non-GNU compiler flags
954
955   # If we are on IRIX, check for -LANG:std
956   cmake_test_flags="-LANG:std"
957   if [ "x${cmake_system}" = "xIRIX64" ]; then
958     TMPFILE=`cmake_tmp_file`
959     echo '
960     #include <iostream>
961     int main() { std::cout << "No need for '"${cmake_test_flags}"'" << std::endl; return 0;}
962 ' > ${TMPFILE}.cxx
963     cmake_need_lang_std=0
964     if cmake_try_run "${cmake_cxx_compiler}" \
965       "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
966       :
967     else
968       if cmake_try_run "${cmake_cxx_compiler}" \
969         "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
970         cmake_need_lang_std=1
971       fi
972     fi
973     if [ "x${cmake_need_lang_std}" = "x1" ]; then
974       cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
975       echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
976     else
977       echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
978     fi
979     rm -f "${TMPFILE}.cxx"
980   fi
981   cmake_test_flags=
982
983   # If we are on OSF, check for -timplicit_local -no_implicit_include
984   cmake_test_flags="-timplicit_local -no_implicit_include"
985   if [ "x${cmake_system}" = "xOSF1" ]; then
986     TMPFILE=`cmake_tmp_file`
987     echo '
988     #include <iostream>
989     int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
990 ' > ${TMPFILE}.cxx
991     cmake_need_flags=1
992     if cmake_try_run "${cmake_cxx_compiler}" \
993       "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
994       :
995     else
996       cmake_need_flags=0
997     fi
998     if [ "x${cmake_need_flags}" = "x1" ]; then
999       cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
1000       echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
1001     else
1002       echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
1003     fi
1004     rm -f "${TMPFILE}.cxx"
1005   fi
1006   cmake_test_flags=
1007
1008   # If we are on OSF, check for -std strict_ansi -nopure_cname
1009   cmake_test_flags="-std strict_ansi -nopure_cname"
1010   if [ "x${cmake_system}" = "xOSF1" ]; then
1011     TMPFILE=`cmake_tmp_file`
1012     echo '
1013     #include <iostream>
1014     int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
1015 ' > ${TMPFILE}.cxx
1016     cmake_need_flags=1
1017     if cmake_try_run "${cmake_cxx_compiler}" \
1018       "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
1019       :
1020     else
1021       cmake_need_flags=0
1022     fi
1023     if [ "x${cmake_need_flags}" = "x1" ]; then
1024       cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
1025       echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
1026     else
1027       echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
1028     fi
1029     rm -f "${TMPFILE}.cxx"
1030   fi
1031   cmake_test_flags=
1032
1033   # If we are on HP-UX, check for -Ae for the C compiler.
1034   cmake_test_flags="-Ae"
1035   if [ "x${cmake_system}" = "xHP-UX" ]; then
1036     TMPFILE=`cmake_tmp_file`
1037     echo '
1038     int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
1039 ' > ${TMPFILE}.c
1040     cmake_need_Ae=0
1041     if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
1042       :
1043     else
1044       if cmake_try_run "${cmake_c_compiler}" \
1045         "${cmake_c_flags} ${cmake_test_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
1046         cmake_need_Ae=1
1047       fi
1048     fi
1049     if [ "x${cmake_need_Ae}" = "x1" ]; then
1050       cmake_c_flags="${cmake_c_flags} ${cmake_test_flags}"
1051       echo "${cmake_c_compiler} needs ${cmake_test_flags}"
1052     else
1053       echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
1054     fi
1055     rm -f "${TMPFILE}.c"
1056   fi
1057   cmake_test_flags=
1058 fi
1059
1060 # Test for kwsys features
1061 KWSYS_NAME_IS_KWSYS=0
1062 KWSYS_BUILD_SHARED=0
1063 KWSYS_LFS_AVAILABLE=0
1064 KWSYS_LFS_REQUESTED=0
1065 KWSYS_IOS_USE_STRSTREAM_H=0
1066 KWSYS_IOS_USE_STRSTREA_H=0
1067 KWSYS_IOS_HAVE_STD=0
1068 KWSYS_IOS_USE_SSTREAM=0
1069 KWSYS_IOS_USE_ANSI=0
1070 KWSYS_IOS_HAVE_BINARY=0
1071 KWSYS_STL_HAVE_STD=0
1072 KWSYS_STAT_HAS_ST_MTIM=0
1073 KWSYS_STL_STRING_HAVE_NEQ_CHAR=0
1074 KWSYS_STL_HAS_ITERATOR_TRAITS=0
1075 KWSYS_STL_HAS_ITERATOR_CATEGORY=0
1076 KWSYS_STL_HAS___ITERATOR_CATEGORY=0
1077 KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=0
1078 KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=0
1079 KWSYS_STL_HAS_ALLOCATOR_REBIND=0
1080 KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=0
1081 KWSYS_STL_HAS_ALLOCATOR_OBJECTS=0
1082 KWSYS_CXX_HAS_SETENV=0
1083 KWSYS_CXX_HAS_UNSETENV=0
1084 KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0
1085 KWSYS_CXX_HAS_CSTDDEF=0
1086 KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0
1087 KWSYS_CXX_HAS_MEMBER_TEMPLATES=0
1088 KWSYS_CXX_HAS_FULL_SPECIALIZATION=0
1089 KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=0
1090
1091 # Hardcode these kwsys features.  They work on all known UNIX compilers anyway.
1092 KWSYS_STL_STRING_HAVE_ISTREAM=1
1093 KWSYS_STL_STRING_HAVE_OSTREAM=1
1094
1095 if cmake_try_run "${cmake_cxx_compiler}" \
1096   "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_SETENV" \
1097   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1098   KWSYS_CXX_HAS_SETENV=1
1099   echo "${cmake_cxx_compiler} has setenv"
1100 else
1101   echo "${cmake_cxx_compiler} does not have setenv"
1102 fi
1103
1104 if cmake_try_run "${cmake_cxx_compiler}" \
1105   "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_UNSETENV" \
1106   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1107   KWSYS_CXX_HAS_UNSETENV=1
1108   echo "${cmake_cxx_compiler} has unsetenv"
1109 else
1110   echo "${cmake_cxx_compiler} does not have unsetenv"
1111 fi
1112
1113 if cmake_try_run "${cmake_cxx_compiler}" \
1114   "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H" \
1115   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1116   KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=1
1117   echo "${cmake_cxx_compiler} has environ in stdlib.h"
1118 else
1119   echo "${cmake_cxx_compiler} does not have environ in stdlib.h"
1120 fi
1121
1122 if cmake_try_run "${cmake_cxx_compiler}" \
1123   "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
1124   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1125   KWSYS_STL_HAVE_STD=1
1126   echo "${cmake_cxx_compiler} has STL in std:: namespace"
1127 else
1128   echo "${cmake_cxx_compiler} does not have STL in std:: namespace"
1129 fi
1130
1131 if cmake_try_run "${cmake_cxx_compiler}" \
1132   "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
1133   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1134   KWSYS_IOS_USE_ANSI=1
1135   echo "${cmake_cxx_compiler} has ANSI streams"
1136 else
1137   echo "${cmake_cxx_compiler} does not have ANSI streams"
1138 fi
1139
1140 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
1141   if cmake_try_run "${cmake_cxx_compiler}" \
1142     "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
1143     "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1144     KWSYS_IOS_HAVE_STD=1
1145     echo "${cmake_cxx_compiler} has streams in std:: namespace"
1146   else
1147     echo "${cmake_cxx_compiler} does not have streams in std:: namespace"
1148   fi
1149   if cmake_try_run "${cmake_cxx_compiler}" \
1150     "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
1151     "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1152     KWSYS_IOS_USE_SSTREAM=1
1153     echo "${cmake_cxx_compiler} has sstream"
1154   else
1155     echo "${cmake_cxx_compiler} does not have sstream"
1156   fi
1157 fi
1158
1159 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
1160   if cmake_try_run "${cmake_cxx_compiler}" \
1161     "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
1162     "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1163     KWSYS_IOS_USE_STRSTREAM_H=1
1164     echo "${cmake_cxx_compiler} has strstream.h"
1165   else
1166     echo "${cmake_cxx_compiler} does not have strstream.h"
1167   fi
1168   if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
1169     if cmake_try_run "${cmake_cxx_compiler}" \
1170       "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
1171       "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1172       KWSYS_IOS_USE_STRSTREA_H=1
1173       echo "${cmake_cxx_compiler} has strstrea.h"
1174     else
1175       echo "${cmake_cxx_compiler} does not have strstrea.h"
1176     fi
1177   fi
1178 fi
1179
1180 if cmake_try_run "${cmake_cxx_compiler}" \
1181   "${cmake_cxx_flags} -DTEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1182   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1183   KWSYS_STL_STRING_HAVE_NEQ_CHAR=1
1184   echo "${cmake_cxx_compiler} has operator!=(string, char*)"
1185 else
1186   echo "${cmake_cxx_compiler} does not have operator!=(string, char*)"
1187 fi
1188
1189 if cmake_try_run "${cmake_cxx_compiler}" \
1190   "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_TRAITS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1191   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1192   KWSYS_STL_HAS_ITERATOR_TRAITS=1
1193   echo "${cmake_cxx_compiler} has stl iterator_traits"
1194 else
1195   echo "${cmake_cxx_compiler} does not have stl iterator_traits"
1196 fi
1197
1198 if [ "x${KWSYS_STL_HAS_ITERATOR_TRAITS}" = "x0" ]; then
1199   if cmake_try_run "${cmake_cxx_compiler}" \
1200     "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1201     "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1202     KWSYS_STL_HAS_ITERATOR_CATEGORY=1
1203     echo "${cmake_cxx_compiler} has old iterator_category"
1204   else
1205     echo "${cmake_cxx_compiler} does not have old iterator_category"
1206   fi
1207   if [ "x${KWSYS_STL_HAS_ITERATOR_CATEGORY}" = "x0" ]; then
1208     if cmake_try_run "${cmake_cxx_compiler}" \
1209       "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS___ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1210       "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1211       KWSYS_STL_HAS___ITERATOR_CATEGORY=1
1212       echo "${cmake_cxx_compiler} has old __iterator_category"
1213     else
1214       echo "${cmake_cxx_compiler} does not have old __iterator_category"
1215     fi
1216   fi
1217 fi
1218
1219 if cmake_try_run "${cmake_cxx_compiler}" \
1220   "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1221   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1222   KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=1
1223   echo "${cmake_cxx_compiler} has standard template allocator"
1224 else
1225   echo "${cmake_cxx_compiler} does not have standard template allocator"
1226 fi
1227
1228 if [ "x${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}" = "x1" ]; then
1229   if cmake_try_run "${cmake_cxx_compiler}" \
1230     "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1231     "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1232     KWSYS_STL_HAS_ALLOCATOR_REBIND=1
1233     echo "${cmake_cxx_compiler} has allocator<>::rebind<>"
1234   else
1235     echo "${cmake_cxx_compiler} does not have allocator<>::rebind<>"
1236   fi
1237
1238   if cmake_try_run "${cmake_cxx_compiler}" \
1239     "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1240     "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1241     KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=1
1242     echo "${cmake_cxx_compiler} has non-standard allocator<>::max_size argument"
1243   else
1244     echo "${cmake_cxx_compiler} does not have non-standard allocator<>::max_size argument"
1245   fi
1246 else
1247   if cmake_try_run "${cmake_cxx_compiler}" \
1248     "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1249     "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1250     KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=1
1251     echo "${cmake_cxx_compiler} has old non-template allocator"
1252   else
1253     echo "${cmake_cxx_compiler} does not have old non-template allocator"
1254   fi
1255 fi
1256
1257 if cmake_try_run "${cmake_cxx_compiler}" \
1258   "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1259   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1260   KWSYS_STL_HAS_ALLOCATOR_OBJECTS=1
1261   echo "${cmake_cxx_compiler} has stl containers supporting allocator objects"
1262 else
1263   echo "${cmake_cxx_compiler} does not have stl containers supporting allocator objects"
1264 fi
1265
1266 if cmake_try_run "${cmake_cxx_compiler}" \
1267   "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_CSTDDEF" \
1268   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1269   KWSYS_CXX_HAS_CSTDDEF=1
1270   echo "${cmake_cxx_compiler} has header cstddef"
1271 else
1272   echo "${cmake_cxx_compiler} does not have header cstddef"
1273 fi
1274
1275 if cmake_try_run "${cmake_cxx_compiler}" \
1276   "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS" \
1277   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1278   echo "${cmake_cxx_compiler} does not require template friends to use <>"
1279 else
1280   KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=1
1281   echo "${cmake_cxx_compiler} requires template friends to use <>"
1282 fi
1283
1284 if cmake_try_run "${cmake_cxx_compiler}" \
1285   "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES" \
1286   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1287   KWSYS_CXX_HAS_MEMBER_TEMPLATES=1
1288   echo "${cmake_cxx_compiler} supports member templates"
1289 else
1290   echo "${cmake_cxx_compiler} does not support member templates"
1291 fi
1292
1293 if cmake_try_run "${cmake_cxx_compiler}" \
1294   "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION" \
1295   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1296   KWSYS_CXX_HAS_FULL_SPECIALIZATION=1
1297   echo "${cmake_cxx_compiler} has standard template specialization syntax"
1298 else
1299   echo "${cmake_cxx_compiler} does not have standard template specialization syntax"
1300 fi
1301
1302 if cmake_try_run "${cmake_cxx_compiler}" \
1303   "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP" \
1304   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1305   KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=1
1306   echo "${cmake_cxx_compiler} has argument dependent lookup"
1307 else
1308   echo "${cmake_cxx_compiler} does not have argument dependent lookup"
1309 fi
1310
1311 if cmake_try_run "${cmake_cxx_compiler}" \
1312   "${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \
1313   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1314   KWSYS_STAT_HAS_ST_MTIM=1
1315   echo "${cmake_cxx_compiler} has struct stat with st_mtim member"
1316 else
1317   echo "${cmake_cxx_compiler} does not have struct stat with st_mtim member"
1318 fi
1319
1320 if cmake_try_run "${cmake_cxx_compiler}" \
1321   "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_BINARY -DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI} -DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD}" \
1322   "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1323   KWSYS_IOS_HAVE_BINARY=1
1324   echo "${cmake_cxx_compiler} has ios::binary openmode"
1325 else
1326   echo "${cmake_cxx_compiler} does not have ios::binary openmode"
1327 fi
1328
1329 # Just to be safe, let us store compiler and flags to the header file
1330
1331 cmake_bootstrap_version='$Revision$'
1332 cmake_compiler_settings_comment="/*
1333  * Generated by ${cmake_source_dir}/bootstrap
1334  * Version:     ${cmake_bootstrap_version}
1335  *
1336  * Source directory: ${cmake_source_dir}
1337  * Binary directory: ${cmake_bootstrap_dir}
1338  *
1339  * C compiler:   ${cmake_c_compiler}
1340  * C flags:      ${cmake_c_flags}
1341  *
1342  * C++ compiler: ${cmake_cxx_compiler}
1343  * C++ flags:    ${cmake_cxx_flags}
1344  *
1345  * Make:         ${cmake_make_processor}
1346  *
1347  * Sources:
1348  * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
1349  * kwSys Sources:
1350  * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
1351  */
1352 "
1353
1354 cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}"
1355
1356 if [ "x$KWSYS_STL_HAVE_STD" = "x1" ]; then
1357   cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_STD_NAMESPACE */"
1358 else
1359   cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_STD_NAMESPACE 1"
1360 fi
1361
1362 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
1363   cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */"
1364 else
1365   cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STREAM_HEADERS 1"
1366 fi
1367
1368 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x1" ]; then
1369   cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STRING_STREAM */"
1370 else
1371   cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STRING_STREAM 1"
1372 fi
1373
1374 # Test for ansi FOR scope
1375 if cmake_try_run "${cmake_cxx_compiler}" \
1376   "${cmake_cxx_flags}" \
1377   "${cmake_source_dir}/Modules/TestForAnsiForScope.cxx" >> cmake_bootstrap.log 2>&1; then
1378   cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_FOR_SCOPE */"
1379   echo "${cmake_cxx_compiler} has ANSI for scoping"
1380 else
1381   cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_FOR_SCOPE 1"
1382   echo "${cmake_cxx_compiler} does not have ANSI for scoping"
1383 fi
1384
1385 # When bootstrapping on MinGW with MSYS we must convert the source
1386 # directory to a windows path.
1387 if ${cmake_system_mingw}; then
1388     cmake_root_dir=`cd "${cmake_source_dir}"; pwd -W`
1389 else
1390     cmake_root_dir="${cmake_source_dir}"
1391 fi
1392
1393 # Write CMake version
1394 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
1395 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
1396 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
1397 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_TWEAK ${cmake_version_tweak}"
1398 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
1399 cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\""
1400 cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
1401 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
1402
1403 # Regenerate configured headers
1404 for h in Configure VersionConfig; do
1405   if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then
1406     rm -f cm${h}.h${_tmp}
1407   else
1408     mv -f cm${h}.h${_tmp} cm${h}.h
1409   fi
1410 done
1411
1412 # Prepare KWSYS
1413 cmake_kwsys_config_replace_string \
1414   "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
1415   "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
1416   "${cmake_compiler_settings_comment}"
1417 cmake_kwsys_config_replace_string \
1418   "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
1419   "${cmake_bootstrap_dir}/cmsys/Configure.h" \
1420   "${cmake_compiler_settings_comment}"
1421
1422 for a in ${KWSYS_FILES}; do
1423   cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
1424      "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
1425 done
1426
1427 for a in ${KWSYS_IOS_FILES}; do
1428   cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_ios_${a}.h.in" \
1429      "${cmake_bootstrap_dir}/cmsys/ios/${a}" KWSYS_NAMESPACE cmsys
1430 done
1431
1432 cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_stl.hxx.in" \
1433    "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" KWSYS_STL_HEADER_EXTRA ""
1434
1435 cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" \
1436    "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" KWSYS_NAMESPACE cmsys
1437
1438 for a in string vector set map algorithm; do
1439   cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" \
1440     "${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
1441 done
1442
1443 # Generate Makefile
1444 dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
1445 objs=""
1446 for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
1447   objs="${objs} ${a}.o"
1448 done
1449
1450 # Generate dependencies for cmBootstrapCommands.cxx
1451 for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
1452   cmBootstrapCommandsDeps="${cmBootstrapCommandsDeps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
1453 done
1454 cmBootstrapCommandsDeps=`echo $cmBootstrapCommandsDeps`
1455
1456 if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
1457   cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
1458 fi
1459
1460 if [ "x${cmake_c_flags}" != "x" ]; then
1461   cmake_c_flags="${cmake_c_flags} "
1462 fi
1463
1464 if [ "x${cmake_cxx_flags}" != "x" ]; then
1465   cmake_cxx_flags="${cmake_cxx_flags} "
1466 fi
1467
1468 cmake_c_flags_String="-DKWSYS_STRING_C"
1469 cmake_cxx_flags_SystemTools="-DKWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV} -DKWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV} -DKWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}"
1470 cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
1471   -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
1472 cmake_cxx_flags="${cmake_cxx_flags} -I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
1473   -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
1474 echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
1475 echo "  ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
1476 for a in ${CMAKE_CXX_SOURCES}; do
1477   src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
1478   echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1479   echo "        ${cmake_cxx_compiler} ${cmake_cxx_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1480 done
1481 echo "cmBootstrapCommands.o : $cmBootstrapCommandsDeps" >> "${cmake_bootstrap_dir}/Makefile"
1482 for a in ${CMAKE_C_SOURCES}; do
1483   src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
1484   echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1485   echo "        ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1486 done
1487 for a in ${KWSYS_C_SOURCES}; do
1488   src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
1489   src_flags=`eval echo \\${cmake_c_flags_\${a}}`
1490   echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1491   echo "        ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1492 done
1493 for a in ${KWSYS_CXX_SOURCES}; do
1494   src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
1495   src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
1496   echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1497   echo "        ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1498 done
1499 echo '
1500 rebuild_cache:
1501         cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
1502 ' >> "${cmake_bootstrap_dir}/Makefile"
1503
1504 # Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake.
1505 echo '
1506 # Generated by '"${cmake_source_dir}"'/bootstrap
1507 # Default cmake settings.  These may be overridden any settings below.
1508 set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
1509 set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
1510 set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
1511 set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
1512 ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1513
1514 # Suppress -isysroot if user-provided flags already have it.
1515 if echo "${cmake_c_flags}"   | grep isysroot >/dev/null 2>&1 &&
1516    echo "${cmake_cxx_flags}" | grep isysroot >/dev/null 2>&1; then
1517   echo '
1518 set(CMAKE_OSX_SYSROOT "" CACHE PATH "" FORCE)
1519 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1520 fi
1521
1522 # Add configuration settings given as command-line options.
1523 if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then
1524   echo '
1525 set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
1526 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1527 fi
1528 if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then
1529   echo '
1530 set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
1531 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1532 fi
1533
1534 # Add user-specified settings.  Handle relative-path case for
1535 # specification of cmake_init_file.
1536 (
1537 cd "${cmake_binary_dir}"
1538 if [ -f "${cmake_init_file}" ]; then
1539   cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1540 fi
1541 )
1542
1543 echo "---------------------------------------------"
1544
1545 # Run make to build bootstrap cmake
1546 if [ "x${cmake_parallel_make}" != "x" ]; then
1547   ${cmake_make_processor} ${cmake_make_flags}
1548 else
1549   ${cmake_make_processor}
1550 fi
1551 RES=$?
1552 if [ "${RES}" -ne "0" ]; then
1553   cmake_error 9 "Problem while running ${cmake_make_processor}"
1554 fi
1555 cd "${cmake_binary_dir}"
1556
1557 # Set C, CXX, and MAKE environment variables, so that real real cmake will be
1558 # build with same compiler and make
1559 CC="${cmake_c_compiler}"
1560 CXX="${cmake_cxx_compiler}"
1561 if [ -n "${cmake_ccache_enabled}" ]; then
1562   CC="ccache ${CC}"
1563   CXX="ccache ${CXX}"
1564 fi
1565 MAKE="${cmake_make_processor}"
1566 export CC
1567 export CXX
1568 export MAKE
1569
1570 # Run bootstrap CMake to configure real CMake
1571 cmake_options="-DCMAKE_BOOTSTRAP=1"
1572 if [ -n "${cmake_verbose}" ]; then
1573   cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
1574 fi
1575 "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@"
1576 RES=$?
1577 if [ "${RES}" -ne "0" ]; then
1578   cmake_error 11 "Problem while running initial CMake"
1579 fi
1580
1581 echo "---------------------------------------------"
1582
1583 # And we are done. Now just run make
1584 echo "CMake has bootstrapped.  Now run ${cmake_make_processor}."