1 # Process this file with autoconf to produce a configure script.
4 AC_CONFIG_HEADER(Source/cmConfigure.h)
9 # check for some programs we use
12 # save the CFLAGS and CXXFLAGS specified by the user
14 save_CXXFLAGS=$CXXFLAGS
16 # let autoconf find cc and CC, it will try to add -g -O2 to CFLAGS and CXXFLAGS
20 # restore the flags specified by the user and get rid of any flags
21 # found by autoconf (we do not want -02 -g by default)
23 CXXFLAGS=$save_CXXFLAGS
25 fullSrcDir=`cd $srcdir; pwd`
26 CMAKE_ROOT_DIR=$fullSrcDir
27 AC_SUBST(CMAKE_ROOT_DIR)
30 # Step 1: set the variable "system" to hold the name and version number
31 # for the system. This can usually be done via the "uname" command, but
32 # there are a few systems, like Next, where this doesn't work.
34 AC_MSG_CHECKING([system version (for dynamic loading)])
35 if test -f /usr/lib/NextStep/software_version; then
36 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
38 system=`uname -s`-`uname -r`
39 if test "$?" -ne 0 ; then
40 AC_MSG_RESULT([unknown (can't find uname command)])
43 # Special check for weird MP-RAS system (uname returns weird
44 # results, and the version is kept in special file).
46 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
47 system=MP-RAS-`awk '{print $3}' /etc/.relid'`
49 AC_MSG_RESULT($system)
54 CMAKE_CONFIG_DIR=`pwd`
55 AC_SUBST(CMAKE_CONFIG_DIR)
58 CMAKE_CONFIG_DIR=`pwd`
59 CMAKE_CONFIG_DIR="\"$CMAKE_CONFIG_DIR\""
65 CMAKE_ANSI_CXXFLAGS=""
66 # on hp use -Aa for ansi
67 if test $ac_cv_prog_gxx = no; then
69 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
70 echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6
71 echo 'void f(){}' > conftest.c
72 if test -z "`${CC} -Aa -c conftest.c 2>&1`"; then
73 echo "$ac_t""yes" 1>&6
74 CMAKE_ANSI_CFLAGS="-Aa"
80 IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
81 echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6
82 echo 'void f(){}' > conftest.c
83 if test -z "`${CXX} -LANG:std -c conftest.c 2>&1`"; then
84 echo "$ac_t""yes" 1>&6
85 CMAKE_ANSI_CXXFLAGS="-LANG:std"
93 AC_SUBST(CMAKE_ANSI_CFLAGS)
94 AC_SUBST(CMAKE_ANSI_CXXFLAGS)
96 # check non-g++ compilers to see if they have the standard
97 # ansi stream files (without the .h)
98 if test $ac_cv_prog_gxx = no; then
99 AC_MSG_CHECKING( ansi standard C++ stream headers )
101 cat > conftest.cc <<!
104 if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
105 echo "$ac_t""yes" 1>&6
107 AC_DEFINE(CMAKE_NO_ANSI_STREAM_HEADERS)
108 echo "$ac_t""no" 1>&6
112 # check non-g++ compilers to see if they have std::stringstream
113 AC_MSG_CHECKING( for ansi standard C++ stringstream )
115 cat > conftest.cc <<!
118 if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
119 echo "$ac_t""yes" 1>&6
121 AC_DEFINE(CMAKE_NO_ANSI_STRING_STREAM)
122 echo "$ac_t""no" 1>&6
125 # check to see if stl is in the std namespace
126 if test $ac_cv_prog_gxx = no; then
127 AC_MSG_CHECKING( ansi standard namespace support )
129 cat > conftest.cc <<!
131 void foo() { std::list<int> l; }
133 if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
134 echo "$ac_t""yes" 1>&6
136 AC_DEFINE(CMAKE_NO_STD_NAMESPACE)
137 echo "$ac_t""no" 1>&6
141 # check to see if for scoping is supported
142 if test $ac_cv_prog_gxx = no; then
143 AC_MSG_CHECKING( ansi for scope support )
145 cat > conftest.cc <<!
146 void foo() { for(int i;;); for(int i;;); }
148 if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
149 echo "$ac_t""yes" 1>&6
151 AC_DEFINE(CMAKE_NO_ANSI_FOR_SCOPE)
152 echo "$ac_t""no" 1>&6
156 # find make to use to build cmake, prefer gmake
157 AC_PATH_PROGS(RUNMAKE, gmake make)
159 AC_OUTPUT(Source/InitialConfigureFlags.cmake Makefile Source/Makefile)
163 ./Source/cmake $fullSrcDir