bootstrap 47 KB

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