ENH: remove c++ comment from c code
[cmake.git] / bootstrap
blob9bc0edd851b13dc51d6bd34c4f65bf14da6f9428
1 #!/bin/sh
3 #=========================================================================
5 # Program: CMake - Cross-Platform Makefile Generator
6 # Module: $RCSfile: bootstrap,v $
7 # Language: Bourne Shell
8 # Date: $Date: 2006-03-22 14:58:10 $
9 # Version: $Revision: 1.80 $
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 # Detect system and directory information.
21 cmake_system=`uname`
22 cmake_source_dir=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
23 cmake_source_dir=`(cd "${cmake_source_dir}";pwd)`
24 cmake_binary_dir=`pwd`
25 cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap.cmk"
26 cmake_data_dir="/share/CMake"
27 cmake_doc_dir="/doc/CMake"
28 cmake_man_dir="/man"
29 cmake_init_file=""
31 # Determine whether this is a MinGW environment.
32 if echo "${cmake_system}" | grep MINGW >/dev/null 2>&1; then
33 cmake_system_mingw=true
34 else
35 cmake_system_mingw=false
38 # Choose the generator to use for bootstrapping.
39 if ${cmake_system_mingw}; then
40 # Bootstrapping from an MSYS prompt.
41 cmake_bootstrap_generator="MSYS Makefiles"
42 else
43 # Bootstrapping from a standard UNIX prompt.
44 cmake_bootstrap_generator="Unix Makefiles"
47 # Helper function to fix windows paths.
48 cmake_fix_slashes ()
50 echo "$1" | sed 's/\\/\//g'
53 # Choose the default install prefix.
54 if ${cmake_system_mingw}; then
55 if [ "x${PROGRAMFILES}" != "x" ]; then
56 cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
57 elif [ "x${ProgramFiles}" != "x" ]; then
58 cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
59 elif [ "x${SYSTEMDRIVE}" != "x" ]; then
60 cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
61 elif [ "x${SystemDrive}" != "x" ]; then
62 cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
63 else
64 cmake_default_prefix="c:/Program Files/CMake"
66 else
67 cmake_default_prefix="/usr/local"
70 CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
71 CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
72 CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
74 CMAKE_PROBLEMATIC_FILES="\
75 CMakeCache.txt \
76 CMakeSystem.cmake \
77 CMakeCCompiler.cmake \
78 CMakeCXXCompiler.cmake \
79 Source/cmConfigure.h \
80 Source/CTest/Curl/config.h \
81 Utilities/cmexpat/expatConfig.h \
82 Utilities/cmexpat/expatDllConfig.h \
85 CMAKE_UNUSED_SOURCES="\
86 cmakewizard \
87 cmGlobalXCodeGenerator \
88 cmLocalXCodeGenerator \
89 cmXCodeObject \
90 cmXCode21Object \
91 cmSourceGroup \
94 CMAKE_CXX_SOURCES="\
95 cmake \
96 cmakemain \
97 cmCommandArgumentLexer \
98 cmCommandArgumentParser \
99 cmCommandArgumentParserHelper \
100 cmDepends \
101 cmDependsC \
102 cmMakeDepend \
103 cmMakefile \
104 cmGeneratedFileStream \
105 cmGlobalGenerator \
106 cmLocalGenerator \
107 cmInstallGenerator \
108 cmInstallFilesGenerator \
109 cmInstallScriptGenerator \
110 cmInstallTargetGenerator \
111 cmSourceFile \
112 cmSystemTools \
113 cmFileTimeComparison \
114 cmGlobalUnixMakefileGenerator3 \
115 cmLocalUnixMakefileGenerator3 \
116 cmMakefileExecutableTargetGenerator \
117 cmMakefileLibraryTargetGenerator \
118 cmMakefileTargetGenerator \
119 cmMakefileUtilityTargetGenerator \
120 cmBootstrapCommands \
121 cmCommands \
122 cmTarget \
123 cmTest \
124 cmCustomCommand \
125 cmCacheManager \
126 cmListFileCache \
127 cmOrderLinkDirectories \
130 if ${cmake_system_mingw}; then
131 CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
132 cmGlobalMSYSMakefileGenerator \
133 cmGlobalMinGWMakefileGenerator \
134 cmWin32ProcessExecution"
137 CMAKE_C_SOURCES="\
138 cmListFileLexer \
141 if ${cmake_system_mingw}; then
142 KWSYS_C_SOURCES="\
143 ProcessWin32"
144 KWSYS_C_MINGW_SOURCES="\
145 ProcessFwd9x \
146 EncodeExecutable"
147 KWSYS_C_GENERATED_SOURCES="\
148 cmsysProcessFwd9xEnc"
149 else
150 KWSYS_C_SOURCES="\
151 ProcessUNIX"
152 KWSYS_C_MINGW_SOURCES=""
153 KWSYS_C_GENERATED_SOURCES=""
156 KWSYS_CXX_SOURCES="\
157 Directory \
158 Glob \
159 RegularExpression \
160 SystemTools"
162 KWSYS_FILES="\
163 Directory.hxx \
164 Glob.hxx \
165 Process.h \
166 RegularExpression.hxx \
167 String.hxx \
168 SystemTools.hxx"
170 KWSYS_IOS_FILES="
171 fstream \
172 iosfwd \
173 iostream \
174 sstream"
176 # Display CMake bootstrap usage
177 cmake_usage()
179 cat <<EOF
180 Usage: $0 [options]
181 Options: [defaults in brackets after descriptions]
182 Configuration:
183 --help print this message
184 --version only print version information
185 --verbose display more information
186 --parallel=n bootstrap cmake in parallel, where n is
187 number of nodes [1]
188 --init=FILE use FILE for cmake initialization
190 Directory and file names:
191 --prefix=PREFIX install files in tree rooted at PREFIX
192 [${cmake_default_prefix}]
193 --datadir=DIR install data files in PREFIX/DIR
194 [/share/CMake]
195 --docdir=DIR install documentation files in PREFIX/DIR
196 [/doc/CMake]
197 --mandir=DIR install man pages files in PREFIX/DIR/manN
198 [/man]
200 exit 10
203 # Display CMake bootstrap usage
204 cmake_version()
206 # Get CMake version
207 CMAKE_VERSION=""
208 for a in MAJOR MINOR PATCH; do
209 CMake_VERSION=`cat "${cmake_source_dir}/CMakeLists.txt" | \
210 grep "SET(CMake_VERSION_${a} *[0-9]*)" | sed "s/SET(CMake_VERSION_${a} *\([0-9]*\))/\1/"`
211 CMAKE_VERSION="${CMAKE_VERSION}.${CMake_VERSION}"
212 done
213 if echo "$CMAKE_VERSION" | grep "\.[0-9][0-9]*\.[0-9]*[13579]\.[0-9]" > /dev/null 2>&1; then
215 CMake_DATE=`cat "${cmake_source_dir}/Source/cmVersion.cxx" | grep "\".Date: [0-9][0-9]*/[0-9][0-9]*/[0-9][0-9]* [0-9][0-9]*:[0-9][0-9]*:[0-9][0-9]* .\";"`
216 CMake_DATE=`echo "${CMake_DATE}" | sed "s/.*Date: \([0-9][0-9]*\)\/\([0-9][0-9]*\)\/\([0-9][0-9]*\) .*/\1\2\3/" `
217 CMAKE_VERSION=`echo $CMAKE_VERSION | sed "s/\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1.\2-${CMake_DATE}/"`
218 else
219 CMAKE_VERSION=`echo $CMAKE_VERSION | sed "s/\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1.\2-\3/"`
221 echo "CMake ${CMAKE_VERSION}, Copyright (c) 2002 Kitware, Inc., Insight Consortium"
224 # Display CMake bootstrap error, display the log file and exit
225 cmake_error()
227 res=$1
228 shift 1
229 echo "---------------------------------------------"
230 echo "Error when bootstrapping CMake:"
231 echo "$*"
232 echo "---------------------------------------------"
233 if [ -f cmake_bootstrap.log ]; then
234 echo "Log of errors: `pwd`/cmake_bootstrap.log"
235 #cat cmake_bootstrap.log
236 echo "---------------------------------------------"
238 exit ${res}
241 # Replace KWSYS_NAMESPACE with cmsys
242 cmake_replace_string ()
244 INFILE="$1"
245 OUTFILE="$2"
246 SEARCHFOR="$3"
247 REPLACEWITH="$4"
248 if [ -f "${INFILE}" ]; then
249 cat "${INFILE}" |
250 sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" > "${OUTFILE}.tmp"
251 if [ -f "${OUTFILE}.tmp" ]; then
252 if diff "${OUTFILE}" "${OUTFILE}.tmp" > /dev/null 2> /dev/null ; then
253 #echo "Files are the same"
254 rm -f "${OUTFILE}.tmp"
255 else
256 mv -f "${OUTFILE}.tmp" "${OUTFILE}"
259 else
260 cmake_error 1 "Cannot find file ${INFILE}"
264 cmake_kwsys_config_replace_string ()
266 INFILE="$1"
267 OUTFILE="$2"
268 shift 2
269 APPEND="$*"
270 if [ -f "${INFILE}" ]; then
271 echo "${APPEND}" > "${OUTFILE}.tmp"
272 cat "${INFILE}" |
273 sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
274 s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
275 s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
276 s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
277 s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
278 s/@KWSYS_IOS_USE_SSTREAM@/${KWSYS_IOS_USE_SSTREAM}/g;
279 s/@KWSYS_IOS_USE_STRSTREAM_H@/${KWSYS_IOS_USE_STRSTREAM_H}/g;
280 s/@KWSYS_IOS_USE_STRSTREA_H@/${KWSYS_IOS_USE_STRSTREA_H}/g;
281 s/@KWSYS_STL_HAVE_STD@/${KWSYS_STL_HAVE_STD}/g;
282 s/@KWSYS_STL_STRING_HAVE_ISTREAM@/${KWSYS_STL_STRING_HAVE_ISTREAM}/g;
283 s/@KWSYS_STL_STRING_HAVE_OSTREAM@/${KWSYS_STL_STRING_HAVE_OSTREAM}/g;
284 s/@KWSYS_STL_STRING_HAVE_NEQ_CHAR@/${KWSYS_STL_STRING_HAVE_NEQ_CHAR}/g;
285 s/@KWSYS_STL_HAS_ITERATOR_TRAITS@/${KWSYS_STL_HAS_ITERATOR_TRAITS}/g;
286 s/@KWSYS_STL_HAS_ITERATOR_CATEGORY@/${KWSYS_STL_HAS_ITERATOR_CATEGORY}/g;
287 s/@KWSYS_STL_HAS___ITERATOR_CATEGORY@/${KWSYS_STL_HAS___ITERATOR_CATEGORY}/g;
288 s/@KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}/g;
289 s/@KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE}/g;
290 s/@KWSYS_STL_HAS_ALLOCATOR_REBIND@/${KWSYS_STL_HAS_ALLOCATOR_REBIND}/g;
291 s/@KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@/${KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT}/g;
292 s/@KWSYS_STL_HAS_ALLOCATOR_OBJECTS@/${KWSYS_STL_HAS_ALLOCATOR_OBJECTS}/g;
293 s/@KWSYS_CXX_HAS_CSTDDEF@/${KWSYS_CXX_HAS_CSTDDEF}/g;
294 s/@KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@/${KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS}/g;
295 s/@KWSYS_CXX_HAS_MEMBER_TEMPLATES@/${KWSYS_CXX_HAS_MEMBER_TEMPLATES}/g;
296 s/@KWSYS_CXX_HAS_FULL_SPECIALIZATION@/${KWSYS_CXX_HAS_FULL_SPECIALIZATION}/g;
297 s/@KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@/${KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP}/g;
298 s/@KWSYS_STAT_HAS_ST_MTIM@/${KWSYS_STAT_HAS_ST_MTIM}/g;}" >> "${OUTFILE}.tmp"
299 if [ -f "${OUTFILE}.tmp" ]; then
300 if diff "${OUTFILE}" "${OUTFILE}.tmp" > /dev/null 2> /dev/null ; then
301 #echo "Files are the same"
302 rm -f "${OUTFILE}.tmp"
303 else
304 mv -f "${OUTFILE}.tmp" "${OUTFILE}"
307 else
308 cmake_error 2 "Cannot find file ${INFILE}"
311 # Write string into a file
312 cmake_report ()
314 FILE=$1
315 shift
316 echo "$*" >> ${FILE}
319 # Escape spaces in strings
320 cmake_escape ()
322 echo $1 | sed "s/ /\\\\ /g"
325 # Write message to the log
326 cmake_log ()
328 echo "$*" >> cmake_bootstrap.log
331 # Return temp file
332 cmake_tmp_file ()
334 echo "cmake_bootstrap_$$.test"
337 # Run a compiler test. First argument is compiler, second one are compiler
338 # flags, third one is test source file to be compiled
339 cmake_try_run ()
341 COMPILER=$1
342 FLAGS=$2
343 TESTFILE=$3
344 if [ ! -f "${TESTFILE}" ]; then
345 echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
346 exit 4
348 TMPFILE=`cmake_tmp_file`
349 echo "Try: ${COMPILER}"
350 echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
351 echo "---------- file -----------------------"
352 cat "${TESTFILE}"
353 echo "------------------------------------------"
354 "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
355 RES=$?
356 if [ "${RES}" -ne "0" ]; then
357 echo "Test failed to compile"
358 return 1
360 if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
361 echo "Test failed to produce executable"
362 return 2
364 ./${TMPFILE}
365 RES=$?
366 rm -f "${TMPFILE}"
367 if [ "${RES}" -ne "0" ]; then
368 echo "Test produced non-zero return code"
369 return 3
371 echo "Test succeded"
372 return 0
375 # Run a make test. First argument is the make interpreter.
376 cmake_try_make ()
378 MAKE_PROC="$1"
379 MAKE_FLAGS="$2"
380 echo "Try: ${MAKE_PROC}"
381 "${MAKE_PROC}" ${MAKE_FLAGS}
382 RES=$?
383 if [ "${RES}" -ne "0" ]; then
384 echo "${MAKE_PROC} does not work"
385 return 1
387 if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
388 echo "${COMPILER} does not produce output"
389 return 2
391 ./test
392 RES=$?
393 rm -f "test"
394 if [ "${RES}" -ne "0" ]; then
395 echo "${MAKE_PROC} produces strange executable"
396 return 3
398 echo "${MAKE_PROC} works"
399 return 0
402 # Parse arguments
403 cmake_verbose=
404 cmake_parallel_make=
405 cmake_prefix_dir="${cmake_default_prefix}"
406 for a in "$@"; do
407 if echo $a | grep "^--prefix=" > /dev/null 2> /dev/null; then
408 cmake_prefix_dir=`echo $a | sed "s/^--prefix=//"`
409 cmake_prefix_dir=`cmake_fix_slashes "${cmake_prefix_dir}"`
411 if echo $a | grep "^--parallel=" > /dev/null 2> /dev/null; then
412 cmake_parallel_make=`echo $a | sed "s/^--parallel=//" | grep "[0-9][0-9]*"`
414 if echo $a | grep "^--datadir=" > /dev/null 2> /dev/null; then
415 cmake_data_dir=`echo $a | sed "s/^--datadir=//"`
417 if echo $a | grep "^--docdir=" > /dev/null 2> /dev/null; then
418 cmake_doc_dir=`echo $a | sed "s/^--docdir=//"`
420 if echo $a | grep "^--mandir=" > /dev/null 2> /dev/null; then
421 cmake_man_dir=`echo $a | sed "s/^--mandir=//"`
423 if echo $a | grep "^--init=" > /dev/null 2> /dev/null; then
424 cmake_init_file=`echo $a | sed "s/^--init=//"`
426 if echo $a | grep "^--help" > /dev/null 2> /dev/null; then
427 cmake_usage
429 if echo $a | grep "^--version" > /dev/null 2> /dev/null; then
430 cmake_version
431 exit 2
433 if echo $a | grep "^--verbose" > /dev/null 2> /dev/null; then
434 cmake_verbose=TRUE
436 done
438 # If verbose, display some information about bootstrap
439 if [ -n "${cmake_verbose}" ]; then
440 echo "---------------------------------------------"
441 echo "Source directory: ${cmake_source_dir}"
442 echo "Binary directory: ${cmake_binary_dir}"
443 echo "Prefix directory: ${cmake_prefix_dir}"
444 echo "System: ${cmake_system}"
445 if [ "x${cmake_parallel_make}" != "x" ]; then
446 echo "Doing parallel make: ${cmake_parallel_make}"
448 echo ""
451 echo "---------------------------------------------"
452 # Get CMake version
453 echo "`cmake_version`"
455 # Check for in-source build
456 cmake_in_source_build=
457 if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
458 -f "${cmake_binary_dir}/Source/cmake.h" ]; then
459 if [ -n "${cmake_verbose}" ]; then
460 echo "Warning: This is an in-source build"
462 cmake_in_source_build=TRUE
465 # If this is not an in-source build, then Bootstrap stuff should not exist.
466 if [ -z "${cmake_in_source_build}" ]; then
467 # Did somebody bootstrap in the source tree?
468 if [ -d "${cmake_source_dir}/Bootstrap.cmk" ]; then
469 cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap.cmk\".
470 Looks like somebody did bootstrap CMake in the source tree, but now you are
471 trying to do bootstrap in the binary tree. Please remove Bootstrap.cmk
472 directory from the source tree."
474 # Is there a cache in the source tree?
475 for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
476 if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
477 cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
478 Looks like somebody tried to build CMake in the source tree, but now you are
479 trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
480 from the source tree."
482 done
485 # Make bootstrap directory
486 [ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
487 if [ ! -d "${cmake_bootstrap_dir}" ]; then
488 cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
490 cd "${cmake_bootstrap_dir}"
492 [ -d "cmsys" ] || mkdir "cmsys"
493 if [ ! -d "cmsys" ]; then
494 cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
497 for a in stl ios; do
498 [ -d "cmsys/${a}" ] || mkdir "cmsys/${a}"
499 if [ ! -d "cmsys/${a}" ]; then
500 cmake_error 5 "Cannot create directory ${cmake_bootstrap_dir}/cmsys/${a}"
502 done
504 # Delete all the bootstrap files
505 rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
506 rm -f "${cmake_bootstrap_dir}/cmConfigure.h.tmp"
508 # If exist compiler flags, set them
509 cmake_c_flags=${CFLAGS}
510 cmake_cxx_flags=${CXXFLAGS}
512 # Test C compiler
513 cmake_c_compiler=
515 # If CC is set, use that for compiler, otherwise use list of known compilers
516 if [ -n "${CC}" ]; then
517 cmake_c_compilers="${CC}"
518 else
519 cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
522 # Check if C compiler works
523 TMPFILE=`cmake_tmp_file`
524 cat > "${TMPFILE}.c" <<EOF
525 #include<stdio.h>
526 int main()
528 printf("1\n");
529 return 0;
532 for a in ${cmake_c_compilers}; do
533 if [ -z "${cmake_c_compiler}" ] && \
534 cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
535 cmake_c_compiler="${a}"
537 done
538 rm -f "${TMPFILE}.c"
540 if [ -z "${cmake_c_compiler}" ]; then
541 cmake_error 6 "Cannot find appropriate C compiler on this system.
542 Please specify one using environment variable CC.
543 See cmake_bootstrap.log for compilers attempted.
546 echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
548 # Test CXX compiler
549 cmake_cxx_compiler=
551 # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
553 # If CC is set, use that for compiler, otherwise use list of known compilers
554 if [ -n "${CXX}" ]; then
555 cmake_cxx_compilers="${CXX}"
556 else
557 cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
560 # Check if C++ compiler works
561 TMPFILE=`cmake_tmp_file`
562 cat > "${TMPFILE}.cxx" <<EOF
563 #if defined(TEST1)
564 # include <iostream>
565 #else
566 # include <iostream.h>
567 #endif
569 class NeedCXX
571 public:
572 NeedCXX() { this->Foo = 1; }
573 int GetFoo() { return this->Foo; }
574 private:
575 int Foo;
577 int main()
579 NeedCXX c;
580 #ifdef TEST3
581 cout << c.GetFoo() << endl;
582 #else
583 std::cout << c.GetFoo() << std::endl;
584 #endif
585 return 0;
588 for a in ${cmake_cxx_compilers}; do
589 for b in 1 2 3; do
590 if [ -z "${cmake_cxx_compiler}" ] && \
591 cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
592 cmake_cxx_compiler="${a}"
594 done
595 done
596 rm -f "${TMPFILE}.cxx"
598 if [ -z "${cmake_cxx_compiler}" ]; then
599 cmake_error 7 "Cannot find appropriate C++ compiler on this system.
600 Please specify one using environment variable CXX.
601 See cmake_bootstrap.log for compilers attempted."
603 echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
605 # Test Make
607 cmake_make_processor=
608 cmake_make_flags=
610 # If MAKE is set, use that for make processor, otherwise use list of known make
611 if [ -n "${MAKE}" ]; then
612 cmake_make_processors="${MAKE}"
613 else
614 cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
617 TMPFILE="`cmake_tmp_file`_dir"
618 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
619 mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
620 cd "${cmake_bootstrap_dir}/${TMPFILE}"
621 cat>"Makefile"<<EOF
622 test: test.c
623 "${cmake_c_compiler}" -o test test.c
625 cat>"test.c"<<EOF
626 #include <stdio.h>
627 int main(){ printf("1\n"); return 0; }
629 cmake_original_make_flags="${cmake_make_flags}"
630 if [ "x${cmake_parallel_make}" != "x" ]; then
631 cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
633 for a in ${cmake_make_processors}; do
634 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log 2>&1; then
635 cmake_make_processor="${a}"
637 done
638 cmake_full_make_flags="${cmake_make_flags}"
639 if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
640 if [ -z "${cmake_make_processor}" ]; then
641 cmake_make_flags="${cmake_original_make_flags}"
642 for a in ${cmake_make_processors}; do
643 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log 2>&1; then
644 cmake_make_processor="${a}"
646 done
649 cd "${cmake_bootstrap_dir}"
650 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
652 if [ -z "${cmake_make_processor}" ]; then
653 cmake_error 8 "Cannot find appropriate Makefile processor on this system.
654 Please specify one using environment variable MAKE."
656 echo "Makefile processor on this system is: ${cmake_make_processor}"
657 if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
658 echo "---------------------------------------------"
659 echo "Makefile processor ${cmake_make_processor} does not support parallel build"
660 echo "---------------------------------------------"
663 # Ok, we have CC, CXX, and MAKE.
665 # Test C++ compiler features
667 # Are we GCC?
669 TMPFILE=`cmake_tmp_file`
670 cat > ${TMPFILE}.cxx <<EOF
671 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
672 #include <iostream>
673 int main() { std::cout << "This is GNU" << std::endl; return 0;}
674 #endif
676 cmake_cxx_compiler_is_gnu=0
677 if cmake_try_run "${cmake_cxx_compiler}" \
678 "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
679 cmake_cxx_compiler_is_gnu=1
681 if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then
682 echo "${cmake_cxx_compiler} is GNU compiler"
683 else
684 echo "${cmake_cxx_compiler} is not GNU compiler"
686 rm -f "${TMPFILE}.cxx"
688 if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
689 # Check for non-GNU compiler flags
691 # If we are on IRIX, check for -LANG:std
692 cmake_test_flags="-LANG:std"
693 if [ "x${cmake_system}" = "xIRIX64" ]; then
694 TMPFILE=`cmake_tmp_file`
695 cat > ${TMPFILE}.cxx <<EOF
696 #include <iostream>
697 int main() { std::cout << "No need for ${cmake_test_flags}" << std::endl; return 0;}
699 cmake_need_lang_std=0
700 if cmake_try_run "${cmake_cxx_compiler}" \
701 "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
703 else
704 if cmake_try_run "${cmake_cxx_compiler}" \
705 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
706 cmake_need_lang_std=1
709 if [ "x${cmake_need_lang_std}" = "x1" ]; then
710 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
711 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
712 else
713 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
715 rm -f "${TMPFILE}.cxx"
717 cmake_test_flags=
719 # If we are on OSF, check for -timplicit_local -no_implicit_include
720 cmake_test_flags="-timplicit_local -no_implicit_include"
721 if [ "x${cmake_system}" = "xOSF1" ]; then
722 TMPFILE=`cmake_tmp_file`
723 cat > ${TMPFILE}.cxx <<EOF
724 #include <iostream>
725 int main() { std::cout << "We need ${cmake_test_flags}" << std::endl; return 0;}
727 cmake_need_flags=1
728 if cmake_try_run "${cmake_cxx_compiler}" \
729 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
731 else
732 cmake_need_flags=0
734 if [ "x${cmake_need_flags}" = "x1" ]; then
735 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
736 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
737 else
738 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
740 rm -f "${TMPFILE}.cxx"
742 cmake_test_flags=
744 # If we are on OSF, check for -std strict_ansi -nopure_cname
745 cmake_test_flags="-std strict_ansi -nopure_cname"
746 if [ "x${cmake_system}" = "xOSF1" ]; then
747 TMPFILE=`cmake_tmp_file`
748 cat > ${TMPFILE}.cxx <<EOF
749 #include <iostream>
750 int main() { std::cout << "We need ${cmake_test_flags}" << std::endl; return 0;}
752 cmake_need_flags=1
753 if cmake_try_run "${cmake_cxx_compiler}" \
754 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
756 else
757 cmake_need_flags=0
759 if [ "x${cmake_need_flags}" = "x1" ]; then
760 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
761 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
762 else
763 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
765 rm -f "${TMPFILE}.cxx"
767 cmake_test_flags=
769 # If we are on HP-UX, check for -Ae for the C compiler.
770 cmake_test_flags="-Ae"
771 if [ "x${cmake_system}" = "xHP-UX" ]; then
772 TMPFILE=`cmake_tmp_file`
773 cat > ${TMPFILE}.c <<EOF
774 int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
776 cmake_need_Ae=0
777 if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
779 else
780 if cmake_try_run "${cmake_c_compiler}" \
781 "${cmake_c_flags} ${cmake_test_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
782 cmake_need_Ae=1
785 if [ "x${cmake_need_Ae}" = "x1" ]; then
786 cmake_c_flags="${cmake_c_flags} ${cmake_test_flags}"
787 echo "${cmake_c_compiler} needs ${cmake_test_flags}"
788 else
789 echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
791 rm -f "${TMPFILE}.c"
793 cmake_test_flags=
796 # Test for kwsys features
797 KWSYS_NAME_IS_KWSYS=0
798 KWSYS_BUILD_SHARED=0
799 KWSYS_IOS_USE_STRSTREAM_H=0
800 KWSYS_IOS_USE_STRSTREA_H=0
801 KWSYS_IOS_HAVE_STD=0
802 KWSYS_IOS_USE_SSTREAM=0
803 KWSYS_IOS_USE_ANSI=0
804 KWSYS_STL_HAVE_STD=0
805 KWSYS_STAT_HAS_ST_MTIM=0
806 KWSYS_STL_STRING_HAVE_NEQ_CHAR=0
807 KWSYS_STL_HAS_ITERATOR_TRAITS=0
808 KWSYS_STL_HAS_ITERATOR_CATEGORY=0
809 KWSYS_STL_HAS___ITERATOR_CATEGORY=0
810 KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=0
811 KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=0
812 KWSYS_STL_HAS_ALLOCATOR_REBIND=0
813 KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=0
814 KWSYS_STL_HAS_ALLOCATOR_OBJECTS=0
815 KWSYS_CXX_HAS_CSTDDEF=0
816 KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0
817 KWSYS_CXX_HAS_MEMBER_TEMPLATES=0
818 KWSYS_CXX_HAS_FULL_SPECIALIZATION=0
819 KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=0
821 # Hardcode these kwsys features. They work on all known UNIX compilers anyway.
822 KWSYS_STL_STRING_HAVE_ISTREAM=1
823 KWSYS_STL_STRING_HAVE_OSTREAM=1
825 if cmake_try_run "${cmake_cxx_compiler}" \
826 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
827 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
828 KWSYS_STL_HAVE_STD=1
829 echo "${cmake_cxx_compiler} has STL in std:: namespace"
830 else
831 echo "${cmake_cxx_compiler} does not have STL in std:: namespace"
834 if cmake_try_run "${cmake_cxx_compiler}" \
835 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
836 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
837 KWSYS_IOS_USE_ANSI=1
838 echo "${cmake_cxx_compiler} has ANSI streams"
839 else
840 echo "${cmake_cxx_compiler} does not have ANSI streams"
843 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
844 if cmake_try_run "${cmake_cxx_compiler}" \
845 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
846 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
847 KWSYS_IOS_HAVE_STD=1
848 echo "${cmake_cxx_compiler} has streams in std:: namespace"
849 else
850 echo "${cmake_cxx_compiler} does not have streams in std:: namespace"
852 if cmake_try_run "${cmake_cxx_compiler}" \
853 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
854 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
855 KWSYS_IOS_USE_SSTREAM=1
856 echo "${cmake_cxx_compiler} has sstream"
857 else
858 echo "${cmake_cxx_compiler} does not have sstream"
862 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
863 if cmake_try_run "${cmake_cxx_compiler}" \
864 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
865 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
866 KWSYS_IOS_USE_STRSTREAM_H=1
867 echo "${cmake_cxx_compiler} has strstream.h"
868 else
869 echo "${cmake_cxx_compiler} does not have strstream.h"
871 if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
872 if cmake_try_run "${cmake_cxx_compiler}" \
873 "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
874 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
875 KWSYS_IOS_USE_STRSTREA_H=1
876 echo "${cmake_cxx_compiler} has strstrea.h"
877 else
878 echo "${cmake_cxx_compiler} does not have strstrea.h"
883 if cmake_try_run "${cmake_cxx_compiler}" \
884 "${cmake_cxx_flags} -DTEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
885 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
886 KWSYS_STL_STRING_HAVE_NEQ_CHAR=1
887 echo "${cmake_cxx_compiler} has operator!=(string, char*)"
888 else
889 echo "${cmake_cxx_compiler} does not have operator!=(string, char*)"
892 if cmake_try_run "${cmake_cxx_compiler}" \
893 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_TRAITS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
894 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
895 KWSYS_STL_HAS_ITERATOR_TRAITS=1
896 echo "${cmake_cxx_compiler} has stl iterator_traits"
897 else
898 echo "${cmake_cxx_compiler} does not have stl iterator_traits"
901 if [ "x${KWSYS_STL_HAS_ITERATOR_TRAITS}" = "x0" ]; then
902 if cmake_try_run "${cmake_cxx_compiler}" \
903 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
904 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
905 KWSYS_STL_HAS_ITERATOR_CATEGORY=1
906 echo "${cmake_cxx_compiler} has old iterator_category"
907 else
908 echo "${cmake_cxx_compiler} does not have old iterator_category"
910 if [ "x${KWSYS_STL_HAS_ITERATOR_CATEGORY}" = "x0" ]; then
911 if cmake_try_run "${cmake_cxx_compiler}" \
912 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS___ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
913 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
914 KWSYS_STL_HAS___ITERATOR_CATEGORY=1
915 echo "${cmake_cxx_compiler} has old __iterator_category"
916 else
917 echo "${cmake_cxx_compiler} does not have old __iterator_category"
922 if cmake_try_run "${cmake_cxx_compiler}" \
923 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
924 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
925 KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=1
926 echo "${cmake_cxx_compiler} has standard template allocator"
927 else
928 echo "${cmake_cxx_compiler} does not have standard template allocator"
931 if [ "x${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}" = "x1" ]; then
932 if cmake_try_run "${cmake_cxx_compiler}" \
933 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
934 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
935 KWSYS_STL_HAS_ALLOCATOR_REBIND=1
936 echo "${cmake_cxx_compiler} has allocator<>::rebind<>"
937 else
938 echo "${cmake_cxx_compiler} does not have allocator<>::rebind<>"
941 if cmake_try_run "${cmake_cxx_compiler}" \
942 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
943 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
944 KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=1
945 echo "${cmake_cxx_compiler} has non-standard allocator<>::max_size argument"
946 else
947 echo "${cmake_cxx_compiler} does not have non-standard allocator<>::max_size argument"
949 else
950 if cmake_try_run "${cmake_cxx_compiler}" \
951 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
952 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
953 KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=1
954 echo "${cmake_cxx_compiler} has old non-template allocator"
955 else
956 echo "${cmake_cxx_compiler} does not have old non-template allocator"
960 if cmake_try_run "${cmake_cxx_compiler}" \
961 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
962 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
963 KWSYS_STL_HAS_ALLOCATOR_OBJECTS=1
964 echo "${cmake_cxx_compiler} has stl containers supporting allocator objects"
965 else
966 echo "${cmake_cxx_compiler} does not have stl containers supporting allocator objects"
969 if cmake_try_run "${cmake_cxx_compiler}" \
970 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_CSTDDEF" \
971 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
972 KWSYS_CXX_HAS_CSTDDEF=1
973 echo "${cmake_cxx_compiler} has header cstddef"
974 else
975 echo "${cmake_cxx_compiler} does not have header cstddef"
978 if cmake_try_run "${cmake_cxx_compiler}" \
979 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS" \
980 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
981 echo "${cmake_cxx_compiler} does not require template friends to use <>"
982 else
983 KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=1
984 echo "${cmake_cxx_compiler} requires template friends to use <>"
987 if cmake_try_run "${cmake_cxx_compiler}" \
988 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES" \
989 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
990 KWSYS_CXX_HAS_MEMBER_TEMPLATES=1
991 echo "${cmake_cxx_compiler} supports member templates"
992 else
993 echo "${cmake_cxx_compiler} does not support member templates"
996 if cmake_try_run "${cmake_cxx_compiler}" \
997 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION" \
998 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
999 KWSYS_CXX_HAS_FULL_SPECIALIZATION=1
1000 echo "${cmake_cxx_compiler} has standard template specialization syntax"
1001 else
1002 echo "${cmake_cxx_compiler} does not have standard template specialization syntax"
1005 if cmake_try_run "${cmake_cxx_compiler}" \
1006 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP" \
1007 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
1008 KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=1
1009 echo "${cmake_cxx_compiler} has argument dependent lookup"
1010 else
1011 echo "${cmake_cxx_compiler} does not have argument dependent lookup"
1014 if cmake_try_run "${cmake_cxx_compiler}" \
1015 "${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \
1016 "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
1017 KWSYS_STAT_HAS_ST_MTIM=1
1018 echo "${cmake_cxx_compiler} has struct stat with st_mtim member"
1019 else
1020 echo "${cmake_cxx_compiler} does not have struct stat with st_mtim member"
1023 # Just to be safe, let us store compiler and flags to the header file
1025 cmake_bootstrap_version='$Revision: 1.80 $'
1026 cmake_compiler_settings_comment="/*
1027 * Generated by ${cmake_source_dir}/bootstrap
1028 * Version: ${cmake_bootstrap_version}
1030 * Source directory: ${cmake_source_dir}
1031 * Binary directory: ${cmake_bootstrap_dir}
1033 * C compiler: ${cmake_c_compiler}
1034 * C flags: ${cmake_c_flags}
1036 * C++ compiler: ${cmake_cxx_compiler}
1037 * C++ flags: ${cmake_cxx_flags}
1039 * Make: ${cmake_make_processor}
1041 * Sources:
1042 * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
1043 * kwSys Sources:
1044 * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}
1048 cmake_report cmConfigure.h.tmp "${cmake_compiler_settings_comment}"
1050 if [ "x$KWSYS_STL_HAVE_STD" = "x1" ]; then
1051 cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_STD_NAMESPACE */"
1052 else
1053 cmake_report cmConfigure.h.tmp "#define CMAKE_NO_STD_NAMESPACE 1"
1056 if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
1057 cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */"
1058 else
1059 cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_STREAM_HEADERS 1"
1062 if [ "x$KWSYS_IOS_USE_SSTREAM" = "x1" ]; then
1063 cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_STRING_STREAM */"
1064 else
1065 cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_STRING_STREAM 1"
1068 # Test for ansi FOR scope
1069 if cmake_try_run "${cmake_cxx_compiler}" \
1070 "${cmake_cxx_flags}" \
1071 "${cmake_source_dir}/Modules/TestForAnsiForScope.cxx" >> cmake_bootstrap.log 2>&1; then
1072 cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_FOR_SCOPE */"
1073 echo "${cmake_cxx_compiler} has ANSI for scoping"
1074 else
1075 cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_FOR_SCOPE 1"
1076 echo "${cmake_cxx_compiler} does not have ANSI for scoping"
1079 # When bootstrapping on MinGW with MSYS we must convert the source
1080 # directory to a windows path.
1081 if ${cmake_system_mingw}; then
1082 cmake_root_dir=`cd "${cmake_source_dir}"; pwd -W`
1083 else
1084 cmake_root_dir="${cmake_source_dir}"
1087 # Write CMake version
1088 for a in MAJOR MINOR PATCH; do
1089 CMake_VERSION=`cat "${cmake_source_dir}/CMakeLists.txt" | \
1090 grep "SET(CMake_VERSION_${a} *[0-9]*)" | sed "s/SET(CMake_VERSION_${a} *\([0-9]*\))/\1/"`
1091 cmake_report cmConfigure.h.tmp "#define CMake_VERSION_${a} ${CMake_VERSION}"
1092 done
1093 cmake_report cmConfigure.h.tmp "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\""
1094 cmake_report cmConfigure.h.tmp "#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
1095 cmake_report cmConfigure.h.tmp "#define CMAKE_BOOTSTRAP"
1097 # Regenerate real cmConfigure.h
1098 if diff cmConfigure.h cmConfigure.h.tmp > /dev/null 2> /dev/null; then
1099 rm -f cmConfigure.h.tmp
1100 else
1101 mv -f cmConfigure.h.tmp cmConfigure.h
1104 # Prepare KWSYS
1105 cmake_kwsys_config_replace_string \
1106 "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
1107 "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
1108 "${cmake_compiler_settings_comment}"
1109 cmake_kwsys_config_replace_string \
1110 "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
1111 "${cmake_bootstrap_dir}/cmsys/Configure.h" \
1112 "${cmake_compiler_settings_comment}"
1114 for a in ${KWSYS_FILES}; do
1115 cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
1116 "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
1117 done
1119 for a in ${KWSYS_IOS_FILES}; do
1120 cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_ios_${a}.h.in" \
1121 "${cmake_bootstrap_dir}/cmsys/ios/${a}" KWSYS_NAMESPACE cmsys
1122 done
1124 cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_stl.hxx.in" \
1125 "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx.in" KWSYS_STL_HEADER_EXTRA ""
1127 cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx.in" \
1128 "${cmake_bootstrap_dir}/cmsys/stl/stl.h.in" KWSYS_NAMESPACE cmsys
1130 for a in string vector map; do
1131 cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.h.in" \
1132 "${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
1133 done
1135 # Generate Makefile
1136 dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
1137 objs=""
1138 for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_GENERATED_SOURCES}; do
1139 objs="${objs} ${a}.o"
1140 done
1142 # Generate dependencies for cmBootstrapCommands.cxx
1143 for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
1144 cmBootstrapCommandsDeps="${cmBootstrapCommandsDeps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
1145 done
1146 cmBootstrapCommandsDeps=`echo $cmBootstrapCommandsDeps`
1148 if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
1149 cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
1152 if [ "x${cmake_c_flags}" != "x" ]; then
1153 cmake_c_flags="${cmake_c_flags} "
1156 if [ "x${cmake_cxx_flags}" != "x" ]; then
1157 cmake_cxx_flags="${cmake_cxx_flags} "
1160 cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
1161 -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
1162 cmake_cxx_flags="${cmake_cxx_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
1163 -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
1164 echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
1165 echo " ${cmake_cxx_compiler} ${LDFLAGS} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
1166 for a in ${CMAKE_CXX_SOURCES}; do
1167 src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
1168 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1169 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1170 done
1171 echo "cmBootstrapCommands.o : $cmBootstrapCommandsDeps" >> "${cmake_bootstrap_dir}/Makefile"
1172 for a in ${CMAKE_C_SOURCES}; do
1173 src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
1174 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1175 echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1176 done
1177 for a in ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}; do
1178 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
1179 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1180 echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1181 done
1182 for a in ${KWSYS_CXX_SOURCES}; do
1183 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
1184 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1185 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1186 done
1187 if ${cmake_system_mingw}; then
1188 src=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9xEnc.c"`
1189 in=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9x.exe"`
1190 cmd=`cmake_escape "${cmake_bootstrap_dir}/cmsysEncodeExecutable.exe"`
1191 a="cmsysProcessFwd9xEnc"
1192 echo "${cmd} : EncodeExecutable.o" >> "${cmake_bootstrap_dir}/Makefile"
1193 echo " ${cmake_c_compiler} ${LDFLAGS} ${cmake_c_flags} EncodeExecutable.o -o ${cmd}" >> "${cmake_bootstrap_dir}/Makefile"
1194 echo "${in} : ProcessFwd9x.o" >> "${cmake_bootstrap_dir}/Makefile"
1195 echo " ${cmake_c_compiler} ${LDFLAGS} ${cmake_c_flags} ProcessFwd9x.o -o ${in}" >> "${cmake_bootstrap_dir}/Makefile"
1196 echo "${src} : ${cmd} ${in}" >> "${cmake_bootstrap_dir}/Makefile"
1197 echo " ${cmd} ${in} ${src} cmsys ProcessFwd9x" >> "${cmake_bootstrap_dir}/Makefile"
1198 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1199 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"
1201 cat>>"${cmake_bootstrap_dir}/Makefile"<<EOF
1202 rebuild_cache:
1203 cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
1206 # Write our default settings to Bootstrap.cmk/InitialCacheFlags.cmake.
1207 cat > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" <<EOF
1208 # Generated by ${cmake_source_dir}/bootstrap
1209 # Default cmake settings. These may be overridden any settings below.
1210 SET (CMAKE_INSTALL_PREFIX "${cmake_prefix_dir}" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
1211 SET (CMAKE_DOC_DIR "${cmake_doc_dir}" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
1212 SET (CMAKE_MAN_DIR "${cmake_man_dir}" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
1213 SET (CMAKE_DATA_DIR "${cmake_data_dir}" CACHE PATH "Install location for data (relative to prefix)." FORCE)
1216 # Add user-specified settings. Handle relative-path case for
1217 # specification of cmake_init_file.
1219 cd "${cmake_binary_dir}"
1220 if [ -f "${cmake_init_file}" ]; then
1221 cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1225 echo "---------------------------------------------"
1227 # Run make to build bootstrap cmake
1228 if [ "x${cmake_parallel_make}" != "x" ]; then
1229 ${cmake_make_processor} ${cmake_make_flags}
1230 else
1231 ${cmake_make_processor}
1233 RES=$?
1234 if [ "${RES}" -ne "0" ]; then
1235 cmake_error 9 "Problem while running ${cmake_make_processor}"
1237 cd "${cmake_binary_dir}"
1239 # Set C, CXX, and MAKE environment variables, so that real real cmake will be
1240 # build with same compiler and make
1241 CC="${cmake_c_compiler}"
1242 CXX="${cmake_cxx_compiler}"
1243 MAKE="${cmake_make_processor}"
1244 export CC
1245 export CXX
1246 export MAKE
1248 # Run bootstrap CMake to configure real CMake
1249 "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}"
1250 RES=$?
1251 if [ "${RES}" -ne "0" ]; then
1252 cmake_error 11 "Problem while running initial CMake"
1255 echo "---------------------------------------------"
1257 # And we are done. Now just run make
1258 echo "CMake has bootstrapped. Now run ${cmake_make_processor}."