bootstrap 47.3 KB
Newer Older
1
#!/bin/sh
2 3 4
#=============================================================================
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5
#
6 7
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
8
#
9 10 11 12
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
13

14 15 16 17 18 19 20 21
# Version number extraction function.
cmake_version_component()
{
  cat "${cmake_source_dir}/CMakeLists.txt" | sed -n "
/^SET(CMake_VERSION_${1}/ {s/SET(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
"
}

22 23 24 25 26 27 28
cmake_date_stamp_component()
{
  cat "${cmake_source_dir}/Source/kwsys/kwsysDateStamp.cmake" | sed -n "
/KWSYS_DATE_STAMP_${1}/  {s/^.* \([0-9][0-9]*\))$/\1/;p;}
"
}

29 30
# Detect system and directory information.
cmake_system=`uname`
31
cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
32
cmake_binary_dir=`pwd`
33 34
cmake_version_major="`cmake_version_component MAJOR`"
cmake_version_minor="`cmake_version_component MINOR`"
35 36 37 38 39
if echo "${cmake_version_minor}" | grep "[0-9]*[13579]" > /dev/null 2>&1; then
  cmake_version_patch="`cmake_date_stamp_component YEAR``cmake_date_stamp_component MONTH``cmake_date_stamp_component DAY`"
else
  cmake_version_patch="`cmake_version_component PATCH`"
fi
40 41
cmake_version="${cmake_version_major}.${cmake_version_minor}"
cmake_version_full="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
42 43
cmake_data_dir="/share/cmake-${cmake_version}"
cmake_doc_dir="/doc/cmake-${cmake_version}"
44 45
cmake_man_dir="/man"
cmake_init_file=""
46
cmake_bootstrap_system_libs=""
47 48
cmake_bootstrap_qt_gui=""
cmake_bootstrap_qt_qmake=""
49

50 51 52 53 54 55 56
# Determine whether this is a Cygwin environment.
if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
  cmake_system_cygwin=true
else
  cmake_system_cygwin=false
fi

57 58 59 60 61 62 63
# Determine whether this is a MinGW environment.
if echo "${cmake_system}" | grep MINGW >/dev/null 2>&1; then
  cmake_system_mingw=true
else
  cmake_system_mingw=false
fi

64 65 66 67 68 69 70
# Determine whether this is OS X
if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then
  cmake_system_darwin=true
else
  cmake_system_darwin=false
fi

71 72 73 74 75 76 77
# Determine whether this is BeOS 
if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
  cmake_system_beos=true
else
  cmake_system_beos=false
fi

78 79 80 81 82 83 84
# Determine whether this is Haiku 
if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
  cmake_system_haiku=true
else
  cmake_system_haiku=false
fi

85 86 87 88 89 90 91
# Determine whether this is OpenVMS
if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then
  cmake_system_openvms=true
else
  cmake_system_openvms=false
fi

92 93 94 95 96 97 98 99 100
# Choose the generator to use for bootstrapping.
if ${cmake_system_mingw}; then
  # Bootstrapping from an MSYS prompt.
  cmake_bootstrap_generator="MSYS Makefiles"
else
  # Bootstrapping from a standard UNIX prompt.
  cmake_bootstrap_generator="Unix Makefiles"
fi

101 102 103 104 105 106 107 108 109 110 111 112 113 114
# Choose tools and extensions for this platform.
if ${cmake_system_openvms}; then
  _tmp="_tmp"
  _cmk="_cmk"
  _diff=`which diff`
else
  _tmp=".tmp"
  _cmk=".cmk"
  _diff="diff"
fi

# Construct bootstrap directory name.
cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}"

115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
# Helper function to fix windows paths.
cmake_fix_slashes ()
{
  echo "$1" | sed 's/\\/\//g'
}

# Choose the default install prefix.
if ${cmake_system_mingw}; then
  if [ "x${PROGRAMFILES}" != "x" ]; then
    cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
  elif [ "x${ProgramFiles}" != "x" ]; then
    cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
  elif [ "x${SYSTEMDRIVE}" != "x" ]; then
    cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
  elif [ "x${SystemDrive}" != "x" ]; then
    cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
  else
    cmake_default_prefix="c:/Program Files/CMake"
  fi
else
  cmake_default_prefix="/usr/local"
fi

138
CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
139
CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
140
CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
141

142 143 144 145 146 147 148 149 150 151 152
CMAKE_PROBLEMATIC_FILES="\
  CMakeCache.txt \
  CMakeSystem.cmake \
  CMakeCCompiler.cmake \
  CMakeCXXCompiler.cmake \
  Source/cmConfigure.h \
  Source/CTest/Curl/config.h \
  Utilities/cmexpat/expatConfig.h \
  Utilities/cmexpat/expatDllConfig.h \
  "

153 154 155 156 157 158 159 160
CMAKE_UNUSED_SOURCES="\
  cmGlobalXCodeGenerator \
  cmLocalXCodeGenerator \
  cmXCodeObject \
  cmXCode21Object \
  cmSourceGroup \
"

161
CMAKE_CXX_SOURCES="\
162 163
  cmake  \
  cmakemain \
164
  cmakewizard  \
165 166 167
  cmCommandArgumentLexer \
  cmCommandArgumentParser \
  cmCommandArgumentParserHelper \
168
  cmDefinitions \
169 170
  cmDepends \
  cmDependsC \
171 172
  cmDocumentationFormatter \
  cmDocumentationFormatterText \
173
  cmPolicies \
Ken Martin's avatar
Ken Martin committed
174 175 176 177
  cmProperty \
  cmPropertyMap \
  cmPropertyDefinition \
  cmPropertyDefinitionMap \
178 179
  cmMakeDepend \
  cmMakefile \
180 181 182
  cmExportFileGenerator \
  cmExportInstallFileGenerator \
  cmInstallDirectoryGenerator \
183
  cmGeneratedFileStream \
184
  cmGeneratorExpression \
185 186
  cmGlobalGenerator \
  cmLocalGenerator \
187
  cmInstallGenerator \
188
  cmInstallExportGenerator \
189
  cmInstallFilesGenerator \
190 191
  cmInstallScriptGenerator \
  cmInstallTargetGenerator \
192
  cmScriptGenerator \
193
  cmSourceFile \
194
  cmSourceFileLocation \
195
  cmSystemTools \
196
  cmTestGenerator \
197
  cmVersion \
198
  cmFileTimeComparison \
199 200
  cmGlobalUnixMakefileGenerator3 \
  cmLocalUnixMakefileGenerator3 \
201 202 203 204
  cmMakefileExecutableTargetGenerator \
  cmMakefileLibraryTargetGenerator \
  cmMakefileTargetGenerator \
  cmMakefileUtilityTargetGenerator \
205
  cmBootstrapCommands \
206 207
  cmCommands \
  cmTarget \
208
  cmTest \
209
  cmCustomCommand \
Bill Hoffman's avatar
Bill Hoffman committed
210
  cmDocumentVariables \
211 212
  cmCacheManager \
  cmListFileCache \
213
  cmComputeLinkDepends \
214
  cmComputeLinkInformation \
215
  cmOrderDirectories \
216
  cmComputeTargetDepends \
217
  cmComputeComponentGraph \
218 219 220
  cmExprLexer \
  cmExprParser \
  cmExprParserHelper \
221
"
222

223 224 225 226 227 228 229
if ${cmake_system_mingw}; then
  CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
    cmGlobalMSYSMakefileGenerator \
    cmGlobalMinGWMakefileGenerator \
    cmWin32ProcessExecution"
fi

230 231 232 233
CMAKE_C_SOURCES="\
  cmListFileLexer \
  "

234 235
if ${cmake_system_mingw}; then
  KWSYS_C_SOURCES="\
236
    ProcessWin32 \
237
    String \
238
    System"
239 240 241 242 243 244 245
  KWSYS_C_MINGW_SOURCES="\
    ProcessFwd9x \
    EncodeExecutable"
  KWSYS_C_GENERATED_SOURCES="\
    cmsysProcessFwd9xEnc"
else
  KWSYS_C_SOURCES="\
246
    ProcessUNIX \
247
    String \
248
    System"
249 250 251
  KWSYS_C_MINGW_SOURCES=""
  KWSYS_C_GENERATED_SOURCES=""
fi
252 253

KWSYS_CXX_SOURCES="\
254
  Directory \
Andy Cedilnik's avatar
Andy Cedilnik committed
255
  Glob \
256 257 258 259
  RegularExpression \
  SystemTools"

KWSYS_FILES="\
260
  auto_ptr.hxx \
261
  Directory.hxx \
Andy Cedilnik's avatar
Andy Cedilnik committed
262
  Glob.hxx \
263 264
  Process.h \
  RegularExpression.hxx \
265
  String.h \
266
  String.hxx \
267
  System.h \
268 269
  SystemTools.hxx"

270
KWSYS_IOS_FILES="
271 272 273 274 275
  fstream \
  iosfwd \
  iostream \
  sstream"

276
# Display CMake bootstrap usage
277 278
cmake_usage()
{
279 280
echo '
Usage: '"$0"' [options]
281 282 283
Options: [defaults in brackets after descriptions]
Configuration:
  --help                  print this message
284
  --version               only print version information
285
  --verbose               display more information
286 287
  --parallel=n            bootstrap cmake in parallel, where n is
                          number of nodes [1]
288
  --init=FILE             use FILE for cmake initialization
289 290 291 292
  --system-libs           use system-installed third-party libraries
                          (for use only by package maintainers)
  --no-system-libs        use cmake-provided third-party libraries
                          (default)
293 294 295
  --qt-gui                build the Qt-based GUI (requires Qt >= 4.2)
  --no-qt-gui             do not build the Qt-based GUI (default)
  --qt-qmake=<qmake>      use <qmake> as the qmake executable to find Qt
296

297
Directory and file names:
298
  --prefix=PREFIX         install files in tree rooted at PREFIX
299
                          [${cmake_default_prefix}]
300 301 302 303 304 305
  --datadir=DIR           install data files in PREFIX/DIR
                          [/share/CMake]
  --docdir=DIR            install documentation files in PREFIX/DIR
                          [/doc/CMake]
  --mandir=DIR            install man pages files in PREFIX/DIR/manN
                          [/man]
306
'
307 308 309
  exit 10
}

310
# Display CMake bootstrap usage
311
cmake_version_display()
312
{
313
  echo "CMake ${cmake_version_full}, Copyright 2000-2009 Kitware, Inc."
314 315 316
}

# Display CMake bootstrap error, display the log file and exit
317 318
cmake_error()
{
319 320
  res=$1
  shift 1
321
  echo "---------------------------------------------"
322 323 324 325
  echo "Error when bootstrapping CMake:" 
  echo "$*"
  echo "---------------------------------------------"
  if [ -f cmake_bootstrap.log ]; then
326 327
    echo "Log of errors: `pwd`/cmake_bootstrap.log"
    #cat cmake_bootstrap.log
328 329
    echo "---------------------------------------------"
  fi
330
  exit ${res}
331
}
332

333 334 335 336 337 338 339
# Replace KWSYS_NAMESPACE with cmsys
cmake_replace_string ()
{
  INFILE="$1"
  OUTFILE="$2"
  SEARCHFOR="$3"
  REPLACEWITH="$4"
340
  if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
341
    cat "${INFILE}" | 
342 343 344
      sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" > "${OUTFILE}${_tmp}"
    if [ -f "${OUTFILE}${_tmp}" ]; then
      if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
345
        #echo "Files are the same"
346
        rm -f "${OUTFILE}${_tmp}"
347
      else
348
        mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
349 350
      fi
    fi
351
  else
352
    cmake_error 1 "Cannot find file ${INFILE}"
353 354 355
  fi
}

356 357 358 359 360 361
cmake_kwsys_config_replace_string ()
{
  INFILE="$1"
  OUTFILE="$2"
  shift 2
  APPEND="$*"
362 363
  if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
    echo "${APPEND}" > "${OUTFILE}${_tmp}"
364 365
    cat "${INFILE}" | 
      sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
366
                s/@KWSYS_DO_NOT_CLEAN_PUTENV@/0/g;
367
                s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
368 369
                s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
                s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
370
                s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
371
                s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
372
                s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
373 374 375
                s/@KWSYS_IOS_USE_SSTREAM@/${KWSYS_IOS_USE_SSTREAM}/g;
                s/@KWSYS_IOS_USE_STRSTREAM_H@/${KWSYS_IOS_USE_STRSTREAM_H}/g;
                s/@KWSYS_IOS_USE_STRSTREA_H@/${KWSYS_IOS_USE_STRSTREA_H}/g;
376
                s/@KWSYS_IOS_HAVE_BINARY@/${KWSYS_IOS_HAVE_BINARY}/g;
377
                s/@KWSYS_STL_HAVE_STD@/${KWSYS_STL_HAVE_STD}/g;
378 379
                s/@KWSYS_STL_STRING_HAVE_ISTREAM@/${KWSYS_STL_STRING_HAVE_ISTREAM}/g;
                s/@KWSYS_STL_STRING_HAVE_OSTREAM@/${KWSYS_STL_STRING_HAVE_OSTREAM}/g;
380
                s/@KWSYS_STL_STRING_HAVE_NEQ_CHAR@/${KWSYS_STL_STRING_HAVE_NEQ_CHAR}/g;
381 382 383
                s/@KWSYS_STL_HAS_ITERATOR_TRAITS@/${KWSYS_STL_HAS_ITERATOR_TRAITS}/g;
                s/@KWSYS_STL_HAS_ITERATOR_CATEGORY@/${KWSYS_STL_HAS_ITERATOR_CATEGORY}/g;
                s/@KWSYS_STL_HAS___ITERATOR_CATEGORY@/${KWSYS_STL_HAS___ITERATOR_CATEGORY}/g;
384
                s/@KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}/g;
385
                s/@KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE}/g;
