CMake/bootstrap

1642 lines
54 KiB
Plaintext
Raw Normal View History

2003-03-27 23:29:38 +03:00
#!/bin/sh
#=============================================================================
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# 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.
#=============================================================================
die() {
echo "$@" 1>&2 ; exit 1
}
# Version number extraction function.
cmake_version_component()
{
cat "${cmake_source_dir}/Source/CMakeVersion.cmake" | sed -n "
/^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
"
}
# Install destination extraction function.
cmake_install_dest_default()
{
cat "${cmake_source_dir}/Source/CMakeInstallDestinations.cmake" | sed -n '
/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT.*) # '"${2}"'$/ {
s/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT *"\([^"]*\)").*$/\1/;p;q;}
'
}
cmake_toupper()
{
echo "$1" | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
}
# Detect system and directory information.
cmake_system=`uname`
cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
cmake_binary_dir=`pwd`
New version scheme to support branchy workflow Prepare to switch to the workflow described by "git help workflows". In this workflow, the "master" branch is always used to integrate topics ready for release. Brand new work merges into a "next" branch instead. We need a new versioning scheme to work this way because the version on "master" must always increase. We no longer use an even/odd minor number to distinguish releases from development versions. Since we still support cvs checkout of our source tree we cannot depend on "git describe" to compute a version number based on the history graph. We can use the CCYYMMDD nightly date stamp to get a monotonically increasing version component. The new version format is "major.minor.patch.(tweak|date)". Releases use a tweak level in the half-open range [0,20000000), which is smaller than any current or future date. For tweak=0 we do not show the tweak component, leaving the format "major.minor.patch" for most releases. Development versions use date=CCYYMMDD for the tweak level. The major.minor.patch part of development versions on "master" always matches the most recent release. For example, a first-parent traversal of "master" might see v2.8.1 2.8.1.20100422 v2.8.2 | | | ----o----o----o----o----o----o----o----o---- Since the date appears in the tweak component, the next release can increment the patch level (or any more significant component) to be greater than any version leading to it. Topic branches not ready for release are published only on "next" so we know that all versions on master lead between two releases.
2010-04-23 17:44:23 +04:00
# Load version information.
cmake_version_major="`cmake_version_component MAJOR`"
cmake_version_minor="`cmake_version_component MINOR`"
New version scheme to support branchy workflow Prepare to switch to the workflow described by "git help workflows". In this workflow, the "master" branch is always used to integrate topics ready for release. Brand new work merges into a "next" branch instead. We need a new versioning scheme to work this way because the version on "master" must always increase. We no longer use an even/odd minor number to distinguish releases from development versions. Since we still support cvs checkout of our source tree we cannot depend on "git describe" to compute a version number based on the history graph. We can use the CCYYMMDD nightly date stamp to get a monotonically increasing version component. The new version format is "major.minor.patch.(tweak|date)". Releases use a tweak level in the half-open range [0,20000000), which is smaller than any current or future date. For tweak=0 we do not show the tweak component, leaving the format "major.minor.patch" for most releases. Development versions use date=CCYYMMDD for the tweak level. The major.minor.patch part of development versions on "master" always matches the most recent release. For example, a first-parent traversal of "master" might see v2.8.1 2.8.1.20100422 v2.8.2 | | | ----o----o----o----o----o----o----o----o---- Since the date appears in the tweak component, the next release can increment the patch level (or any more significant component) to be greater than any version leading to it. Topic branches not ready for release are published only on "next" so we know that all versions on master lead between two releases.
2010-04-23 17:44:23 +04:00
cmake_version_patch="`cmake_version_component PATCH`"
cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
cmake_version_tweak="`cmake_version_component TWEAK`"
if [ "$cmake_version_tweak" != "0" ]; then
cmake_version="${cmake_version}.${cmake_version_tweak}"
fi
cmake_version_rc="`cmake_version_component RC`"
if [ "$cmake_version_rc" != "" ]; then
cmake_version="${cmake_version}-rc${cmake_version_rc}"
fi
New version scheme to support branchy workflow Prepare to switch to the workflow described by "git help workflows". In this workflow, the "master" branch is always used to integrate topics ready for release. Brand new work merges into a "next" branch instead. We need a new versioning scheme to work this way because the version on "master" must always increase. We no longer use an even/odd minor number to distinguish releases from development versions. Since we still support cvs checkout of our source tree we cannot depend on "git describe" to compute a version number based on the history graph. We can use the CCYYMMDD nightly date stamp to get a monotonically increasing version component. The new version format is "major.minor.patch.(tweak|date)". Releases use a tweak level in the half-open range [0,20000000), which is smaller than any current or future date. For tweak=0 we do not show the tweak component, leaving the format "major.minor.patch" for most releases. Development versions use date=CCYYMMDD for the tweak level. The major.minor.patch part of development versions on "master" always matches the most recent release. For example, a first-parent traversal of "master" might see v2.8.1 2.8.1.20100422 v2.8.2 | | | ----o----o----o----o----o----o----o----o---- Since the date appears in the tweak component, the next release can increment the patch level (or any more significant component) to be greater than any version leading to it. Topic branches not ready for release are published only on "next" so we know that all versions on master lead between two releases.
2010-04-23 17:44:23 +04:00
cmake_data_dir_keyword="OTHER"
cmake_doc_dir_keyword="OTHER"
cmake_man_dir_keyword="OTHER"
cmake_data_dir=""
cmake_doc_dir=""
cmake_man_dir=""
cmake_init_file=""
cmake_bootstrap_system_libs=""
cmake_bootstrap_qt_gui=""
cmake_bootstrap_qt_qmake=""
Build Help documentation during CMake build using Sphinx Add a Utilities/Sphinx directory to hold CMake build code to run the Sphinx (sphinx-doc.org) documentation generation tool. Create a CMakeLists.txt file there capable of building either as a subdirectory of the main CMake build, or as a standalone documentation build. Add cache options SPHINX_MAN and SPHINX_HTML to select output formats and SPHINX_EXECUTABLE to specify the sphinx-build executable. Add bootstrap options --sphix-man and --sphinx-html to select output formats and --sphinx-build=<sb> to specify the sphinx-build executable. Create a "conf.py.in" file to configure_file into "conf.py" to tell sphinx-build how to build our documents. Create a "cmake.py" Sphinx extension module defining: * The "cmake-module" directive used in Help/module/*.rst files to scan .rst markup from the corresponding Modules/*.cmake file. * A Sphinx domain called "cmake" defining documentation object types for CMake Help/<type> directories: command, generator, manual, module, policy, prop_*, and variable. Add a "role" for each type to perform cross-references. Teach the roles to treat "<XYZ>" as placeholders instead of explicit targets if not preceded by a space. Add cmake domain directives to define command and variable objects explicitly in .rst file content. This will allow modules to define their own commands and variables and have them indexed and linkable. * A Sphinx document transform that converts Help/<type>/*.rst documents into cmake domain objects of the corresponding <type> and adds index entries for them. This will automatically index all CMake documentation objects and provide cross-reference targets for them with no special markup in the .rst files.
2013-09-18 00:08:05 +04:00
cmake_sphinx_man=""
cmake_sphinx_html=""
cmake_sphinx_build=""
# Determine whether this is a Cygwin environment.
if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
cmake_system_cygwin=true
cmake_doc_dir_keyword="CYGWIN"
cmake_man_dir_keyword="CYGWIN"
else
cmake_system_cygwin=false
fi
# 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
# 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
2012-07-07 21:57:40 +04:00
# Determine whether this is BeOS
2006-12-05 01:26:41 +03:00
if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
cmake_system_beos=true
cmake_doc_dir_keyword="HAIKU"
cmake_man_dir_keyword="HAIKU"
2006-12-05 01:26:41 +03:00
else
cmake_system_beos=false
fi
2012-07-07 21:57:40 +04:00
# Determine whether this is Haiku
if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
cmake_system_haiku=true
cmake_doc_dir_keyword="HAIKU"
cmake_man_dir_keyword="HAIKU"
else
cmake_system_haiku=false
fi
# 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
# Determine whether this is Linux
if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then
cmake_system_linux=true
# find out if it is a HP PA-RISC machine
if uname -m | grep parisc >/dev/null 2>&1; then
cmake_machine_parisc=true
else
cmake_machine_parisc=false
fi
else
cmake_system_linux=false
fi
# 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
# 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}"
# Helper function to fix windows paths.
case "${cmake_system}" in
*MINGW*)
cmake_fix_slashes()
{
cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//'
}
;;
*)
cmake_fix_slashes()
{
echo "$1" | sed 's/\\/\//g'
}
;;
esac
# 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
elif ${cmake_system_haiku}; then
cmake_default_prefix=`finddir B_COMMON_DIRECTORY`
else
cmake_default_prefix="/usr/local"
fi
# Lookup default install destinations.
cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`"
cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`"
cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`"
2003-03-27 23:29:38 +03:00
CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
2004-10-19 22:51:25 +04:00
CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
2003-03-27 23:29:38 +03:00
CMAKE_PROBLEMATIC_FILES="\
CMakeCache.txt \
CMakeSystem.cmake \
CMakeCCompiler.cmake \
CMakeCXXCompiler.cmake \
Make platform information files specific to the CMake version At the top of a build tree we configure inside the CMakeFiles directory files such as "CMakeSystem.cmake" and "CMake<lang>Compiler.cmake" to save information detected about the system and compilers in use. The method of detection and the exact results store varies across CMake versions as things improve. This leads to problems when loading files configured by a different version of CMake. Previously we ignored such existing files only if the major.minor part of the CMake version component changed, and depended on the CMakeCache.txt to tell us the last version of CMake that wrote the files. This led to problems if the user deletes the CMakeCache.txt or we add required information to the files in a patch-level release of CMake (still a "feature point" release by modern CMake versioning convention). Ensure that we always have version-consistent platform information files by storing them in a subdirectory named with the CMake version. Every version of CMake will do its own system and compiler identification checks even when a build tree has already been configured by another version of CMake. Stored results will not clobber those from other versions of CMake which may be run again on the same tree in the future. Loaded results will match what the system and language modules expect. Rename the undocumented variable CMAKE_PLATFORM_ROOT_BIN to CMAKE_PLATFORM_INFO_DIR to clarify its purpose. The new variable points at the version-specific directory while the old variable did not.
2012-08-24 16:48:59 +04:00
*/CMakeSystem.cmake \
*/CMakeCCompiler.cmake \
*/CMakeCXXCompiler.cmake \
Source/cmConfigure.h \
Source/CTest/Curl/config.h \
Utilities/cmexpat/expatConfig.h \
Utilities/cmexpat/expatDllConfig.h \
"
2006-03-22 17:58:11 +03:00
CMAKE_UNUSED_SOURCES="\
cmGlobalXCodeGenerator \
cmLocalXCodeGenerator \
cmXCodeObject \
cmXCode21Object \
cmSourceGroup \
"
CMAKE_CXX_SOURCES="\
cmStandardIncludes \
2003-03-27 23:29:38 +03:00
cmake \
cmakemain \
cmakewizard \
cmcmd \
cmCommandArgumentLexer \
cmCommandArgumentParser \
cmCommandArgumentParserHelper \
cmDefinitions \
cmDepends \
cmDependsC \
cmDocumentationFormatter \
cmPolicies \
2006-12-07 18:48:11 +03:00
cmProperty \
cmPropertyMap \
cmPropertyDefinition \
cmPropertyDefinitionMap \
2003-03-27 23:29:38 +03:00
cmMakeDepend \
cmMakefile \
cmExportFileGenerator \
cmExportInstallFileGenerator \
cmExportTryCompileFileGenerator \
cmExportSet \
cmExportSetMap \
cmInstallDirectoryGenerator \
cmGeneratedFileStream \
cmGeneratorTarget \
cmGeneratorExpressionDAGChecker \
cmGeneratorExpressionEvaluator \
cmGeneratorExpressionLexer \
cmGeneratorExpressionParser \
cmGeneratorExpression \
2003-03-27 23:29:38 +03:00
cmGlobalGenerator \
cmLocalGenerator \
cmInstallGenerator \
cmInstallExportGenerator \
cmInstallFilesGenerator \
cmInstallScriptGenerator \
cmInstallTargetGenerator \
cmScriptGenerator \
2003-03-27 23:29:38 +03:00
cmSourceFile \
cmSourceFileLocation \
2003-03-27 23:29:38 +03:00
cmSystemTools \
cmTestGenerator \
2006-11-30 01:45:55 +03:00
cmVersion \
2005-10-12 21:36:07 +04:00
cmFileTimeComparison \
2005-05-12 19:53:42 +04:00
cmGlobalUnixMakefileGenerator3 \
cmLocalUnixMakefileGenerator3 \
cmMakefileExecutableTargetGenerator \
cmMakefileLibraryTargetGenerator \
cmMakefileTargetGenerator \
cmMakefileUtilityTargetGenerator \
cmOSXBundleGenerator \
cmNewLineStyle \
cmBootstrapCommands1 \
cmBootstrapCommands2 \
2003-03-27 23:29:38 +03:00
cmCommands \
cmTarget \
cmTest \
2003-03-27 23:29:38 +03:00
cmCustomCommand \
cmCustomCommandGenerator \
2003-03-27 23:29:38 +03:00
cmCacheManager \
cmListFileCache \
cmComputeLinkDepends \
cmComputeLinkInformation \
cmOrderDirectories \
cmComputeTargetDepends \
cmComputeComponentGraph \
cmExprLexer \
cmExprParser \
cmExprParserHelper \
2012-07-20 13:08:36 +04:00
cmGlobalNinjaGenerator \
cmLocalNinjaGenerator \
cmNinjaTargetGenerator \
cmNinjaNormalTargetGenerator \
cmNinjaUtilityTargetGenerator \
2006-03-22 17:58:11 +03:00
"
2003-03-27 23:29:38 +03:00
if ${cmake_system_mingw}; then
CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
cmGlobalMSYSMakefileGenerator \
cmGlobalMinGWMakefileGenerator"
fi
CMAKE_C_SOURCES="\
cmListFileLexer \
"
if ${cmake_system_mingw}; then
KWSYS_C_SOURCES="\
2006-09-21 21:47:54 +04:00
ProcessWin32 \
String \
2006-09-21 21:47:54 +04:00
System"
else
KWSYS_C_SOURCES="\
2006-09-21 21:47:54 +04:00
ProcessUNIX \
String \
2006-09-21 21:47:54 +04:00
System"
fi
KWSYS_CXX_SOURCES="\
2003-06-23 16:58:58 +04:00
Directory \
2005-10-18 22:08:55 +04:00
Glob \
2003-06-23 16:58:58 +04:00
RegularExpression \
SystemTools"
KWSYS_FILES="\
auto_ptr.hxx \
2003-06-23 16:58:58 +04:00
Directory.hxx \
2005-10-18 22:08:55 +04:00
Glob.hxx \
2003-06-23 16:58:58 +04:00
Process.h \
RegularExpression.hxx \
String.h \
String.hxx \
2006-09-21 21:47:54 +04:00
System.h \
2003-06-23 16:58:58 +04:00
SystemTools.hxx"
KWSYS_IOS_FILES="
2003-06-23 16:58:58 +04:00
fstream \
iosfwd \
iostream \
sstream"
# Display CMake bootstrap usage
2003-03-27 23:29:38 +03:00
cmake_usage()
{
echo '
Usage: '"$0"' [<options>...] [-- <cmake-options>...]
2003-03-27 23:29:38 +03:00
Options: [defaults in brackets after descriptions]
Configuration:
--help print this message
--version only print version information
2003-03-27 23:29:38 +03:00
--verbose display more information
--parallel=n bootstrap cmake in parallel, where n is
number of nodes [1]
--enable-ccache Enable ccache when building cmake
--init=FILE load FILE as script to populate cache
--system-libs use all system-installed third-party libraries
(for use only by package maintainers)
--no-system-libs use all cmake-provided third-party libraries
(default)
--system-curl use system-installed curl library
--no-system-curl use cmake-provided curl library (default)
--system-expat use system-installed expat library
--no-system-expat use cmake-provided expat library (default)
--system-zlib use system-installed zlib library
--no-system-zlib use cmake-provided zlib library (default)
--system-bzip2 use system-installed bzip2 library
--no-system-bzip2 use cmake-provided bzip2 library (default)
--system-libarchive use system-installed libarchive library
--no-system-libarchive use cmake-provided libarchive library (default)
--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
Build Help documentation during CMake build using Sphinx Add a Utilities/Sphinx directory to hold CMake build code to run the Sphinx (sphinx-doc.org) documentation generation tool. Create a CMakeLists.txt file there capable of building either as a subdirectory of the main CMake build, or as a standalone documentation build. Add cache options SPHINX_MAN and SPHINX_HTML to select output formats and SPHINX_EXECUTABLE to specify the sphinx-build executable. Add bootstrap options --sphix-man and --sphinx-html to select output formats and --sphinx-build=<sb> to specify the sphinx-build executable. Create a "conf.py.in" file to configure_file into "conf.py" to tell sphinx-build how to build our documents. Create a "cmake.py" Sphinx extension module defining: * The "cmake-module" directive used in Help/module/*.rst files to scan .rst markup from the corresponding Modules/*.cmake file. * A Sphinx domain called "cmake" defining documentation object types for CMake Help/<type> directories: command, generator, manual, module, policy, prop_*, and variable. Add a "role" for each type to perform cross-references. Teach the roles to treat "<XYZ>" as placeholders instead of explicit targets if not preceded by a space. Add cmake domain directives to define command and variable objects explicitly in .rst file content. This will allow modules to define their own commands and variables and have them indexed and linkable. * A Sphinx document transform that converts Help/<type>/*.rst documents into cmake domain objects of the corresponding <type> and adds index entries for them. This will automatically index all CMake documentation objects and provide cross-reference targets for them with no special markup in the .rst files.
2013-09-18 00:08:05 +04:00
--sphinx-man build man pages with Sphinx
--sphinx-html build html help with Sphinx
--sphinx-build=<sb> use <sb> as the sphinx-build executable
2003-03-27 23:29:38 +03:00
Directory and file names:
--prefix=PREFIX install files in tree rooted at PREFIX
['"${cmake_default_prefix}"']
--datadir=DIR install data files in PREFIX/DIR
['"${cmake_data_dir_default}"']
--docdir=DIR install documentation files in PREFIX/DIR
['"${cmake_doc_dir_default}"']
--mandir=DIR install man pages files in PREFIX/DIR/manN
['"${cmake_man_dir_default}"']
'
2003-03-27 23:29:38 +03:00
exit 10
}
# Display CMake bootstrap usage
cmake_version_display()
{
echo "CMake ${cmake_version}, Copyright 2000-2012 Kitware, Inc."
}
# Display CMake bootstrap error, display the log file and exit
2003-05-14 17:19:12 +04:00
cmake_error()
{
res=$1
shift 1
2003-03-27 23:29:38 +03:00
echo "---------------------------------------------"
2012-07-07 21:57:40 +04:00
echo "Error when bootstrapping CMake:"
2003-05-14 17:19:12 +04:00
echo "$*"
echo "---------------------------------------------"
if [ -f cmake_bootstrap.log ]; then
echo "Log of errors: `pwd`/cmake_bootstrap.log"
#cat cmake_bootstrap.log
2003-05-14 17:19:12 +04:00
echo "---------------------------------------------"
fi
exit ${res}
2003-05-14 17:19:12 +04:00
}
2003-03-27 23:29:38 +03:00
# Replace KWSYS_NAMESPACE with cmsys
cmake_replace_string ()
{
INFILE="$1"
OUTFILE="$2"
SEARCHFOR="$3"
REPLACEWITH="$4"
if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
2012-07-07 21:57:40 +04:00
cat "${INFILE}" |
sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" > "${OUTFILE}${_tmp}"
if [ -f "${OUTFILE}${_tmp}" ]; then
if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
#echo "Files are the same"
rm -f "${OUTFILE}${_tmp}"
else
mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
fi
fi
2003-06-23 16:58:58 +04:00
else
cmake_error 1 "Cannot find file ${INFILE}"
fi
}
cmake_kwsys_config_replace_string ()
{
INFILE="$1"
OUTFILE="$2"
shift 2
APPEND="$*"
if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
echo "${APPEND}" > "${OUTFILE}${_tmp}"
2012-07-07 21:57:40 +04:00
cat "${INFILE}" |
sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
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;
s/@KWSYS_IOS_HAVE_BINARY@/${KWSYS_IOS_HAVE_BINARY}/g;
s/@KWSYS_STL_HAVE_STD@/${KWSYS_STL_HAVE_STD}/g;
s/@KWSYS_STL_STRING_HAVE_ISTREAM@/${KWSYS_STL_STRING_HAVE_ISTREAM}/g;
s/@KWSYS_STL_STRING_HAVE_OSTREAM@/${KWSYS_STL_STRING_HAVE_OSTREAM}/g;
s/@KWSYS_STL_STRING_HAVE_NEQ_CHAR@/${KWSYS_STL_STRING_HAVE_NEQ_CHAR}/g;
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;
s/@KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}/g;
s/@KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE}/g;
s/@KWSYS_STL_HAS_ALLOCATOR_REBIND@/${KWSYS_STL_HAS_ALLOCATOR_REBIND}/g;
s/@KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@/${KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT}/g;
s/@KWSYS_STL_HAS_ALLOCATOR_OBJECTS@/${KWSYS_STL_HAS_ALLOCATOR_OBJECTS}/g;
s/@KWSYS_CXX_HAS_CSTDDEF@/${KWSYS_CXX_HAS_CSTDDEF}/g;
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;
s/@KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@/${KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP}/g;
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
#echo "Files are the same"
rm -f "${OUTFILE}${_tmp}"
else
mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
fi
fi
else
cmake_error 2 "Cannot find file ${INFILE}"
fi
}
# Write string into a file
2003-03-27 23:29:38 +03:00
cmake_report ()
{
FILE=$1
shift
echo "$*" >> ${FILE}
}
# Escape spaces in strings
2003-03-27 23:29:38 +03:00
cmake_escape ()
{
echo $1 | sed "s/ /\\\\ /g"
}
# Strip prefix from argument
cmake_arg ()
{
echo "$1" | sed "s/^${2-[^=]*=}//"
}
# Write message to the log
2003-03-27 23:29:38 +03:00
cmake_log ()
{
echo "$*" >> cmake_bootstrap.log
}
# Return temp file
2003-03-27 23:29:38 +03:00
cmake_tmp_file ()
{
echo "cmake_bootstrap_$$_test"
2003-03-27 23:29:38 +03:00
}
# Run a compiler test. First argument is compiler, second one are compiler
# flags, third one is test source file to be compiled
2003-03-27 23:29:38 +03:00
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}"
echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
echo "---------- file -----------------------"
cat "${TESTFILE}"
echo "------------------------------------------"
2003-03-27 23:29:38 +03:00
"${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
RES=$?
if [ "${RES}" -ne "0" ]; then
echo "Test failed to compile"
return 1
2003-03-27 23:29:38 +03:00
fi
if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
echo "Test failed to produce executable"
2003-03-27 23:29:38 +03:00
return 2
fi
./${TMPFILE}
RES=$?
rm -f "${TMPFILE}"
if [ "${RES}" -ne "0" ]; then
echo "Test produced non-zero return code"
2003-03-27 23:29:38 +03:00
return 3
fi
echo "Test succeded"
2003-03-27 23:29:38 +03:00
return 0
}
# Run a make test. First argument is the make interpreter.
2003-03-27 23:29:38 +03:00
cmake_try_make ()
{
MAKE_PROC="$1"
MAKE_FLAGS="$2"
2003-03-27 23:29:38 +03:00
echo "Try: ${MAKE_PROC}"
"${MAKE_PROC}" ${MAKE_FLAGS}
2003-03-27 23:29:38 +03:00
RES=$?
if [ "${RES}" -ne "0" ]; then
echo "${MAKE_PROC} does not work"
return 1
2003-03-27 23:29:38 +03:00
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
}
# Parse arguments
2003-05-14 17:19:12 +04:00
cmake_verbose=
cmake_parallel_make=
cmake_ccache_enabled=
cmake_prefix_dir="${cmake_default_prefix}"
while test $# != 0; do
case "$1" in
--prefix=*) dir=`cmake_arg "$1"`
cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;;
--parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;;
--datadir=*) cmake_data_dir=`cmake_arg "$1"` ;;
--docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;;
--mandir=*) cmake_man_dir=`cmake_arg "$1"` ;;
--init=*) cmake_init_file=`cmake_arg "$1"` ;;
--system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
--no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
--system-bzip2|--system-curl|--system-expat|--system-libarchive|--system-zlib)
lib=`cmake_arg "$1" "--system-"`
cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
--no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-libarchive|--no-system-zlib)
lib=`cmake_arg "$1" "--no-system-"`
cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
--qt-gui) cmake_bootstrap_qt_gui="1" ;;
--no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
--qt-qmake=*) cmake_bootstrap_qt_qmake=`cmake_arg "$1"` ;;
Build Help documentation during CMake build using Sphinx Add a Utilities/Sphinx directory to hold CMake build code to run the Sphinx (sphinx-doc.org) documentation generation tool. Create a CMakeLists.txt file there capable of building either as a subdirectory of the main CMake build, or as a standalone documentation build. Add cache options SPHINX_MAN and SPHINX_HTML to select output formats and SPHINX_EXECUTABLE to specify the sphinx-build executable. Add bootstrap options --sphix-man and --sphinx-html to select output formats and --sphinx-build=<sb> to specify the sphinx-build executable. Create a "conf.py.in" file to configure_file into "conf.py" to tell sphinx-build how to build our documents. Create a "cmake.py" Sphinx extension module defining: * The "cmake-module" directive used in Help/module/*.rst files to scan .rst markup from the corresponding Modules/*.cmake file. * A Sphinx domain called "cmake" defining documentation object types for CMake Help/<type> directories: command, generator, manual, module, policy, prop_*, and variable. Add a "role" for each type to perform cross-references. Teach the roles to treat "<XYZ>" as placeholders instead of explicit targets if not preceded by a space. Add cmake domain directives to define command and variable objects explicitly in .rst file content. This will allow modules to define their own commands and variables and have them indexed and linkable. * A Sphinx document transform that converts Help/<type>/*.rst documents into cmake domain objects of the corresponding <type> and adds index entries for them. This will automatically index all CMake documentation objects and provide cross-reference targets for them with no special markup in the .rst files.
2013-09-18 00:08:05 +04:00
--sphinx-man) cmake_sphinx_man="1" ;;
--sphinx-html) cmake_sphinx_html="1" ;;
--sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;;
--help) cmake_usage ;;
--version) cmake_version_display ; exit 2 ;;
--verbose) cmake_verbose=TRUE ;;
--enable-ccache) cmake_ccache_enabled=TRUE ;;
--) shift; break ;;
*) die "Unknown option: $1" ;;
esac
shift
2003-05-14 17:19:12 +04:00
done
# If verbose, display some information about bootstrap
2003-05-14 17:19:12 +04:00
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}"
if [ "x${cmake_parallel_make}" != "x" ]; then
echo "Doing parallel make: ${cmake_parallel_make}"
fi
echo ""
2003-05-14 17:19:12 +04:00
fi
echo "---------------------------------------------"
# Get CMake version
echo "`cmake_version_display`"
2003-05-14 17:19:12 +04:00
# 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?
if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then
cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
Looks like somebody did bootstrap CMake in the source tree, but now you are
trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
directory from the source tree."
fi
# Is there a cache in the source tree?
for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
2004-10-19 02:11:42 +04:00
if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
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
# Make bootstrap directory
2003-05-14 17:19:12 +04:00
[ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
if [ ! -d "${cmake_bootstrap_dir}" ]; then
cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
2003-05-14 17:19:12 +04:00
fi
cd "${cmake_bootstrap_dir}"
2003-06-23 16:58:58 +04:00
[ -d "cmsys" ] || mkdir "cmsys"
if [ ! -d "cmsys" ]; then
cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
2003-06-23 16:58:58 +04:00
fi
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
2003-06-23 16:58:58 +04:00
# Delete all the bootstrap files
2003-05-14 17:19:12 +04:00
rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
2003-05-14 17:19:12 +04:00
# If exist compiler flags, set them
2003-03-27 23:29:38 +03:00
cmake_c_flags=${CFLAGS}
cmake_cxx_flags=${CXXFLAGS}
2006-12-05 16:47:06 +03:00
cmake_ld_flags=${LDFLAGS}
2003-03-27 23:29:38 +03:00
# Add Cygwin-specific flags
if ${cmake_system_cygwin}; then
cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
fi
# Add CoreFoundation framework on Darwin
if ${cmake_system_darwin}; then
cmake_ld_flags="${LDFLAGS} -framework CoreFoundation"
fi
2006-12-05 01:26:41 +03:00
# Add BeOS toolkits...
if ${cmake_system_beos}; then
cmake_ld_flags="${LDFLAGS} -lroot -lbe"
fi
# Add Haiku toolkits...
if ${cmake_system_haiku}; then
cmake_ld_flags="${LDFLAGS} -lroot -lbe"
fi
if ${cmake_system_linux}; then
# avoid binutils problem with large binaries, e.g. when building CMake in debug mode
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230
if ${cmake_machine_parisc}; then
# if -O[s23] is given the effect is inverted, so do not use the flag then
if [ "`echo "${CXXFLAGS}" | sed -r '/^(.* )?(-O[s234])( .*)?$/s/.*/-Os/'`" != "-Os" ]; then
cmake_ld_flags="${LDFLAGS} -Wl,--unique=.text.*"
fi
fi
fi
#-----------------------------------------------------------------------------
# Detect known toolchains on some platforms.
cmake_toolchains=''
case "${cmake_system}" in
*AIX*) cmake_toolchains='XL GNU' ;;
*CYGWIN*) cmake_toolchains='GNU' ;;
*Darwin*) cmake_toolchains='GNU Clang' ;;
*Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;;
*MINGW*) cmake_toolchains='GNU' ;;
esac
# Toolchain compiler name table.
cmake_toolchain_Clang_CC='clang'
cmake_toolchain_Clang_CXX='clang++'
cmake_toolchain_GNU_CC='gcc'
cmake_toolchain_GNU_CXX='g++'
cmake_toolchain_PGI_CC='pgcc'
cmake_toolchain_PGI_CXX='pgCC'
cmake_toolchain_PathScale_CC='pathcc'
cmake_toolchain_PathScale_CXX='pathCC'
cmake_toolchain_XL_CC='xlc'
cmake_toolchain_XL_CXX='xlC'
cmake_toolchain_try()
{
tc="$1"
TMPFILE=`cmake_tmp_file`
eval "tc_CC=\${cmake_toolchain_${tc}_CC}"
echo 'int main() { return 0; }' > "${TMPFILE}.c"
cmake_try_run "$tc_CC" "" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1
tc_result_CC="$?"
rm -f "${TMPFILE}.c"
test "${tc_result_CC}" = "0" || return 1
eval "tc_CXX=\${cmake_toolchain_${tc}_CXX}"
echo 'int main() { return 0; }' > "${TMPFILE}.cpp"
cmake_try_run "$tc_CXX" "" "${TMPFILE}.cpp" >> cmake_bootstrap.log 2>&1
tc_result_CXX="$?"
rm -f "${TMPFILE}.cpp"
test "${tc_result_CXX}" = "0" || return 1
cmake_toolchain="$tc"
}
cmake_toolchain_detect()
{
cmake_toolchain=
for tc in ${cmake_toolchains}; do
echo "Checking for $tc toolchain" >> cmake_bootstrap.log 2>&1
cmake_toolchain_try "$tc" &&
echo "Found $tc toolchain" &&
break
done
}
if [ -z "${CC}" -a -z "${CXX}" ]; then
cmake_toolchain_detect
fi
#-----------------------------------------------------------------------------
2003-03-27 23:29:38 +03:00
# Test C compiler
cmake_c_compiler=
# If CC is set, use that for compiler, otherwise use list of known compilers
if [ -n "${cmake_toolchain}" ]; then
eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
elif [ -n "${CC}" ]; then
2003-03-27 23:29:38 +03:00
cmake_c_compilers="${CC}"
else
cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
fi
# Check if C compiler works
2003-03-27 23:29:38 +03:00
TMPFILE=`cmake_tmp_file`
echo '
2006-07-26 22:10:14 +04:00
#ifdef __cplusplus
# error "The CMAKE_C_COMPILER is set to a C++ compiler"
2006-07-26 19:46:22 +04:00
#endif
2006-07-26 22:10:14 +04:00
#include<stdio.h>
#if defined(__CLASSIC_C__)
2006-07-26 19:46:22 +04:00
int main(argc, argv)
int argc;
char* argv[];
#else
2006-07-25 19:00:10 +04:00
int main(int argc, char* argv[])
2006-07-26 19:46:22 +04:00
#endif
2003-03-27 23:29:38 +03:00
{
printf("%d%c", (argv != 0), (char)0x0a);
2006-07-25 19:00:10 +04:00
return argc-1;
2003-03-27 23:29:38 +03:00
}
' > "${TMPFILE}.c"
2003-03-27 23:29:38 +03:00
for a in ${cmake_c_compilers}; do
if [ -z "${cmake_c_compiler}" ] && \
cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
2003-03-27 23:29:38 +03:00
cmake_c_compiler="${a}"
fi
done
rm -f "${TMPFILE}.c"
if [ -z "${cmake_c_compiler}" ]; then
cmake_error 6 "Cannot find appropriate C compiler on this system.
2004-10-12 18:57:24 +04:00
Please specify one using environment variable CC.
See cmake_bootstrap.log for compilers attempted.
"
2003-03-27 23:29:38 +03:00
fi
echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
#-----------------------------------------------------------------------------
2003-03-27 23:29:38 +03:00
# Test CXX compiler
cmake_cxx_compiler=
# On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
# If CC is set, use that for compiler, otherwise use list of known compilers
if [ -n "${cmake_toolchain}" ]; then
eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
elif [ -n "${CXX}" ]; then
2003-03-27 23:29:38 +03:00
cmake_cxx_compilers="${CXX}"
else
cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
fi
# Check if C++ compiler works
2003-03-27 23:29:38 +03:00
TMPFILE=`cmake_tmp_file`
echo '
#if defined(TEST1)
# include <iostream>
#else
# include <iostream.h>
#endif
2012-07-07 21:57:40 +04:00
class NeedCXX
{
public:
NeedCXX() { this->Foo = 1; }
int GetFoo() { return this->Foo; }
private:
int Foo;
};
2003-03-27 23:29:38 +03:00
int main()
{
NeedCXX c;
#ifdef TEST3
cout << c.GetFoo() << endl;
#else
std::cout << c.GetFoo() << std::endl;
#endif
2003-03-27 23:29:38 +03:00
return 0;
}
' > "${TMPFILE}.cxx"
2003-03-27 23:29:38 +03:00
for a in ${cmake_cxx_compilers}; do
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
2003-03-27 23:29:38 +03:00
done
rm -f "${TMPFILE}.cxx"
if [ -z "${cmake_cxx_compiler}" ]; then
cmake_error 7 "Cannot find appropriate C++ compiler on this system.
2004-10-12 18:57:24 +04:00
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted."
2003-03-27 23:29:38 +03:00
fi
echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
#-----------------------------------------------------------------------------
2003-03-27 23:29:38 +03:00
# Test Make
cmake_make_processor=
cmake_make_flags=
# If MAKE is set, use that for make processor, otherwise use list of known make
2003-03-27 23:29:38 +03:00
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}"
echo '
2003-03-27 23:29:38 +03:00
test: test.c
"'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
'>"Makefile"
echo '
2003-03-27 23:29:38 +03:00
#include <stdio.h>
int main(){ printf("1%c", (char)0x0a); return 0; }
' > "test.c"
cmake_original_make_flags="${cmake_make_flags}"
if [ "x${cmake_parallel_make}" != "x" ]; then
cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
fi
2003-03-27 23:29:38 +03:00
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
2003-03-27 23:29:38 +03:00
cmake_make_processor="${a}"
fi
done
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
2003-03-27 23:29:38 +03:00
cd "${cmake_bootstrap_dir}"
if [ -z "${cmake_make_processor}" ]; then
cmake_error 8 "Cannot find appropriate Makefile processor on this system.
Please specify one using environment variable MAKE."
fi
rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
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
2003-03-27 23:29:38 +03:00
# Ok, we have CC, CXX, and MAKE.
2003-03-27 23:29:38 +03:00
# Test C++ compiler features
2003-04-22 22:32:48 +04:00
# Are we GCC?
TMPFILE=`cmake_tmp_file`
echo '
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
#include <iostream>
int main() { std::cout << "This is GNU" << std::endl; return 0;}
#endif
' > ${TMPFILE}.cxx
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`
echo '
#include <iostream>
int main() { std::cout << "No need for '"${cmake_test_flags}"'" << std::endl; return 0;}
' > ${TMPFILE}.cxx
cmake_need_lang_std=0
if cmake_try_run "${cmake_cxx_compiler}" \
"${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
2003-04-22 22:32:48 +04:00
fi
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"
2003-04-22 22:32:48 +04:00
fi
cmake_test_flags=
# 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`
echo '
#include <iostream>
int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
' > ${TMPFILE}.cxx
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"
fi
cmake_test_flags=
# 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`
echo '
#include <iostream>
int main() { std::cout << "We need '"${cmake_test_flags}"'" << std::endl; return 0;}
' > ${TMPFILE}.cxx
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"
fi
cmake_test_flags=
2003-04-22 22:32:48 +04:00
# 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`
echo '
int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
' > ${TMPFILE}.c
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
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"
fi
cmake_test_flags=
fi
# 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_HAVE_STD=0
KWSYS_IOS_USE_SSTREAM=0
KWSYS_IOS_USE_ANSI=0
KWSYS_IOS_HAVE_BINARY=0
KWSYS_STL_HAVE_STD=0
KWSYS_STAT_HAS_ST_MTIM=0
KWSYS_STL_STRING_HAVE_NEQ_CHAR=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_SETENV=0
KWSYS_CXX_HAS_UNSETENV=0
KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0
KWSYS_CXX_HAS_UTIMENSAT=0
KWSYS_CXX_HAS_UTIMES=0
KWSYS_CXX_HAS_CSTDDEF=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_CXX_HAS_SETENV" \
"${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_CXX_HAS_SETENV=1
echo "${cmake_cxx_compiler} has setenv"
else
echo "${cmake_cxx_compiler} does not have setenv"
fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_UNSETENV" \
"${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_CXX_HAS_UNSETENV=1
echo "${cmake_cxx_compiler} has unsetenv"
else
echo "${cmake_cxx_compiler} does not have unsetenv"
fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H" \
"${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=1
echo "${cmake_cxx_compiler} has environ in stdlib.h"
else
echo "${cmake_cxx_compiler} does not have environ in stdlib.h"
fi
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"
else
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
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"
else
echo "${cmake_cxx_compiler} does not have standard template allocator"
fi
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"
fi
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}
*/
"
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 */"
2003-03-27 23:29:38 +03:00
else
cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_STD_NAMESPACE 1"
2003-03-27 23:29:38 +03:00
fi
if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */"
2003-03-27 23:29:38 +03:00
else
cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STREAM_HEADERS 1"
2003-03-27 23:29:38 +03:00
fi
if [ "x$KWSYS_IOS_USE_SSTREAM" = "x1" ]; then
cmake_report cmConfigure.h${_tmp} "/* #undef CMAKE_NO_ANSI_STRING_STREAM */"
2003-03-27 23:29:38 +03:00
else
cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_STRING_STREAM 1"
2003-03-27 23:29:38 +03:00
fi
# 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 */"
2003-03-27 23:29:38 +03:00
echo "${cmake_cxx_compiler} has ANSI for scoping"
else
cmake_report cmConfigure.h${_tmp} "#define CMAKE_NO_ANSI_FOR_SCOPE 1"
2003-03-27 23:29:38 +03:00
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
# Write CMake version
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}"
New version scheme to support branchy workflow Prepare to switch to the workflow described by "git help workflows". In this workflow, the "master" branch is always used to integrate topics ready for release. Brand new work merges into a "next" branch instead. We need a new versioning scheme to work this way because the version on "master" must always increase. We no longer use an even/odd minor number to distinguish releases from development versions. Since we still support cvs checkout of our source tree we cannot depend on "git describe" to compute a version number based on the history graph. We can use the CCYYMMDD nightly date stamp to get a monotonically increasing version component. The new version format is "major.minor.patch.(tweak|date)". Releases use a tweak level in the half-open range [0,20000000), which is smaller than any current or future date. For tweak=0 we do not show the tweak component, leaving the format "major.minor.patch" for most releases. Development versions use date=CCYYMMDD for the tweak level. The major.minor.patch part of development versions on "master" always matches the most recent release. For example, a first-parent traversal of "master" might see v2.8.1 2.8.1.20100422 v2.8.2 | | | ----o----o----o----o----o----o----o----o---- Since the date appears in the tweak component, the next release can increment the patch level (or any more significant component) to be greater than any version leading to it. Topic branches not ready for release are published only on "next" so we know that all versions on master lead between two releases.
2010-04-23 17:44:23 +04:00
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 \"/bootstrap-not-insalled\""
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}
else
mv -f cm${h}.h${_tmp} cm${h}.h
fi
done
2003-03-27 23:29:38 +03:00
2003-06-23 16:58:58 +04:00
# 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}"
2012-07-07 21:57:40 +04:00
for a in ${KWSYS_FILES}; do
2003-06-23 16:58:58 +04:00
cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
"${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
done
2012-07-07 21:57:40 +04:00
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
2003-06-23 16:58:58 +04:00
done
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 set map algorithm; do
cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx_b" \
"${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
2003-06-23 16:58:58 +04:00
done
2003-03-27 23:29:38 +03:00
# Generate Makefile
2006-03-06 23:41:56 +03:00
dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
2003-03-27 23:29:38 +03:00
objs=""
for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
2003-03-27 23:29:38 +03:00
objs="${objs} ${a}.o"
done
# Generate dependencies for cmBootstrapCommands1.cxx
for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands1.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
cmBootstrapCommands1Deps="${cmBootstrapCommands1Deps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
done
cmBootstrapCommands1Deps=`echo $cmBootstrapCommands1Deps`
for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands2.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
cmBootstrapCommands2Deps="${cmBootstrapCommands2Deps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
done
cmBootstrapCommands2Deps=`echo $cmBootstrapCommands2Deps`
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_cxx_flags_SystemTools="
-DKWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV}
-DKWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV}
-DKWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}
-DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
-DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
"
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}\"`"
2003-03-27 23:29:38 +03:00
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
2003-03-27 23:29:38 +03:00
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 "cmBootstrapCommands1.o : $cmBootstrapCommands1Deps" >> "${cmake_bootstrap_dir}/Makefile"
echo "cmBootstrapCommands2.o : $cmBootstrapCommands2Deps" >> "${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}; 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
2003-06-23 16:58:58 +04:00
src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
2003-06-23 16:58:58 +04:00
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
2003-06-23 16:58:58 +04:00
done
echo '
2003-08-07 01:52:16 +04:00
rebuild_cache:
cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
' >> "${cmake_bootstrap_dir}/Makefile"
2003-03-27 23:29:38 +03:00
# 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"
fi
Build Help documentation during CMake build using Sphinx Add a Utilities/Sphinx directory to hold CMake build code to run the Sphinx (sphinx-doc.org) documentation generation tool. Create a CMakeLists.txt file there capable of building either as a subdirectory of the main CMake build, or as a standalone documentation build. Add cache options SPHINX_MAN and SPHINX_HTML to select output formats and SPHINX_EXECUTABLE to specify the sphinx-build executable. Add bootstrap options --sphix-man and --sphinx-html to select output formats and --sphinx-build=<sb> to specify the sphinx-build executable. Create a "conf.py.in" file to configure_file into "conf.py" to tell sphinx-build how to build our documents. Create a "cmake.py" Sphinx extension module defining: * The "cmake-module" directive used in Help/module/*.rst files to scan .rst markup from the corresponding Modules/*.cmake file. * A Sphinx domain called "cmake" defining documentation object types for CMake Help/<type> directories: command, generator, manual, module, policy, prop_*, and variable. Add a "role" for each type to perform cross-references. Teach the roles to treat "<XYZ>" as placeholders instead of explicit targets if not preceded by a space. Add cmake domain directives to define command and variable objects explicitly in .rst file content. This will allow modules to define their own commands and variables and have them indexed and linkable. * A Sphinx document transform that converts Help/<type>/*.rst documents into cmake domain objects of the corresponding <type> and adds index entries for them. This will automatically index all CMake documentation objects and provide cross-reference targets for them with no special markup in the .rst files.
2013-09-18 00:08:05 +04:00
if [ "x${cmake_sphinx_man}" != "x" ]; then
echo '
set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE FILEPATH "Build man pages with Sphinx" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
if [ "x${cmake_sphinx_html}" != "x" ]; then
echo '
set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE FILEPATH "Build html help with Sphinx" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
if [ "x${cmake_sphinx_build}" != "x" ]; then
echo '
set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
# 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
)
2003-03-27 23:29:38 +03:00
echo "---------------------------------------------"
# Run make to build bootstrap cmake
if [ "x${cmake_parallel_make}" != "x" ]; then
${cmake_make_processor} ${cmake_make_flags}
else
${cmake_make_processor}
fi
2003-03-27 23:29:38 +03:00
RES=$?
if [ "${RES}" -ne "0" ]; then
cmake_error 9 "Problem while running ${cmake_make_processor}"
2003-03-27 23:29:38 +03:00
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} "$@"
2005-03-04 18:03:38 +03:00
RES=$?
if [ "${RES}" -ne "0" ]; then
cmake_error 11 "Problem while running initial CMake"
fi
2003-03-27 23:29:38 +03:00
echo "---------------------------------------------"
# And we are done. Now just run make
echo "CMake has bootstrapped. Now run ${cmake_make_processor}."