bootstrap 46 KB

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