bootstrap 49 KB

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