bootstrap 48 KB

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