configure.in 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. # Process this file with autoconf to produce a configure script.
  2. AC_INIT()
  3. AC_CONFIG_HEADER(Source/cmConfigure.h)
  4. #
  5. # check for some programs we use
  6. #
  7. # save the CFLAGS and CXXFLAGS specified by the user
  8. save_CFLAGS=$CFLAGS
  9. save_CXXFLAGS=$CXXFLAGS
  10. # let autoconf find cc and CC, it will try to add -g -O2 to CFLAGS and CXXFLAGS
  11. AC_PROG_CC
  12. AC_PROG_CXX
  13. # restore the flags specified by the user and get rid of any flags
  14. # found by autoconf (we do not want -02 -g by default)
  15. CFLAGS=$save_CFLAGS
  16. CXXFLAGS=$save_CXXFLAGS
  17. fullSrcDir=`cd $srcdir; pwd`
  18. CMAKE_ROOT_DIR=$fullSrcDir
  19. AC_SUBST(CMAKE_ROOT_DIR)
  20. # Step 1: set the variable "system" to hold the name and version number
  21. # for the system. This can usually be done via the "uname" command, but
  22. # there are a few systems, like Next, where this doesn't work.
  23. AC_MSG_CHECKING([system version (for dynamic loading)])
  24. if test -f /usr/lib/NextStep/software_version; then
  25. system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
  26. else
  27. system=`uname -s`-`uname -r`
  28. if test "$?" -ne 0 ; then
  29. AC_MSG_RESULT([unknown (can't find uname command)])
  30. system=unknown
  31. else
  32. # Special check for weird MP-RAS system (uname returns weird
  33. # results, and the version is kept in special file).
  34. if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
  35. system=MP-RAS-`awk '{print $3}' /etc/.relid'`
  36. fi
  37. AC_MSG_RESULT($system)
  38. fi
  39. fi
  40. CMAKE_CONFIG_DIR=`pwd`
  41. AC_SUBST(CMAKE_CONFIG_DIR)
  42. case $system in
  43. CYGWIN_NT*)
  44. CMAKE_CONFIG_DIR=`pwd`
  45. CMAKE_CONFIG_DIR="\"$CMAKE_CONFIG_DIR\""
  46. ;;
  47. esac
  48. CMAKE_ANSI_CFLAGS=""
  49. CMAKE_ANSI_CXXFLAGS=""
  50. # on hp use -Aa for ansi
  51. if test $ac_cv_prog_gxx = no; then
  52. case $system in
  53. HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
  54. echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6
  55. echo 'void f(){}' > conftest.c
  56. if test -z "`${CC} -Aa -c conftest.c 2>&1`"; then
  57. echo "$ac_t""yes" 1>&6
  58. CMAKE_ANSI_CFLAGS="-Aa"
  59. else
  60. echo "$ac_t""no" 1>&6
  61. fi
  62. rm -f conftest*
  63. ;;
  64. IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
  65. echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6
  66. echo 'void f(){}' > conftest.c
  67. if test -z "`${CXX} -LANG:std -c conftest.c 2>&1`"; then
  68. echo "$ac_t""yes" 1>&6
  69. CMAKE_ANSI_CXXFLAGS="-LANG:std"
  70. else
  71. echo "$ac_t""no" 1>&6
  72. fi
  73. rm -f conftest*
  74. ;;
  75. esac
  76. fi
  77. AC_SUBST(CMAKE_ANSI_CFLAGS)
  78. AC_SUBST(CMAKE_ANSI_CXXFLAGS)
  79. # check no g++ compilers to see if they have the standard
  80. # ansi stream files (without the .h)
  81. if test $ac_cv_prog_gxx = no; then
  82. AC_MSG_CHECKING( ansi standard C++ stream headers )
  83. rm -rf conftest.*
  84. cat > conftest.cc <<!
  85. #include <iostream>
  86. !
  87. if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  88. echo "$ac_t""yes" 1>&6
  89. else
  90. AC_DEFINE(CMAKE_NO_ANSI_STREAM_HEADERS)
  91. echo "$ac_t""no" 1>&6
  92. fi
  93. fi
  94. # check to see if stl is in the std namespace
  95. if test $ac_cv_prog_gxx = no; then
  96. AC_MSG_CHECKING( ansi standard namespace support )
  97. rm -rf conftest.*
  98. cat > conftest.cc <<!
  99. #include <list>
  100. void foo() { std::list<int> l; }
  101. !
  102. if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  103. echo "$ac_t""yes" 1>&6
  104. else
  105. AC_DEFINE(CMAKE_NO_STD_NAMESPACE)
  106. echo "$ac_t""no" 1>&6
  107. fi
  108. fi
  109. # check to see if for scoping is supported
  110. if test $ac_cv_prog_gxx = no; then
  111. AC_MSG_CHECKING( ansi for scope support )
  112. rm -rf conftest.*
  113. cat > conftest.cc <<!
  114. void foo() { for(int i;;); for(int i;;); }
  115. !
  116. if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  117. echo "$ac_t""yes" 1>&6
  118. else
  119. AC_DEFINE(CMAKE_NO_ANSI_FOR_SCOPE)
  120. echo "$ac_t""no" 1>&6
  121. fi
  122. fi
  123. # find make to use to build cmake, prefer gmake
  124. AC_PATH_PROGS(RUNMAKE, gmake make)
  125. AC_OUTPUT(Source/InitialConfigureFlags.cmake Source/bootstrap/Makefile)
  126. # build cmake
  127. (cd Source/bootstrap; $RUNMAKE)
  128. # run cmake
  129. ./Source/bootstrap/cmake $fullSrcDir
  130. # run cmake depends
  131. $RUNMAKE depend