1
0

bootstrap 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494
  1. #!/bin/sh
  2. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  3. # file Copyright.txt or https://cmake.org/licensing for details.
  4. die() {
  5. echo "$@" 1>&2 ; exit 1
  6. }
  7. # Version number extraction function.
  8. cmake_version_component()
  9. {
  10. cat "${cmake_source_dir}/Source/CMakeVersion.cmake" | sed -n "
  11. /^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
  12. "
  13. }
  14. # Install destination extraction function.
  15. cmake_install_dest_default()
  16. {
  17. cat "${cmake_source_dir}/Source/CMakeInstallDestinations.cmake" | sed -n '
  18. /^ *set(CMAKE_'"${1}"'_DIR_DEFAULT.*) # '"${2}"'$/ {
  19. s/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT *"\([^"]*\)").*$/\1/
  20. s/${CMake_VERSION_MAJOR}/'"${cmake_version_major}"'/
  21. s/${CMake_VERSION_MINOR}/'"${cmake_version_minor}"'/
  22. s/${CMake_VERSION_PATCH}/'"${cmake_version_patch}"'/
  23. p
  24. q
  25. }
  26. '
  27. }
  28. cmake_toupper()
  29. {
  30. echo "$1" | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
  31. }
  32. # Detect system and directory information.
  33. cmake_system=`uname`
  34. cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
  35. cmake_binary_dir=`pwd`
  36. # Load version information.
  37. cmake_version_major="`cmake_version_component MAJOR`"
  38. cmake_version_minor="`cmake_version_component MINOR`"
  39. cmake_version_patch="`cmake_version_component PATCH`"
  40. cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
  41. cmake_version_rc="`cmake_version_component RC`"
  42. if [ "$cmake_version_rc" != "" ]; then
  43. cmake_version="${cmake_version}-rc${cmake_version_rc}"
  44. fi
  45. cmake_copyright="`grep '^Copyright .* Kitware' "${cmake_source_dir}/Copyright.txt"`"
  46. cmake_bin_dir_keyword="OTHER"
  47. cmake_data_dir_keyword="OTHER"
  48. cmake_doc_dir_keyword="OTHER"
  49. cmake_man_dir_keyword="OTHER"
  50. cmake_xdgdata_dir_keyword="OTHER"
  51. cmake_bin_dir=""
  52. cmake_data_dir=""
  53. cmake_doc_dir=""
  54. cmake_man_dir=""
  55. cmake_xdgdata_dir=""
  56. cmake_init_file=""
  57. cmake_bootstrap_system_libs=""
  58. cmake_bootstrap_qt_gui=""
  59. cmake_bootstrap_qt_qmake=""
  60. cmake_bootstrap_server=""
  61. cmake_sphinx_man=""
  62. cmake_sphinx_html=""
  63. cmake_sphinx_qthelp=""
  64. cmake_sphinx_build=""
  65. cmake_sphinx_flags=""
  66. # Determine whether this is a Cygwin environment.
  67. if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
  68. cmake_system_cygwin=true
  69. cmake_doc_dir_keyword="CYGWIN"
  70. cmake_man_dir_keyword="CYGWIN"
  71. else
  72. cmake_system_cygwin=false
  73. fi
  74. # Determine whether this is a MinGW environment.
  75. if echo "${cmake_system}" | grep 'MINGW\|MSYS' >/dev/null 2>&1; then
  76. cmake_system_mingw=true
  77. else
  78. cmake_system_mingw=false
  79. fi
  80. # Determine whether this is OS X
  81. if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then
  82. cmake_system_darwin=true
  83. else
  84. cmake_system_darwin=false
  85. fi
  86. # Determine whether this is BeOS
  87. if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
  88. cmake_system_beos=true
  89. cmake_doc_dir_keyword="HAIKU"
  90. cmake_man_dir_keyword="HAIKU"
  91. else
  92. cmake_system_beos=false
  93. fi
  94. # Determine whether this is Haiku
  95. if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
  96. cmake_system_haiku=true
  97. cmake_doc_dir_keyword="HAIKU"
  98. cmake_man_dir_keyword="HAIKU"
  99. else
  100. cmake_system_haiku=false
  101. fi
  102. # Determine whether this is OpenVMS
  103. if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then
  104. cmake_system_openvms=true
  105. else
  106. cmake_system_openvms=false
  107. fi
  108. # Determine whether this is HP-UX
  109. if echo "${cmake_system}" | grep HP-UX >/dev/null 2>&1; then
  110. cmake_system_hpux=true
  111. else
  112. cmake_system_hpux=false
  113. fi
  114. # Determine whether this is Linux
  115. if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then
  116. cmake_system_linux=true
  117. else
  118. cmake_system_linux=false
  119. fi
  120. # Determine whether this is a PA-RISC machine
  121. # This only works for Linux or HP-UX, not other PA-RISC OSs (BSD maybe?). Also
  122. # may falsely detect parisc on HP-UX m68k
  123. cmake_machine_parisc=false
  124. if ${cmake_system_linux}; then
  125. if uname -m | grep parisc >/dev/null 2>&1; then
  126. cmake_machine_parisc=true
  127. fi
  128. elif ${cmake_system_hpux}; then
  129. if uname -m | grep ia64 >/dev/null 2>&1; then : ; else
  130. cmake_machine_parisc=true
  131. fi
  132. fi
  133. # Choose the generator to use for bootstrapping.
  134. if ${cmake_system_mingw}; then
  135. # Bootstrapping from an MSYS prompt.
  136. cmake_bootstrap_generator="MSYS Makefiles"
  137. else
  138. # Bootstrapping from a standard UNIX prompt.
  139. cmake_bootstrap_generator="Unix Makefiles"
  140. fi
  141. # Choose tools and extensions for this platform.
  142. if ${cmake_system_openvms}; then
  143. _tmp="_tmp"
  144. _cmk="_cmk"
  145. _diff=`which diff`
  146. else
  147. _tmp=".tmp"
  148. _cmk=".cmk"
  149. _diff="diff"
  150. fi
  151. # Construct bootstrap directory name.
  152. cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}"
  153. # Helper function to fix windows paths.
  154. case "${cmake_system}" in
  155. *MINGW*)
  156. cmake_fix_slashes()
  157. {
  158. cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//'
  159. }
  160. ;;
  161. *)
  162. cmake_fix_slashes()
  163. {
  164. echo "$1" | sed 's/\\/\//g'
  165. }
  166. ;;
  167. esac
  168. # Choose the default install prefix.
  169. if ${cmake_system_mingw}; then
  170. if [ "x${PROGRAMFILES}" != "x" ]; then
  171. cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
  172. elif [ "x${ProgramFiles}" != "x" ]; then
  173. cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
  174. elif [ "x${SYSTEMDRIVE}" != "x" ]; then
  175. cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
  176. elif [ "x${SystemDrive}" != "x" ]; then
  177. cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
  178. else
  179. cmake_default_prefix="c:/Program Files/CMake"
  180. fi
  181. elif ${cmake_system_haiku}; then
  182. cmake_default_prefix=`finddir B_COMMON_DIRECTORY`
  183. else
  184. cmake_default_prefix="/usr/local"
  185. fi
  186. # Lookup default install destinations.
  187. cmake_bin_dir_default="`cmake_install_dest_default BIN ${cmake_bin_dir_keyword}`"
  188. cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`"
  189. cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`"
  190. cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`"
  191. cmake_xdgdata_dir_default="`cmake_install_dest_default XDGDATA ${cmake_xdgdata_dir_keyword}`"
  192. CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
  193. CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
  194. CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
  195. CMAKE_PROBLEMATIC_FILES="\
  196. CMakeCache.txt \
  197. CMakeSystem.cmake \
  198. CMakeCCompiler.cmake \
  199. CMakeCXXCompiler.cmake \
  200. */CMakeSystem.cmake \
  201. */CMakeCCompiler.cmake \
  202. */CMakeCXXCompiler.cmake \
  203. Source/cmConfigure.h \
  204. Source/CTest/Curl/config.h \
  205. Utilities/cmexpat/expatConfig.h \
  206. Utilities/cmexpat/expatDllConfig.h \
  207. "
  208. CMAKE_UNUSED_SOURCES="\
  209. cmGlobalXCodeGenerator \
  210. cmLocalXCodeGenerator \
  211. cmXCodeObject \
  212. cmXCode21Object \
  213. cmSourceGroup \
  214. "
  215. CMAKE_CXX_SOURCES="\
  216. cmake \
  217. cmakemain \
  218. cmcmd \
  219. cmCommandArgumentLexer \
  220. cmCommandArgumentParser \
  221. cmCommandArgumentParserHelper \
  222. cmCommonTargetGenerator \
  223. cmCPackPropertiesGenerator \
  224. cmDefinitions \
  225. cmDepends \
  226. cmDependsC \
  227. cmDocumentationFormatter \
  228. cmPolicies \
  229. cmProperty \
  230. cmPropertyMap \
  231. cmPropertyDefinition \
  232. cmPropertyDefinitionMap \
  233. cmMakefile \
  234. cmMessenger \
  235. cmExportBuildFileGenerator \
  236. cmExportFileGenerator \
  237. cmExportInstallFileGenerator \
  238. cmExportTryCompileFileGenerator \
  239. cmExportSet \
  240. cmExportSetMap \
  241. cmExternalMakefileProjectGenerator \
  242. cmGeneratorExpressionEvaluationFile \
  243. cmGeneratedFileStream \
  244. cmGeneratorTarget \
  245. cmGeneratorExpressionContext \
  246. cmGeneratorExpressionDAGChecker \
  247. cmGeneratorExpressionEvaluator \
  248. cmGeneratorExpressionLexer \
  249. cmGeneratorExpressionNode \
  250. cmGeneratorExpressionParser \
  251. cmGeneratorExpression \
  252. cmGlobalCommonGenerator \
  253. cmGlobalGenerator \
  254. cmInstallDirectoryGenerator \
  255. cmLocalCommonGenerator \
  256. cmLocalGenerator \
  257. cmRulePlaceholderExpander \
  258. cmInstalledFile \
  259. cmInstallGenerator \
  260. cmInstallExportGenerator \
  261. cmInstallFilesGenerator \
  262. cmInstallScriptGenerator \
  263. cmInstallTargetGenerator \
  264. cmScriptGenerator \
  265. cmSourceFile \
  266. cmSourceFileLocation \
  267. cmState \
  268. cmSystemTools \
  269. cmTestGenerator \
  270. cmVersion \
  271. cmFileTimeComparison \
  272. cmGlobalUnixMakefileGenerator3 \
  273. cmLocalUnixMakefileGenerator3 \
  274. cmLinkLineComputer \
  275. cmMSVC60LinkLineComputer \
  276. cmMakefileExecutableTargetGenerator \
  277. cmMakefileLibraryTargetGenerator \
  278. cmMakefileTargetGenerator \
  279. cmMakefileUtilityTargetGenerator \
  280. cmOutputConverter \
  281. cmOSXBundleGenerator \
  282. cmNewLineStyle \
  283. cmBootstrapCommands1 \
  284. cmBootstrapCommands2 \
  285. cmCommandsForBootstrap \
  286. cmTarget \
  287. cmTest \
  288. cmCustomCommand \
  289. cmCustomCommandGenerator \
  290. cmCacheManager \
  291. cmListFileCache \
  292. cmComputeLinkDepends \
  293. cmComputeLinkInformation \
  294. cmOrderDirectories \
  295. cmComputeTargetDepends \
  296. cmComputeComponentGraph \
  297. cmExprLexer \
  298. cmExprParser \
  299. cmExprParserHelper \
  300. "
  301. if ${cmake_system_mingw}; then
  302. CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
  303. cmGlobalMSYSMakefileGenerator \
  304. cmGlobalMinGWMakefileGenerator"
  305. fi
  306. CMAKE_C_SOURCES="\
  307. cmListFileLexer \
  308. "
  309. if ${cmake_system_mingw}; then
  310. KWSYS_C_SOURCES="\
  311. EncodingC \
  312. ProcessWin32 \
  313. String \
  314. System \
  315. Terminal"
  316. else
  317. KWSYS_C_SOURCES="\
  318. EncodingC \
  319. ProcessUNIX \
  320. String \
  321. System \
  322. Terminal"
  323. fi
  324. KWSYS_CXX_SOURCES="\
  325. Directory \
  326. EncodingCXX \
  327. FStream \
  328. Glob \
  329. RegularExpression \
  330. SystemTools"
  331. KWSYS_FILES="\
  332. Directory.hxx \
  333. Encoding.h \
  334. Encoding.hxx \
  335. FStream.hxx \
  336. Glob.hxx \
  337. Process.h \
  338. RegularExpression.hxx \
  339. String.h \
  340. String.hxx \
  341. System.h \
  342. SystemTools.hxx \
  343. Terminal.h"
  344. # Display CMake bootstrap usage
  345. cmake_usage()
  346. {
  347. echo '
  348. Usage: '"$0"' [<options>...] [-- <cmake-options>...]
  349. Options: [defaults in brackets after descriptions]
  350. Configuration:
  351. --help print this message
  352. --version only print version information
  353. --verbose display more information
  354. --parallel=n bootstrap cmake in parallel, where n is
  355. number of nodes [1]
  356. --enable-ccache Enable ccache when building cmake
  357. --init=FILE load FILE as script to populate cache
  358. --system-libs use all system-installed third-party libraries
  359. (for use only by package maintainers)
  360. --no-system-libs use all cmake-provided third-party libraries
  361. (default)
  362. --system-curl use system-installed curl library
  363. --no-system-curl use cmake-provided curl library (default)
  364. --system-expat use system-installed expat library
  365. --no-system-expat use cmake-provided expat library (default)
  366. --system-jsoncpp use system-installed jsoncpp library
  367. --no-system-jsoncpp use cmake-provided jsoncpp library (default)
  368. --system-zlib use system-installed zlib library
  369. --no-system-zlib use cmake-provided zlib library (default)
  370. --system-bzip2 use system-installed bzip2 library
  371. --no-system-bzip2 use cmake-provided bzip2 library (default)
  372. --system-liblzma use system-installed liblzma library
  373. --no-system-liblzma use cmake-provided liblzma library (default)
  374. --system-libarchive use system-installed libarchive library
  375. --no-system-libarchive use cmake-provided libarchive library (default)
  376. --qt-gui build the Qt-based GUI (requires Qt >= 4.2)
  377. --no-qt-gui do not build the Qt-based GUI (default)
  378. --qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt
  379. --server enable the server mode (default if supported)
  380. --no-server disable the server mode
  381. --sphinx-man build man pages with Sphinx
  382. --sphinx-html build html help with Sphinx
  383. --sphinx-qthelp build qch help with Sphinx
  384. --sphinx-build=<sb> use <sb> as the sphinx-build executable
  385. --sphinx-flags=<flags> pass <flags> to sphinx-build executable
  386. Directory and file names:
  387. --prefix=PREFIX install files in tree rooted at PREFIX
  388. ['"${cmake_default_prefix}"']
  389. --bindir=DIR install binaries in PREFIX/DIR
  390. ['"${cmake_bin_dir_default}"']
  391. --datadir=DIR install data files in PREFIX/DIR
  392. ['"${cmake_data_dir_default}"']
  393. --docdir=DIR install documentation files in PREFIX/DIR
  394. ['"${cmake_doc_dir_default}"']
  395. --mandir=DIR install man pages files in PREFIX/DIR/manN
  396. ['"${cmake_man_dir_default}"']
  397. --xdgdatadir=DIR install XDG specific files in PREFIX/DIR
  398. ['"${cmake_xdgdata_dir_default}"']
  399. '
  400. exit 10
  401. }
  402. # Display CMake bootstrap usage
  403. cmake_version_display()
  404. {
  405. echo "CMake ${cmake_version}, ${cmake_copyright}"
  406. }
  407. # Display CMake bootstrap error, display the log file and exit
  408. cmake_error()
  409. {
  410. res=$1
  411. shift 1
  412. echo "---------------------------------------------"
  413. echo "Error when bootstrapping CMake:"
  414. echo "$*"
  415. echo "---------------------------------------------"
  416. if [ -f cmake_bootstrap.log ]; then
  417. echo "Log of errors: `pwd`/cmake_bootstrap.log"
  418. #cat cmake_bootstrap.log
  419. echo "---------------------------------------------"
  420. fi
  421. exit ${res}
  422. }
  423. cmake_generate_file ()
  424. {
  425. OUTFILE="$1"
  426. CONTENT="$2"
  427. echo "$CONTENT" > "$OUTFILE.tmp"
  428. if "${_diff}" "$OUTFILE.tmp" "$OUTFILE" > /dev/null 2> /dev/null ; then
  429. rm -f "$OUTFILE.tmp"
  430. else
  431. mv -f "$OUTFILE.tmp" "$OUTFILE"
  432. fi
  433. }
  434. # Replace KWSYS_NAMESPACE with cmsys
  435. cmake_replace_string ()
  436. {
  437. INFILE="$1"
  438. OUTFILE="$2"
  439. SEARCHFOR="$3"
  440. REPLACEWITH="$4"
  441. if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
  442. cat "${INFILE}" |
  443. sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" > "${OUTFILE}${_tmp}"
  444. if [ -f "${OUTFILE}${_tmp}" ]; then
  445. if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
  446. #echo "Files are the same"
  447. rm -f "${OUTFILE}${_tmp}"
  448. else
  449. mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
  450. fi
  451. fi
  452. else
  453. cmake_error 1 "Cannot find file ${INFILE}"
  454. fi
  455. }
  456. cmake_kwsys_config_replace_string ()
  457. {
  458. INFILE="$1"
  459. OUTFILE="$2"
  460. shift 2
  461. APPEND="$*"
  462. if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
  463. echo "${APPEND}" > "${OUTFILE}${_tmp}"
  464. cat "${INFILE}" |
  465. sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
  466. s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
  467. s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
  468. s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
  469. s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
  470. s/@KWSYS_STL_HAS_WSTRING@/${KWSYS_STL_HAS_WSTRING}/g;
  471. s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g;
  472. }" >> "${OUTFILE}${_tmp}"
  473. if [ -f "${OUTFILE}${_tmp}" ]; then
  474. if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
  475. #echo "Files are the same"
  476. rm -f "${OUTFILE}${_tmp}"
  477. else
  478. mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
  479. fi
  480. fi
  481. else
  482. cmake_error 2 "Cannot find file ${INFILE}"
  483. fi
  484. }
  485. # Write string into a file
  486. cmake_report ()
  487. {
  488. FILE=$1
  489. shift
  490. echo "$*" >> ${FILE}
  491. }
  492. # Escape spaces in strings
  493. cmake_escape ()
  494. {
  495. echo $1 | sed "s/ /\\\\ /g"
  496. }
  497. # Strip prefix from argument
  498. cmake_arg ()
  499. {
  500. echo "$1" | sed "s/^${2-[^=]*=}//"
  501. }
  502. # Write message to the log
  503. cmake_log ()
  504. {
  505. echo "$*" >> cmake_bootstrap.log
  506. }
  507. # Return temp file
  508. cmake_tmp_file ()
  509. {
  510. echo "cmake_bootstrap_$$_test"
  511. }
  512. # Run a compiler test. First argument is compiler, second one are compiler
  513. # flags, third one is test source file to be compiled
  514. cmake_try_run ()
  515. {
  516. COMPILER=$1
  517. FLAGS=$2
  518. TESTFILE=$3
  519. if [ ! -f "${TESTFILE}" ]; then
  520. echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
  521. exit 4
  522. fi
  523. TMPFILE=`cmake_tmp_file`
  524. echo "Try: ${COMPILER}"
  525. echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
  526. echo "---------- file -----------------------"
  527. cat "${TESTFILE}"
  528. echo "------------------------------------------"
  529. "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
  530. RES=$?
  531. if [ "${RES}" -ne "0" ]; then
  532. echo "Test failed to compile"
  533. return 1
  534. fi
  535. if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
  536. echo "Test failed to produce executable"
  537. return 2
  538. fi
  539. ./${TMPFILE}
  540. RES=$?
  541. rm -f "${TMPFILE}"
  542. if [ "${RES}" -ne "0" ]; then
  543. echo "Test produced non-zero return code"
  544. return 3
  545. fi
  546. echo "Test succeeded"
  547. return 0
  548. }
  549. # Run a make test. First argument is the make interpreter.
  550. cmake_try_make ()
  551. {
  552. MAKE_PROC="$1"
  553. MAKE_FLAGS="$2"
  554. echo "Try: ${MAKE_PROC}"
  555. "${MAKE_PROC}" ${MAKE_FLAGS}
  556. RES=$?
  557. if [ "${RES}" -ne "0" ]; then
  558. echo "${MAKE_PROC} does not work"
  559. return 1
  560. fi
  561. if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
  562. echo "${COMPILER} does not produce output"
  563. return 2
  564. fi
  565. ./test
  566. RES=$?
  567. rm -f "test"
  568. if [ "${RES}" -ne "0" ]; then
  569. echo "${MAKE_PROC} produces strange executable"
  570. return 3
  571. fi
  572. echo "${MAKE_PROC} works"
  573. return 0
  574. }
  575. # Parse arguments
  576. cmake_verbose=
  577. cmake_parallel_make=
  578. cmake_ccache_enabled=
  579. cmake_prefix_dir="${cmake_default_prefix}"
  580. while test $# != 0; do
  581. case "$1" in
  582. --prefix=*) dir=`cmake_arg "$1"`
  583. cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;;
  584. --parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;;
  585. --bindir=*) cmake_bin_dir=`cmake_arg "$1"` ;;
  586. --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;;
  587. --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;;
  588. --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;;
  589. --xdgdatadir=*) cmake_xdgdata_dir=`cmake_arg "$1"` ;;
  590. --init=*) cmake_init_file=`cmake_arg "$1"` ;;
  591. --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
  592. --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
  593. --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-zlib|--system-liblzma)
  594. lib=`cmake_arg "$1" "--system-"`
  595. cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
  596. --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-zlib|--no-system-liblzma)
  597. lib=`cmake_arg "$1" "--no-system-"`
  598. cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
  599. --qt-gui) cmake_bootstrap_qt_gui="1" ;;
  600. --no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
  601. --qt-qmake=*) cmake_bootstrap_qt_qmake=`cmake_arg "$1"` ;;
  602. --server) cmake_bootstrap_server="1" ;;
  603. --no-server) cmake_bootstrap_server="0" ;;
  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_bootstrap_server}" != "x" ]; then
  1290. echo '
  1291. set (CMake_ENABLE_SERVER_MODE '"${cmake_bootstrap_server}"' CACHE BOOL "Enable server mode" FORCE)
  1292. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1293. fi
  1294. if [ "x${cmake_sphinx_man}" != "x" ]; then
  1295. echo '
  1296. set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE BOOL "Build man pages with Sphinx" FORCE)
  1297. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1298. fi
  1299. if [ "x${cmake_sphinx_html}" != "x" ]; then
  1300. echo '
  1301. set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE BOOL "Build html help with Sphinx" FORCE)
  1302. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1303. fi
  1304. if [ "x${cmake_sphinx_qthelp}" != "x" ]; then
  1305. echo '
  1306. set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE)
  1307. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1308. fi
  1309. if [ "x${cmake_sphinx_build}" != "x" ]; then
  1310. echo '
  1311. set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
  1312. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1313. fi
  1314. if [ "x${cmake_sphinx_flags}" != "x" ]; then
  1315. echo '
  1316. set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE)
  1317. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1318. fi
  1319. # Add user-specified settings. Handle relative-path case for
  1320. # specification of cmake_init_file.
  1321. (
  1322. cd "${cmake_binary_dir}"
  1323. if [ -f "${cmake_init_file}" ]; then
  1324. cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1325. fi
  1326. )
  1327. echo "---------------------------------------------"
  1328. # Run make to build bootstrap cmake
  1329. if [ "x${cmake_parallel_make}" != "x" ]; then
  1330. ${cmake_make_processor} ${cmake_make_flags}
  1331. else
  1332. ${cmake_make_processor}
  1333. fi
  1334. RES=$?
  1335. if [ "${RES}" -ne "0" ]; then
  1336. cmake_error 9 "Problem while running ${cmake_make_processor}"
  1337. fi
  1338. cd "${cmake_binary_dir}"
  1339. # Set C, CXX, and MAKE environment variables, so that real real cmake will be
  1340. # build with same compiler and make
  1341. CC="${cmake_c_compiler}"
  1342. CXX="${cmake_cxx_compiler}"
  1343. if [ -n "${cmake_ccache_enabled}" ]; then
  1344. CC="ccache ${CC}"
  1345. CXX="ccache ${CXX}"
  1346. fi
  1347. MAKE="${cmake_make_processor}"
  1348. export CC
  1349. export CXX
  1350. export MAKE
  1351. # Run bootstrap CMake to configure real CMake
  1352. cmake_options="-DCMAKE_BOOTSTRAP=1"
  1353. if [ -n "${cmake_verbose}" ]; then
  1354. cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
  1355. fi
  1356. "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@"
  1357. RES=$?
  1358. if [ "${RES}" -ne "0" ]; then
  1359. cmake_error 11 "Problem while running initial CMake"
  1360. fi
  1361. echo "---------------------------------------------"
  1362. # And we are done. Now just run make
  1363. echo "CMake has bootstrapped. Now run ${cmake_make_processor}."