bootstrap 57 KB

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