bootstrap 47 KB

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