bootstrap 52 KB

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