bootstrap 52 KB

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