cxxconfigure.in 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. # Process this file with autoconf to produce a configure script.
  2. AC_INIT()
  3. #
  4. # check for some programs we use
  5. #
  6. # save the CXXFLAGS specified by the user
  7. save_CXXFLAGS=$CXXFLAGS
  8. AC_PROG_CXX
  9. # Step 1: set the variable "system" to hold the name and version number
  10. # for the system. This can usually be done via the "uname" command, but
  11. # there are a few systems, like Next, where this doesn't work.
  12. AC_MSG_CHECKING([system version (for dynamic loading)])
  13. if test -f /usr/lib/NextStep/software_version; then
  14. system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
  15. else
  16. system=`uname -s`-`uname -r`
  17. if test "$?" -ne 0 ; then
  18. AC_MSG_RESULT([unknown (can't find uname command)])
  19. system=unknown
  20. else
  21. # Special check for weird MP-RAS system (uname returns weird
  22. # results, and the version is kept in special file).
  23. if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
  24. system=MP-RAS-`awk '{print $3}' /etc/.relid'`
  25. fi
  26. AC_MSG_RESULT($system)
  27. fi
  28. fi
  29. # restore the flags specified by the user and get rid of any flags
  30. # found by autoconf (we do not want -02 -g by default)
  31. CXXFLAGS=$save_CXXFLAGS
  32. CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION=""
  33. if test $ac_cv_prog_gxx = no; then
  34. echo $ac_n "checking whether ${CXX} supports explicit instantiation""... $ac_c" 1>&6
  35. echo 'template<class T>class x{};template class x<int>;' > conftest.cc
  36. if test -z "`${CXX} -c conftest.cc 2>&1`"; then
  37. echo "$ac_t""yes" 1>&6
  38. else
  39. echo "$ac_t""no" 1>&6
  40. CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION="1"
  41. fi
  42. rm -f conftest*
  43. fi
  44. # if running on darwin no explicit template instantiations even though
  45. # syntax is supported.
  46. case $system in
  47. Darwin*)
  48. CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION="1"
  49. ;;
  50. esac
  51. AC_SUBST(CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
  52. CMAKE_ANSI_CXXFLAGS=""
  53. # on hp use -Aa for ansi
  54. if test $ac_cv_prog_gxx = no; then
  55. case $system in
  56. IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
  57. echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6
  58. echo 'void f(){}' > conftest.c
  59. if test -z "`${CXX} -LANG:std -c conftest.c 2>&1`"; then
  60. echo "$ac_t""yes" 1>&6
  61. CMAKE_ANSI_CXXFLAGS="-LANG:std"
  62. else
  63. echo "$ac_t""no" 1>&6
  64. fi
  65. rm -f conftest*
  66. ;;
  67. esac
  68. fi
  69. AC_SUBST(CMAKE_ANSI_CXXFLAGS)
  70. # if we are not running g++ then we might need some other flags
  71. # to get the templates compiled correctly
  72. CMAKE_TEMPLATE_FLAGS=""
  73. if test $ac_cv_prog_gxx = no; then
  74. echo $ac_n "checking whether ${CXX} accepts -ptused -no_prelink""... $ac_c" 1>&6
  75. echo 'void f(){}' > conftest.cc
  76. if test -z "`${CXX} -ptused -no_prelink -c conftest.cc 2>&1`"; then
  77. echo "$ac_t""yes" 1>&6
  78. CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink"
  79. else
  80. echo "$ac_t""no" 1>&6
  81. fi
  82. rm -f conftest*
  83. fi
  84. AC_SUBST(CMAKE_TEMPLATE_FLAGS)
  85. # check no g++ compilers to see if they have the standard
  86. # ansi stream files (without the .h)
  87. if test $ac_cv_prog_gxx = no; then
  88. AC_MSG_CHECKING( ansi standard C++ stream headers )
  89. rm -rf conftest.*
  90. cat > conftest.cc <<!
  91. #include <iostream>
  92. !
  93. if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  94. echo "$ac_t""yes" 1>&6
  95. else
  96. CMAKE_NO_ANSI_STREAM_HEADERS="1"
  97. echo "$ac_t""no" 1>&6
  98. fi
  99. fi
  100. AC_SUBST(CMAKE_NO_ANSI_STREAM_HEADERS)
  101. # check to see if stl is in the std namespace
  102. if test $ac_cv_prog_gxx = no; then
  103. AC_MSG_CHECKING( ansi standard namespace support )
  104. rm -rf conftest.*
  105. cat > conftest.cc <<!
  106. #include <list>
  107. void foo() { std::list<int> l; }
  108. !
  109. if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  110. echo "$ac_t""yes" 1>&6
  111. else
  112. CMAKE_NO_STD_NAMESPACE="1"
  113. echo "$ac_t""no" 1>&6
  114. fi
  115. fi
  116. AC_SUBST(CMAKE_NO_STD_NAMESPACE)
  117. # check to see if for scoping is supported
  118. if test $ac_cv_prog_gxx = no; then
  119. AC_MSG_CHECKING( ansi for scope support )
  120. rm -rf conftest.*
  121. cat > conftest.cc <<!
  122. void foo() { for(int i;;); for(int i;;); }
  123. !
  124. if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
  125. echo "$ac_t""yes" 1>&6
  126. else
  127. CMAKE_NO_ANSI_FOR_SCOPE="1"
  128. echo "$ac_t""no" 1>&6
  129. fi
  130. fi
  131. AC_SUBST(CMAKE_NO_ANSI_FOR_SCOPE)
  132. # find make to use to build cmake, prefer gmake
  133. AC_PATH_PROGS(CMAKE_AR_TMP, ar)
  134. CMAKE_CXX_AR="$CMAKE_AR_TMP"
  135. CMAKE_CXX_AR_ARGS="cr"
  136. # if on SunOS and not using gXX then use the compiler to make .a libs
  137. case $system in
  138. SunOS-5*)
  139. if test $ac_cv_prog_gxx = yes; then
  140. :
  141. else
  142. echo "Using $CXX -xar -o for creating .a libraries"
  143. CMAKE_CXX_AR="$CXX"
  144. CMAKE_CXX_AR_ARGS="-xar -o"
  145. fi
  146. ;;
  147. IRIX*)
  148. if test $ac_cv_prog_gxx = yes; then
  149. :
  150. else
  151. echo "Using $CXX -xar -o for creating .a libraries"
  152. CMAKE_CXX_AR="$CXX"
  153. CMAKE_CXX_AR_ARGS="-ar -o"
  154. fi
  155. ;;
  156. esac
  157. AC_SUBST(CMAKE_CXX_AR)
  158. AC_SUBST(CMAKE_CXX_AR_ARGS)
  159. CMAKE_COMPILER_IS_GNUGXX=0
  160. if test $ac_cv_prog_gxx = yes; then
  161. CMAKE_COMPILER_IS_GNUCXX=1
  162. fi
  163. AC_SUBST(CMAKE_COMPILER_IS_GNUCXX)
  164. # generate output files.
  165. # create mkdir files just to make some of the directories
  166. AC_OUTPUT( CXXCMakeSystemConfig.cmake )