Skip to content
Snippets Groups Projects
bootstrap 50.7 KiB
Newer Older
    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
    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"
# Test for kwsys features
KWSYS_NAME_IS_KWSYS=0
KWSYS_BUILD_SHARED=0
KWSYS_LFS_AVAILABLE=0
KWSYS_LFS_REQUESTED=0
KWSYS_IOS_USE_STRSTREAM_H=0
KWSYS_IOS_USE_STRSTREA_H=0
KWSYS_IOS_USE_SSTREAM=0
KWSYS_IOS_USE_ANSI=0
KWSYS_IOS_HAVE_BINARY=0
KWSYS_STL_HAS_ITERATOR_TRAITS=0
KWSYS_STL_HAS_ITERATOR_CATEGORY=0
KWSYS_STL_HAS___ITERATOR_CATEGORY=0
KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=0
KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=0
KWSYS_STL_HAS_ALLOCATOR_REBIND=0
KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=0
KWSYS_STL_HAS_ALLOCATOR_OBJECTS=0
KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0
KWSYS_CXX_HAS_MEMBER_TEMPLATES=0
KWSYS_CXX_HAS_FULL_SPECIALIZATION=0
KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=0
# Hardcode these kwsys features.  They work on all known UNIX compilers anyway.
KWSYS_STL_STRING_HAVE_ISTREAM=1
KWSYS_STL_STRING_HAVE_OSTREAM=1

if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  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}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  KWSYS_IOS_USE_ANSI=1
  echo "${cmake_cxx_compiler} has ANSI streams"
else
  echo "${cmake_cxx_compiler} does not have ANSI streams"
fi

if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
  if cmake_try_run "${cmake_cxx_compiler}" \
    "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
    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}" \
    "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
    KWSYS_IOS_USE_SSTREAM=1
    echo "${cmake_cxx_compiler} has sstream"
  else
    echo "${cmake_cxx_compiler} does not have sstream"
  fi
fi

if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
  if cmake_try_run "${cmake_cxx_compiler}" \
    "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
    KWSYS_IOS_USE_STRSTREAM_H=1
    echo "${cmake_cxx_compiler} has strstream.h"
  else
    echo "${cmake_cxx_compiler} does not have strstream.h"
  fi
  if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
    if cmake_try_run "${cmake_cxx_compiler}" \
      "${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
      "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
      KWSYS_IOS_USE_STRSTREA_H=1
      echo "${cmake_cxx_compiler} has strstrea.h"
    else
      echo "${cmake_cxx_compiler} does not have strstrea.h"
    fi
  fi
fi

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}" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  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

if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_TRAITS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  KWSYS_STL_HAS_ITERATOR_TRAITS=1
  echo "${cmake_cxx_compiler} has stl iterator_traits"
  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}" \
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
    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}" \
      "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
      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
if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=1
  echo "${cmake_cxx_compiler} has standard template allocator"
  echo "${cmake_cxx_compiler} does not have standard template allocator"
if [ "x${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}" = "x1" ]; then
  if cmake_try_run "${cmake_cxx_compiler}" \
    "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
    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}" \
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
    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
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}" \
    "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
    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}" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  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"
if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_CSTDDEF" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  KWSYS_CXX_HAS_CSTDDEF=1
  echo "${cmake_cxx_compiler} has header cstddef"
else
  echo "${cmake_cxx_compiler} does not have header cstddef"
fi

if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  echo "${cmake_cxx_compiler} does not require template friends to use <>"
else
  KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=1
  echo "${cmake_cxx_compiler} requires template friends to use <>"
fi

if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  KWSYS_CXX_HAS_MEMBER_TEMPLATES=1
  echo "${cmake_cxx_compiler} supports member templates"
else
  echo "${cmake_cxx_compiler} does not support member templates"
fi

if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  KWSYS_CXX_HAS_FULL_SPECIALIZATION=1
  echo "${cmake_cxx_compiler} has standard template specialization syntax"
else
  echo "${cmake_cxx_compiler} does not have standard template specialization syntax"
fi

if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=1
  echo "${cmake_cxx_compiler} has argument dependent lookup"
