bootstrap 47 KB

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