386
                s/@KWSYS_STL_HAS_ALLOCATOR_REBIND@/${KWSYS_STL_HAS_ALLOCATOR_REBIND}/g;
387
                s/@KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@/${KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT}/g;
388
                s/@KWSYS_STL_HAS_ALLOCATOR_OBJECTS@/${KWSYS_STL_HAS_ALLOCATOR_OBJECTS}/g;
389
                s/@KWSYS_CXX_HAS_CSTDDEF@/${KWSYS_CXX_HAS_CSTDDEF}/g;
390 391 392
                s/@KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@/${KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS}/g;
                s/@KWSYS_CXX_HAS_MEMBER_TEMPLATES@/${KWSYS_CXX_HAS_MEMBER_TEMPLATES}/g;
                s/@KWSYS_CXX_HAS_FULL_SPECIALIZATION@/${KWSYS_CXX_HAS_FULL_SPECIALIZATION}/g;
393
                s/@KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@/${KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP}/g;
394 395 396
                s/@KWSYS_STAT_HAS_ST_MTIM@/${KWSYS_STAT_HAS_ST_MTIM}/g;}" >> "${OUTFILE}${_tmp}"
    if [ -f "${OUTFILE}${_tmp}" ]; then
      if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
397
        #echo "Files are the same"
398
        rm -f "${OUTFILE}${_tmp}"
