bootstrap 42 KB

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