bootstrap 47 KB

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