bootstrap 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  1. #!/bin/sh
  2. #=========================================================================
  3. #
  4. # Program: CMake - Cross-Platform Makefile Generator
  5. # Module: $RCSfile$
  6. # Language: Bourne Shell
  7. # Date: $Date$
  8. # Version: $Revision$
  9. #
  10. # Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  11. # See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  12. #
  13. # This software is distributed WITHOUT ANY WARRANTY; without even
  14. # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. # PURPOSE. See the above copyright notices for more information.
  16. #
  17. #=========================================================================
  18. CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
  19. CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
  20. CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
  21. CMAKE_PROBLEMATIC_FILES="\
  22. CMakeCache.txt \
  23. CMakeSystem.cmake \
  24. CMakeCCompiler.cmake \
  25. CMakeCXXCompiler.cmake \
  26. Source/cmConfigure.h \
  27. Source/CTest/Curl/config.h \
  28. Utilities/cmexpat/expatConfig.h \
  29. Utilities/cmexpat/expatDllConfig.h \
  30. "
  31. CMAKE_CXX_SOURCES="\
  32. cmake \
  33. cmakewizard \
  34. cmakemain \
  35. cmDepends \
  36. cmDependsC \
  37. cmMakeDepend \
  38. cmMakefile \
  39. cmGeneratedFileStream \
  40. cmGlobalGenerator \
  41. cmLocalGenerator \
  42. cmSourceFile \
  43. cmSystemTools \
  44. cmGlobalUnixMakefileGenerator \
  45. cmGlobalXCodeGenerator \
  46. cmLocalXCodeGenerator \
  47. cmXCodeObject \
  48. cmLocalUnixMakefileGenerator2 \
  49. cmBootstrapCommands \
  50. cmCommands \
  51. cmTarget \
  52. cmCustomCommand \
  53. cmCacheManager \
  54. cmListFileCache \
  55. cmOrderLinkDirectories \
  56. cmSourceGroup"
  57. CMAKE_C_SOURCES="\
  58. cmListFileLexer \
  59. "
  60. KWSYS_C_SOURCES="\
  61. ProcessUNIX"
  62. KWSYS_CXX_SOURCES="\
  63. Directory \
  64. RegularExpression \
  65. SystemTools"
  66. KWSYS_FILES="\
  67. Directory.hxx \
  68. Process.h \
  69. RegularExpression.hxx \
  70. SystemTools.hxx"
  71. KWSYS_IOS_FILES="
  72. fstream \
  73. iosfwd \
  74. iostream \
  75. sstream"
  76. cmake_system=`uname`
  77. cmake_source_dir=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
  78. cmake_source_dir=`(cd "${cmake_source_dir}";pwd)`
  79. cmake_binary_dir=`pwd`
  80. cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap.cmk"
  81. cmake_data_dir="/share/CMake"
  82. cmake_doc_dir="/doc/CMake"
  83. cmake_man_dir="/man"
  84. cmake_init_file=""
  85. # Display CMake bootstrap usage
  86. cmake_usage()
  87. {
  88. cat <<EOF
  89. Usage: $0 [options]
  90. Options: [defaults in brackets after descriptions]
  91. Configuration:
  92. --help print this message
  93. --version only print version information
  94. --verbose display more information
  95. --parallel=n bootstrap cmake in parallel, where n is
  96. number of nodes [1]
  97. --init=FILE use FILE for cmake initialization
  98. Directory and file names:
  99. --prefix=PREFIX install files in tree rooted at PREFIX
  100. [/usr/local]
  101. --datadir=DIR install data files in PREFIX/DIR
  102. [/share/CMake]
  103. --docdir=DIR install documentation files in PREFIX/DIR
  104. [/doc/CMake]
  105. --mandir=DIR install man pages files in PREFIX/DIR/manN
  106. [/man]
  107. EOF
  108. exit 10
  109. }
  110. # Display CMake bootstrap usage
  111. cmake_version()
  112. {
  113. # Get CMake version
  114. CMAKE_VERSION=""
  115. for a in MAJOR MINOR PATCH; do
  116. CMake_VERSION=`cat "${cmake_source_dir}/CMakeLists.txt" | \
  117. grep "SET(CMake_VERSION_${a} *[0-9]*)" | sed "s/SET(CMake_VERSION_${a} *\([0-9]*\))/\1/"`
  118. CMAKE_VERSION="${CMAKE_VERSION}.${CMake_VERSION}"
  119. done
  120. if echo "$CMAKE_VERSION" | grep "\.[0-9][0-9]*\.[0-9]*[13579]\.[0-9]" > /dev/null 2>&1; then
  121. 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]* .\";"`
  122. CMake_DATE=`echo "${CMake_DATE}" | sed "s/.*Date: \([0-9][0-9]*\)\/\([0-9][0-9]*\)\/\([0-9][0-9]*\) .*/\1\2\3/" `
  123. CMAKE_VERSION=`echo $CMAKE_VERSION | sed "s/\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1.\2-${CMake_DATE}/"`
  124. else
  125. CMAKE_VERSION=`echo $CMAKE_VERSION | sed "s/\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1.\2-\3/"`
  126. fi
  127. echo "CMake ${CMAKE_VERSION}, Copyright (c) 2002 Kitware, Inc., Insight Consortium"
  128. }
  129. # Display CMake bootstrap error, display the log file and exit
  130. cmake_error()
  131. {
  132. res=$1
  133. shift 1
  134. echo "---------------------------------------------"
  135. echo "Error when bootstrapping CMake:"
  136. echo "$*"
  137. echo "---------------------------------------------"
  138. if [ -f cmake_bootstrap.log ]; then
  139. echo "Log of errors: `pwd`/cmake_bootstrap.log"
  140. #cat cmake_bootstrap.log
  141. echo "---------------------------------------------"
  142. fi
  143. exit ${res}
  144. }
  145. # Replace KWSYS_NAMESPACE with cmsys
  146. cmake_replace_string ()
  147. {
  148. INFILE="$1"
  149. OUTFILE="$2"
  150. SEARCHFOR="$3"
  151. REPLACEWITH="$4"
  152. if [ -f "${INFILE}" ]; then
  153. cat "${INFILE}" |
  154. sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" > "${OUTFILE}.tmp"
  155. if [ -f "${OUTFILE}.tmp" ]; then
  156. if diff "${OUTFILE}" "${OUTFILE}.tmp" > /dev/null 2> /dev/null ; then
  157. #echo "Files are the same"
  158. rm -f "${OUTFILE}.tmp"
  159. else
  160. mv -f "${OUTFILE}.tmp" "${OUTFILE}"
  161. fi
  162. fi
  163. else
  164. cmake_error 1 "Cannot find file ${INFILE}"
  165. fi
  166. }
  167. cmake_kwsys_config_replace_string ()
  168. {
  169. INFILE="$1"
  170. OUTFILE="$2"
  171. shift 2
  172. APPEND="$*"
  173. if [ -f "${INFILE}" ]; then
  174. echo "${APPEND}" > "${OUTFILE}.tmp"
  175. cat "${INFILE}" |
  176. sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
  177. s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
  178. s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
  179. s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
  180. s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
  181. s/@KWSYS_IOS_USE_SSTREAM@/${KWSYS_IOS_USE_SSTREAM}/g;
  182. s/@KWSYS_IOS_USE_STRSTREAM_H@/${KWSYS_IOS_USE_STRSTREAM_H}/g;
  183. s/@KWSYS_IOS_USE_STRSTREA_H@/${KWSYS_IOS_USE_STRSTREA_H}/g;
  184. s/@KWSYS_STL_HAVE_STD@/${KWSYS_STL_HAVE_STD}/g;
  185. s/@KWSYS_STL_STRING_HAVE_ISTREAM@/${KWSYS_STL_STRING_HAVE_ISTREAM}/g;
  186. s/@KWSYS_STL_STRING_HAVE_OSTREAM@/${KWSYS_STL_STRING_HAVE_OSTREAM}/g;
  187. s/@KWSYS_STL_STRING_HAVE_NEQ_CHAR@/${KWSYS_STL_STRING_HAVE_NEQ_CHAR}/g;
  188. s/@KWSYS_STL_HAS_ALLOCATOR_REBIND@/${KWSYS_STL_HAS_ALLOCATOR_REBIND}/g;
  189. s/@KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@/${KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS}/g;
  190. s/@KWSYS_CXX_HAS_MEMBER_TEMPLATES@/${KWSYS_CXX_HAS_MEMBER_TEMPLATES}/g;
  191. s/@KWSYS_CXX_HAS_FULL_SPECIALIZATION@/${KWSYS_CXX_HAS_FULL_SPECIALIZATION}/g;
  192. s/@KWSYS_STAT_HAS_ST_MTIM@/${KWSYS_STAT_HAS_ST_MTIM}/g;}" >> "${OUTFILE}.tmp"
  193. if [ -f "${OUTFILE}.tmp" ]; then
  194. if diff "${OUTFILE}" "${OUTFILE}.tmp" > /dev/null 2> /dev/null ; then
  195. #echo "Files are the same"
  196. rm -f "${OUTFILE}.tmp"
  197. else
  198. mv -f "${OUTFILE}.tmp" "${OUTFILE}"
  199. fi
  200. fi
  201. else
  202. cmake_error 2 "Cannot find file ${INFILE}"
  203. fi
  204. }
  205. # Write string into a file
  206. cmake_report ()
  207. {
  208. FILE=$1
  209. shift
  210. echo "$*" >> ${FILE}
  211. }
  212. # Escape spaces in strings
  213. cmake_escape ()
  214. {
  215. echo $1 | sed "s/ /\\\\ /g"
  216. }
  217. # Write message to the log
  218. cmake_log ()
  219. {
  220. echo "$*" >> cmake_bootstrap.log
  221. }
  222. # Return temp file
  223. cmake_tmp_file ()
  224. {
  225. echo "cmake_bootstrap_$$.test"
  226. }
  227. # Run a compiler test. First argument is compiler, second one are compiler
  228. # flags, third one is test source file to be compiled
  229. cmake_try_run ()
  230. {
  231. COMPILER=$1
  232. FLAGS=$2
  233. TESTFILE=$3
  234. if [ ! -f "${TESTFILE}" ]; then
  235. echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
  236. exit 4
  237. fi
  238. TMPFILE=`cmake_tmp_file`
  239. echo "Try: ${COMPILER}"
  240. echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
  241. echo "---------- file -----------------------"
  242. cat "${TESTFILE}"
  243. echo "------------------------------------------"
  244. "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
  245. RES=$?
  246. if [ "${RES}" -ne "0" ]; then
  247. echo "Test failed to compile"
  248. return 1
  249. fi
  250. if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
  251. echo "Test failed to produce executable"
  252. return 2
  253. fi
  254. ./${TMPFILE}
  255. RES=$?
  256. rm -f "${TMPFILE}"
  257. if [ "${RES}" -ne "0" ]; then
  258. echo "Test produced non-zero return code"
  259. return 3
  260. fi
  261. echo "Test succeded"
  262. return 0
  263. }
  264. # Run a make test. First argument is the make interpreter.
  265. cmake_try_make ()
  266. {
  267. MAKE_PROC="$1"
  268. MAKE_FLAGS="$2"
  269. echo "Try: ${MAKE_PROC}"
  270. "${MAKE_PROC}" ${MAKE_FLAGS}
  271. RES=$?
  272. if [ "${RES}" -ne "0" ]; then
  273. echo "${MAKE_PROC} does not work"
  274. return 1
  275. fi
  276. if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
  277. echo "${COMPILER} does not produce output"
  278. return 2
  279. fi
  280. ./test
  281. RES=$?
  282. rm -f "test"
  283. if [ "${RES}" -ne "0" ]; then
  284. echo "${MAKE_PROC} produces strange executable"
  285. return 3
  286. fi
  287. echo "${MAKE_PROC} works"
  288. return 0
  289. }
  290. # Parse arguments
  291. cmake_verbose=
  292. cmake_parallel_make=
  293. cmake_prefix_dir="/usr/local"
  294. for a in "$@"; do
  295. if echo $a | grep "^--prefix=" > /dev/null 2> /dev/null; then
  296. cmake_prefix_dir=`echo $a | sed "s/^--prefix=//"`
  297. fi
  298. if echo $a | grep "^--parallel=" > /dev/null 2> /dev/null; then
  299. cmake_parallel_make=`echo $a | sed "s/^--parallel=//" | grep "[0-9][0-9]*"`
  300. fi
  301. if echo $a | grep "^--datadir=" > /dev/null 2> /dev/null; then
  302. cmake_data_dir=`echo $a | sed "s/^--datadir=//"`
  303. fi
  304. if echo $a | grep "^--docdir=" > /dev/null 2> /dev/null; then
  305. cmake_doc_dir=`echo $a | sed "s/^--docdir=//"`
  306. fi
  307. if echo $a | grep "^--mandir=" > /dev/null 2> /dev/null; then
  308. cmake_man_dir=`echo $a | sed "s/^--mandir=//"`
  309. fi
  310. if echo $a | grep "^--init=" > /dev/null 2> /dev/null; then
  311. cmake_init_file=`echo $a | sed "s/^--init=//"`
  312. fi
  313. if echo $a | grep "^--help" > /dev/null 2> /dev/null; then
  314. cmake_usage
  315. fi
  316. if echo $a | grep "^--version" > /dev/null 2> /dev/null; then
  317. cmake_version
  318. exit 2
  319. fi
  320. if echo $a | grep "^--verbose" > /dev/null 2> /dev/null; then
  321. cmake_verbose=TRUE
  322. fi
  323. done
  324. # If verbose, display some information about bootstrap
  325. if [ -n "${cmake_verbose}" ]; then
  326. echo "---------------------------------------------"
  327. echo "Source directory: ${cmake_source_dir}"
  328. echo "Binary directory: ${cmake_binary_dir}"
  329. echo "Prefix directory: ${cmake_prefix_dir}"
  330. echo "System: ${cmake_system}"
  331. if [ "x${cmake_parallel_make}" != "x" ]; then
  332. echo "Doing parallel make: ${cmake_parallel_make}"
  333. fi
  334. echo ""
  335. fi
  336. echo "---------------------------------------------"
  337. # Get CMake version
  338. echo "`cmake_version`"
  339. # Check for in-source build
  340. cmake_in_source_build=
  341. if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
  342. -f "${cmake_binary_dir}/Source/cmake.h" ]; then
  343. if [ -n "${cmake_verbose}" ]; then
  344. echo "Warning: This is an in-source build"
  345. fi
  346. cmake_in_source_build=TRUE
  347. fi
  348. # If this is not an in-source build, then Bootstrap stuff should not exist.
  349. if [ -z "${cmake_in_source_build}" ]; then
  350. # Did somebody bootstrap in the source tree?
  351. if [ -d "${cmake_source_dir}/Bootstrap.cmk" ]; then
  352. cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap.cmk\".
  353. Looks like somebody did bootstrap CMake in the source tree, but now you are
  354. trying to do bootstrap in the binary tree. Please remove Bootstrap.cmk
  355. directory from the source tree."
  356. fi
  357. # Is there a cache in the source tree?
  358. for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
  359. if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
  360. cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
  361. Looks like somebody tried to build CMake in the source tree, but now you are
  362. trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
  363. from the source tree."
  364. fi
  365. done
  366. fi
  367. # Make bootstrap directory
  368. [ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
  369. if [ ! -d "${cmake_bootstrap_dir}" ]; then
  370. cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
  371. fi
  372. cd "${cmake_bootstrap_dir}"
  373. [ -d "cmsys" ] || mkdir "cmsys"
  374. if [ ! -d "cmsys" ]; then
  375. cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
  376. fi
  377. for a in stl ios; do
  378. [ -d "cmsys/${a}" ] || mkdir "cmsys/${a}"
  379. if [ ! -d "cmsys/${a}" ]; then
  380. cmake_error 5 "Cannot create directory ${cmake_bootstrap_dir}/cmsys/${a}"
  381. fi
  382. done
  383. # Delete all the bootstrap files
  384. rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
  385. rm -f "${cmake_bootstrap_dir}/cmConfigure.h.tmp"
  386. # If exist compiler flags, set them
  387. cmake_c_flags=${CFLAGS}
  388. cmake_cxx_flags=${CXXFLAGS}
  389. # Test C compiler
  390. cmake_c_compiler=
  391. # If CC is set, use that for compiler, otherwise use list of known compilers
  392. if [ -n "${CC}" ]; then
  393. cmake_c_compilers="${CC}"
  394. else
  395. cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
  396. fi
  397. # Check if C compiler works
  398. TMPFILE=`cmake_tmp_file`
  399. cat > "${TMPFILE}.c" <<EOF
  400. #include<stdio.h>
  401. int main()
  402. {
  403. printf("1\n");
  404. return 0;
  405. }
  406. EOF
  407. for a in ${cmake_c_compilers}; do
  408. if [ -z "${cmake_c_compiler}" ] && \
  409. cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  410. cmake_c_compiler="${a}"
  411. fi
  412. done
  413. rm -f "${TMPFILE}.c"
  414. if [ -z "${cmake_c_compiler}" ]; then
  415. cmake_error 6 "Cannot find appropriate C compiler on this system.
  416. Please specify one using environment variable CC.
  417. See cmake_bootstrap.log for compilers attempted.
  418. "
  419. fi
  420. echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
  421. # Test CXX compiler
  422. cmake_cxx_compiler=
  423. # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
  424. # If CC is set, use that for compiler, otherwise use list of known compilers
  425. if [ -n "${CXX}" ]; then
  426. cmake_cxx_compilers="${CXX}"
  427. else
  428. cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
  429. fi
  430. # Check if C++ compiler works
  431. TMPFILE=`cmake_tmp_file`
  432. cat > "${TMPFILE}.cxx" <<EOF
  433. #if defined(TEST1)
  434. # include <iostream>
  435. #else
  436. # include <iostream.h>
  437. #endif
  438. class NeedCXX
  439. {
  440. public:
  441. NeedCXX() { this->Foo = 1; }
  442. int GetFoo() { return this->Foo; }
  443. private:
  444. int Foo;
  445. };
  446. int main()
  447. {
  448. NeedCXX c;
  449. #ifdef TEST3
  450. cout << c.GetFoo() << endl;
  451. #else
  452. std::cout << c.GetFoo() << std::endl;
  453. #endif
  454. return 0;
  455. }
  456. EOF
  457. for a in ${cmake_cxx_compilers}; do
  458. for b in 1 2 3; do
  459. if [ -z "${cmake_cxx_compiler}" ] && \
  460. cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  461. cmake_cxx_compiler="${a}"
  462. fi
  463. done
  464. done
  465. rm -f "${TMPFILE}.cxx"
  466. if [ -z "${cmake_cxx_compiler}" ]; then
  467. cmake_error 7 "Cannot find appropriate C++ compiler on this system.
  468. Please specify one using environment variable CXX.
  469. See cmake_bootstrap.log for compilers attempted."
  470. fi
  471. echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
  472. # Test Make
  473. cmake_make_processor=
  474. cmake_make_flags=
  475. # If MAKE is set, use that for make processor, otherwise use list of known make
  476. if [ -n "${MAKE}" ]; then
  477. cmake_make_processors="${MAKE}"
  478. else
  479. cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
  480. fi
  481. TMPFILE="`cmake_tmp_file`_dir"
  482. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  483. mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
  484. cd "${cmake_bootstrap_dir}/${TMPFILE}"
  485. cat>"Makefile"<<EOF
  486. test: test.c
  487. "${cmake_c_compiler}" -o test test.c
  488. EOF
  489. cat>"test.c"<<EOF
  490. #include <stdio.h>
  491. int main(){ printf("1\n"); return 0; }
  492. EOF
  493. cmake_original_make_flags="${cmake_make_flags}"
  494. if [ "x${cmake_parallel_make}" != "x" ]; then
  495. cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
  496. fi
  497. for a in ${cmake_make_processors}; do
  498. if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log 2>&1; then
  499. cmake_make_processor="${a}"
  500. fi
  501. done
  502. cmake_full_make_flags="${cmake_make_flags}"
  503. if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
  504. if [ -z "${cmake_make_processor}" ]; then
  505. cmake_make_flags="${cmake_original_make_flags}"
  506. for a in ${cmake_make_processors}; do
  507. if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log 2>&1; then
  508. cmake_make_processor="${a}"
  509. fi
  510. done
  511. fi
  512. fi
  513. cd "${cmake_bootstrap_dir}"
  514. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  515. if [ -z "${cmake_make_processor}" ]; then
  516. cmake_error 8 "Cannot find appropriate Makefile processor on this system.
  517. Please specify one using environment variable MAKE."
  518. fi
  519. echo "Makefile processor on this system is: ${cmake_make_processor}"
  520. if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
  521. echo "---------------------------------------------"
  522. echo "Makefile processor ${cmake_make_processor} does not support parallel build"
  523. echo "---------------------------------------------"
  524. fi
  525. # Ok, we have CC, CXX, and MAKE.
  526. # Test C++ compiler features
  527. # Are we GCC?
  528. TMPFILE=`cmake_tmp_file`
  529. cat > ${TMPFILE}.cxx <<EOF
  530. #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
  531. #include <iostream>
  532. int main() { std::cout << "This is GNU" << std::endl; return 0;}
  533. #endif
  534. EOF
  535. cmake_cxx_compiler_is_gnu=0
  536. if cmake_try_run "${cmake_cxx_compiler}" \
  537. "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  538. cmake_cxx_compiler_is_gnu=1
  539. fi
  540. if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then
  541. echo "${cmake_cxx_compiler} is GNU compiler"
  542. else
  543. echo "${cmake_cxx_compiler} is not GNU compiler"
  544. fi
  545. rm -f "${TMPFILE}.cxx"
  546. if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
  547. # Check for non-GNU compiler flags
  548. # If we are on IRIX, check for -LANG:std
  549. cmake_test_flags="-LANG:std"
  550. if [ "x${cmake_system}" = "xIRIX64" ]; then
  551. TMPFILE=`cmake_tmp_file`
  552. cat > ${TMPFILE}.cxx <<EOF
  553. #include <iostream>
  554. int main() { std::cout << "No need for ${cmake_test_flags}" << std::endl; return 0;}
  555. EOF
  556. cmake_need_lang_std=0
  557. if cmake_try_run "${cmake_cxx_compiler}" \
  558. "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  559. :
  560. else
  561. if cmake_try_run "${cmake_cxx_compiler}" \
  562. "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  563. cmake_need_lang_std=1
  564. fi
  565. fi
  566. if [ "x${cmake_need_lang_std}" = "x1" ]; then
  567. cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
  568. echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
  569. else
  570. echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
  571. fi
  572. rm -f "${TMPFILE}.cxx"
  573. fi
  574. cmake_test_flags=
  575. # If we are on OSF, check for -timplicit_local -no_implicit_include
  576. cmake_test_flags="-timplicit_local -no_implicit_include"
  577. if [ "x${cmake_system}" = "xOSF1" ]; then
  578. TMPFILE=`cmake_tmp_file`
  579. cat > ${TMPFILE}.cxx <<EOF
  580. #include <iostream>
  581. int main() { std::cout << "We need ${cmake_test_flags}" << std::endl; return 0;}
  582. EOF
  583. cmake_need_flags=1
  584. if cmake_try_run "${cmake_cxx_compiler}" \
  585. "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  586. :
  587. else
  588. cmake_need_flags=0
  589. fi
  590. if [ "x${cmake_need_flags}" = "x1" ]; then
  591. cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
  592. echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
  593. else
  594. echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
  595. fi
  596. rm -f "${TMPFILE}.cxx"
  597. fi
  598. cmake_test_flags=
  599. # If we are on OSF, check for -std strict_ansi -nopure_cname
  600. cmake_test_flags="-std strict_ansi -nopure_cname"
  601. if [ "x${cmake_system}" = "xOSF1" ]; then
  602. TMPFILE=`cmake_tmp_file`
  603. cat > ${TMPFILE}.cxx <<EOF
  604. #include <iostream>
  605. int main() { std::cout << "We need ${cmake_test_flags}" << std::endl; return 0;}
  606. EOF
  607. cmake_need_flags=1
  608. if cmake_try_run "${cmake_cxx_compiler}" \
  609. "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  610. :
  611. else
  612. cmake_need_flags=0
  613. fi
  614. if [ "x${cmake_need_flags}" = "x1" ]; then
  615. cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
  616. echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
  617. else
  618. echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
  619. fi
  620. rm -f "${TMPFILE}.cxx"
  621. fi
  622. cmake_test_flags=
  623. # If we are on HP-UX, check for -Ae for the C compiler.
  624. cmake_test_flags="-Ae"
  625. if [ "x${cmake_system}" = "xHP-UX" ]; then
  626. TMPFILE=`cmake_tmp_file`
  627. cat > ${TMPFILE}.c <<EOF
  628. int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
  629. EOF
  630. cmake_need_Ae=0
  631. if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  632. :
  633. else
  634. if cmake_try_run "${cmake_c_compiler}" \
  635. "${cmake_c_flags} ${cmake_test_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  636. cmake_need_Ae=1
  637. fi
  638. fi
  639. if [ "x${cmake_need_Ae}" = "x1" ]; then
  640. cmake_c_flags="${cmake_c_flags} ${cmake_test_flags}"
  641. echo "${cmake_c_compiler} needs ${cmake_test_flags}"
  642. else
  643. echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
  644. fi
  645. rm -f "${TMPFILE}.c"
  646. fi
  647. cmake_test_flags=
  648. fi
  649. # Test for kwsys features
  650. KWSYS_NAME_IS_KWSYS=0
  651. KWSYS_BUILD_SHARED=0
  652. KWSYS_IOS_USE_STRSTREAM_H=0
  653. KWSYS_IOS_USE_STRSTREA_H=0
  654. KWSYS_IOS_HAVE_STD=0
  655. KWSYS_IOS_USE_SSTREAM=0
  656. KWSYS_IOS_USE_ANSI=0
  657. KWSYS_STL_HAVE_STD=0
  658. KWSYS_STAT_HAS_ST_MTIM=0
  659. KWSYS_STL_STRING_HAVE_NEQ_CHAR=0
  660. KWSYS_STL_HAS_ALLOCATOR_REBIND=0
  661. KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0
  662. KWSYS_CXX_HAS_MEMBER_TEMPLATES=0
  663. KWSYS_CXX_HAS_FULL_SPECIALIZATION=0
  664. # Hardcode these kwsys features. They work on all known UNIX compilers anyway.
  665. KWSYS_STL_STRING_HAVE_ISTREAM=1
  666. KWSYS_STL_STRING_HAVE_OSTREAM=1
  667. if cmake_try_run "${cmake_cxx_compiler}" \
  668. "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
  669. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  670. KWSYS_STL_HAVE_STD=1
  671. echo "${cmake_cxx_compiler} has STL in std:: namespace"
  672. else
  673. echo "${cmake_cxx_compiler} does not have STL in std:: namespace"
  674. fi
  675. if cmake_try_run "${cmake_cxx_compiler}" \
  676. "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
  677. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  678. KWSYS_IOS_USE_ANSI=1
  679. echo "${cmake_cxx_compiler} has ANSI streams"
  680. else
  681. echo "${cmake_cxx_compiler} does not have ANSI streams"
  682. fi
  683. if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
  684. if cmake_try_run "${cmake_cxx_compiler}" \
  685. "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
  686. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  687. KWSYS_IOS_HAVE_STD=1
  688. echo "${cmake_cxx_compiler} has streams in std:: namespace"
  689. else
  690. echo "${cmake_cxx_compiler} does not have streams in std:: namespace"
  691. fi
  692. if cmake_try_run "${cmake_cxx_compiler}" \
  693. "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
  694. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  695. KWSYS_IOS_USE_SSTREAM=1
  696. echo "${cmake_cxx_compiler} has sstream"
  697. else
  698. echo "${cmake_cxx_compiler} does not have sstream"
  699. fi
  700. fi
  701. if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
  702. if cmake_try_run "${cmake_cxx_compiler}" \
  703. "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
  704. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  705. KWSYS_IOS_USE_STRSTREAM_H=1
  706. echo "${cmake_cxx_compiler} has strstream.h"
  707. else
  708. echo "${cmake_cxx_compiler} does not have strstream.h"
  709. fi
  710. if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
  711. if cmake_try_run "${cmake_cxx_compiler}" \
  712. "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
  713. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  714. KWSYS_IOS_USE_STRSTREA_H=1
  715. echo "${cmake_cxx_compiler} has strstrea.h"
  716. else
  717. echo "${cmake_cxx_compiler} does not have strstrea.h"
  718. fi
  719. fi
  720. fi
  721. if cmake_try_run "${cmake_cxx_compiler}" \
  722. "${cmake_cxx_flags} -DTEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
  723. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  724. KWSYS_STL_STRING_HAVE_NEQ_CHAR=1
  725. echo "${cmake_cxx_compiler} has operator!=(string, char*)"
  726. else
  727. echo "${cmake_cxx_compiler} does not have operator!=(string, char*)"
  728. fi
  729. if cmake_try_run "${cmake_cxx_compiler}" \
  730. "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
  731. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  732. KWSYS_STL_HAS_ALLOCATOR_REBIND=1
  733. echo "${cmake_cxx_compiler} has allocator<>::rebind<>"
  734. else
  735. echo "${cmake_cxx_compiler} does not have allocator<>::rebind<>"
  736. fi
  737. if cmake_try_run "${cmake_cxx_compiler}" \
  738. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS" \
  739. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  740. echo "${cmake_cxx_compiler} does not require template friends to use <>"
  741. else
  742. KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=1
  743. echo "${cmake_cxx_compiler} requires template friends to use <>"
  744. fi
  745. if cmake_try_run "${cmake_cxx_compiler}" \
  746. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES" \
  747. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  748. KWSYS_CXX_HAS_MEMBER_TEMPLATES=1
  749. echo "${cmake_cxx_compiler} supports member templates"
  750. else
  751. echo "${cmake_cxx_compiler} does not support member templates"
  752. fi
  753. if cmake_try_run "${cmake_cxx_compiler}" \
  754. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION" \
  755. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  756. KWSYS_CXX_HAS_FULL_SPECIALIZATION=1
  757. echo "${cmake_cxx_compiler} has standard template specialization syntax"
  758. else
  759. echo "${cmake_cxx_compiler} does not have standard template specialization syntax"
  760. fi
  761. if cmake_try_run "${cmake_cxx_compiler}" \
  762. "${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \
  763. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  764. KWSYS_STAT_HAS_ST_MTIM=1
  765. echo "${cmake_cxx_compiler} has struct stat with st_mtim member"
  766. else
  767. echo "${cmake_cxx_compiler} does not have struct stat with st_mtim member"
  768. fi
  769. # Just to be safe, let us store compiler and flags to the header file
  770. cmake_bootstrap_version='$Revision$'
  771. cmake_compiler_settings_comment="/*
  772. * Generated by ${cmake_source_dir}/bootstrap
  773. * Version: ${cmake_bootstrap_version}
  774. *
  775. * Source directory: ${cmake_source_dir}
  776. * Binary directory: ${cmake_bootstrap_dir}
  777. *
  778. * C compiler: ${cmake_c_compiler}
  779. * C flags: ${cmake_c_flags}
  780. *
  781. * C++ compiler: ${cmake_cxx_compiler}
  782. * C++ flags: ${cmake_cxx_flags}
  783. *
  784. * Make: ${cmake_make_processor}
  785. *
  786. * Sources:
  787. * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
  788. * kwSys Sources:
  789. * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
  790. */
  791. "
  792. cmake_report cmConfigure.h.tmp "${cmake_compiler_settings_comment}"
  793. if [ "x$KWSYS_STL_HAVE_STD" = "x1" ]; then
  794. cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_STD_NAMESPACE */"
  795. else
  796. cmake_report cmConfigure.h.tmp "#define CMAKE_NO_STD_NAMESPACE 1"
  797. fi
  798. if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
  799. cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */"
  800. else
  801. cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_STREAM_HEADERS 1"
  802. fi
  803. if [ "x$KWSYS_IOS_USE_SSTREAM" = "x1" ]; then
  804. cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_STRING_STREAM */"
  805. else
  806. cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_STRING_STREAM 1"
  807. fi
  808. # Test for ansi FOR scope
  809. if cmake_try_run "${cmake_cxx_compiler}" \
  810. "${cmake_cxx_flags}" \
  811. "${cmake_source_dir}/Modules/TestForAnsiForScope.cxx" >> cmake_bootstrap.log 2>&1; then
  812. cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_FOR_SCOPE */"
  813. echo "${cmake_cxx_compiler} has ANSI for scoping"
  814. else
  815. cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_FOR_SCOPE 1"
  816. echo "${cmake_cxx_compiler} does not have ANSI for scoping"
  817. fi
  818. # Write CMake version
  819. for a in MAJOR MINOR PATCH; do
  820. CMake_VERSION=`cat "${cmake_source_dir}/CMakeLists.txt" | \
  821. grep "SET(CMake_VERSION_${a} *[0-9]*)" | sed "s/SET(CMake_VERSION_${a} *\([0-9]*\))/\1/"`
  822. cmake_report cmConfigure.h.tmp "#define CMake_VERSION_${a} ${CMake_VERSION}"
  823. done
  824. cmake_report cmConfigure.h.tmp "#define CMAKE_ROOT_DIR \"${cmake_source_dir}\""
  825. cmake_report cmConfigure.h.tmp "#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
  826. cmake_report cmConfigure.h.tmp "#define CMAKE_BOOTSTRAP"
  827. # Regenerate real cmConfigure.h
  828. if diff cmConfigure.h cmConfigure.h.tmp > /dev/null 2> /dev/null; then
  829. rm -f cmConfigure.h.tmp
  830. else
  831. mv -f cmConfigure.h.tmp cmConfigure.h
  832. fi
  833. # Prepare KWSYS
  834. cmake_kwsys_config_replace_string \
  835. "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
  836. "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
  837. "${cmake_compiler_settings_comment}"
  838. cmake_kwsys_config_replace_string \
  839. "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
  840. "${cmake_bootstrap_dir}/cmsys/Configure.h" \
  841. "${cmake_compiler_settings_comment}"
  842. for a in ${KWSYS_FILES}; do
  843. cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
  844. "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
  845. done
  846. for a in ${KWSYS_IOS_FILES}; do
  847. cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_ios_${a}.h.in" \
  848. "${cmake_bootstrap_dir}/cmsys/ios/${a}" KWSYS_NAMESPACE cmsys
  849. done
  850. cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_stl.hxx.in" \
  851. "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx.in" KWSYS_STL_HEADER_EXTRA ""
  852. cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx.in" \
  853. "${cmake_bootstrap_dir}/cmsys/stl/stl.h.in" KWSYS_NAMESPACE cmsys
  854. for a in string vector map; do
  855. cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.h.in" \
  856. "${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
  857. done
  858. # Generate Makefile
  859. dep="cmConfigure.h cmsys/Configure.hxx cmsys/Configure.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
  860. objs=""
  861. for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
  862. objs="${objs} ${a}.o"
  863. done
  864. # Generate dependencies for cmBootstrapCommands.cxx
  865. for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
  866. cmBootstrapCommandsDeps="${cmBootstrapCommandsDeps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
  867. done
  868. cmBootstrapCommandsDeps=`echo $cmBootstrapCommandsDeps`
  869. if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
  870. cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
  871. fi
  872. if [ "x${cmake_c_flags}" != "x" ]; then
  873. cmake_c_flags="${cmake_c_flags} "
  874. fi
  875. if [ "x${cmake_cxx_flags}" != "x" ]; then
  876. cmake_cxx_flags="${cmake_cxx_flags} "
  877. fi
  878. cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
  879. -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
  880. cmake_cxx_flags="${cmake_cxx_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
  881. -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
  882. echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
  883. echo " ${cmake_cxx_compiler} ${LDFLAGS} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
  884. for a in ${CMAKE_CXX_SOURCES}; do
  885. src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
  886. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  887. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  888. done
  889. echo "cmBootstrapCommands.o : $cmBootstrapCommandsDeps" >> "${cmake_bootstrap_dir}/Makefile"
  890. for a in ${CMAKE_C_SOURCES}; do
  891. src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
  892. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  893. echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  894. done
  895. for a in ${KWSYS_C_SOURCES}; do
  896. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
  897. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  898. echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  899. done
  900. for a in ${KWSYS_CXX_SOURCES}; do
  901. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
  902. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  903. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  904. done
  905. cat>>"${cmake_bootstrap_dir}/Makefile"<<EOF
  906. rebuild_cache:
  907. cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
  908. EOF
  909. # Write our default settings to Bootstrap.cmk/InitialCacheFlags.cmake.
  910. cat > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" <<EOF
  911. # Generated by ${cmake_source_dir}/bootstrap
  912. # Default cmake settings. These may be overridden any settings below.
  913. SET (CMAKE_INSTALL_PREFIX "${cmake_prefix_dir}" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
  914. SET (CMAKE_DOC_DIR "${cmake_doc_dir}" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
  915. SET (CMAKE_MAN_DIR "${cmake_man_dir}" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
  916. SET (CMAKE_DATA_DIR "${cmake_data_dir}" CACHE PATH "Install location for data (relative to prefix)." FORCE)
  917. EOF
  918. # Add user-specified settings. Handle relative-path case for
  919. # specification of cmake_init_file.
  920. (
  921. cd "${cmake_binary_dir}"
  922. if [ -f "${cmake_init_file}" ]; then
  923. cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  924. fi
  925. )
  926. echo "---------------------------------------------"
  927. # Run make to build bootstrap cmake
  928. if [ "x${cmake_parallel_make}" != "x" ]; then
  929. ${cmake_make_processor} ${cmake_make_flags}
  930. else
  931. ${cmake_make_processor}
  932. fi
  933. RES=$?
  934. if [ "${RES}" -ne "0" ]; then
  935. cmake_error 9 "Problem while running ${cmake_make_processor}"
  936. fi
  937. cd "${cmake_binary_dir}"
  938. # Set C, CXX, and MAKE environment variables, so that real real cmake will be
  939. # build with same compiler and make
  940. CC="${cmake_c_compiler}"
  941. CXX="${cmake_cxx_compiler}"
  942. MAKE="${cmake_make_processor}"
  943. export CC
  944. export CXX
  945. export MAKE
  946. # Run bootstrap CMake to configure real CMake
  947. "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  948. RES=$?
  949. if [ "${RES}" -ne "0" ]; then
  950. cmake_error 11 "Problem while running initial CMake"
  951. fi
  952. echo "---------------------------------------------"
  953. # And we are done. Now just run make
  954. echo "CMake has bootstrapped. Now run ${cmake_make_processor}."