bootstrap 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008
  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_STAT_HAS_ST_MTIM@/${KWSYS_STAT_HAS_ST_MTIM}/g;}" >> "${OUTFILE}.tmp"
  189. if [ -f "${OUTFILE}.tmp" ]; then
  190. if diff "${OUTFILE}" "${OUTFILE}.tmp" > /dev/null 2> /dev/null ; then
  191. #echo "Files are the same"
  192. rm -f "${OUTFILE}.tmp"
  193. else
  194. mv -f "${OUTFILE}.tmp" "${OUTFILE}"
  195. fi
  196. fi
  197. else
  198. cmake_error 2 "Cannot find file ${INFILE}"
  199. fi
  200. }
  201. # Write string into a file
  202. cmake_report ()
  203. {
  204. FILE=$1
  205. shift
  206. echo "$*" >> ${FILE}
  207. }
  208. # Escape spaces in strings
  209. cmake_escape ()
  210. {
  211. echo $1 | sed "s/ /\\\\ /g"
  212. }
  213. # Write message to the log
  214. cmake_log ()
  215. {
  216. echo "$*" >> cmake_bootstrap.log
  217. }
  218. # Return temp file
  219. cmake_tmp_file ()
  220. {
  221. echo "cmake_bootstrap_$$.test"
  222. }
  223. # Run a compiler test. First argument is compiler, second one are compiler
  224. # flags, third one is test source file to be compiled
  225. cmake_try_run ()
  226. {
  227. COMPILER=$1
  228. FLAGS=$2
  229. TESTFILE=$3
  230. if [ ! -f "${TESTFILE}" ]; then
  231. echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
  232. exit 4
  233. fi
  234. TMPFILE=`cmake_tmp_file`
  235. echo "Try: ${COMPILER}"
  236. echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
  237. echo "---------- file -----------------------"
  238. cat ${TESTFILE}
  239. echo "------------------------------------------"
  240. "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
  241. RES=$?
  242. if [ "${RES}" -ne "0" ]; then
  243. echo "Test failed to compile"
  244. return 1
  245. fi
  246. if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
  247. echo "Test failed to produce executable"
  248. return 2
  249. fi
  250. ./${TMPFILE}
  251. RES=$?
  252. rm -f "${TMPFILE}"
  253. if [ "${RES}" -ne "0" ]; then
  254. echo "Test produced non-zero return code"
  255. return 3
  256. fi
  257. echo "Test succeded"
  258. return 0
  259. }
  260. # Run a make test. First argument is the make interpreter.
  261. cmake_try_make ()
  262. {
  263. MAKE_PROC="$1"
  264. MAKE_FLAGS="$2"
  265. echo "Try: ${MAKE_PROC}"
  266. "${MAKE_PROC}" ${MAKE_FLAGS}
  267. RES=$?
  268. if [ "${RES}" -ne "0" ]; then
  269. echo "${MAKE_PROC} does not work"
  270. return 1
  271. fi
  272. if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
  273. echo "${COMPILER} does not produce output"
  274. return 2
  275. fi
  276. ./test
  277. RES=$?
  278. rm -f "test"
  279. if [ "${RES}" -ne "0" ]; then
  280. echo "${MAKE_PROC} produces strange executable"
  281. return 3
  282. fi
  283. echo "${MAKE_PROC} works"
  284. return 0
  285. }
  286. # Parse arguments
  287. cmake_verbose=
  288. cmake_parallel_make=
  289. cmake_prefix_dir="/usr/local"
  290. for a in "$@"; do
  291. if echo $a | grep "^--prefix=" > /dev/null 2> /dev/null; then
  292. cmake_prefix_dir=`echo $a | sed "s/^--prefix=//"`
  293. fi
  294. if echo $a | grep "^--parallel=" > /dev/null 2> /dev/null; then
  295. cmake_parallel_make=`echo $a | sed "s/^--parallel=//" | grep "[0-9][0-9]*"`
  296. fi
  297. if echo $a | grep "^--datadir=" > /dev/null 2> /dev/null; then
  298. cmake_data_dir=`echo $a | sed "s/^--datadir=//"`
  299. fi
  300. if echo $a | grep "^--docdir=" > /dev/null 2> /dev/null; then
  301. cmake_doc_dir=`echo $a | sed "s/^--docdir=//"`
  302. fi
  303. if echo $a | grep "^--mandir=" > /dev/null 2> /dev/null; then
  304. cmake_man_dir=`echo $a | sed "s/^--mandir=//"`
  305. fi
  306. if echo $a | grep "^--init=" > /dev/null 2> /dev/null; then
  307. cmake_init_file=`echo $a | sed "s/^--init=//"`
  308. fi
  309. if echo $a | grep "^--help" > /dev/null 2> /dev/null; then
  310. cmake_usage
  311. fi
  312. if echo $a | grep "^--version" > /dev/null 2> /dev/null; then
  313. cmake_version
  314. exit 2
  315. fi
  316. if echo $a | grep "^--verbose" > /dev/null 2> /dev/null; then
  317. cmake_verbose=TRUE
  318. fi
  319. done
  320. # If verbose, display some information about bootstrap
  321. if [ -n "${cmake_verbose}" ]; then
  322. echo "---------------------------------------------"
  323. echo "Source directory: ${cmake_source_dir}"
  324. echo "Binary directory: ${cmake_binary_dir}"
  325. echo "Prefix directory: ${cmake_prefix_dir}"
  326. echo "System: ${cmake_system}"
  327. if [ "x${cmake_parallel_make}" != "x" ]; then
  328. echo "Doing parallel make: ${cmake_parallel_make}"
  329. fi
  330. echo ""
  331. fi
  332. echo "---------------------------------------------"
  333. # Get CMake version
  334. echo "`cmake_version`"
  335. # Check for in-source build
  336. cmake_in_source_build=
  337. if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
  338. -f "${cmake_binary_dir}/Source/cmake.h" ]; then
  339. if [ -n "${cmake_verbose}" ]; then
  340. echo "Warning: This is an in-source build"
  341. fi
  342. cmake_in_source_build=TRUE
  343. fi
  344. # If this is not an in-source build, then Bootstrap stuff should not exist.
  345. if [ -z "${cmake_in_source_build}" ]; then
  346. # Did somebody bootstrap in the source tree?
  347. if [ -d "${cmake_source_dir}/Bootstrap.cmk" ]; then
  348. cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap.cmk\".
  349. Looks like somebody did bootstrap CMake in the source tree, but now you are
  350. trying to do bootstrap in the binary tree. Please remove Bootstrap.cmk
  351. directory from the source tree."
  352. fi
  353. # Is there a cache in the source tree?
  354. for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
  355. if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
  356. cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
  357. Looks like somebody tried to build CMake in the source tree, but now you are
  358. trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
  359. from the source tree."
  360. fi
  361. done
  362. fi
  363. # Make bootstrap directory
  364. [ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
  365. if [ ! -d "${cmake_bootstrap_dir}" ]; then
  366. cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
  367. fi
  368. cd "${cmake_bootstrap_dir}"
  369. [ -d "cmsys" ] || mkdir "cmsys"
  370. if [ ! -d "cmsys" ]; then
  371. cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
  372. fi
  373. for a in stl ios; do
  374. [ -d "cmsys/${a}" ] || mkdir "cmsys/${a}"
  375. if [ ! -d "cmsys/${a}" ]; then
  376. cmake_error 5 "Cannot create directory ${cmake_bootstrap_dir}/cmsys/${a}"
  377. fi
  378. done
  379. # Delete all the bootstrap files
  380. rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
  381. rm -f "${cmake_bootstrap_dir}/cmConfigure.h.tmp"
  382. # If exist compiler flags, set them
  383. cmake_c_flags=${CFLAGS}
  384. cmake_cxx_flags=${CXXFLAGS}
  385. # Test C compiler
  386. cmake_c_compiler=
  387. # If CC is set, use that for compiler, otherwise use list of known compilers
  388. if [ -n "${CC}" ]; then
  389. cmake_c_compilers="${CC}"
  390. else
  391. cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
  392. fi
  393. # Check if C compiler works
  394. TMPFILE=`cmake_tmp_file`
  395. cat > "${TMPFILE}.c" <<EOF
  396. #include<stdio.h>
  397. int main()
  398. {
  399. printf("1\n");
  400. return 0;
  401. }
  402. EOF
  403. for a in ${cmake_c_compilers}; do
  404. if [ -z "${cmake_c_compiler}" ] && \
  405. cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  406. cmake_c_compiler="${a}"
  407. fi
  408. done
  409. rm -f "${TMPFILE}.c"
  410. if [ -z "${cmake_c_compiler}" ]; then
  411. cmake_error 6 "Cannot find appropriate C compiler on this system.
  412. Please specify one using environment variable CC.
  413. See cmake_bootstrap.log for compilers attempted.
  414. "
  415. fi
  416. echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
  417. # Test CXX compiler
  418. cmake_cxx_compiler=
  419. # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
  420. # If CC is set, use that for compiler, otherwise use list of known compilers
  421. if [ -n "${CXX}" ]; then
  422. cmake_cxx_compilers="${CXX}"
  423. else
  424. cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
  425. fi
  426. # Check if C++ compiler works
  427. TMPFILE=`cmake_tmp_file`
  428. cat > "${TMPFILE}.cxx" <<EOF
  429. #if defined(TEST1)
  430. # include <iostream>
  431. #else
  432. # include <iostream.h>
  433. #endif
  434. class NeedCXX
  435. {
  436. public:
  437. NeedCXX() { this->Foo = 1; }
  438. int GetFoo() { return this->Foo; }
  439. private:
  440. int Foo;
  441. };
  442. int main()
  443. {
  444. NeedCXX c;
  445. #ifdef TEST3
  446. cout << c.GetFoo() << endl;
  447. #else
  448. std::cout << c.GetFoo() << std::endl;
  449. #endif
  450. return 0;
  451. }
  452. EOF
  453. for a in ${cmake_cxx_compilers}; do
  454. for b in 1 2 3; do
  455. if [ -z "${cmake_cxx_compiler}" ] && \
  456. cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  457. cmake_cxx_compiler="${a}"
  458. fi
  459. done
  460. done
  461. rm -f "${TMPFILE}.cxx"
  462. if [ -z "${cmake_cxx_compiler}" ]; then
  463. cmake_error 7 "Cannot find appropriate C++ compiler on this system.
  464. Please specify one using environment variable CXX.
  465. See cmake_bootstrap.log for compilers attempted."
  466. fi
  467. echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
  468. # Test Make
  469. cmake_make_processor=
  470. cmake_make_flags=
  471. # If MAKE is set, use that for make processor, otherwise use list of known make
  472. if [ -n "${MAKE}" ]; then
  473. cmake_make_processors="${MAKE}"
  474. else
  475. cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
  476. fi
  477. TMPFILE="`cmake_tmp_file`_dir"
  478. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  479. mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
  480. cd "${cmake_bootstrap_dir}/${TMPFILE}"
  481. cat>"Makefile"<<EOF
  482. test: test.c
  483. "${cmake_c_compiler}" -o test test.c
  484. EOF
  485. cat>"test.c"<<EOF
  486. #include <stdio.h>
  487. int main(){ printf("1\n"); return 0; }
  488. EOF
  489. cmake_original_make_flags="${cmake_make_flags}"
  490. if [ "x${cmake_parallel_make}" != "x" ]; then
  491. cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
  492. fi
  493. for a in ${cmake_make_processors}; do
  494. if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log 2>&1; then
  495. cmake_make_processor="${a}"
  496. fi
  497. done
  498. cmake_full_make_flags="${cmake_make_flags}"
  499. if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
  500. if [ -z "${cmake_make_processor}" ]; then
  501. cmake_make_flags="${cmake_original_make_flags}"
  502. for a in ${cmake_make_processors}; do
  503. if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log 2>&1; then
  504. cmake_make_processor="${a}"
  505. fi
  506. done
  507. fi
  508. fi
  509. cd "${cmake_bootstrap_dir}"
  510. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  511. if [ -z "${cmake_make_processor}" ]; then
  512. cmake_error 8 "Cannot find appropriate Makefile processor on this system.
  513. Please specify one using environment variable MAKE."
  514. fi
  515. echo "Makefile processor on this system is: ${cmake_make_processor}"
  516. if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
  517. echo "---------------------------------------------"
  518. echo "Makefile processor ${cmake_make_processor} does not support parallel build"
  519. echo "---------------------------------------------"
  520. fi
  521. # Ok, we have CC, CXX, and MAKE.
  522. # Test C++ compiler features
  523. # Are we GCC?
  524. TMPFILE=`cmake_tmp_file`
  525. cat > ${TMPFILE}.cxx <<EOF
  526. #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
  527. #include <iostream>
  528. int main() { std::cout << "This is GNU" << std::endl; return 0;}
  529. #endif
  530. EOF
  531. cmake_cxx_compiler_is_gnu=0
  532. if cmake_try_run "${cmake_cxx_compiler}" \
  533. "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  534. cmake_cxx_compiler_is_gnu=1
  535. fi
  536. if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then
  537. echo "${cmake_cxx_compiler} is GNU compiler"
  538. else
  539. echo "${cmake_cxx_compiler} is not GNU compiler"
  540. fi
  541. rm -f "${TMPFILE}.cxx"
  542. if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
  543. # Check for non-GNU compiler flags
  544. # If we are on IRIX, check for -LANG:std
  545. cmake_test_flags="-LANG:std"
  546. if [ "x${cmake_system}" = "xIRIX64" ]; then
  547. TMPFILE=`cmake_tmp_file`
  548. cat > ${TMPFILE}.cxx <<EOF
  549. #include <iostream>
  550. int main() { std::cout << "No need for ${cmake_test_flags}" << std::endl; return 0;}
  551. EOF
  552. cmake_need_lang_std=0
  553. if cmake_try_run "${cmake_cxx_compiler}" \
  554. "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  555. :
  556. else
  557. if cmake_try_run "${cmake_cxx_compiler}" \
  558. "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  559. cmake_need_lang_std=1
  560. fi
  561. fi
  562. if [ "x${cmake_need_lang_std}" = "x1" ]; then
  563. cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
  564. echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
  565. else
  566. echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
  567. fi
  568. rm -f "${TMPFILE}.cxx"
  569. fi
  570. cmake_test_flags=
  571. # If we are on OSF, check for -timplicit_local -no_implicit_include
  572. cmake_test_flags="-timplicit_local -no_implicit_include"
  573. if [ "x${cmake_system}" = "xOSF1" ]; then
  574. TMPFILE=`cmake_tmp_file`
  575. cat > ${TMPFILE}.cxx <<EOF
  576. #include <iostream>
  577. int main() { std::cout << "We need ${cmake_test_flags}" << std::endl; return 0;}
  578. EOF
  579. cmake_need_flags=1
  580. if cmake_try_run "${cmake_cxx_compiler}" \
  581. "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  582. :
  583. else
  584. cmake_need_flags=0
  585. fi
  586. if [ "x${cmake_need_flags}" = "x1" ]; then
  587. cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
  588. echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
  589. else
  590. echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
  591. fi
  592. rm -f "${TMPFILE}.cxx"
  593. fi
  594. cmake_test_flags=
  595. # If we are on OSF, check for -std strict_ansi -nopure_cname
  596. cmake_test_flags="-std strict_ansi -nopure_cname"
  597. if [ "x${cmake_system}" = "xOSF1" ]; then
  598. TMPFILE=`cmake_tmp_file`
  599. cat > ${TMPFILE}.cxx <<EOF
  600. #include <iostream>
  601. int main() { std::cout << "We need ${cmake_test_flags}" << std::endl; return 0;}
  602. EOF
  603. cmake_need_flags=1
  604. if cmake_try_run "${cmake_cxx_compiler}" \
  605. "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  606. :
  607. else
  608. cmake_need_flags=0
  609. fi
  610. if [ "x${cmake_need_flags}" = "x1" ]; then
  611. cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
  612. echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
  613. else
  614. echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
  615. fi
  616. rm -f "${TMPFILE}.cxx"
  617. fi
  618. cmake_test_flags=
  619. # If we are on HP-UX, check for -Ae for the C compiler.
  620. cmake_test_flags="-Ae"
  621. if [ "x${cmake_system}" = "xHP-UX" ]; then
  622. TMPFILE=`cmake_tmp_file`
  623. cat > ${TMPFILE}.c <<EOF
  624. int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
  625. EOF
  626. cmake_need_Ae=0
  627. if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  628. :
  629. else
  630. if cmake_try_run "${cmake_c_compiler}" \
  631. "${cmake_c_flags} ${cmake_test_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  632. cmake_need_Ae=1
  633. fi
  634. fi
  635. if [ "x${cmake_need_Ae}" = "x1" ]; then
  636. cmake_c_flags="${cmake_c_flags} ${cmake_test_flags}"
  637. echo "${cmake_c_compiler} needs ${cmake_test_flags}"
  638. else
  639. echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
  640. fi
  641. rm -f "${TMPFILE}.c"
  642. fi
  643. cmake_test_flags=
  644. fi
  645. # Test for kwsys features
  646. KWSYS_NAME_IS_KWSYS=0
  647. KWSYS_BUILD_SHARED=0
  648. KWSYS_IOS_USE_STRSTREAM_H=0
  649. KWSYS_IOS_USE_STRSTREA_H=0
  650. KWSYS_IOS_HAVE_STD=0
  651. KWSYS_IOS_USE_SSTREAM=0
  652. KWSYS_IOS_USE_ANSI=0
  653. KWSYS_STL_HAVE_STD=0
  654. KWSYS_STAT_HAS_ST_MTIM=0
  655. KWSYS_STL_STRING_HAVE_NEQ_CHAR=0
  656. # Hardcode these kwsys features. They work on all known UNIX compilers anyway.
  657. KWSYS_STL_STRING_HAVE_ISTREAM=1
  658. KWSYS_STL_STRING_HAVE_OSTREAM=1
  659. if cmake_try_run "${cmake_cxx_compiler}" \
  660. "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
  661. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  662. KWSYS_STL_HAVE_STD=1
  663. echo "${cmake_cxx_compiler} has STL in std:: namespace"
  664. else
  665. echo "${cmake_cxx_compiler} does not have STL in std:: namespace"
  666. fi
  667. if cmake_try_run "${cmake_cxx_compiler}" \
  668. "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
  669. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  670. KWSYS_IOS_USE_ANSI=1
  671. echo "${cmake_cxx_compiler} has ANSI streams"
  672. else
  673. echo "${cmake_cxx_compiler} does not have ANSI streams"
  674. fi
  675. if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
  676. if cmake_try_run "${cmake_cxx_compiler}" \
  677. "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
  678. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  679. KWSYS_IOS_HAVE_STD=1
  680. echo "${cmake_cxx_compiler} has streams in std:: namespace"
  681. else
  682. echo "${cmake_cxx_compiler} does not have streams in std:: namespace"
  683. fi
  684. if cmake_try_run "${cmake_cxx_compiler}" \
  685. "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
  686. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  687. KWSYS_IOS_USE_SSTREAM=1
  688. echo "${cmake_cxx_compiler} has sstream"
  689. else
  690. echo "${cmake_cxx_compiler} does not have sstream"
  691. fi
  692. fi
  693. if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
  694. if cmake_try_run "${cmake_cxx_compiler}" \
  695. "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
  696. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  697. KWSYS_IOS_USE_STRSTREAM_H=1
  698. echo "${cmake_cxx_compiler} has strstream.h"
  699. else
  700. echo "${cmake_cxx_compiler} does not have strstream.h"
  701. fi
  702. if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
  703. if cmake_try_run "${cmake_cxx_compiler}" \
  704. "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
  705. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  706. KWSYS_IOS_USE_STRSTREA_H=1
  707. echo "${cmake_cxx_compiler} has strstrea.h"
  708. else
  709. echo "${cmake_cxx_compiler} does not have strstrea.h"
  710. fi
  711. fi
  712. fi
  713. if cmake_try_run "${cmake_cxx_compiler}" \
  714. "${cmake_cxx_flags} -DTEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
  715. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  716. KWSYS_STL_STRING_HAVE_NEQ_CHAR=1
  717. echo "${cmake_cxx_compiler} has operator!=(string, char*)"
  718. else
  719. echo "${cmake_cxx_compiler} does not have operator!=(string, char*)"
  720. fi
  721. if cmake_try_run "${cmake_cxx_compiler}" \
  722. "${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \
  723. "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
  724. KWSYS_STAT_HAS_ST_MTIM=1
  725. echo "${cmake_cxx_compiler} has struct stat with st_mtim member"
  726. else
  727. echo "${cmake_cxx_compiler} does not have struct stat with st_mtim member"
  728. fi
  729. # Just to be safe, let us store compiler and flags to the header file
  730. cmake_bootstrap_version='$Revision$'
  731. cmake_compiler_settings_comment="/*
  732. * Generated by ${cmake_source_dir}/bootstrap
  733. * Version: ${cmake_bootstrap_version}
  734. *
  735. * Source directory: ${cmake_source_dir}
  736. * Binary directory: ${cmake_bootstrap_dir}
  737. *
  738. * C compiler: ${cmake_c_compiler}
  739. * C flags: ${cmake_c_flags}
  740. *
  741. * C++ compiler: ${cmake_cxx_compiler}
  742. * C++ flags: ${cmake_cxx_flags}
  743. *
  744. * Make: ${cmake_make_processor}
  745. *
  746. * Sources:
  747. * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
  748. * kwSys Sources:
  749. * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
  750. */
  751. "
  752. cmake_report cmConfigure.h.tmp "${cmake_compiler_settings_comment}"
  753. if [ "x$KWSYS_STL_HAVE_STD" = "x1" ]; then
  754. cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_STD_NAMESPACE */"
  755. else
  756. cmake_report cmConfigure.h.tmp "#define CMAKE_NO_STD_NAMESPACE 1"
  757. fi
  758. if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
  759. cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */"
  760. else
  761. cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_STREAM_HEADERS 1"
  762. fi
  763. if [ "x$KWSYS_IOS_USE_SSTREAM" = "x1" ]; then
  764. cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_STRING_STREAM */"
  765. else
  766. cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_STRING_STREAM 1"
  767. fi
  768. # Test for ansi FOR scope
  769. if cmake_try_run "${cmake_cxx_compiler}" \
  770. "${cmake_cxx_flags}" \
  771. "${cmake_source_dir}/Modules/TestForAnsiForScope.cxx" >> cmake_bootstrap.log 2>&1; then
  772. cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_FOR_SCOPE */"
  773. echo "${cmake_cxx_compiler} has ANSI for scoping"
  774. else
  775. cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_FOR_SCOPE 1"
  776. echo "${cmake_cxx_compiler} does not have ANSI for scoping"
  777. fi
  778. # Write CMake version
  779. for a in MAJOR MINOR PATCH; do
  780. CMake_VERSION=`cat "${cmake_source_dir}/CMakeLists.txt" | \
  781. grep "SET(CMake_VERSION_${a} *[0-9]*)" | sed "s/SET(CMake_VERSION_${a} *\([0-9]*\))/\1/"`
  782. cmake_report cmConfigure.h.tmp "#define CMake_VERSION_${a} ${CMake_VERSION}"
  783. done
  784. cmake_report cmConfigure.h.tmp "#define CMAKE_ROOT_DIR \"${cmake_source_dir}\""
  785. cmake_report cmConfigure.h.tmp "#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
  786. cmake_report cmConfigure.h.tmp "#define CMAKE_BOOTSTRAP"
  787. # Regenerate real cmConfigure.h
  788. if diff cmConfigure.h cmConfigure.h.tmp > /dev/null 2> /dev/null; then
  789. rm -f cmConfigure.h.tmp
  790. else
  791. mv -f cmConfigure.h.tmp cmConfigure.h
  792. fi
  793. # Prepare KWSYS
  794. cmake_kwsys_config_replace_string \
  795. "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
  796. "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
  797. "${cmake_compiler_settings_comment}"
  798. cmake_kwsys_config_replace_string \
  799. "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
  800. "${cmake_bootstrap_dir}/cmsys/Configure.h" \
  801. "${cmake_compiler_settings_comment}"
  802. for a in ${KWSYS_FILES}; do
  803. cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
  804. "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
  805. done
  806. for a in ${KWSYS_IOS_FILES}; do
  807. cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_ios_${a}.h.in" \
  808. "${cmake_bootstrap_dir}/cmsys/ios/${a}" KWSYS_NAMESPACE cmsys
  809. done
  810. cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_stl.hxx.in" \
  811. "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx.in" KWSYS_STL_HEADER_EXTRA ""
  812. cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx.in" \
  813. "${cmake_bootstrap_dir}/cmsys/stl/stl.h.in" KWSYS_NAMESPACE cmsys
  814. for a in string vector map; do
  815. cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.h.in" \
  816. "${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
  817. done
  818. # Generate Makefile
  819. dep="cmConfigure.h cmsys/Configure.hxx cmsys/Configure.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
  820. objs=""
  821. for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
  822. objs="${objs} ${a}.o"
  823. done
  824. # Generate dependencies for cmBootstrapCommands.cxx
  825. for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
  826. cmBootstrapCommandsDeps="${cmBootstrapCommandsDeps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
  827. done
  828. cmBootstrapCommandsDeps=`echo $cmBootstrapCommandsDeps`
  829. if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
  830. cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
  831. fi
  832. if [ "x${cmake_c_flags}" != "x" ]; then
  833. cmake_c_flags="${cmake_c_flags} "
  834. fi
  835. if [ "x${cmake_cxx_flags}" != "x" ]; then
  836. cmake_cxx_flags="${cmake_cxx_flags} "
  837. fi
  838. cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
  839. -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
  840. cmake_cxx_flags="${cmake_cxx_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
  841. -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
  842. echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
  843. echo " ${cmake_cxx_compiler} ${LDFLAGS} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
  844. for a in ${CMAKE_CXX_SOURCES}; do
  845. src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
  846. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  847. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  848. done
  849. echo "cmBootstrapCommands.o : $cmBootstrapCommandsDeps" >> "${cmake_bootstrap_dir}/Makefile"
  850. for a in ${CMAKE_C_SOURCES}; do
  851. src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
  852. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  853. echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  854. done
  855. for a in ${KWSYS_C_SOURCES}; do
  856. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
  857. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  858. echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  859. done
  860. for a in ${KWSYS_CXX_SOURCES}; do
  861. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
  862. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  863. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  864. done
  865. cat>>"${cmake_bootstrap_dir}/Makefile"<<EOF
  866. rebuild_cache:
  867. cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
  868. EOF
  869. # Write our default settings to Bootstrap.cmk/InitialCacheFlags.cmake.
  870. cat > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" <<EOF
  871. # Generated by ${cmake_source_dir}/bootstrap
  872. # Default cmake settings. These may be overridden any settings below.
  873. SET (CMAKE_INSTALL_PREFIX "${cmake_prefix_dir}" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
  874. SET (CMAKE_DOC_DIR "${cmake_doc_dir}" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
  875. SET (CMAKE_MAN_DIR "${cmake_man_dir}" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
  876. SET (CMAKE_DATA_DIR "${cmake_data_dir}" CACHE PATH "Install location for data (relative to prefix)." FORCE)
  877. EOF
  878. # Add user-specified settings. Handle relative-path case for
  879. # specification of cmake_init_file.
  880. (
  881. cd "${cmake_binary_dir}"
  882. if [ -f "${cmake_init_file}" ]; then
  883. cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  884. fi
  885. )
  886. echo "---------------------------------------------"
  887. # Run make to build bootstrap cmake
  888. if [ "x${cmake_parallel_make}" != "x" ]; then
  889. ${cmake_make_processor} ${cmake_make_flags}
  890. else
  891. ${cmake_make_processor}
  892. fi
  893. RES=$?
  894. if [ "${RES}" -ne "0" ]; then
  895. cmake_error 9 "Problem while running ${cmake_make_processor}"
  896. fi
  897. cd "${cmake_binary_dir}"
  898. # Set C, CXX, and MAKE environment variables, so that real real cmake will be
  899. # build with same compiler and make
  900. CC="${cmake_c_compiler}"
  901. CXX="${cmake_cxx_compiler}"
  902. MAKE="${cmake_make_processor}"
  903. export CC
  904. export CXX
  905. export MAKE
  906. # Run bootstrap CMake to configure real CMake
  907. "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  908. RES=$?
  909. if [ "${RES}" -ne "0" ]; then
  910. cmake_error 11 "Problem while running initial CMake"
  911. fi
  912. echo "---------------------------------------------"
  913. # And we are done. Now just run make
  914. echo "CMake has bootstrapped. Now run ${cmake_make_processor}."