bootstrap 54 KB

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