bootstrap 48 KB

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