bootstrap 58 KB

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