bootstrap 55 KB

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