bootstrap 49 KB

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