bootstrap 49 KB

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