bootstrap 47 KB

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