configure.in 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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 non-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 non-g++ compilers to see if they have std::stringstream
  95. AC_MSG_CHECKING( for ansi standard C++ stringstream )
  96. rm -rf conftest.*
  97. cat > conftest.cc <<!
  98. #include <sstream>
  99. !
  100. if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  101. echo "$ac_t""yes" 1>&6
  102. else
  103. AC_DEFINE(CMAKE_NO_ANSI_STRING_STREAM)
  104. echo "$ac_t""no" 1>&6
  105. fi
  106. # check to see if stl is in the std namespace
  107. if test $ac_cv_prog_gxx = no; then
  108. AC_MSG_CHECKING( ansi standard namespace support )
  109. rm -rf conftest.*
  110. cat > conftest.cc <<!
  111. #include <list>
  112. void foo() { std::list<int> l; }
  113. !
  114. if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  115. echo "$ac_t""yes" 1>&6
  116. else
  117. AC_DEFINE(CMAKE_NO_STD_NAMESPACE)
  118. echo "$ac_t""no" 1>&6
  119. fi
  120. fi
  121. # check to see if for scoping is supported
  122. if test $ac_cv_prog_gxx = no; then
  123. AC_MSG_CHECKING( ansi for scope support )
  124. rm -rf conftest.*
  125. cat > conftest.cc <<!
  126. void foo() { for(int i;;); for(int i;;); }
  127. !
  128. if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  129. echo "$ac_t""yes" 1>&6
  130. else
  131. AC_DEFINE(CMAKE_NO_ANSI_FOR_SCOPE)
  132. echo "$ac_t""no" 1>&6
  133. fi
  134. fi
  135. # find make to use to build cmake, prefer gmake
  136. AC_PATH_PROGS(RUNMAKE, gmake make)
  137. AC_OUTPUT(Source/InitialConfigureFlags.cmake Makefile Source/Makefile)
  138. # build cmake
  139. $RUNMAKE
  140. # run cmake
  141. ./Source/cmake $fullSrcDir
  142. # run cmake depends
  143. $RUNMAKE depend