else
  echo "${cmake_cxx_compiler} does not have argument dependent lookup"
fi

if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  KWSYS_STAT_HAS_ST_MTIM=1
  echo "${cmake_cxx_compiler} has struct stat with st_mtim member"
else
  echo "${cmake_cxx_compiler} does not have struct stat with st_mtim member"
fi

if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_BINARY -DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI} -DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD}" \
  "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  KWSYS_IOS_HAVE_BINARY=1
  echo "${cmake_cxx_compiler} has ios::binary openmode"
else
  echo "${cmake_cxx_compiler} does not have ios::binary openmode"
fi

# Just to be safe, let us store compiler and flags to the header file

cmake_bootstrap_version='$Revision$'
cmake_compiler_settings_comment="/*
 * Generated by ${cmake_source_dir}/bootstrap
 * Version:     ${cmake_bootstrap_version}
 *
 * Source directory: ${cmake_source_dir}
 * Binary directory: ${cmake_bootstrap_dir}
 *
 * C compiler:   ${cmake_c_compiler}
 * C flags:      ${cmake_c_flags}
 *
 * C++ compiler: ${cmake_cxx_compiler}
 * C++ flags:    ${cmake_cxx_flags}
 *
 * Make:         ${cmake_make_processor}
 *
 * Sources:
 * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
 * kwSys Sources:
 * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}
cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}"

if [ "x$KWSYS_STL_HAVE_STD" = "x1" ]; then
  cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_STD_NAMESPACE */"
  cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_STD_NAMESPACE 1"
if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
  cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */"
  cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STREAM_HEADERS 1"
if [ "x$KWSYS_IOS_USE_SSTREAM" = "x1" ]; then
  cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STRING_STREAM */"
  cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STRING_STREAM 1"
# Test for ansi FOR scope
if cmake_try_run "${cmake_cxx_compiler}" \
  "${cmake_cxx_flags}" \
  "${cmake_source_dir}/Modules/TestForAnsiForScope.cxx" >> cmake_bootstrap.log 2>&1; then
  cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_FOR_SCOPE */"
  echo "${cmake_cxx_compiler} has ANSI for scoping"
else
  cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_FOR_SCOPE 1"
  echo "${cmake_cxx_compiler} does not have ANSI for scoping"
fi

# When bootstrapping on MinGW with MSYS we must convert the source
# directory to a windows path.
if ${cmake_system_mingw}; then
    cmake_root_dir=`cd "${cmake_source_dir}"; pwd -W`
else
    cmake_root_dir="${cmake_source_dir}"
fi

cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_TWEAK ${cmake_version_tweak}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
# Regenerate configured headers
for h in Configure VersionConfig; do
  if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then
    rm -f cm${h}.h${_tmp}
    mv -f cm${h}.h${_tmp} cm${h}.h
# Prepare KWSYS
cmake_kwsys_config_replace_string \
  "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
  "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
  "${cmake_compiler_settings_comment}"
cmake_kwsys_config_replace_string \
  "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
  "${cmake_bootstrap_dir}/cmsys/Configure.h" \
  "${cmake_compiler_settings_comment}"

for a in ${KWSYS_FILES}; do 
  cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
     "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
done

for a in ${KWSYS_IOS_FILES}; do 
  cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_ios_${a}.h.in" \
     "${cmake_bootstrap_dir}/cmsys/ios/${a}" KWSYS_NAMESPACE cmsys
cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_stl.hxx.in" \
   "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" KWSYS_STL_HEADER_EXTRA ""
cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_a" \
   "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" KWSYS_NAMESPACE cmsys
for a in string vector map algorithm; do
  cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" \
    "${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
# Generate Makefile
dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_GENERATED_SOURCES}; do
  objs="${objs} ${a}.o"
done
# Generate dependencies for cmBootstrapCommands.cxx
for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
  cmBootstrapCommandsDeps="${cmBootstrapCommandsDeps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
done
cmBootstrapCommandsDeps=`echo $cmBootstrapCommandsDeps`

if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
  cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
fi

if [ "x${cmake_c_flags}" != "x" ]; then
  cmake_c_flags="${cmake_c_flags} "
