bootstrap 53 KB

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