bootstrap 48 KB

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