bootstrap 46 KB

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