bootstrap 52 KB

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