bootstrap 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528
  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 exist compiler flags, set them
  775. cmake_c_flags=${CFLAGS}
  776. cmake_cxx_flags=${CXXFLAGS}
  777. cmake_ld_flags=${LDFLAGS}
  778. # Add Cygwin-specific flags
  779. if ${cmake_system_cygwin}; then
  780. cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
  781. fi
  782. # Add CoreFoundation framework on Darwin
  783. if ${cmake_system_darwin}; then
  784. cmake_ld_flags="${LDFLAGS} -framework CoreFoundation"
  785. fi
  786. # Add BeOS toolkits...
  787. if ${cmake_system_beos}; then
  788. cmake_ld_flags="${LDFLAGS} -lroot -lbe"
  789. fi
  790. # Add Haiku toolkits...
  791. if ${cmake_system_haiku}; then
  792. cmake_ld_flags="${LDFLAGS} -lroot -lbe"
  793. fi
  794. # Workaround for short jump tables on PA-RISC
  795. if ${cmake_machine_parisc}; then
  796. if ${cmake_c_compiler_is_gnu}; then
  797. cmake_c_flags="${CFLAGS} -mlong-calls"
  798. fi
  799. if ${cmake_cxx_compiler_is_gnu}; then
  800. cmake_cxx_flags="${CXXFLAGS} -mlong-calls"
  801. fi
  802. fi
  803. #-----------------------------------------------------------------------------
  804. # Detect known toolchains on some platforms.
  805. cmake_toolchains=''
  806. case "${cmake_system}" in
  807. *AIX*) cmake_toolchains='XL GNU' ;;
  808. *CYGWIN*) cmake_toolchains='GNU' ;;
  809. *Darwin*) cmake_toolchains='Clang GNU' ;;
  810. *Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;;
  811. *MINGW*) cmake_toolchains='GNU' ;;
  812. esac
  813. # Toolchain compiler name table.
  814. cmake_toolchain_Clang_CC='clang'
  815. cmake_toolchain_Clang_CXX='clang++'
  816. cmake_toolchain_GNU_CC='gcc'
  817. cmake_toolchain_GNU_CXX='g++'
  818. cmake_toolchain_PGI_CC='pgcc'
  819. cmake_toolchain_PGI_CXX='pgCC'
  820. cmake_toolchain_PathScale_CC='pathcc'
  821. cmake_toolchain_PathScale_CXX='pathCC'
  822. cmake_toolchain_XL_CC='xlc'
  823. cmake_toolchain_XL_CXX='xlC'
  824. cmake_toolchain_try()
  825. {
  826. tc="$1"
  827. TMPFILE=`cmake_tmp_file`
  828. eval "tc_CC=\${cmake_toolchain_${tc}_CC}"
  829. echo 'int main() { return 0; }' > "${TMPFILE}.c"
  830. cmake_try_run "$tc_CC" "" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1
  831. tc_result_CC="$?"
  832. rm -f "${TMPFILE}.c"
  833. test "${tc_result_CC}" = "0" || return 1
  834. eval "tc_CXX=\${cmake_toolchain_${tc}_CXX}"
  835. echo 'int main() { return 0; }' > "${TMPFILE}.cpp"
  836. cmake_try_run "$tc_CXX" "" "${TMPFILE}.cpp" >> cmake_bootstrap.log 2>&1
  837. tc_result_CXX="$?"
  838. rm -f "${TMPFILE}.cpp"
  839. test "${tc_result_CXX}" = "0" || return 1
  840. cmake_toolchain="$tc"
  841. }
  842. cmake_toolchain_detect()
  843. {
  844. cmake_toolchain=
  845. for tc in ${cmake_toolchains}; do
  846. echo "Checking for $tc toolchain" >> cmake_bootstrap.log 2>&1
  847. cmake_toolchain_try "$tc" &&
  848. echo "Found $tc toolchain" &&
  849. break
  850. done
  851. }
  852. if [ -z "${CC}" -a -z "${CXX}" ]; then
  853. cmake_toolchain_detect
  854. fi
  855. #-----------------------------------------------------------------------------
  856. # Test C compiler
  857. cmake_c_compiler=
  858. # If CC is set, use that for compiler, otherwise use list of known compilers
  859. if [ -n "${cmake_toolchain}" ]; then
  860. eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
  861. elif [ -n "${CC}" ]; then
  862. cmake_c_compilers="${CC}"
  863. else
  864. cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
  865. fi
  866. # Check if C compiler works
  867. TMPFILE=`cmake_tmp_file`
  868. echo '
  869. #ifdef __cplusplus
  870. # error "The CMAKE_C_COMPILER is set to a C++ compiler"
  871. #endif
  872. #include<stdio.h>
  873. #if defined(__CLASSIC_C__)
  874. int main(argc, argv)
  875. int argc;
  876. char* argv[];
  877. #else
  878. int main(int argc, char* argv[])
  879. #endif
  880. {
  881. printf("%d%c", (argv != 0), (char)0x0a);
  882. return argc-1;
  883. }
  884. ' > "${TMPFILE}.c"
  885. for a in ${cmake_c_compilers}; do
  886. if [ -z "${cmake_c_compiler}" ] && \
  887. cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  888. cmake_c_compiler="${a}"
  889. fi
  890. done
  891. for std in 11 99 90; do
  892. try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`"
  893. for flag in $try_flags; do
  894. echo "Checking whether ${cmake_c_compiler} supports ${flag}" >> cmake_bootstrap.log 2>&1
  895. if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags} ${flag}" \
  896. "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  897. cmake_c_flags="${cmake_c_flags} ${flag}"
  898. break 2
  899. fi
  900. done
  901. done
  902. rm -f "${TMPFILE}.c"
  903. if [ -z "${cmake_c_compiler}" ]; then
  904. cmake_error 6 "Cannot find appropriate C compiler on this system.
  905. Please specify one using environment variable CC.
  906. See cmake_bootstrap.log for compilers attempted.
  907. "
  908. fi
  909. echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
  910. #-----------------------------------------------------------------------------
  911. # Test CXX compiler
  912. cmake_cxx_compiler=
  913. # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
  914. # If CC is set, use that for compiler, otherwise use list of known compilers
  915. if [ -n "${cmake_toolchain}" ]; then
  916. eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
  917. elif [ -n "${CXX}" ]; then
  918. cmake_cxx_compilers="${CXX}"
  919. else
  920. cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
  921. fi
  922. # Check if C++ compiler works
  923. TMPFILE=`cmake_tmp_file`
  924. echo '
  925. #if defined(TEST1)
  926. # include <iostream>
  927. #else
  928. # include <iostream.h>
  929. #endif
  930. #if __cplusplus >= 201103L && defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
  931. #error "SunPro <= 5.13 C++ 11 mode not supported due to bug in move semantics."
  932. #endif
  933. class NeedCXX
  934. {
  935. public:
  936. NeedCXX() { this->Foo = 1; }
  937. int GetFoo() { return this->Foo; }
  938. private:
  939. int Foo;
  940. };
  941. int main()
  942. {
  943. NeedCXX c;
  944. #ifdef TEST3
  945. cout << c.GetFoo() << endl;
  946. #else
  947. std::cout << c.GetFoo() << std::endl;
  948. #endif
  949. return 0;
  950. }
  951. ' > "${TMPFILE}.cxx"
  952. for a in ${cmake_cxx_compilers}; do
  953. for b in 1 2 3; do
  954. if [ -z "${cmake_cxx_compiler}" ] && \
  955. cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  956. cmake_cxx_compiler="${a}"
  957. fi
  958. done
  959. done
  960. for std in 14 11 98; do
  961. try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
  962. for flag in $try_flags; do
  963. echo "Checking for wheter ${cmake_cxx_flags} supports ${flag}" >> cmake_bootstrap.log 2>&1
  964. if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags} ${flag} -DTEST1" \
  965. "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  966. cmake_cxx_flags="${cmake_cxx_flags} ${flag} "
  967. break 2
  968. fi
  969. done
  970. done
  971. rm -f "${TMPFILE}.cxx"
  972. if [ -z "${cmake_cxx_compiler}" ]; then
  973. cmake_error 7 "Cannot find appropriate C++ compiler on this system.
  974. Please specify one using environment variable CXX.
  975. See cmake_bootstrap.log for compilers attempted."
  976. fi
  977. echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
  978. #-----------------------------------------------------------------------------
  979. # Test Make
  980. cmake_make_processor=
  981. cmake_make_flags=
  982. # If MAKE is set, use that for make processor, otherwise use list of known make
  983. if [ -n "${MAKE}" ]; then
  984. cmake_make_processors="${MAKE}"
  985. else
  986. cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
  987. fi
  988. TMPFILE="`cmake_tmp_file`_dir"
  989. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  990. mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
  991. cd "${cmake_bootstrap_dir}/${TMPFILE}"
  992. echo '
  993. test: test.c
  994. "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
  995. '>"Makefile"
  996. echo '
  997. #include <stdio.h>
  998. int main(){ printf("1%c", (char)0x0a); return 0; }
  999. ' > "test.c"
  1000. cmake_original_make_flags="${cmake_make_flags}"
  1001. if [ "x${cmake_parallel_make}" != "x" ]; then
  1002. cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
  1003. fi
  1004. for a in ${cmake_make_processors}; do
  1005. if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
  1006. cmake_make_processor="${a}"
  1007. fi
  1008. done
  1009. cmake_full_make_flags="${cmake_make_flags}"
  1010. if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
  1011. if [ -z "${cmake_make_processor}" ]; then
  1012. cmake_make_flags="${cmake_original_make_flags}"
  1013. for a in ${cmake_make_processors}; do
  1014. if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
  1015. cmake_make_processor="${a}"
  1016. fi
  1017. done
  1018. fi
  1019. fi
  1020. cd "${cmake_bootstrap_dir}"
  1021. if [ -z "${cmake_make_processor}" ]; then
  1022. cmake_error 8 "Cannot find appropriate Makefile processor on this system.
  1023. Please specify one using environment variable MAKE."
  1024. fi
  1025. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  1026. echo "Makefile processor on this system is: ${cmake_make_processor}"
  1027. if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
  1028. echo "---------------------------------------------"
  1029. echo "Makefile processor ${cmake_make_processor} does not support parallel build"
  1030. echo "---------------------------------------------"
  1031. fi
  1032. # Ok, we have CC, CXX, and MAKE.
  1033. # Test C++ compiler features
  1034. # Are we GCC?
  1035. TMPFILE=`cmake_tmp_file`
  1036. echo '
  1037. #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
  1038. #include <iostream>
  1039. int main() { std::cout << "This is GNU" << std::endl; return 0;}
  1040. #endif
  1041. ' > ${TMPFILE}.cxx
  1042. cmake_cxx_compiler_is_gnu=0
  1043. if cmake_try_run "${cmake_cxx_compiler}" \
  1044. "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  1045. cmake_cxx_compiler_is_gnu=1
  1046. fi
  1047. if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then
  1048. echo "${cmake_cxx_compiler} is GNU compiler"
  1049. else
  1050. echo "${cmake_cxx_compiler} is not GNU compiler"
  1051. fi
  1052. rm -f "${TMPFILE}.cxx"
  1053. if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
  1054. # Check for non-GNU compiler flags
  1055. # If we are on HP-UX, check for -Ae for the C compiler.
  1056. if [ "x${cmake_system}" = "xHP-UX" ]; then
  1057. cmake_test_flags="-Ae"
  1058. TMPFILE=`cmake_tmp_file`
  1059. echo '
  1060. int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
  1061. ' > ${TMPFILE}.c
  1062. cmake_need_Ae=0
  1063. if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  1064. :
  1065. else
  1066. if cmake_try_run "${cmake_c_compiler}" \
  1067. "${cmake_c_flags} ${cmake_test_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  1068. cmake_need_Ae=1
  1069. fi
  1070. fi
  1071. if [ "x${cmake_need_Ae}" = "x1" ]; then
  1072. cmake_c_flags="${cmake_c_flags} ${cmake_test_flags}"
  1073. echo "${cmake_c_compiler} needs ${cmake_test_flags}"
  1074. else
  1075. echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
  1076. fi
  1077. rm -f "${TMPFILE}.c"
  1078. echo '
  1079. #include <iostream>
  1080. int main(int argc, char** argv) {
  1081. for(int i=0; i < 1; ++i);
  1082. for(int i=0; i < 1; ++i);
  1083. (void)argc; (void)argv; return 0; }
  1084. ' > ${TMPFILE}.cxx
  1085. cmake_need_AAstd98=0
  1086. cmake_test_flags="-AA +hpxstd98"
  1087. if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  1088. :
  1089. else
  1090. if cmake_try_run "${cmake_cxx_compiler}" \
  1091. "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  1092. cmake_need_AAstd98=1
  1093. fi
  1094. fi
  1095. if [ "x${cmake_need_AAstd98}" = "x1" ]; then
  1096. cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
  1097. echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
  1098. else
  1099. echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
  1100. fi
  1101. fi
  1102. cmake_test_flags=
  1103. fi
  1104. # Test for kwsys features
  1105. KWSYS_NAME_IS_KWSYS=0
  1106. KWSYS_BUILD_SHARED=0
  1107. KWSYS_LFS_AVAILABLE=0
  1108. KWSYS_LFS_REQUESTED=0
  1109. KWSYS_STL_HAS_WSTRING=0
  1110. KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=0
  1111. KWSYS_CXX_HAS_SETENV=0
  1112. KWSYS_CXX_HAS_UNSETENV=0
  1113. KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0
  1114. KWSYS_CXX_HAS_UTIMENSAT=0
  1115. KWSYS_CXX_HAS_UTIMES=0
  1116. if cmake_try_run "${cmake_cxx_compiler}" \
  1117. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_SETENV" \
  1118. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1119. KWSYS_CXX_HAS_SETENV=1
  1120. echo "${cmake_cxx_compiler} has setenv"
  1121. else
  1122. echo "${cmake_cxx_compiler} does not have setenv"
  1123. fi
  1124. if cmake_try_run "${cmake_cxx_compiler}" \
  1125. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_UNSETENV" \
  1126. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1127. KWSYS_CXX_HAS_UNSETENV=1
  1128. echo "${cmake_cxx_compiler} has unsetenv"
  1129. else
  1130. echo "${cmake_cxx_compiler} does not have unsetenv"
  1131. fi
  1132. if cmake_try_run "${cmake_cxx_compiler}" \
  1133. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H" \
  1134. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1135. KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=1
  1136. echo "${cmake_cxx_compiler} has environ in stdlib.h"
  1137. else
  1138. echo "${cmake_cxx_compiler} does not have environ in stdlib.h"
  1139. fi
  1140. if cmake_try_run "${cmake_cxx_compiler}" \
  1141. "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_WSTRING" \
  1142. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1143. KWSYS_STL_HAS_WSTRING=1
  1144. echo "${cmake_cxx_compiler} has stl wstring"
  1145. else
  1146. echo "${cmake_cxx_compiler} does not have stl wstring"
  1147. fi
  1148. if cmake_try_run "${cmake_cxx_compiler}" \
  1149. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H" \
  1150. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1151. KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=1
  1152. echo "${cmake_cxx_compiler} has <ext/stdio_filebuf.h>"
  1153. else
  1154. echo "${cmake_cxx_compiler} does not have <ext/stdio_filebuf.h>"
  1155. fi
  1156. # Just to be safe, let us store compiler and flags to the header file
  1157. cmake_bootstrap_version='$Revision$'
  1158. cmake_compiler_settings_comment="/*
  1159. * Generated by ${cmake_source_dir}/bootstrap
  1160. * Version: ${cmake_bootstrap_version}
  1161. *
  1162. * Source directory: ${cmake_source_dir}
  1163. * Binary directory: ${cmake_bootstrap_dir}
  1164. *
  1165. * C compiler: ${cmake_c_compiler}
  1166. * C flags: ${cmake_c_flags}
  1167. *
  1168. * C++ compiler: ${cmake_cxx_compiler}
  1169. * C++ flags: ${cmake_cxx_flags}
  1170. *
  1171. * Make: ${cmake_make_processor}
  1172. *
  1173. * Sources:
  1174. * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
  1175. * LexerParser Sources:
  1176. * ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES}
  1177. * kwSys Sources:
  1178. * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
  1179. */
  1180. "
  1181. cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}"
  1182. # When bootstrapping on MinGW with MSYS we must convert the source
  1183. # directory to a windows path.
  1184. if ${cmake_system_mingw}; then
  1185. CMAKE_BOOTSTRAP_SOURCE_DIR=`cd "${cmake_source_dir}"; pwd -W`
  1186. CMAKE_BOOTSTRAP_BINARY_DIR=`cd "${cmake_binary_dir}"; pwd -W`
  1187. else
  1188. CMAKE_BOOTSTRAP_SOURCE_DIR="${cmake_source_dir}"
  1189. CMAKE_BOOTSTRAP_BINARY_DIR="${cmake_binary_dir}"
  1190. fi
  1191. # Write CMake version
  1192. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
  1193. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
  1194. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
  1195. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
  1196. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_SOURCE_DIR \"${CMAKE_BOOTSTRAP_SOURCE_DIR}\""
  1197. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_BOOTSTRAP_BINARY_DIR}\""
  1198. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\""
  1199. cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
  1200. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
  1201. cmake_report cmConfigure.h${_tmp} "#define CM_EQ_DELETE"
  1202. cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH"
  1203. cmake_report cmConfigure.h${_tmp} "#define CM_NULLPTR 0"
  1204. cmake_report cmConfigure.h${_tmp} "#define CM_OVERRIDE"
  1205. cmake_report cmConfigure.h${_tmp} "#define CM_DISABLE_COPY(Class)"
  1206. # Regenerate configured headers
  1207. for h in Configure VersionConfig; do
  1208. if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then
  1209. rm -f cm${h}.h${_tmp}
  1210. else
  1211. mv -f cm${h}.h${_tmp} cm${h}.h
  1212. fi
  1213. done
  1214. # Prepare KWSYS
  1215. cmake_kwsys_config_replace_string \
  1216. "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
  1217. "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
  1218. "${cmake_compiler_settings_comment}"
  1219. cmake_kwsys_config_replace_string \
  1220. "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
  1221. "${cmake_bootstrap_dir}/cmsys/Configure.h" \
  1222. "${cmake_compiler_settings_comment}"
  1223. for a in ${KWSYS_FILES}; do
  1224. cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
  1225. "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
  1226. done
  1227. cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" ""
  1228. # Generate Makefile
  1229. dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
  1230. objs=""
  1231. for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
  1232. objs="${objs} ${a}.o"
  1233. done
  1234. if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
  1235. cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
  1236. fi
  1237. if [ "x${cmake_c_flags}" != "x" ]; then
  1238. cmake_c_flags="${cmake_c_flags} "
  1239. fi
  1240. if [ "x${cmake_cxx_flags}" != "x" ]; then
  1241. cmake_cxx_flags="${cmake_cxx_flags} "
  1242. fi
  1243. cmake_c_flags_String="-DKWSYS_STRING_C"
  1244. if ${cmake_system_mingw}; then
  1245. cmake_c_flags_EncodingC="-DKWSYS_ENCODING_DEFAULT_CODEPAGE=CP_ACP"
  1246. cmake_cxx_flags_EncodingCXX="${cmake_c_flags_EncodingC}"
  1247. cmake_cxx_flags_cmProcessOutput="${cmake_c_flags_EncodingC}"
  1248. fi
  1249. cmake_cxx_flags_SystemTools="
  1250. -DKWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV}
  1251. -DKWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV}
  1252. -DKWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}
  1253. -DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
  1254. -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
  1255. "
  1256. cmake_c_flags="${cmake_c_flags} \
  1257. -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
  1258. -I`cmake_escape \"${cmake_source_dir}/Source\"` \
  1259. -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
  1260. -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
  1261. cmake_cxx_flags="${cmake_cxx_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. echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
  1267. echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
  1268. for a in ${CMAKE_CXX_SOURCES}; do
  1269. src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
  1270. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1271. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1272. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1273. done
  1274. for a in ${CMAKE_C_SOURCES}; do
  1275. src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
  1276. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1277. echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1278. done
  1279. for a in ${LexerParser_CXX_SOURCES}; do
  1280. src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.cxx"`
  1281. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1282. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1283. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1284. done
  1285. for a in ${LexerParser_C_SOURCES}; do
  1286. src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.c"`
  1287. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1288. echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1289. done
  1290. for a in ${KWSYS_C_SOURCES}; do
  1291. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
  1292. src_flags=`eval echo \\${cmake_c_flags_\${a}}`
  1293. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1294. echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1295. done
  1296. for a in ${KWSYS_CXX_SOURCES}; do
  1297. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
  1298. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1299. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1300. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1301. done
  1302. echo '
  1303. rebuild_cache:
  1304. cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
  1305. ' >> "${cmake_bootstrap_dir}/Makefile"
  1306. # Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake.
  1307. echo '
  1308. # Generated by '"${cmake_source_dir}"'/bootstrap
  1309. # Default cmake settings. These may be overridden any settings below.
  1310. set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
  1311. set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
  1312. set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
  1313. set (CMAKE_BIN_DIR "'"${cmake_bin_dir}"'" CACHE PATH "Install location for binaries (relative to prefix)." FORCE)
  1314. set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
  1315. set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location for XDG specific files (relative to prefix)." FORCE)
  1316. ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1317. # Add configuration settings given as command-line options.
  1318. if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then
  1319. echo '
  1320. set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
  1321. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1322. fi
  1323. if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then
  1324. echo '
  1325. set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
  1326. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1327. fi
  1328. if [ "x${cmake_bootstrap_server}" != "x" ]; then
  1329. echo '
  1330. set (CMake_ENABLE_SERVER_MODE '"${cmake_bootstrap_server}"' CACHE BOOL "Enable server mode" FORCE)
  1331. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1332. fi
  1333. if [ "x${cmake_sphinx_man}" != "x" ]; then
  1334. echo '
  1335. set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE BOOL "Build man pages with Sphinx" FORCE)
  1336. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1337. fi
  1338. if [ "x${cmake_sphinx_html}" != "x" ]; then
  1339. echo '
  1340. set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE BOOL "Build html help with Sphinx" FORCE)
  1341. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1342. fi
  1343. if [ "x${cmake_sphinx_qthelp}" != "x" ]; then
  1344. echo '
  1345. set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE)
  1346. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1347. fi
  1348. if [ "x${cmake_sphinx_build}" != "x" ]; then
  1349. echo '
  1350. set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
  1351. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1352. fi
  1353. if [ "x${cmake_sphinx_flags}" != "x" ]; then
  1354. echo '
  1355. set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE)
  1356. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1357. fi
  1358. # Add user-specified settings. Handle relative-path case for
  1359. # specification of cmake_init_file.
  1360. (
  1361. cd "${cmake_binary_dir}"
  1362. if [ -f "${cmake_init_file}" ]; then
  1363. cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1364. fi
  1365. )
  1366. echo "---------------------------------------------"
  1367. # Run make to build bootstrap cmake
  1368. if [ "x${cmake_parallel_make}" != "x" ]; then
  1369. ${cmake_make_processor} ${cmake_make_flags}
  1370. else
  1371. ${cmake_make_processor}
  1372. fi
  1373. RES=$?
  1374. if [ "${RES}" -ne "0" ]; then
  1375. cmake_error 9 "Problem while running ${cmake_make_processor}"
  1376. fi
  1377. cd "${cmake_binary_dir}"
  1378. # Set C, CXX, and MAKE environment variables, so that real real cmake will be
  1379. # build with same compiler and make
  1380. CC="${cmake_c_compiler}"
  1381. CXX="${cmake_cxx_compiler}"
  1382. if [ -n "${cmake_ccache_enabled}" ]; then
  1383. CC="ccache ${CC}"
  1384. CXX="ccache ${CXX}"
  1385. fi
  1386. MAKE="${cmake_make_processor}"
  1387. export CC
  1388. export CXX
  1389. export MAKE
  1390. # Run bootstrap CMake to configure real CMake
  1391. cmake_options="-DCMAKE_BOOTSTRAP=1"
  1392. if [ -n "${cmake_verbose}" ]; then
  1393. cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
  1394. fi
  1395. "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@"
  1396. RES=$?
  1397. if [ "${RES}" -ne "0" ]; then
  1398. cmake_error 11 "Problem while running initial CMake"
  1399. fi
  1400. echo "---------------------------------------------"
  1401. # And we are done. Now just run make
  1402. echo "CMake has bootstrapped. Now run ${cmake_make_processor}."