bootstrap 47 KB

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