bootstrap 49 KB

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