bootstrap 55 KB

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