bootstrap 54 KB

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