399
      else
400
        mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
401 402 403 404 405 406
      fi
    fi
  else
    cmake_error 2 "Cannot find file ${INFILE}"
  fi
}
407
# Write string into a file
408 409 410 411 412 413 414
cmake_report ()
{
  FILE=$1
  shift
  echo "$*" >> ${FILE}
}

415
# Escape spaces in strings
416 417 418 419 420
cmake_escape ()
{
  echo $1 | sed "s/ /\\\\ /g"
}

421
# Write message to the log
422 423 424 425 426
cmake_log ()
{
  echo "$*" >> cmake_bootstrap.log
}

427
# Return temp file
428 429
cmake_tmp_file ()
{
430
  echo "cmake_bootstrap_$$_test"
431 432
}

433 434
# Run a compiler test. First argument is compiler, second one are compiler
# flags, third one is test source file to be compiled
435 436 437 438 439 440 441 442 443 444 445
cmake_try_run ()
{
  COMPILER=$1
  FLAGS=$2
  TESTFILE=$3
  if [ ! -f "${TESTFILE}" ]; then
    echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
    exit 4
  fi
  TMPFILE=`cmake_tmp_file`
  echo "Try: ${COMPILER}"
446 447
  echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
  echo "----------  file   -----------------------"
448
  cat "${TESTFILE}"
449
  echo "------------------------------------------"
450 451 452
  "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
  RES=$?
  if [ "${RES}" -ne "0" ]; then
453 454
    echo "Test failed to compile"
    return 1
455 456
  fi
  if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
457
    echo "Test failed to produce executable"
458 459 460 461 462 463
    return 2
  fi
  ./${TMPFILE}
  RES=$?
  rm -f "${TMPFILE}"
  if [ "${RES}" -ne "0" ]; then
464
    echo "Test produced non-zero return code"
465 466
    return 3
  fi
467
  echo "Test succeded"
468 469 470
  return 0
}

