bootstrap 47 KB

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