configure.in 3.2 KB

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