bootstrap 55 KB

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