bootstrap 52 KB

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