bootstrap 47 KB

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