bootstrap 52 KB

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