1 # Process this file with autoconf to produce a configure script.
4 AC_CONFIG_HEADER(Source/cmConfigure.h)
6 # find make to use to build cmake, prefer gmake
7 AC_PATH_PROGS(RUNMAKE, gmake make)
9 fullSrcDir=`cd $srcdir; pwd`
10 CMAKE_ROOT_DIR=$fullSrcDir
12 if test "x$BUILD_CMAKE_IN_SUBDIR" = "xtrue"; then
15 # check for some programs we use
18 # save the CFLAGS and CXXFLAGS specified by the user
20 save_CXXFLAGS=$CXXFLAGS
22 # let autoconf find cc and CC, it will try to add -g -O2 to CFLAGS and CXXFLAGS
26 # restore the flags specified by the user and get rid of any flags
27 # found by autoconf (we do not want -02 -g by default)
29 CXXFLAGS=$save_CXXFLAGS
31 AC_SUBST(CMAKE_ROOT_DIR)
34 # Step 1: set the variable "system" to hold the name and version number
35 # for the system. This can usually be done via the "uname" command, but
36 # there are a few systems, like Next, where this doesn't work.
38 AC_MSG_CHECKING([system version (for dynamic loading)])
39 if test -f /usr/lib/NextStep/software_version; then
40 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
42 system=`uname -s`-`uname -r`
43 if test "$?" -ne 0 ; then
44 AC_MSG_RESULT([unknown (can't find uname command)])
47 # Special check for weird MP-RAS system (uname returns weird
48 # results, and the version is kept in special file).
50 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
51 system=MP-RAS-`awk '{print $3}' /etc/.relid'`
53 AC_MSG_RESULT($system)
58 CMAKE_CONFIG_DIR=`pwd`
59 AC_SUBST(CMAKE_CONFIG_DIR)
62 CMAKE_CONFIG_DIR=`pwd`
63 CMAKE_CONFIG_DIR="\"$CMAKE_CONFIG_DIR\""
69 CMAKE_ANSI_CXXFLAGS=""
70 # on hp use -Aa for ansi
71 if test $ac_cv_prog_gxx = no; then
73 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
76 AC_MSG_CHECKING([whether ${CC} accepts -Aa])
81 CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa"
87 IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
88 echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6
89 echo 'void f(){}' > conftest.cc
90 if test -z "`${CXX} -LANG:std -c conftest.cc 2>&1`"; then
91 echo "$ac_t""yes" 1>&6
92 CMAKE_ANSI_CXXFLAGS="-LANG:std"
100 CXXFLAGS_ORIG="$CXXFLAGS"
101 CXXFLAGS="-std strict_ansi -nopure_cname $CXXFLAGS"
102 AC_MSG_CHECKING([whether ${CXX} accepts -std strict_ansi -nopure_cname])
109 CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
114 CXXFLAGS="$CXXFLAGS_ORIG"
118 AC_SUBST(CMAKE_ANSI_CFLAGS)
119 AC_SUBST(CMAKE_ANSI_CXXFLAGS)
121 # check non-g++ compilers to see if they have the standard
122 # ansi stream files (without the .h)
123 if test $ac_cv_prog_gxx = no; then
124 CXXFLAGS_ORIG="$CXXFLAGS"
125 CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
126 AC_MSG_CHECKING( ansi standard C++ stream headers )
134 AC_DEFINE(CMAKE_NO_ANSI_STREAM_HEADERS)
138 CXXFLAGS="$CXXFLAGS_ORIG"
141 # check non-g++ compilers to see if they have std::stringstream
142 CXXFLAGS_ORIG="$CXXFLAGS"
143 CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
144 AC_MSG_CHECKING([for ansi standard C++ stringstream])
152 AC_DEFINE(CMAKE_NO_ANSI_STRING_STREAM)
156 CXXFLAGS="$CXXFLAGS_ORIG"
158 # check to see if stl is in the std namespace
159 if test $ac_cv_prog_gxx = no; then
160 CXXFLAGS_ORIG="$CXXFLAGS"
161 CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
162 AC_MSG_CHECKING([whether the std namespace is supported])
167 void foo() { std::list<int>(); }
171 AC_DEFINE(CMAKE_NO_STD_NAMESPACE)
175 CXXFLAGS="$CXXFLAGS_ORIG"
178 # check to see if for scoping is supported
179 if test $ac_cv_prog_gxx = no; then
180 CXXFLAGS_ORIG="$CXXFLAGS"
181 CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
182 AC_MSG_CHECKING([ansi for scope support])
186 void foo() { for(int i;;); for(int i;;); }
190 AC_DEFINE(CMAKE_NO_ANSI_FOR_SCOPE)
194 CXXFLAGS="$CXXFLAGS_ORIG"
198 AC_OUTPUT(Source/InitialConfigureFlags.cmake Makefile Source/Makefile)
203 PRGNAME=configure # Should be `basename $0`
206 # Check if the bootstrap directory already exists.
207 if test -d Bootstrap; then
210 # if it does not create one
214 # Build bootstrap cmake
216 echo "Bootstrapping to directory `pwd`"
217 BUILD_CMAKE_IN_SUBDIR=true $CMAKE_ROOT_DIR/$PRGNAME $ac_configure_args
220 Bootstrap/Source/cmake $fullSrcDir
225 echo "Problem bootstrapping CMake"