bootstrap 49 KB

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