bootstrap 51 KB

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