bootstrap 57 KB

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