bootstrap 52 KB

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