bootstrap 46 KB

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