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