configure.in 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. # Process this file with autoconf to produce a configure script.
  2. AC_INIT()
  3. AC_CONFIG_HEADER(Source/cmConfigure.h)
  4. CMAKE_CONFIG_DIR=`pwd`
  5. AC_SUBST(CMAKE_CONFIG_DIR)
  6. #
  7. # check for some programs we use
  8. #
  9. AC_PROG_CC
  10. AC_PROG_CXX
  11. fullSrcDir=`cd $srcdir; pwd`
  12. CMAKE_ROOT_DIR=$fullSrcDir
  13. AC_SUBST(CMAKE_ROOT_DIR)
  14. CMAKE_ANSI_CFLAGS=""
  15. # on hp use -Aa for ansi
  16. if test $ac_cv_prog_gxx = no; then
  17. case $system in
  18. HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
  19. echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6
  20. echo 'void f(){}' > conftest.c
  21. if test -z "`${CC} -Aa -c conftest.c 2>&1`"; then
  22. echo "$ac_t""yes" 1>&6
  23. CMAKE_ANSI_CFLAGS="-Aa"
  24. else
  25. echo "$ac_t""no" 1>&6
  26. fi
  27. rm -f conftest*
  28. ;;
  29. IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
  30. echo $ac_n "checking whether ${CC} accepts -LANG:std""... $ac_c" 1>&6
  31. echo 'void f(){}' > conftest.c
  32. if test -z "`${CC} -LANG:std -c conftest.c 2>&1`"; then
  33. echo "$ac_t""yes" 1>&6
  34. CMAKE_ANSI_CFLAGS="-LANG:std"
  35. else
  36. echo "$ac_t""no" 1>&6
  37. fi
  38. rm -f conftest*
  39. ;;
  40. esac
  41. fi
  42. AC_SUBST(CMAKE_ANSI_CFLAGS)
  43. # if we are not running g++ then we might need some other flags
  44. # to get the templates compiled correctly
  45. CMAKE_TEMPLATE_FLAGS=""
  46. if test $ac_cv_prog_gxx = no; then
  47. echo $ac_n "checking whether ${CXX} accepts -ptused -no_prelink""... $ac_c" 1>&6
  48. echo 'void f(){}' > conftest.cc
  49. if test -z "`${CXX} -ptused -no_prelink -c conftest.cc 2>&1`"; then
  50. echo "$ac_t""yes" 1>&6
  51. CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink"
  52. else
  53. echo "$ac_t""no" 1>&6
  54. fi
  55. rm -f conftest*
  56. echo $ac_n "checking whether ${CXX} accepts -instances=semiexplicit""... $ac_c" 1>&6
  57. echo 'void f(){}' > conftest.cc
  58. if test -z "`${CXX} -instances=static -c conftest.cc 2>&1`"; then
  59. echo "$ac_t""yes" 1>&6
  60. CMAKE_TEMPLATE_FLAGS="-instances=static"
  61. else
  62. echo "$ac_t""no" 1>&6
  63. fi
  64. fi
  65. AC_SUBST(CMAKE_TEMPLATE_FLAGS)
  66. # check no g++ compilers to see if they have the standard
  67. # ansi stream files (without the .h)
  68. if test $ac_cv_prog_gxx = no; then
  69. AC_MSG_CHECKING( ansi standard C++ stream headers )
  70. rm -rf conftest.*
  71. cat > conftest.cc <<!
  72. #include <iostream>
  73. !
  74. if test -z "`${CXX} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  75. echo "$ac_t""yes" 1>&6
  76. else
  77. AC_DEFINE(CMAKE_NO_ANSI_STREAM_HEADERS)
  78. echo "$ac_t""no" 1>&6
  79. fi
  80. fi
  81. # check to see if stl is in the std namespace
  82. if test $ac_cv_prog_gxx = no; then
  83. AC_MSG_CHECKING( ansi standard namespace support )
  84. rm -rf conftest.*
  85. cat > conftest.cc <<!
  86. #include <list>
  87. void foo() { std::list<int> l; }
  88. !
  89. if test -z "`${CXX} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  90. echo "$ac_t""yes" 1>&6
  91. else
  92. AC_DEFINE(CMAKE_NO_STD_NAMESPACE)
  93. echo "$ac_t""no" 1>&6
  94. fi
  95. fi
  96. # check to see if for scoping is supported
  97. if test $ac_cv_prog_gxx = no; then
  98. AC_MSG_CHECKING( ansi for scope support )
  99. rm -rf conftest.*
  100. cat > conftest.cc <<!
  101. void foo() { for(int i;;); for(int i;;); }
  102. !
  103. if test -z "`${CXX} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  104. echo "$ac_t""yes" 1>&6
  105. else
  106. AC_DEFINE(CMAKE_NO_ANSI_FOR_SCOPE)
  107. echo "$ac_t""no" 1>&6
  108. fi
  109. fi
  110. # find make to use to build cmake, prefer gmake
  111. AC_PATH_PROGS(RUNMAKE, gmake make)
  112. AC_OUTPUT(Makefile Source/Makefile)
  113. # build cmake
  114. $RUNMAKE
  115. # run cmake
  116. ./Source/cmake $fullSrcDir
  117. # run cmake depends
  118. $RUNMAKE depend