471
# Run a make test. First argument is the make interpreter.
472 473
cmake_try_make ()
{
474 475
  MAKE_PROC="$1"
  MAKE_FLAGS="$2"
476
  echo "Try: ${MAKE_PROC}"
477
  "${MAKE_PROC}" ${MAKE_FLAGS}
478 479
  RES=$?
  if [ "${RES}" -ne "0" ]; then
480 481
    echo "${MAKE_PROC} does not work"
    return 1
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497
  fi
  if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
    echo "${COMPILER} does not produce output"
    return 2
  fi
  ./test
  RES=$?
  rm -f "test"
  if [ "${RES}" -ne "0" ]; then
    echo "${MAKE_PROC} produces strange executable"
    return 3
  fi
  echo "${MAKE_PROC} works"
  return 0
}

498
# Parse arguments
499
cmake_verbose=
500
cmake_parallel_make=
501
cmake_prefix_dir="${cmake_default_prefix}"
502
for a in "$@"; do
503
  if echo $a | grep "^--prefix=" > /dev/null 2> /dev/null; then
504
    cmake_prefix_dir=`echo $a | sed "s/^--prefix=//"`
505
    cmake_prefix_dir=`cmake_fix_slashes "${cmake_prefix_dir}"`
506
  fi
507 508 509
  if echo $a | grep "^--parallel=" > /dev/null 2> /dev/null; then
    cmake_parallel_make=`echo $a | sed "s/^--parallel=//" | grep "[0-9][0-9]*"`
  fi
510 511 512 513 514 515 516 517 518 519 520 521
  if echo $a | grep "^--datadir=" > /dev/null 2> /dev/null; then
    cmake_data_dir=`echo $a | sed "s/^--datadir=//"`
  fi
  if echo $a | grep "^--docdir=" > /dev/null 2> /dev/null; then
    cmake_doc_dir=`echo $a | sed "s/^--docdir=//"`
  fi
  if echo $a | grep "^--mandir=" > /dev/null 2> /dev/null; then
    cmake_man_dir=`echo $a | sed "s/^--mandir=//"`
  fi
  if echo $a | grep "^--init=" > /dev/null 2> /dev/null; then
    cmake_init_file=`echo $a | sed "s/^--init=//"`
  fi
522 523 524 525 526 527
  if echo $a | grep "^--system-libs" > /dev/null 2> /dev/null; then
    cmake_bootstrap_system_libs="-DCMAKE_USE_SYSTEM_LIBRARIES=1"
  fi
  if echo $a | grep "^--no-system-libs" > /dev/null 2> /dev/null; then
    cmake_bootstrap_system_libs="-DCMAKE_USE_SYSTEM_LIBRARIES=0"
  fi
528 529 530 531 532 533 534 535 536
  if echo $a | grep "^--qt-gui" > /dev/null 2> /dev/null; then
    cmake_bootstrap_qt_gui="1"
  fi
  if echo $a | grep "^--no-qt-gui" > /dev/null 2> /dev/null; then
    cmake_bootstrap_qt_gui="0"
  fi
  if echo $a | grep "^--qt-qmake=" > /dev/null 2> /dev/null; then
    cmake_bootstrap_qt_qmake=`echo $a | sed "s/^--qt-qmake=//"`
  fi
537
  if echo $a | grep "^--help" > /dev/null 2> /dev/null; then
