bootstrap 48 KB

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