bootstrap 49 KB

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