538 539
    cmake_usage
  fi
540
  if echo $a | grep "^--version" > /dev/null 2> /dev/null; then
541
    cmake_version_display
542 543
    exit 2
  fi
544
  if echo $a | grep "^--verbose" > /dev/null 2> /dev/null; then
545 546 547 548
    cmake_verbose=TRUE
  fi
done

549
# If verbose, display some information about bootstrap
550 551 552 553 554 555
if [ -n "${cmake_verbose}" ]; then
  echo "---------------------------------------------"
  echo "Source directory: ${cmake_source_dir}"
  echo "Binary directory: ${cmake_binary_dir}"
  echo "Prefix directory: ${cmake_prefix_dir}"
  echo "System:           ${cmake_system}"
556 557 558 559
  if [ "x${cmake_parallel_make}" != "x" ]; then
    echo "Doing parallel make: ${cmake_parallel_make}"
  fi
  echo ""
560 561 562
fi

echo "---------------------------------------------"
563
# Get CMake version
564
echo "`cmake_version_display`"
565

566 567 568 569 570 571 572 573 574 575 576 577 578
# Check for in-source build
cmake_in_source_build=
if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
     -f "${cmake_binary_dir}/Source/cmake.h" ]; then
  if [ -n "${cmake_verbose}" ]; then
    echo "Warning: This is an in-source build"
  fi
  cmake_in_source_build=TRUE
fi

# If this is not an in-source build, then Bootstrap stuff should not exist.
if [ -z "${cmake_in_source_build}" ]; then
  # Did somebody bootstrap in the source tree?
579 580
  if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then
    cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
581
Looks like somebody did bootstrap CMake in the source tree, but now you are
582
trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
583 584 585 586
directory from the source tree."
  fi
  # Is there a cache in the source tree?
  for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
Will Schroeder's avatar
Will Schroeder committed
587
    if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
588 589 590 591 592 593 594 595
      cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
Looks like somebody tried to build CMake in the source tree, but now you are
trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
from the source tree."
    fi
  done
fi

