bootstrap 47 KB

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