diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-02 20:43:23 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-02 20:43:23 (GMT) |
commit | 4ea0f6b9494f2b4a4a5a238f8ad51ee6fbbcfe0a (patch) | |
tree | b73c04c8bce53edbdf39e3e98ae6e2a361f47bef /Templates/cxxconfigure.in | |
parent | 81ebecaea17cc18dfdda4fc3051eba08f6f076a0 (diff) | |
download | CMake-4ea0f6b9494f2b4a4a5a238f8ad51ee6fbbcfe0a.zip CMake-4ea0f6b9494f2b4a4a5a238f8ad51ee6fbbcfe0a.tar.gz CMake-4ea0f6b9494f2b4a4a5a238f8ad51ee6fbbcfe0a.tar.bz2 |
ENH: add enable language support for PROJECT command, this means that a C only project can be built with cmake, even without a cxx compiler
Diffstat (limited to 'Templates/cxxconfigure.in')
-rw-r--r-- | Templates/cxxconfigure.in | 165 |
1 files changed, 165 insertions, 0 deletions
diff --git a/Templates/cxxconfigure.in b/Templates/cxxconfigure.in new file mode 100644 index 0000000..4529e0d --- /dev/null +++ b/Templates/cxxconfigure.in @@ -0,0 +1,165 @@ +# Process this file with autoconf to produce a configure script. +AC_INIT() + + +# +# check for some programs we use +# + +# save the CXXFLAGS specified by the user +save_CXXFLAGS=$CXXFLAGS + +AC_PROG_CXX + + +# restore the flags specified by the user and get rid of any flags +# found by autoconf (we do not want -02 -g by default) +CXXFLAGS=$save_CXXFLAGS + + +CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION="" +if test $ac_cv_prog_gxx = no; then + echo $ac_n "checking whether ${CXX} supports explicit instantiation""... $ac_c" 1>&6 + echo 'template<class T>class x{};template class x<int>;' > conftest.cc + if test -z "`${CXX} -c conftest.cc 2>&1`"; then + echo "$ac_t""yes" 1>&6 + else + echo "$ac_t""no" 1>&6 + CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION="1" + fi + rm -f conftest* +fi +# if running on darwin no explicit template instantiations even though +# syntax is supported. +case $system in + Darwin*) + CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION="1" + ;; +esac +AC_SUBST(CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION) + +CMAKE_ANSI_CXXFLAGS="" +# on hp use -Aa for ansi +if test $ac_cv_prog_gxx = no; then +case $system in + IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*) + echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6 + echo 'void f(){}' > conftest.c + if test -z "`${CXX} -LANG:std -c conftest.c 2>&1`"; then + echo "$ac_t""yes" 1>&6 + CMAKE_ANSI_CXXFLAGS="-LANG:std" + else + echo "$ac_t""no" 1>&6 + fi + rm -f conftest* + ;; +esac +fi +AC_SUBST(CMAKE_ANSI_CXXFLAGS) + +# if we are not running g++ then we might need some other flags +# to get the templates compiled correctly +CMAKE_TEMPLATE_FLAGS="" +if test $ac_cv_prog_gxx = no; then + echo $ac_n "checking whether ${CXX} accepts -ptused -no_prelink""... $ac_c" 1>&6 + echo 'void f(){}' > conftest.cc + if test -z "`${CXX} -ptused -no_prelink -c conftest.cc 2>&1`"; then + echo "$ac_t""yes" 1>&6 + CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink" + else + echo "$ac_t""no" 1>&6 + fi + rm -f conftest* +fi +AC_SUBST(CMAKE_TEMPLATE_FLAGS) + + +# check no g++ compilers to see if they have the standard +# ansi stream files (without the .h) +if test $ac_cv_prog_gxx = no; then + AC_MSG_CHECKING( ansi standard C++ stream headers ) + rm -rf conftest.* + cat > conftest.cc <<! +#include <iostream> +! + if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then + echo "$ac_t""yes" 1>&6 + else + CMAKE_NO_ANSI_STREAM_HEADERS="1" + echo "$ac_t""no" 1>&6 + fi +fi +AC_SUBST(CMAKE_NO_ANSI_STREAM_HEADERS) + +# check to see if stl is in the std namespace +if test $ac_cv_prog_gxx = no; then + AC_MSG_CHECKING( ansi standard namespace support ) + rm -rf conftest.* + cat > conftest.cc <<! +#include <list> +void foo() { std::list<int> l; } +! + if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then + echo "$ac_t""yes" 1>&6 + else + CMAKE_NO_STD_NAMESPACE="1" + echo "$ac_t""no" 1>&6 + fi +fi +AC_SUBST(CMAKE_NO_STD_NAMESPACE) + +# check to see if for scoping is supported +if test $ac_cv_prog_gxx = no; then + AC_MSG_CHECKING( ansi for scope support ) + rm -rf conftest.* + cat > conftest.cc <<! +void foo() { for(int i;;); for(int i;;); } +! + if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then + echo "$ac_t""yes" 1>&6 + else + CMAKE_NO_ANSI_FOR_SCOPE="1" + echo "$ac_t""no" 1>&6 + fi +fi +AC_SUBST(CMAKE_NO_ANSI_FOR_SCOPE) + + +# find make to use to build cmake, prefer gmake +AC_PATH_PROGS(CMAKE_AR_TMP, ar) +CMAKE_AR="$CMAKE_AR_TMP" +CMAKE_AR_ARGS="cr" +# if on SunOS and not using gXX then use the compiler to make .a libs +case $system in + SunOS-5*) + if test $ac_cv_prog_gxx = yes; then + : + else + echo "Using $CXX -xar -o for creating .a libraries" + CMAKE_AR="$CXX" + CMAKE_AR_ARGS="-xar -o" + fi + ;; + IRIX*) + if test $ac_cv_prog_gxx = yes; then + : + else + echo "Using $CXX -xar -o for creating .a libraries" + CMAKE_AR="$CXX" + CMAKE_AR_ARGS="-ar -o" + fi + ;; +esac +AC_SUBST(CMAKE_AR) +AC_SUBST(CMAKE_AR_ARGS) + +CMAKE_COMPILER_IS_GNUGXX=0 +if test $ac_cv_prog_gxx = yes; then + CMAKE_COMPILER_IS_GNUCXX=1 +fi + +AC_SUBST(CMAKE_COMPILER_IS_GNUCXX) +# generate output files. +# create mkdir files just to make some of the directories + +AC_OUTPUT( CXXCMakeSystemConfig.cmake ) |