fi

if [ "x${cmake_cxx_flags}" != "x" ]; then
  cmake_cxx_flags="${cmake_cxx_flags} "
fi

cmake_c_flags_String="-DKWSYS_STRING_C"
cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
  -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
cmake_cxx_flags="${cmake_cxx_flags} -I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \
  -I`cmake_escape \"${cmake_bootstrap_dir}\"`"
echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
echo "	${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
for a in ${CMAKE_CXX_SOURCES}; do
  src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
  echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  echo "	${cmake_cxx_compiler} ${cmake_cxx_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
echo "cmBootstrapCommands.o : $cmBootstrapCommandsDeps" >> "${cmake_bootstrap_dir}/Makefile"
for a in ${CMAKE_C_SOURCES}; do
  src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
  echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  echo "	${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
for a in ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}; do
  src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
  src_flags=`eval echo \\${cmake_c_flags_\${a}}`
  echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  echo "	${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
for a in ${KWSYS_CXX_SOURCES}; do
  src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
  echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  echo "	${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
if ${cmake_system_mingw}; then
  src=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9xEnc.c"`
  in=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9x.exe"`
  cmd=`cmake_escape "${cmake_bootstrap_dir}/cmsysEncodeExecutable.exe"`
  a="cmsysProcessFwd9xEnc"
  echo "${cmd} : EncodeExecutable.o" >> "${cmake_bootstrap_dir}/Makefile"
  echo "	${cmake_c_compiler} ${cmake_ld_flags} ${cmake_c_flags} EncodeExecutable.o -o ${cmd}" >> "${cmake_bootstrap_dir}/Makefile"
  echo "${in} : ProcessFwd9x.o" >> "${cmake_bootstrap_dir}/Makefile"
  echo "	${cmake_c_compiler} ${cmake_ld_flags} ${cmake_c_flags} ProcessFwd9x.o -o ${in}" >> "${cmake_bootstrap_dir}/Makefile"
  echo "${src} : ${cmd} ${in}" >> "${cmake_bootstrap_dir}/Makefile"
  echo "	${cmd} ${in} ${src} cmsys ProcessFwd9x" >> "${cmake_bootstrap_dir}/Makefile"
  echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  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"
fi
Andy Cedilnik's avatar
Andy Cedilnik committed
rebuild_cache:
	cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
' >> "${cmake_bootstrap_dir}/Makefile"
# Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake.
echo '
# Generated by '"${cmake_source_dir}"'/bootstrap
# Default cmake settings.  These may be overridden any settings below.
SET (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
SET (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
SET (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
SET (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
# Add configuration settings given as command-line options.
if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then
  echo '
SET (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then
  echo '
SET (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
# Add user-specified settings.  Handle relative-path case for
# specification of cmake_init_file.
(
cd "${cmake_binary_dir}"
if [ -f "${cmake_init_file}" ]; then
  cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
)

echo "---------------------------------------------"

# Run make to build bootstrap cmake
  ${cmake_make_processor} ${cmake_make_flags}
RES=$?
if [ "${RES}" -ne "0" ]; then
  cmake_error 9 "Problem while running ${cmake_make_processor}"
fi
cd "${cmake_binary_dir}"

# Set C, CXX, and MAKE environment variables, so that real real cmake will be
# build with same compiler and make
CC="${cmake_c_compiler}"
CXX="${cmake_cxx_compiler}"
if [ -n "${cmake_ccache_enabled}" ]; then
  CC="ccache ${CC}"
  CXX="ccache ${CXX}"
fi
MAKE="${cmake_make_processor}"
export CC
export CXX
export MAKE

# Run bootstrap CMake to configure real CMake
cmake_options="-DCMAKE_BOOTSTRAP=1"
if [ -n "${cmake_verbose}" ]; then
  cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
fi
"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs}
RES=$?
if [ "${RES}" -ne "0" ]; then
  cmake_error 11 "Problem while running initial CMake"
fi

echo "---------------------------------------------"

# And we are done. Now just run make
echo "CMake has bootstrapped.  Now run ${cmake_make_processor}."