bootstrap 56 KB

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