bootstrap 54 KB

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