bootstrap 47 KB

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