bootstrap 53 KB

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