596
# Make bootstrap directory
597 598
[ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
if [ ! -d "${cmake_bootstrap_dir}" ]; then
599
  cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
600 601 602
fi
cd "${cmake_bootstrap_dir}"

603 604
[ -d "cmsys" ] || mkdir "cmsys"
if [ ! -d "cmsys" ]; then
605
  cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
606 607
fi

608 609 610 611 612 613
for a in stl ios; do
  [ -d "cmsys/${a}" ] || mkdir "cmsys/${a}"
  if [ ! -d "cmsys/${a}" ]; then
    cmake_error 5 "Cannot create directory ${cmake_bootstrap_dir}/cmsys/${a}"
  fi
done
614

615
# Delete all the bootstrap files
616
rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
617 618
rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
619

620
# If exist compiler flags, set them
621 622
cmake_c_flags=${CFLAGS}
cmake_cxx_flags=${CXXFLAGS}
Bill Hoffman's avatar
Bill Hoffman committed
623
cmake_ld_flags=${LDFLAGS}
624

625 626 627 628 629
# Add Cygwin-specific flags
if ${cmake_system_cygwin}; then
  cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
fi

630 631 632 633 634
# Add Carbon framework on Darwin
if ${cmake_system_darwin}; then
  cmake_ld_flags="${LDFLAGS} -framework Carbon"  
fi

635 636 637 638 639
# Add BeOS toolkits...
if ${cmake_system_beos}; then
  cmake_ld_flags="${LDFLAGS} -lroot -lbe"
fi

640 641 642 643 644
# Add Haiku toolkits...
if ${cmake_system_haiku}; then
  cmake_ld_flags="${LDFLAGS} -lroot -lbe"
fi

645 646 647
# Test C compiler
cmake_c_compiler=

648
# If CC is set, use that for compiler, otherwise use list of known compilers
649 650 651 652 653 654
if [ -n "${CC}" ]; then
  cmake_c_compilers="${CC}"
else
  cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
fi

655
# Check if C compiler works
656
TMPFILE=`cmake_tmp_file`
657
echo '
658 659
#ifdef __cplusplus
# error "The CMAKE_C_COMPILER is set to a C++ compiler"
660 661
#endif

662 663 664
#include<stdio.h>

#if defined(__CLASSIC_C__)
665 666 667 668
int main(argc, argv)
  int argc;
  char* argv[];
#else
Andy Cedilnik's avatar
Andy Cedilnik committed
669
int main(int argc, char* argv[])
670
#endif
671
{
672
  printf("%d%c", (argv != 0), (char)0x0a);
Andy Cedilnik's avatar
Andy Cedilnik committed
673
  return argc-1;
674
}
675
' > "${TMPFILE}.c"
676
for a in ${cmake_c_compilers}; do
677 678
  if [ -z "${cmake_c_compiler}" ] && \
    cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
679 680 681 682 683 684
    cmake_c_compiler="${a}"
  fi
done
rm -f "${TMPFILE}.c"

if [ -z "${cmake_c_compiler}" ]; then
685
  cmake_error 6 "Cannot find appropriate C compiler on this system.
Bill Hoffman's avatar
Bill Hoffman committed
686 687 688
Please specify one using environment variable CC.
See cmake_bootstrap.log for compilers attempted.
"
689 690 691 692 693
fi
echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"

# Test CXX compiler
cmake_cxx_compiler=
694

695 696
# On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.

697
# If CC is set, use that for compiler, otherwise use list of known compilers
698 699 700 701 702 703
if [ -n "${CXX}" ]; then
  cmake_cxx_compilers="${CXX}"
else
  cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
fi

704
# Check if C++ compiler works
705
TMPFILE=`cmake_tmp_file`
706
echo '
707 708 709 710 711 712
#if defined(TEST1)
# include <iostream>
#else
# include <iostream.h>
#endif

713 714 715 716 717 718 719 720
class NeedCXX 
{
public:
  NeedCXX() { this->Foo = 1; }
  int GetFoo() { return this->Foo; }
private:
  int Foo;
};
721 722
int main()
{
723
  NeedCXX c;
724 725 726 727 728
#ifdef TEST3
  cout << c.GetFoo() << endl;
#else
  std::cout << c.GetFoo() << std::endl;
#endif
729 730
  return 0;
}
731
' > "${TMPFILE}.cxx"
732
for a in ${cmake_cxx_compilers}; do
733 734 735 736 737 738
  for b in 1 2 3; do
    if [ -z "${cmake_cxx_compiler}" ] && \
      cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
      cmake_cxx_compiler="${a}"
    fi
  done
739 740 741 742
done
rm -f "${TMPFILE}.cxx"

if [ -z "${cmake_cxx_compiler}" ]; then
743
  cmake_error 7 "Cannot find appropriate C++ compiler on this system.
Bill Hoffman's avatar
Bill Hoffman committed
744 745
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted."
746 747 748 749 750 751
fi
echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"

# Test Make

cmake_make_processor=
752
cmake_make_flags=
753 754

# If MAKE is set, use that for make processor, otherwise use list of known make
755 756 757 758 759 760 761 762 763 764
if [ -n "${MAKE}" ]; then
  cmake_make_processors="${MAKE}"
else
  cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
fi

TMPFILE="`cmake_tmp_file`_dir"
rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
cd "${cmake_bootstrap_dir}/${TMPFILE}"
765
echo '
766
test: test.c
767 768 769
	"'"${cmake_c_compiler}"'" -o test test.c
'>"Makefile"
echo '
770
#include <stdio.h>
771
int main(){ printf("1%c", (char)0x0a); return 0; }
772
' > "test.c"
773
cmake_original_make_flags="${cmake_make_flags}"
774 775 776
if [ "x${cmake_parallel_make}" != "x" ]; then
  cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
fi
777
for a in ${cmake_make_processors}; do
778
  if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log 2>&1; then
779 780 781
    cmake_make_processor="${a}"
  fi
done
782 783 784 785 786 787 788 789 790 791 792
cmake_full_make_flags="${cmake_make_flags}"
if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
  if [ -z "${cmake_make_processor}" ]; then
    cmake_make_flags="${cmake_original_make_flags}"
    for a in ${cmake_make_processors}; do
      if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> cmake_bootstrap.log 2>&1; then
        cmake_make_processor="${a}"
      fi
    done
  fi
fi
793 794 795
cd "${cmake_bootstrap_dir}"
rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"

796
if [ -z "${cmake_make_processor}" ]; then
797
  cmake_error 8 "Cannot find appropriate Makefile processor on this system.
798 799
Please specify one using environment variable MAKE."
fi
800 801 802 803 804 805
echo "Makefile processor on this system is: ${cmake_make_processor}"
if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
  echo "---------------------------------------------"
  echo "Makefile processor ${cmake_make_processor} does not support parallel build"
  echo "---------------------------------------------"
fi
806

807 808
# Ok, we have CC, CXX, and MAKE.

809
# Test C++ compiler features
810

811 812 813
# Are we GCC?

TMPFILE=`cmake_tmp_file`
814
echo '
815 816 817 818
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
#include <iostream>
int main() { std::cout << "This is GNU" << std::endl; return 0;}
#endif
819
' > ${TMPFILE}.cxx
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838
cmake_cxx_compiler_is_gnu=0
if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  cmake_cxx_compiler_is_gnu=1
fi
if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then
  echo "${cmake_cxx_compiler} is GNU compiler"
else
  echo "${cmake_cxx_compiler} is not GNU compiler"
fi
rm -f "${TMPFILE}.cxx"

if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
  # Check for non-GNU compiler flags

  # If we are on IRIX, check for -LANG:std
  cmake_test_flags="-LANG:std"
  if [ "x${cmake_system}" = "xIRIX64" ]; then
    TMPFILE=`cmake_tmp_file`
839
    echo '
840
    #include <iostream>
841 842
    int main() { std::cout << "No need for '"${cmake_test_flags}"'" << std::endl; return 0;}
' > ${TMPFILE}.cxx
843
    cmake_need_lang_std=0
844
    if cmake_try_run "${cmake_cxx_compiler}" \
845 846 847 848 849 850 851
      "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
      :
    else
      if cmake_try_run "${cmake_cxx_compiler}" \
        "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
        cmake_need_lang_std=1
      fi
852
    fi
853 854 855 856 857 858 859
    if [ "x${cmake_need_lang_std}" = "x1" ]; then
      cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
      echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
    else
      echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
    fi
    rm -f "${TMPFILE}.cxx"
860
  fi
861
  cmake_test_flags=
862

863 864 865 866
  # If we are on OSF, check for -timplicit_local -no_implicit_include
  cmake_test_flags="-timplicit_local -no_implicit_include"
  if [ "x${cmake_system}" = "xOSF1" ]; then
    TMPFILE=`cmake_tmp_file`
867
    echo '
868
    #include <iostream>
869 870
    int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
' > ${TMPFILE}.cxx
871 872 873 874 875 876 877 878 879 880 881 882 883 884
    cmake_need_flags=1
    if cmake_try_run "${cmake_cxx_compiler}" \
      "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
      :
    else
      cmake_need_flags=0
    fi
    if [ "x${cmake_need_flags}" = "x1" ]; then
      cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
      echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
    else
      echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
    fi
    rm -f "${TMPFILE}.cxx"
885
  fi
886
  cmake_test_flags=
887

888 889 890 891
  # If we are on OSF, check for -std strict_ansi -nopure_cname
  cmake_test_flags="-std strict_ansi -nopure_cname"
  if [ "x${cmake_system}" = "xOSF1" ]; then
    TMPFILE=`cmake_tmp_file`
892
    echo '
893
    #include <iostream>
894 895
    int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
' > ${TMPFILE}.cxx
896 897 898 899 900 901 902 903 904 905 906 907 908 909
    cmake_need_flags=1
    if cmake_try_run "${cmake_cxx_compiler}" \
      "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
      :
    else
      cmake_need_flags=0
    fi
    if [ "x${cmake_need_flags}" = "x1" ]; then
      cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
      echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
    else
      echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
    fi
    rm -f "${TMPFILE}.cxx"
910
  fi
911
  cmake_test_flags=
912

913 914 915 916
  # If we are on HP-UX, check for -Ae for the C compiler.
  cmake_test_flags="-Ae"
  if [ "x${cmake_system}" = "xHP-UX" ]; then
    TMPFILE=`cmake_tmp_file`
917
    echo '
918
    int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
919
' > ${TMPFILE}.c
920 921 922 923 924 925 926 927
    cmake_need_Ae=0
    if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
      :
    else
      if cmake_try_run "${cmake_c_compiler}" \
        "${cmake_c_flags} ${cmake_test_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
        cmake_need_Ae=1
      fi
928
    fi
929 930 931 932 933 934 935
    if [ "x${cmake_need_Ae}" = "x1" ]; then
      cmake_c_flags="${cmake_c_flags} ${cmake_test_flags}"
      echo "${cmake_c_compiler} needs ${cmake_test_flags}"
    else
      echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
    fi
    rm -f "${TMPFILE}.c"
936
  fi
937
  cmake_test_flags=
938 939
fi

940 941 942
# Test for kwsys features
KWSYS_NAME_IS_KWSYS=0
KWSYS_BUILD_SHARED=0
943 944
KWSYS_LFS_AVAILABLE=0
KWSYS_LFS_REQUESTED=0
945 946
KWSYS_IOS_USE_STRSTREAM_H=0
KWSYS_IOS_USE_STRSTREA_H=0
947
KWSYS_IOS_HAVE_STD=0
948 949
KWSYS_IOS_USE_SSTREAM=0
KWSYS_IOS_USE_ANSI=0
950
KWSYS_IOS_HAVE_BINARY=0
951
KWSYS_STL_HAVE_STD=0
952
KWSYS_STAT_HAS_ST_MTIM=0
953
KWSYS_STL_STRING_HAVE_NEQ_CHAR=0
954 955 956
KWSYS_STL_HAS_ITERATOR_TRAITS=0
KWSYS_STL_HAS_ITERATOR_CATEGORY=0
KWSYS_STL_HAS___ITERATOR_CATEGORY=0
957
KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=0
958
KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=0
959
KWSYS_STL_HAS_ALLOCATOR_REBIND=0
960
KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=0
961
KWSYS_STL_HAS_ALLOCATOR_OBJECTS=0
962
KWSYS_CXX_HAS_CSTDDEF=0
963 964 965
KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0
KWSYS_CXX_HAS_MEMBER_TEMPLATES=0
KWSYS_CXX_HAS_FULL_SPECIALIZATION=0
966
KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=0
967

968 969 970 971
# Hardcode these kwsys features.  They work on all known UNIX compilers anyway.
KWSYS_STL_STRING_HAVE_ISTREAM=1
KWSYS_STL_STRING_HAVE_OSTREAM=1

972 973
if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
974
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
975 976 977 978 979 980 981
  KWSYS_STL_HAVE_STD=1
  echo "${cmake_cxx_compiler} has STL in std:: namespace"
else
  echo "${cmake_cxx_compiler} does not have STL in std:: namespace"
fi

if cmake_try_run "${cmake_cxx_compiler}" \
982
  "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
983
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
984
  KWSYS_IOS_USE_ANSI=1
985 986 987 988 989
  echo "${cmake_cxx_compiler} has ANSI streams"
else
  echo "${cmake_cxx_compiler} does not have ANSI streams"
fi

990
if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
991 992
  if cmake_try_run "${cmake_cxx_compiler}" \
    "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
993
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
994 995 996 997 998 999
    KWSYS_IOS_HAVE_STD=1
    echo "${cmake_cxx_compiler} has streams in std:: namespace"
  else
    echo "${cmake_cxx_compiler} does not have streams in std:: namespace"
  fi
  if cmake_try_run "${cmake_cxx_compiler}" \
1000
    "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
1001
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1002
    KWSYS_IOS_USE_SSTREAM=1
1003 1004 1005 1006 1007 1008
    echo "${cmake_cxx_compiler} has sstream"
  else
    echo "${cmake_cxx_compiler} does not have sstream"
  fi
fi

1009
if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
1010
  if cmake_try_run "${cmake_cxx_compiler}" \
1011
    "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
1012
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1013
    KWSYS_IOS_USE_STRSTREAM_H=1
1014 1015 1016 1017
    echo "${cmake_cxx_compiler} has strstream.h"
  else
    echo "${cmake_cxx_compiler} does not have strstream.h"
  fi
1018
  if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
1019
    if cmake_try_run "${cmake_cxx_compiler}" \
1020
      "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
1021
      "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1022
      KWSYS_IOS_USE_STRSTREA_H=1
1023 1024 1025 1026 1027 1028 1029
      echo "${cmake_cxx_compiler} has strstrea.h"
    else
      echo "${cmake_cxx_compiler} does not have strstrea.h"
    fi
  fi
fi

1030 1031
if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1032
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1033 1034 1035 1036 1037 1038
  KWSYS_STL_STRING_HAVE_NEQ_CHAR=1
  echo "${cmake_cxx_compiler} has operator!=(string, char*)"
else
  echo "${cmake_cxx_compiler} does not have operator!=(string, char*)"
fi

1039
if cmake_try_run "${cmake_cxx_compiler}" \
1040
  "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_TRAITS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1041
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1042 1043
  KWSYS_STL_HAS_ITERATOR_TRAITS=1
  echo "${cmake_cxx_compiler} has stl iterator_traits"
1044
else
1045 1046 1047 1048 1049 1050
  echo "${cmake_cxx_compiler} does not have stl iterator_traits"
fi

if [ "x${KWSYS_STL_HAS_ITERATOR_TRAITS}" = "x0" ]; then
  if cmake_try_run "${cmake_cxx_compiler}" \
    "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1051
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1052 1053 1054 1055 1056 1057 1058 1059
    KWSYS_STL_HAS_ITERATOR_CATEGORY=1
    echo "${cmake_cxx_compiler} has old iterator_category"
  else
    echo "${cmake_cxx_compiler} does not have old iterator_category"
  fi
  if [ "x${KWSYS_STL_HAS_ITERATOR_CATEGORY}" = "x0" ]; then
    if cmake_try_run "${cmake_cxx_compiler}" \
      "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS___ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1060
      "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1061 1062 1063 1064 1065 1066
      KWSYS_STL_HAS___ITERATOR_CATEGORY=1
      echo "${cmake_cxx_compiler} has old __iterator_category"
    else
      echo "${cmake_cxx_compiler} does not have old __iterator_category"
    fi
  fi
1067 1068
fi

1069
if cmake_try_run "${cmake_cxx_compiler}" \
1070
  "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1071
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1072 1073
  KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=1
  echo "${cmake_cxx_compiler} has standard template allocator"
1074
else
1075
  echo "${cmake_cxx_compiler} does not have standard template allocator"
1076 1077
fi

1078
if [ "x${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}" = "x1" ]; then
1079 1080
  if cmake_try_run "${cmake_cxx_compiler}" \
    "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1081
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1082 1083 1084 1085 1086 1087 1088 1089
    KWSYS_STL_HAS_ALLOCATOR_REBIND=1
    echo "${cmake_cxx_compiler} has allocator<>::rebind<>"
  else
    echo "${cmake_cxx_compiler} does not have allocator<>::rebind<>"
  fi

  if cmake_try_run "${cmake_cxx_compiler}" \
    "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1090
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1091 1092 1093 1094 1095
    KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=1
    echo "${cmake_cxx_compiler} has non-standard allocator<>::max_size argument"
  else
    echo "${cmake_cxx_compiler} does not have non-standard allocator<>::max_size argument"
  fi
1096 1097 1098
else
  if cmake_try_run "${cmake_cxx_compiler}" \
    "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1099
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1100 1101 1102 1103 1104 1105 1106 1107 1108
    KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=1
    echo "${cmake_cxx_compiler} has old non-template allocator"
  else
    echo "${cmake_cxx_compiler} does not have old non-template allocator"
  fi
fi

if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
1109
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1110 1111 1112 1113
  KWSYS_STL_HAS_ALLOCATOR_OBJECTS=1
  echo "${cmake_cxx_compiler} has stl containers supporting allocator objects"
else
  echo "${cmake_cxx_compiler} does not have stl containers supporting allocator objects"
1114 1115
fi

1116 1117
if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_CSTDDEF" \