bootstrap 47 KB

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