bootstrap 52 KB

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