configure.in 3.9 KB

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