bootstrap 49 KB

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