bootstrap 47 KB

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