bootstrap 57 KB

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