bootstrap 49 KB

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