bootstrap 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735
  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. cmState \
  406. cmStateDirectory \
  407. cmStateSnapshot \
  408. cmString \
  409. cmStringAlgorithms \
  410. cmStringReplaceHelper \
  411. cmStringCommand \
  412. cmSubcommandTable \
  413. cmSubdirCommand \
  414. cmSystemTools \
  415. cmTarget \
  416. cmTargetCompileDefinitionsCommand \
  417. cmTargetCompileFeaturesCommand \
  418. cmTargetCompileOptionsCommand \
  419. cmTargetIncludeDirectoriesCommand \
  420. cmTargetLinkLibrariesCommand \
  421. cmTargetLinkOptionsCommand \
  422. cmTargetPrecompileHeadersCommand \
  423. cmTargetPropCommandBase \
  424. cmTargetPropertyComputer \
  425. cmTargetSourcesCommand \
  426. cmTest \
  427. cmTestGenerator \
  428. cmTimestamp \
  429. cmTryCompileCommand \
  430. cmTryRunCommand \
  431. cmUnsetCommand \
  432. cmUVHandlePtr \
  433. cmUVProcessChain \
  434. cmVersion \
  435. cmWhileCommand \
  436. cmWorkingDirectory \
  437. cmake \
  438. cmakemain \
  439. cmcmd \
  440. "
  441. if ${cmake_system_mingw}; then
  442. CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
  443. cmGlobalMSYSMakefileGenerator \
  444. cmGlobalMinGWMakefileGenerator \
  445. cmVSSetupHelper \
  446. "
  447. fi
  448. CMAKE_STD_CXX_HEADERS="\
  449. memory \
  450. optional \
  451. shared_mutex \
  452. string_view \
  453. utility \
  454. "
  455. CMAKE_STD_CXX_SOURCES="\
  456. string_view \
  457. "
  458. LexerParser_CXX_SOURCES="\
  459. cmCommandArgumentLexer \
  460. cmCommandArgumentParser \
  461. cmExprLexer \
  462. cmExprParser \
  463. "
  464. LexerParser_C_SOURCES="\
  465. cmListFileLexer \
  466. "
  467. if ${cmake_system_mingw}; then
  468. KWSYS_C_SOURCES="\
  469. EncodingC \
  470. ProcessWin32 \
  471. String \
  472. System \
  473. Terminal"
  474. else
  475. KWSYS_C_SOURCES="\
  476. EncodingC \
  477. ProcessUNIX \
  478. String \
  479. System \
  480. Terminal"
  481. fi
  482. KWSYS_CXX_SOURCES="\
  483. Directory \
  484. EncodingCXX \
  485. FStream \
  486. Glob \
  487. RegularExpression \
  488. SystemTools"
  489. KWSYS_FILES="\
  490. Directory.hxx \
  491. Encoding.h \
  492. Encoding.hxx \
  493. FStream.hxx \
  494. Glob.hxx \
  495. Process.h \
  496. RegularExpression.hxx \
  497. String.h \
  498. String.hxx \
  499. System.h \
  500. SystemTools.hxx \
  501. Terminal.h"
  502. if ${cmake_system_mingw}; then
  503. LIBUV_C_SOURCES="\
  504. src/fs-poll.c \
  505. src/idna.c
  506. src/inet.c \
  507. src/threadpool.c \
  508. src/strscpy.c \
  509. src/timer.c \
  510. src/uv-common.c \
  511. src/win/async.c \
  512. src/win/core.c \
  513. src/win/detect-wakeup.c \
  514. src/win/dl.c \
  515. src/win/error.c \
  516. src/win/fs-event.c \
  517. src/win/fs.c \
  518. src/win/getaddrinfo.c \
  519. src/win/getnameinfo.c \
  520. src/win/handle.c \
  521. src/win/loop-watcher.c \
  522. src/win/pipe.c \
  523. src/win/poll.c \
  524. src/win/process-stdio.c \
  525. src/win/process.c \
  526. src/win/signal.c \
  527. src/win/stream.c \
  528. src/win/tcp.c \
  529. src/win/thread.c \
  530. src/win/tty.c \
  531. src/win/udp.c \
  532. src/win/util.c \
  533. src/win/winapi.c \
  534. src/win/winsock.c \
  535. "
  536. else
  537. LIBUV_C_SOURCES="\
  538. src/strscpy.c \
  539. src/timer.c \
  540. src/uv-common.c \
  541. src/unix/cmake-bootstrap.c \
  542. src/unix/core.c \
  543. src/unix/fs.c \
  544. src/unix/loop.c \
  545. src/unix/loop-watcher.c \
  546. src/unix/no-fsevents.c \
  547. src/unix/pipe.c \
  548. src/unix/poll.c \
  549. src/unix/posix-hrtime.c \
  550. src/unix/posix-poll.c \
  551. src/unix/process.c \
  552. src/unix/signal.c \
  553. src/unix/stream.c \
  554. "
  555. fi
  556. # Display CMake bootstrap usage
  557. cmake_usage()
  558. {
  559. echo '
  560. Usage: '"$0"' [<options>...] [-- <cmake-options>...]
  561. Options: [defaults in brackets after descriptions]
  562. Configuration:
  563. --help print this message
  564. --version only print version information
  565. --verbose display more information
  566. --parallel=n bootstrap cmake in parallel, where n is
  567. number of nodes [1]
  568. --enable-ccache Enable ccache when building cmake
  569. --init=FILE load FILE as script to populate cache
  570. --system-libs use all system-installed third-party libraries
  571. (for use only by package maintainers)
  572. --no-system-libs use all cmake-provided third-party libraries
  573. (default)
  574. --system-curl use system-installed curl library
  575. --no-system-curl use cmake-provided curl library (default)
  576. --system-expat use system-installed expat library
  577. --no-system-expat use cmake-provided expat library (default)
  578. --system-jsoncpp use system-installed jsoncpp library
  579. --no-system-jsoncpp use cmake-provided jsoncpp library (default)
  580. --system-zlib use system-installed zlib library
  581. --no-system-zlib use cmake-provided zlib library (default)
  582. --system-bzip2 use system-installed bzip2 library
  583. --no-system-bzip2 use cmake-provided bzip2 library (default)
  584. --system-liblzma use system-installed liblzma library
  585. --no-system-liblzma use cmake-provided liblzma library (default)
  586. --system-nghttp2 use system-installed nghttp2 library
  587. --no-system-nghttp2 use cmake-provided nghttp2 library (default)
  588. --system-zstd use system-installed zstd library
  589. --no-system-zstd use cmake-provided zstd library (default)
  590. --system-libarchive use system-installed libarchive library
  591. --no-system-libarchive use cmake-provided libarchive library (default)
  592. --system-librhash use system-installed librhash library
  593. --no-system-librhash use cmake-provided librhash library (default)
  594. --system-libuv use system-installed libuv library
  595. --no-system-libuv use cmake-provided libuv library (default)
  596. --qt-gui build the Qt-based GUI (requires Qt >= 4.2)
  597. --no-qt-gui do not build the Qt-based GUI (default)
  598. --qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt
  599. --sphinx-info build Info manual with Sphinx
  600. --sphinx-man build man pages with Sphinx
  601. --sphinx-html build html help with Sphinx
  602. --sphinx-qthelp build qch help with Sphinx
  603. --sphinx-build=<sb> use <sb> as the sphinx-build executable
  604. --sphinx-flags=<flags> pass <flags> to sphinx-build executable
  605. Directory and file names:
  606. --prefix=PREFIX install files in tree rooted at PREFIX
  607. ['"${cmake_default_prefix}"']
  608. --bindir=DIR install binaries in PREFIX/DIR
  609. ['"${cmake_bin_dir_default}"']
  610. --datadir=DIR install data files in PREFIX/DIR
  611. ['"${cmake_data_dir_default}"']
  612. --docdir=DIR install documentation files in PREFIX/DIR
  613. ['"${cmake_doc_dir_default}"']
  614. --mandir=DIR install man pages files in PREFIX/DIR/manN
  615. ['"${cmake_man_dir_default}"']
  616. --xdgdatadir=DIR install XDG specific files in PREFIX/DIR
  617. ['"${cmake_xdgdata_dir_default}"']
  618. '
  619. exit 10
  620. }
  621. # Display CMake bootstrap usage
  622. cmake_version_display()
  623. {
  624. echo "CMake ${cmake_version}, ${cmake_copyright}"
  625. }
  626. # Display CMake bootstrap error, display the log file and exit
  627. cmake_error()
  628. {
  629. res=$1
  630. shift 1
  631. echo "---------------------------------------------"
  632. echo "Error when bootstrapping CMake:"
  633. echo "$*"
  634. echo "---------------------------------------------"
  635. if test -f cmake_bootstrap.log; then
  636. echo "Log of errors: `pwd`/cmake_bootstrap.log"
  637. #cat cmake_bootstrap.log
  638. echo "---------------------------------------------"
  639. fi
  640. exit ${res}
  641. }
  642. cmake_generate_file ()
  643. {
  644. OUTFILE="$1"
  645. CONTENT="$2"
  646. echo "$CONTENT" > "$OUTFILE.tmp"
  647. if "${_diff}" "$OUTFILE.tmp" "$OUTFILE" > /dev/null 2> /dev/null ; then
  648. rm -f "$OUTFILE.tmp"
  649. else
  650. mv -f "$OUTFILE.tmp" "$OUTFILE"
  651. fi
  652. }
  653. # Replace KWSYS_NAMESPACE with cmsys
  654. cmake_replace_string ()
  655. {
  656. INFILE="$1"
  657. OUTFILE="$2"
  658. SEARCHFOR="$3"
  659. REPLACEWITH="$4"
  660. if test -f "${INFILE}" || ${cmake_system_openvms}; then
  661. sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" "${INFILE}" > "${OUTFILE}${_tmp}"
  662. if test -f "${OUTFILE}${_tmp}"; then
  663. if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
  664. #echo "Files are the same"
  665. rm -f "${OUTFILE}${_tmp}"
  666. else
  667. mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
  668. fi
  669. fi
  670. else
  671. cmake_error 1 "Cannot find file ${INFILE}"
  672. fi
  673. }
  674. cmake_kwsys_config_replace_string ()
  675. {
  676. INFILE="$1"
  677. OUTFILE="$2"
  678. shift 2
  679. APPEND="$*"
  680. if test -f "${INFILE}" || ${cmake_system_openvms}; then
  681. echo "${APPEND}" > "${OUTFILE}${_tmp}"
  682. sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
  683. s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
  684. s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
  685. s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
  686. s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
  687. s/@KWSYS_STL_HAS_WSTRING@/${KWSYS_STL_HAS_WSTRING}/g;
  688. s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g;
  689. s/@KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@/${KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP}/g;
  690. }" "${INFILE}" >> "${OUTFILE}${_tmp}"
  691. if test -f "${OUTFILE}${_tmp}"; then
  692. if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
  693. #echo "Files are the same"
  694. rm -f "${OUTFILE}${_tmp}"
  695. else
  696. mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
  697. fi
  698. fi
  699. else
  700. cmake_error 2 "Cannot find file ${INFILE}"
  701. fi
  702. }
  703. # Write string into a file
  704. cmake_report ()
  705. {
  706. FILE=$1
  707. shift
  708. echo "$*" >> ${FILE}
  709. }
  710. # Escape spaces in strings
  711. cmake_escape ()
  712. {
  713. echo $1 | sed "s/ /\\\\ /g"
  714. }
  715. # Encode object file names.
  716. cmake_obj ()
  717. {
  718. echo $1 | sed 's/\//-/g' | sed 's/$/\.o/'
  719. }
  720. # Strip prefix from argument
  721. cmake_arg ()
  722. {
  723. echo "$1" | sed "s/^${2-[^=]*=}//"
  724. }
  725. # Write message to the log
  726. cmake_log ()
  727. {
  728. echo "$*" >> cmake_bootstrap.log
  729. }
  730. # Return temp file
  731. cmake_tmp_file ()
  732. {
  733. echo "cmake_bootstrap_$$_test"
  734. }
  735. # Run a compiler test. First argument is compiler, second one are compiler
  736. # flags, third one is test source file to be compiled
  737. cmake_try_run ()
  738. {
  739. COMPILER=$1
  740. FLAGS=$2
  741. TESTFILE=$3
  742. if test ! -f "${TESTFILE}"; then
  743. echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
  744. exit 4
  745. fi
  746. TMPFILE=`cmake_tmp_file`
  747. echo "Try: ${COMPILER}"
  748. echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
  749. echo "---------- file -----------------------"
  750. cat "${TESTFILE}"
  751. echo "------------------------------------------"
  752. "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
  753. RES=$?
  754. if test "${RES}" -ne "0"; then
  755. echo "Test failed to compile"
  756. return 1
  757. fi
  758. if test ! -f "${TMPFILE}" && test ! -f "${TMPFILE}.exe"; then
  759. echo "Test failed to produce executable"
  760. return 2
  761. fi
  762. ./${TMPFILE}
  763. RES=$?
  764. rm -f "${TMPFILE}"
  765. if test "${RES}" -ne "0"; then
  766. echo "Test produced non-zero return code"
  767. return 3
  768. fi
  769. echo "Test succeeded"
  770. return 0
  771. }
  772. # Run a make test. First argument is the make interpreter.
  773. cmake_try_make ()
  774. {
  775. MAKE_PROC="$1"
  776. MAKE_FLAGS="$2"
  777. echo "Try: ${MAKE_PROC}"
  778. "${MAKE_PROC}" ${MAKE_FLAGS}
  779. RES=$?
  780. if test "${RES}" -ne "0"; then
  781. echo "${MAKE_PROC} does not work"
  782. return 1
  783. fi
  784. if test ! -f "test" && test ! -f "test.exe"; then
  785. echo "${COMPILER} does not produce output"
  786. return 2
  787. fi
  788. ./test
  789. RES=$?
  790. rm -f "test"
  791. if test "${RES}" -ne "0"; then
  792. echo "${MAKE_PROC} produces strange executable"
  793. return 3
  794. fi
  795. echo "${MAKE_PROC} works"
  796. return 0
  797. }
  798. # Parse arguments
  799. cmake_verbose=
  800. cmake_parallel_make=
  801. cmake_ccache_enabled=
  802. cmake_prefix_dir="${cmake_default_prefix}"
  803. while test $# != 0; do
  804. case "$1" in
  805. --prefix=*) dir=`cmake_arg "$1"`
  806. cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;;
  807. --parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;;
  808. --bindir=*) cmake_bin_dir=`cmake_arg "$1"` ;;
  809. --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;;
  810. --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;;
  811. --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;;
  812. --xdgdatadir=*) cmake_xdgdata_dir=`cmake_arg "$1"` ;;
  813. --init=*) cmake_init_file=`cmake_arg "$1"` ;;
  814. --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
  815. --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
  816. --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-librhash|--system-zlib|--system-liblzma|--system-nghttp2|--system-zstd|--system-libuv)
  817. lib=`cmake_arg "$1" "--system-"`
  818. cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
  819. --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-nghttp2|--no-system-zstd|--no-system-libuv)
  820. lib=`cmake_arg "$1" "--no-system-"`
  821. cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
  822. --qt-gui) cmake_bootstrap_qt_gui="1" ;;
  823. --no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
  824. --qt-qmake=*) cmake_bootstrap_qt_qmake=`cmake_arg "$1"` ;;
  825. --sphinx-info) cmake_sphinx_info="1" ;;
  826. --sphinx-man) cmake_sphinx_man="1" ;;
  827. --sphinx-html) cmake_sphinx_html="1" ;;
  828. --sphinx-qthelp) cmake_sphinx_qthelp="1" ;;
  829. --sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;;
  830. --sphinx-flags=*) cmake_sphinx_flags=`cmake_arg "$1"` ;;
  831. --help) cmake_usage ;;
  832. --version) cmake_version_display ; exit 2 ;;
  833. --verbose) cmake_verbose=TRUE ;;
  834. --enable-ccache) cmake_ccache_enabled=TRUE ;;
  835. CC=*) CC=`cmake_arg "$1"` ;;
  836. CXX=*) CXX=`cmake_arg "$1"` ;;
  837. CFLAGS=*) CFLAGS=`cmake_arg "$1"` ;;
  838. CXXFLAGS=*) CXXFLAGS=`cmake_arg "$1"` ;;
  839. LDFLAGS=*) LDFLAGS=`cmake_arg "$1"` ;;
  840. --) shift; break ;;
  841. *) die "Unknown option: $1" ;;
  842. esac
  843. shift
  844. done
  845. # If verbose, display some information about bootstrap
  846. if test -n "${cmake_verbose}"; then
  847. echo "---------------------------------------------"
  848. echo "Source directory: ${cmake_source_dir}"
  849. echo "Binary directory: ${cmake_binary_dir}"
  850. echo "Prefix directory: ${cmake_prefix_dir}"
  851. echo "System: ${cmake_system}"
  852. if test "x${cmake_parallel_make}" != "x"; then
  853. echo "Doing parallel make: ${cmake_parallel_make}"
  854. fi
  855. echo ""
  856. fi
  857. echo "---------------------------------------------"
  858. # Get CMake version
  859. echo "`cmake_version_display`"
  860. # Check for in-source build
  861. cmake_in_source_build=
  862. if test -f "${cmake_binary_dir}/Source/cmake.cxx" &&
  863. test -f "${cmake_binary_dir}/Source/cmake.h"; then
  864. if test -n "${cmake_verbose}"; then
  865. echo "Warning: This is an in-source build"
  866. fi
  867. cmake_in_source_build=TRUE
  868. fi
  869. # If this is not an in-source build, then Bootstrap stuff should not exist.
  870. if test -z "${cmake_in_source_build}"; then
  871. # Did somebody bootstrap in the source tree?
  872. if test -d "${cmake_source_dir}/Bootstrap${_cmk}"; then
  873. cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
  874. Looks like somebody did bootstrap CMake in the source tree, but now you are
  875. trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
  876. directory from the source tree."
  877. fi
  878. # Is there a cache in the source tree?
  879. for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
  880. if test -f "${cmake_source_dir}/${cmake_problematic_file}"; then
  881. cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
  882. Looks like somebody tried to build CMake in the source tree, but now you are
  883. trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
  884. from the source tree."
  885. fi
  886. done
  887. fi
  888. # Make bootstrap directory
  889. test -d "${cmake_bootstrap_dir}" || mkdir "${cmake_bootstrap_dir}"
  890. if test ! -d "${cmake_bootstrap_dir}"; then
  891. cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
  892. fi
  893. cd "${cmake_bootstrap_dir}"
  894. test -d "cmsys" || mkdir "cmsys"
  895. if test ! -d "cmsys"; then
  896. cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
  897. fi
  898. # Delete all the bootstrap files
  899. rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
  900. rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
  901. rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
  902. # If building in-source, remove any cmConfigure.h that may
  903. # have been created by a previous run of the bootstrap cmake.
  904. if test -n "${cmake_in_source_build}"; then
  905. rm -f "${cmake_source_dir}/Source/cmConfigure.h"
  906. fi
  907. # If exist compiler flags, set them
  908. cmake_c_flags=${CFLAGS}
  909. cmake_cxx_flags=${CXXFLAGS}
  910. cmake_ld_flags=${LDFLAGS}
  911. # Add Cygwin-specific flags
  912. if ${cmake_system_cygwin}; then
  913. cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
  914. fi
  915. # Add CoreFoundation framework on Darwin
  916. if ${cmake_system_darwin}; then
  917. cmake_ld_flags="${LDFLAGS} -framework CoreFoundation"
  918. fi
  919. # Add BeOS toolkits...
  920. if ${cmake_system_beos}; then
  921. cmake_ld_flags="${LDFLAGS} -lroot -lbe"
  922. fi
  923. # Add Haiku toolkits...
  924. if ${cmake_system_haiku}; then
  925. cmake_ld_flags="${LDFLAGS} -lroot -lbe"
  926. fi
  927. #-----------------------------------------------------------------------------
  928. # Detect known toolchains on some platforms.
  929. cmake_toolchains=''
  930. case "${cmake_system}" in
  931. *AIX*) cmake_toolchains='XL GNU' ;;
  932. *CYGWIN*) cmake_toolchains='GNU' ;;
  933. *Darwin*) cmake_toolchains='Clang GNU' ;;
  934. *Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;;
  935. *MINGW*) cmake_toolchains='GNU' ;;
  936. esac
  937. # Toolchain compiler name table.
  938. cmake_toolchain_Clang_CC='clang'
  939. cmake_toolchain_Clang_CXX='clang++'
  940. cmake_toolchain_GNU_CC='gcc'
  941. cmake_toolchain_GNU_CXX='g++'
  942. cmake_toolchain_PGI_CC='pgcc'
  943. cmake_toolchain_PGI_CXX='pgCC'
  944. cmake_toolchain_PathScale_CC='pathcc'
  945. cmake_toolchain_PathScale_CXX='pathCC'
  946. cmake_toolchain_XL_CC='xlc'
  947. cmake_toolchain_XL_CXX='xlC'
  948. cmake_toolchain_try()
  949. {
  950. tc="$1"
  951. TMPFILE=`cmake_tmp_file`
  952. eval "tc_CC=\${cmake_toolchain_${tc}_CC}"
  953. echo 'int main() { return 0; }' > "${TMPFILE}.c"
  954. cmake_try_run "$tc_CC" "" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1
  955. tc_result_CC="$?"
  956. rm -f "${TMPFILE}.c"
  957. test "${tc_result_CC}" = "0" || return 1
  958. eval "tc_CXX=\${cmake_toolchain_${tc}_CXX}"
  959. echo 'int main() { return 0; }' > "${TMPFILE}.cpp"
  960. cmake_try_run "$tc_CXX" "" "${TMPFILE}.cpp" >> cmake_bootstrap.log 2>&1
  961. tc_result_CXX="$?"
  962. rm -f "${TMPFILE}.cpp"
  963. test "${tc_result_CXX}" = "0" || return 1
  964. cmake_toolchain="$tc"
  965. }
  966. cmake_toolchain_detect()
  967. {
  968. cmake_toolchain=
  969. for tc in ${cmake_toolchains}; do
  970. echo "Checking for $tc toolchain" >> cmake_bootstrap.log 2>&1
  971. cmake_toolchain_try "$tc" &&
  972. echo "Found $tc toolchain" &&
  973. break
  974. done
  975. }
  976. if test -z "${CC}" && test -z "${CXX}"; then
  977. cmake_toolchain_detect
  978. fi
  979. thread_flags=''
  980. case "${cmake_system}" in
  981. *AIX*) thread_flags='-pthread' ;;
  982. esac
  983. #-----------------------------------------------------------------------------
  984. # Test C compiler
  985. cmake_c_compiler=
  986. # If CC is set, use that for compiler, otherwise use list of known compilers
  987. if test -n "${cmake_toolchain}"; then
  988. eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
  989. elif test -n "${CC}"; then
  990. cmake_c_compilers="${CC}"
  991. else
  992. cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
  993. fi
  994. # Check if C compiler works
  995. TMPFILE=`cmake_tmp_file`
  996. echo '
  997. #ifdef __cplusplus
  998. # error "The CMAKE_C_COMPILER is set to a C++ compiler"
  999. #endif
  1000. #if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
  1001. #error "On AIX with GNU we need the -pthread flag."
  1002. #endif
  1003. #if defined(__sun) && __STDC_VERSION__ < 199901L
  1004. #error "On Solaris we need C99."
  1005. #endif
  1006. #if defined(__hpux) && !(defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 409)
  1007. #error "On HP-UX we need GCC 4.9 or higher."
  1008. #endif
  1009. #include <stdio.h>
  1010. int main(int argc, char* argv[])
  1011. {
  1012. printf("%d%c", (argv != 0), (char)0x0a);
  1013. return argc - 1;
  1014. }
  1015. ' > "${TMPFILE}.c"
  1016. for std in 11 99 90; do
  1017. std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`"
  1018. for compiler in ${cmake_c_compilers}; do
  1019. for std_flag in '' $std_flags; do
  1020. for thread_flag in '' $thread_flags; do
  1021. echo "Checking whether '${compiler} ${cmake_c_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1
  1022. if cmake_try_run "${compiler}" "${cmake_c_flags} ${std_flag} ${thread_flag}" \
  1023. "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  1024. cmake_c_compiler="${compiler}"
  1025. cmake_c_flags="${cmake_c_flags} ${std_flag} ${thread_flag}"
  1026. break 4
  1027. fi
  1028. done
  1029. done
  1030. done
  1031. done
  1032. rm -f "${TMPFILE}.c"
  1033. if test -z "${cmake_c_compiler}"; then
  1034. cmake_error 6 "Cannot find appropriate C compiler on this system.
  1035. Please specify one using environment variable CC.
  1036. See cmake_bootstrap.log for compilers attempted.
  1037. "
  1038. fi
  1039. echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
  1040. #-----------------------------------------------------------------------------
  1041. # Test CXX compiler
  1042. cmake_cxx_compiler=
  1043. # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
  1044. # If CC is set, use that for compiler, otherwise use list of known compilers
  1045. if test -n "${cmake_toolchain}"; then
  1046. eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
  1047. elif test -n "${CXX}"; then
  1048. cmake_cxx_compilers="${CXX}"
  1049. else
  1050. cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
  1051. fi
  1052. # Check if C++ compiler works
  1053. TMPFILE=`cmake_tmp_file`
  1054. echo '
  1055. #include <iostream>
  1056. #include <memory>
  1057. #include <unordered_map>
  1058. #if __cplusplus < 201103L
  1059. #error "Compiler is not in a mode aware of C++11."
  1060. #endif
  1061. #if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
  1062. #error "On AIX with GNU we need the -pthread flag."
  1063. #endif
  1064. #if defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
  1065. #error "SunPro <= 5.13 mode not supported due to bug in move semantics."
  1066. #endif
  1067. #if defined(__hpux) && !(defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 409)
  1068. #error "On HP-UX we need GCC 4.9 or higher."
  1069. #endif
  1070. #if __cplusplus > 201103L
  1071. #include <iterator>
  1072. int check_cxx14()
  1073. {
  1074. int a[] = { 0, 1, 2 };
  1075. auto ai = std::cbegin(a);
  1076. int b[] = { 2, 1, 0 };
  1077. auto bi = std::cend(b);
  1078. return *ai + *(bi - 1);
  1079. }
  1080. #else
  1081. int check_cxx14()
  1082. {
  1083. return 0;
  1084. }
  1085. #endif
  1086. #if (__cplusplus >= 201703L || defined(__INTEL_COMPILER) && defined(__cpp_deduction_guides))
  1087. #include <optional>
  1088. template <typename T,
  1089. typename std::invoke_result<decltype(&T::get), T>::type = nullptr>
  1090. typename T::pointer get_ptr(T& item)
  1091. {
  1092. return item.get();
  1093. }
  1094. int check_cxx17()
  1095. {
  1096. // Intel compiler do not handle correctly 'decltype' inside 'invoke_result'
  1097. std::unique_ptr<int> u(new int(0));
  1098. get_ptr(u);
  1099. std::optional<int> oi = 0;
  1100. return oi.value();
  1101. }
  1102. #else
  1103. int check_cxx17()
  1104. {
  1105. return 0;
  1106. }
  1107. #endif
  1108. class Class
  1109. {
  1110. public:
  1111. int Get() const { return this->Member; }
  1112. private:
  1113. int Member = 1;
  1114. };
  1115. int main()
  1116. {
  1117. auto const c = std::unique_ptr<Class>(new Class);
  1118. std::cout << c->Get() << check_cxx14() << check_cxx17() << std::endl;
  1119. return 0;
  1120. }
  1121. ' > "${TMPFILE}.cxx"
  1122. for std in 17 14 11; do
  1123. std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
  1124. for compiler in ${cmake_cxx_compilers}; do
  1125. for std_flag in '' $std_flags; do
  1126. for thread_flag in '' $thread_flags; do
  1127. echo "Checking whether '${compiler} ${cmake_cxx_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1
  1128. if cmake_try_run "${compiler}" "${cmake_cxx_flags} ${std_flag} ${thread_flag}" \
  1129. "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  1130. cmake_cxx_compiler="${compiler}"
  1131. cmake_cxx_flags="${cmake_cxx_flags} ${std_flag} ${thread_flag} "
  1132. break 4
  1133. fi
  1134. done
  1135. done
  1136. done
  1137. done
  1138. rm -f "${TMPFILE}.cxx"
  1139. if test -z "${cmake_cxx_compiler}"; then
  1140. cmake_error 7 "Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
  1141. Please specify one using environment variable CXX.
  1142. The C++ flags are \"$cmake_cxx_flags\".
  1143. They can be changed using the environment variable CXXFLAGS.
  1144. See cmake_bootstrap.log for compilers attempted."
  1145. fi
  1146. echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
  1147. #-----------------------------------------------------------------------------
  1148. # Test CXX features
  1149. cmake_cxx_features="make_unique"
  1150. for feature in ${cmake_cxx_features}; do
  1151. eval "cmake_have_cxx_${feature}=0"
  1152. echo "Checking whether '${cmake_cxx_compiler} ${cmake_cxx_flags}' supports '${feature}'." >> cmake_bootstrap.log 2>&1
  1153. if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags}" \
  1154. "${cmake_source_dir}/Source/Checks/cm_cxx_${feature}.cxx" >> cmake_bootstrap.log 2>&1; then
  1155. eval "cmake_have_cxx_${feature}=1"
  1156. fi
  1157. done
  1158. cmake_have_cxx_features=""
  1159. for feature in ${cmake_cxx_features}; do
  1160. feature_variable="cmake_have_cxx_${feature}"
  1161. eval "feature_value=\${${feature_variable}}"
  1162. if test "${feature_value}" -eq "1"; then
  1163. cmake_have_cxx_features="${cmake_have_cxx_features} -DCMake_HAVE_CXX_`cmake_toupper ${feature}`=${feature_value}"
  1164. fi
  1165. done
  1166. #-----------------------------------------------------------------------------
  1167. # Test Make
  1168. cmake_make_processor=
  1169. cmake_make_flags=
  1170. # If MAKE is set, use that for make processor, otherwise use list of known make
  1171. if test -n "${MAKE}"; then
  1172. cmake_make_processors="${MAKE}"
  1173. else
  1174. cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
  1175. fi
  1176. TMPFILE="`cmake_tmp_file`_dir"
  1177. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  1178. mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
  1179. cd "${cmake_bootstrap_dir}/${TMPFILE}"
  1180. echo '
  1181. test: test.c
  1182. "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
  1183. '>"Makefile"
  1184. echo '
  1185. #include <stdio.h>
  1186. int main(){ printf("1%c", (char)0x0a); return 0; }
  1187. ' > "test.c"
  1188. cmake_original_make_flags="${cmake_make_flags}"
  1189. if test "x${cmake_parallel_make}" != "x"; then
  1190. cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
  1191. fi
  1192. for a in ${cmake_make_processors}; do
  1193. if test -z "${cmake_make_processor}" && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
  1194. cmake_make_processor="${a}"
  1195. fi
  1196. done
  1197. cmake_full_make_flags="${cmake_make_flags}"
  1198. if test "x${cmake_original_make_flags}" != "x${cmake_make_flags}"; then
  1199. if test -z "${cmake_make_processor}"; then
  1200. cmake_make_flags="${cmake_original_make_flags}"
  1201. for a in ${cmake_make_processors}; do
  1202. if test -z "${cmake_make_processor}" && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
  1203. cmake_make_processor="${a}"
  1204. fi
  1205. done
  1206. fi
  1207. fi
  1208. cd "${cmake_bootstrap_dir}"
  1209. if test -z "${cmake_make_processor}"; then
  1210. cmake_error 8 "Cannot find appropriate Makefile processor on this system.
  1211. Please specify one using environment variable MAKE."
  1212. fi
  1213. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  1214. echo "Makefile processor on this system is: ${cmake_make_processor}"
  1215. if test "x${cmake_full_make_flags}" != "x${cmake_make_flags}"; then
  1216. echo "---------------------------------------------"
  1217. echo "Makefile processor ${cmake_make_processor} does not support parallel build"
  1218. echo "---------------------------------------------"
  1219. fi
  1220. # Test for kwsys features
  1221. KWSYS_NAME_IS_KWSYS=0
  1222. KWSYS_BUILD_SHARED=0
  1223. KWSYS_LFS_AVAILABLE=0
  1224. KWSYS_LFS_REQUESTED=0
  1225. KWSYS_STL_HAS_WSTRING=0
  1226. KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=0
  1227. KWSYS_CXX_HAS_SETENV=0
  1228. KWSYS_CXX_HAS_UNSETENV=0
  1229. KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0
  1230. KWSYS_CXX_HAS_UTIMENSAT=0
  1231. KWSYS_CXX_HAS_UTIMES=0
  1232. KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP=1
  1233. if cmake_try_run "${cmake_cxx_compiler}" \
  1234. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_SETENV" \
  1235. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1236. KWSYS_CXX_HAS_SETENV=1
  1237. echo "${cmake_cxx_compiler} has setenv"
  1238. else
  1239. echo "${cmake_cxx_compiler} does not have setenv"
  1240. fi
  1241. if cmake_try_run "${cmake_cxx_compiler}" \
  1242. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_UNSETENV" \
  1243. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1244. KWSYS_CXX_HAS_UNSETENV=1
  1245. echo "${cmake_cxx_compiler} has unsetenv"
  1246. else
  1247. echo "${cmake_cxx_compiler} does not have unsetenv"
  1248. fi
  1249. if cmake_try_run "${cmake_cxx_compiler}" \
  1250. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H" \
  1251. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1252. KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=1
  1253. echo "${cmake_cxx_compiler} has environ in stdlib.h"
  1254. else
  1255. echo "${cmake_cxx_compiler} does not have environ in stdlib.h"
  1256. fi
  1257. if cmake_try_run "${cmake_cxx_compiler}" \
  1258. "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_WSTRING" \
  1259. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1260. KWSYS_STL_HAS_WSTRING=1
  1261. echo "${cmake_cxx_compiler} has stl wstring"
  1262. else
  1263. echo "${cmake_cxx_compiler} does not have stl wstring"
  1264. fi
  1265. if cmake_try_run "${cmake_cxx_compiler}" \
  1266. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H" \
  1267. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1268. KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=1
  1269. echo "${cmake_cxx_compiler} has <ext/stdio_filebuf.h>"
  1270. else
  1271. echo "${cmake_cxx_compiler} does not have <ext/stdio_filebuf.h>"
  1272. fi
  1273. if test -n "${cmake_ccache_enabled}"; then
  1274. echo "Building CMake with ccache"
  1275. cmake_c_compiler="ccache ${cmake_c_compiler}"
  1276. cmake_cxx_compiler="ccache ${cmake_cxx_compiler}"
  1277. fi
  1278. # Just to be safe, let us store compiler and flags to the header file
  1279. cmake_bootstrap_version='$Revision$'
  1280. cmake_compiler_settings_comment="/*
  1281. * Generated by ${cmake_source_dir}/bootstrap
  1282. * Version: ${cmake_bootstrap_version}
  1283. *
  1284. * Source directory: ${cmake_source_dir}
  1285. * Binary directory: ${cmake_bootstrap_dir}
  1286. *
  1287. * C compiler: ${cmake_c_compiler}
  1288. * C flags: ${cmake_c_flags}
  1289. *
  1290. * C++ compiler: ${cmake_cxx_compiler}
  1291. * C++ flags: ${cmake_cxx_flags}
  1292. *
  1293. * Make: ${cmake_make_processor}
  1294. *
  1295. * Sources:
  1296. * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
  1297. * STD Sources:
  1298. * ${CMAKE_STD_CXX_HEADERS} ${CMAKE_STD_CXX_SOURCES}
  1299. * LexerParser Sources:
  1300. * ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES}
  1301. * kwSys Sources:
  1302. * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
  1303. * libuv Sources:
  1304. * ${LIBUV_C_SOURCES}
  1305. */
  1306. "
  1307. cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}"
  1308. # When bootstrapping on MinGW with MSYS we must convert the source
  1309. # directory to a windows path.
  1310. if ${cmake_system_mingw}; then
  1311. CMAKE_BOOTSTRAP_SOURCE_DIR=`cd "${cmake_source_dir}"; pwd -W`
  1312. CMAKE_BOOTSTRAP_BINARY_DIR=`cd "${cmake_binary_dir}"; pwd -W`
  1313. else
  1314. CMAKE_BOOTSTRAP_SOURCE_DIR="${cmake_source_dir}"
  1315. CMAKE_BOOTSTRAP_BINARY_DIR="${cmake_binary_dir}"
  1316. fi
  1317. # Write CMake version
  1318. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
  1319. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
  1320. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
  1321. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
  1322. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_SOURCE_DIR \"${CMAKE_BOOTSTRAP_SOURCE_DIR}\""
  1323. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_BOOTSTRAP_BINARY_DIR}\""
  1324. cmake_report cmConfigure.h${_tmp} "#define CMake_DEFAULT_RECURSION_LIMIT 400"
  1325. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\""
  1326. cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
  1327. cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH"
  1328. if ${cmake_system_mingw}; then
  1329. cmake_report cmConfigure.h${_tmp} "#if defined(_WIN32) && !defined(NOMINMAX)"
  1330. cmake_report cmConfigure.h${_tmp} "# define NOMINMAX"
  1331. cmake_report cmConfigure.h${_tmp} "#endif"
  1332. fi
  1333. # Regenerate configured headers
  1334. for h in Configure VersionConfig; do
  1335. if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then
  1336. rm -f cm${h}.h${_tmp}
  1337. else
  1338. mv -f cm${h}.h${_tmp} cm${h}.h
  1339. fi
  1340. done
  1341. # Prepare KWSYS
  1342. cmake_kwsys_config_replace_string \
  1343. "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
  1344. "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
  1345. "${cmake_compiler_settings_comment}"
  1346. cmake_kwsys_config_replace_string \
  1347. "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
  1348. "${cmake_bootstrap_dir}/cmsys/Configure.h" \
  1349. "${cmake_compiler_settings_comment}"
  1350. for a in ${KWSYS_FILES}; do
  1351. cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
  1352. "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
  1353. done
  1354. cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" ""
  1355. # Generate Makefile
  1356. dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.hxx `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
  1357. for h in ${CMAKE_STD_CXX_HEADERS}; do
  1358. dep="${dep} `cmake_escape \"${cmake_source_dir}\"`/Utilities/std/cm/${h}"
  1359. done
  1360. objs=""
  1361. 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
  1362. objs="${objs} ${a}.o"
  1363. done
  1364. for a in ${LIBUV_C_SOURCES}; do
  1365. objs="${objs} uv-`cmake_obj ${a}`"
  1366. done
  1367. libs=""
  1368. uv_c_flags=""
  1369. if ${cmake_system_mingw}; then
  1370. uv_c_flags="${uv_c_flags} -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600"
  1371. libs="${libs} -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv -lole32 -loleaut32"
  1372. else
  1373. case "${cmake_system}" in
  1374. *AIX*)
  1375. uv_c_flags="${uv_c_flags} -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT"
  1376. libs="${libs} -lperfstat"
  1377. ;;
  1378. *Darwin*)
  1379. uv_c_flags="${uv_c_flags} -D_DARWIN_USE_64_BIT_INODE=1 -D_DARWIN_UNLIMITED_SELECT=1"
  1380. ;;
  1381. *HP-UX*)
  1382. uv_c_flags="${uv_c_flags} -D_XOPEN_SOURCE_EXTENDED"
  1383. ;;
  1384. *Linux*)
  1385. uv_c_flags="${uv_c_flags} -D_GNU_SOURCE"
  1386. libs="${libs} -ldl -lrt"
  1387. ;;
  1388. *kFreeBSD*)
  1389. libs="${libs} -lkvm -lfreebsd-glue"
  1390. ;;
  1391. *BSD*)
  1392. libs="${libs} -lkvm"
  1393. ;;
  1394. *SunOS*)
  1395. # Normally libuv uses '-D_XOPEN_SOURCE=500 -std=c90' on Solaris 5.10,
  1396. # but we do not need to do that because we bootstrap using POSIX APIs.
  1397. uv_c_flags="${uv_c_flags} -D__EXTENSIONS__ -D_XOPEN_SOURCE=600"
  1398. libs="${libs} -lkstat -lnsl -lsendfile -lsocket -lrt"
  1399. ;;
  1400. esac
  1401. fi
  1402. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/include"`"
  1403. if ${cmake_system_mingw}; then
  1404. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src/win"`"
  1405. else
  1406. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src/unix"`"
  1407. fi
  1408. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src"`"
  1409. if test "x${cmake_ansi_cxx_flags}" != "x"; then
  1410. cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
  1411. fi
  1412. if test "x${cmake_c_flags}" != "x"; then
  1413. cmake_c_flags="${cmake_c_flags} "
  1414. fi
  1415. if test "x${cmake_cxx_flags}" != "x"; then
  1416. cmake_cxx_flags="${cmake_cxx_flags} "
  1417. fi
  1418. cmake_c_flags_String="-DKWSYS_STRING_C"
  1419. if ${cmake_system_mingw}; then
  1420. cmake_c_flags_EncodingC="-DKWSYS_ENCODING_DEFAULT_CODEPAGE=CP_ACP"
  1421. cmake_cxx_flags_EncodingCXX="${cmake_c_flags_EncodingC}"
  1422. cmake_cxx_flags_cmProcessOutput="${cmake_c_flags_EncodingC}"
  1423. fi
  1424. cmake_cxx_flags_SystemTools="
  1425. -DKWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV}
  1426. -DKWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV}
  1427. -DKWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}
  1428. -DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
  1429. -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
  1430. "
  1431. cmake_c_flags="${cmake_c_flags} \
  1432. -DCMAKE_BOOTSTRAP \
  1433. -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
  1434. -I`cmake_escape \"${cmake_source_dir}/Source\"` \
  1435. -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
  1436. -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
  1437. cmake_cxx_flags="${cmake_cxx_flags} \
  1438. -DCMAKE_BOOTSTRAP \
  1439. ${cmake_have_cxx_features} \
  1440. -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
  1441. -I`cmake_escape \"${cmake_source_dir}/Source\"` \
  1442. -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
  1443. -I`cmake_escape \"${cmake_source_dir}/Utilities/std\"` \
  1444. -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
  1445. echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
  1446. echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} ${libs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
  1447. for a in ${CMAKE_CXX_SOURCES}; do
  1448. src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
  1449. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1450. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1451. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1452. done
  1453. for a in ${CMAKE_C_SOURCES}; do
  1454. src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
  1455. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1456. echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1457. done
  1458. for a in ${CMAKE_STD_CXX_SOURCES}; do
  1459. src=`cmake_escape "${cmake_source_dir}/Utilities/std/cm/bits/${a}.cxx"`
  1460. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1461. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1462. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1463. done
  1464. for a in ${LexerParser_CXX_SOURCES}; do
  1465. src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.cxx"`
  1466. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1467. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1468. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1469. done
  1470. for a in ${LexerParser_C_SOURCES}; do
  1471. src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.c"`
  1472. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1473. echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1474. done
  1475. for a in ${KWSYS_C_SOURCES}; do
  1476. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
  1477. src_flags=`eval echo \\${cmake_c_flags_\${a}}`
  1478. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1479. echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1480. done
  1481. for a in ${KWSYS_CXX_SOURCES}; do
  1482. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
  1483. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1484. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1485. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1486. done
  1487. for a in ${LIBUV_C_SOURCES}; do
  1488. src=`cmake_escape "${cmake_source_dir}/Utilities/cmlibuv/${a}"`
  1489. echo "uv-`cmake_obj ${a}` : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1490. echo " ${cmake_c_compiler} ${cmake_c_flags} ${uv_c_flags} -c ${src} -o uv-`cmake_obj ${a}`" >> "${cmake_bootstrap_dir}/Makefile"
  1491. done
  1492. echo '
  1493. rebuild_cache:
  1494. cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
  1495. ' >> "${cmake_bootstrap_dir}/Makefile"
  1496. # Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake.
  1497. echo '
  1498. # Generated by '"${cmake_source_dir}"'/bootstrap
  1499. # Default cmake settings. These may be overridden any settings below.
  1500. set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build.") # not FORCE to preserve defaults specified elsewhere
  1501. set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
  1502. set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
  1503. set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
  1504. set (CMAKE_BIN_DIR "'"${cmake_bin_dir}"'" CACHE PATH "Install location for binaries (relative to prefix)." FORCE)
  1505. set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
  1506. set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location for XDG specific files (relative to prefix)." FORCE)
  1507. ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1508. # Add configuration settings given as command-line options.
  1509. if test "x${cmake_bootstrap_qt_gui}" != "x"; then
  1510. echo '
  1511. set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
  1512. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1513. fi
  1514. if test "x${cmake_bootstrap_qt_qmake}" != "x"; then
  1515. echo '
  1516. set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
  1517. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1518. fi
  1519. if test "x${cmake_sphinx_info}" != "x"; then
  1520. echo '
  1521. set (SPHINX_INFO "'"${cmake_sphinx_info}"'" CACHE BOOL "Build Info manual with Sphinx" FORCE)
  1522. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1523. fi
  1524. if test "x${cmake_sphinx_man}" != "x"; then
  1525. echo '
  1526. set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE BOOL "Build man pages with Sphinx" FORCE)
  1527. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1528. fi
  1529. if test "x${cmake_sphinx_html}" != "x"; then
  1530. echo '
  1531. set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE BOOL "Build html help with Sphinx" FORCE)
  1532. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1533. fi
  1534. if test "x${cmake_sphinx_qthelp}" != "x"; then
  1535. echo '
  1536. set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE)
  1537. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1538. fi
  1539. if test "x${cmake_sphinx_build}" != "x"; then
  1540. echo '
  1541. set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
  1542. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1543. fi
  1544. if test "x${cmake_sphinx_flags}" != "x"; then
  1545. echo '
  1546. set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE)
  1547. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1548. fi
  1549. # Add user-specified settings. Handle relative-path case for
  1550. # specification of cmake_init_file.
  1551. (
  1552. cd "${cmake_binary_dir}"
  1553. if test -f "${cmake_init_file}"; then
  1554. cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1555. fi
  1556. )
  1557. echo "---------------------------------------------"
  1558. # Run make to build bootstrap cmake
  1559. if test "x${cmake_parallel_make}" != "x"; then
  1560. ${cmake_make_processor} ${cmake_make_flags}
  1561. else
  1562. ${cmake_make_processor}
  1563. fi
  1564. RES=$?
  1565. if test "${RES}" -ne "0"; then
  1566. cmake_error 9 "Problem while running ${cmake_make_processor}"
  1567. fi
  1568. cd "${cmake_binary_dir}"
  1569. # Set C, CXX, and MAKE environment variables, so that real real cmake will be
  1570. # build with same compiler and make
  1571. CC="${cmake_c_compiler}"
  1572. CXX="${cmake_cxx_compiler}"
  1573. MAKE="${cmake_make_processor}"
  1574. export CC
  1575. export CXX
  1576. export MAKE
  1577. export CFLAGS
  1578. export CXXFLAGS
  1579. export LDFLAGS
  1580. # Run bootstrap CMake to configure real CMake
  1581. cmake_options="-DCMAKE_BOOTSTRAP=1"
  1582. if test -n "${cmake_verbose}"; then
  1583. cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
  1584. fi
  1585. "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@"
  1586. RES=$?
  1587. if test "${RES}" -ne "0"; then
  1588. cmake_error 11 "Problem while running initial CMake"
  1589. fi
  1590. echo "---------------------------------------------"
  1591. # And we are done. Now just run make
  1592. echo "CMake has bootstrapped. Now run ${cmake_make_processor}."