bootstrap 53 KB

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