2001-05-21 17:33:35 +04:00
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
AC_INIT()
|
|
|
|
|
|
|
|
AC_CONFIG_HEADER(Source/cmConfigure.h)
|
|
|
|
|
2002-09-13 17:51:57 +04:00
|
|
|
# find make to use to build cmake, prefer gmake
|
|
|
|
AC_PATH_PROGS(RUNMAKE, gmake make)
|
|
|
|
|
|
|
|
fullSrcDir=`cd $srcdir; pwd`
|
|
|
|
CMAKE_ROOT_DIR=$fullSrcDir
|
2002-04-18 19:52:12 +04:00
|
|
|
|
2002-09-13 17:51:57 +04:00
|
|
|
if test "x$BUILD_CMAKE_IN_SUBDIR" = "xtrue"; then
|
2001-05-21 17:33:35 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# check for some programs we use
|
|
|
|
#
|
2002-02-14 18:02:09 +03:00
|
|
|
|
|
|
|
# save the CFLAGS and CXXFLAGS specified by the user
|
|
|
|
save_CFLAGS=$CFLAGS
|
|
|
|
save_CXXFLAGS=$CXXFLAGS
|
|
|
|
|
|
|
|
# let autoconf find cc and CC, it will try to add -g -O2 to CFLAGS and CXXFLAGS
|
2001-05-21 17:33:35 +04:00
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_CXX
|
|
|
|
|
2002-02-14 18:02:09 +03:00
|
|
|
# restore the flags specified by the user and get rid of any flags
|
|
|
|
# found by autoconf (we do not want -02 -g by default)
|
|
|
|
CFLAGS=$save_CFLAGS
|
|
|
|
CXXFLAGS=$save_CXXFLAGS
|
|
|
|
|
2001-05-21 17:33:35 +04:00
|
|
|
AC_SUBST(CMAKE_ROOT_DIR)
|
|
|
|
|
2003-02-14 05:57:05 +03:00
|
|
|
# Parse the cmake version number out of the top-level CMake listfile.
|
|
|
|
[
|
|
|
|
CMake_VERSION_MAJOR=`cat $fullSrcDir/CMakeLists.txt | sed -n '/SET *( *CMake_VERSION_MAJOR/ {s/.*MAJOR *\([0-9][0-9]*\).*/\1/;p;}'`
|
|
|
|
CMake_VERSION_MINOR=`cat $fullSrcDir/CMakeLists.txt | sed -n '/SET *( *CMake_VERSION_MINOR/ {s/.*MINOR *\([0-9][0-9]*\).*/\1/;p;}'`
|
|
|
|
CMake_VERSION_PATCH=`cat $fullSrcDir/CMakeLists.txt | sed -n '/SET *( *CMake_VERSION_PATCH/ {s/.*PATCH *\([0-9][0-9]*\).*/\1/;p;}'`
|
|
|
|
]
|
|
|
|
AC_DEFINE_UNQUOTED(CMake_VERSION_MAJOR, ${CMake_VERSION_MAJOR})
|
|
|
|
AC_DEFINE_UNQUOTED(CMake_VERSION_MINOR, ${CMake_VERSION_MINOR})
|
|
|
|
AC_DEFINE_UNQUOTED(CMake_VERSION_PATCH, ${CMake_VERSION_PATCH})
|
|
|
|
AC_SUBST(CMake_VERSION_MAJOR)
|
|
|
|
AC_SUBST(CMake_VERSION_MINOR)
|
|
|
|
AC_SUBST(CMake_VERSION_PATCH)
|
2001-08-25 01:00:40 +04:00
|
|
|
|
|
|
|
# Step 1: set the variable "system" to hold the name and version number
|
|
|
|
# for the system. This can usually be done via the "uname" command, but
|
|
|
|
# there are a few systems, like Next, where this doesn't work.
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([system version (for dynamic loading)])
|
|
|
|
if test -f /usr/lib/NextStep/software_version; then
|
|
|
|
system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
|
|
|
|
else
|
|
|
|
system=`uname -s`-`uname -r`
|
|
|
|
if test "$?" -ne 0 ; then
|
|
|
|
AC_MSG_RESULT([unknown (can't find uname command)])
|
|
|
|
system=unknown
|
|
|
|
else
|
|
|
|
# Special check for weird MP-RAS system (uname returns weird
|
|
|
|
# results, and the version is kept in special file).
|
|
|
|
|
|
|
|
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
|
|
|
|
system=MP-RAS-`awk '{print $3}' /etc/.relid'`
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT($system)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2002-04-18 19:52:12 +04:00
|
|
|
|
|
|
|
CMAKE_CONFIG_DIR=`pwd`
|
|
|
|
AC_SUBST(CMAKE_CONFIG_DIR)
|
|
|
|
case $system in
|
|
|
|
CYGWIN_NT*)
|
|
|
|
CMAKE_CONFIG_DIR=`pwd`
|
|
|
|
CMAKE_CONFIG_DIR="\"$CMAKE_CONFIG_DIR\""
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2001-05-21 17:33:35 +04:00
|
|
|
CMAKE_ANSI_CFLAGS=""
|
2001-08-27 22:35:34 +04:00
|
|
|
CMAKE_ANSI_CXXFLAGS=""
|
2001-05-21 17:33:35 +04:00
|
|
|
# on hp use -Aa for ansi
|
|
|
|
if test $ac_cv_prog_gxx = no; then
|
|
|
|
case $system in
|
|
|
|
HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
|
2002-09-07 01:19:18 +04:00
|
|
|
CFLAGS_ORIG="$FLAGS"
|
|
|
|
CFLAGS="-Aa $CFLAGS"
|
|
|
|
AC_MSG_CHECKING([whether ${CC} accepts -Aa])
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
void foo() {}
|
|
|
|
],,[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa"
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
CFLAGS="$CFLAGS_ORIG"
|
2001-08-24 23:45:46 +04:00
|
|
|
;;
|
2002-09-07 01:19:18 +04:00
|
|
|
IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
|
2002-09-10 18:35:53 +04:00
|
|
|
echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6
|
|
|
|
echo 'void f(){}' > conftest.cc
|
|
|
|
if test -z "`${CXX} -LANG:std -c conftest.cc 2>&1`"; then
|
|
|
|
echo "$ac_t""yes" 1>&6
|
|
|
|
CMAKE_ANSI_CXXFLAGS="-LANG:std"
|
|
|
|
else
|
|
|
|
echo "$ac_t""no" 1>&6
|
|
|
|
fi
|
|
|
|
rm -f conftest*
|
2002-09-07 01:19:18 +04:00
|
|
|
;;
|
2002-08-22 19:38:06 +04:00
|
|
|
OSF1-*)
|
|
|
|
|
2002-09-07 01:19:18 +04:00
|
|
|
CXXFLAGS_ORIG="$CXXFLAGS"
|
|
|
|
CXXFLAGS="-std strict_ansi -nopure_cname $CXXFLAGS"
|
|
|
|
AC_MSG_CHECKING([whether ${CXX} accepts -std strict_ansi -nopure_cname])
|
|
|
|
AC_LANG_SAVE
|
|
|
|
AC_LANG_CPLUSPLUS
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
void foo() {}
|
|
|
|
],,[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
|
|
|
;;
|
2001-05-21 17:33:35 +04:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
AC_SUBST(CMAKE_ANSI_CFLAGS)
|
2001-08-27 22:35:34 +04:00
|
|
|
AC_SUBST(CMAKE_ANSI_CXXFLAGS)
|
2001-05-21 17:33:35 +04:00
|
|
|
|
2002-06-19 23:05:14 +04:00
|
|
|
# check non-g++ compilers to see if they have the standard
|
2001-05-21 17:33:35 +04:00
|
|
|
# ansi stream files (without the .h)
|
|
|
|
if test $ac_cv_prog_gxx = no; then
|
2002-09-07 01:19:18 +04:00
|
|
|
CXXFLAGS_ORIG="$CXXFLAGS"
|
|
|
|
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
|
2001-05-21 17:33:35 +04:00
|
|
|
AC_MSG_CHECKING( ansi standard C++ stream headers )
|
2002-09-07 01:19:18 +04:00
|
|
|
AC_LANG_SAVE
|
|
|
|
AC_LANG_CPLUSPLUS
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <iostream>
|
|
|
|
],,[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
],[
|
2002-09-10 18:02:58 +04:00
|
|
|
AC_DEFINE(CMAKE_NO_ANSI_STREAM_HEADERS)
|
2002-09-07 01:19:18 +04:00
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
2001-05-21 17:33:35 +04:00
|
|
|
fi
|
|
|
|
|
2002-06-19 23:05:14 +04:00
|
|
|
# check non-g++ compilers to see if they have std::stringstream
|
2002-09-07 01:19:18 +04:00
|
|
|
CXXFLAGS_ORIG="$CXXFLAGS"
|
|
|
|
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
|
|
|
|
AC_MSG_CHECKING([for ansi standard C++ stringstream])
|
|
|
|
AC_LANG_SAVE
|
|
|
|
AC_LANG_CPLUSPLUS
|
|
|
|
AC_TRY_COMPILE([
|
2002-06-19 23:05:14 +04:00
|
|
|
#include <sstream>
|
2002-09-07 01:19:18 +04:00
|
|
|
],,[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
],[
|
2002-09-10 18:02:58 +04:00
|
|
|
AC_DEFINE(CMAKE_NO_ANSI_STRING_STREAM)
|
2002-09-07 01:19:18 +04:00
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
2002-06-19 23:05:14 +04:00
|
|
|
|
2001-05-21 17:33:35 +04:00
|
|
|
# check to see if stl is in the std namespace
|
|
|
|
if test $ac_cv_prog_gxx = no; then
|
2002-09-07 01:19:18 +04:00
|
|
|
CXXFLAGS_ORIG="$CXXFLAGS"
|
|
|
|
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
|
|
|
|
AC_MSG_CHECKING([whether the std namespace is supported])
|
|
|
|
AC_LANG_SAVE
|
|
|
|
AC_LANG_CPLUSPLUS
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <list>
|
|
|
|
void foo() { std::list<int>(); }
|
|
|
|
],,[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
],[
|
2002-09-10 18:02:58 +04:00
|
|
|
AC_DEFINE(CMAKE_NO_STD_NAMESPACE)
|
2002-09-07 01:19:18 +04:00
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
2001-05-21 17:33:35 +04:00
|
|
|
fi
|
|
|
|
|
2001-08-08 19:54:46 +04:00
|
|
|
# check to see if for scoping is supported
|
|
|
|
if test $ac_cv_prog_gxx = no; then
|
2002-09-07 01:19:18 +04:00
|
|
|
CXXFLAGS_ORIG="$CXXFLAGS"
|
|
|
|
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
|
|
|
|
AC_MSG_CHECKING([ansi for scope support])
|
|
|
|
AC_LANG_SAVE
|
|
|
|
AC_LANG_CPLUSPLUS
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
void foo() { for(int i;;); for(int i;;); }
|
|
|
|
],,[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
],[
|
2002-09-10 18:02:58 +04:00
|
|
|
AC_DEFINE(CMAKE_NO_ANSI_FOR_SCOPE)
|
2002-09-07 01:19:18 +04:00
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
2001-08-08 19:54:46 +04:00
|
|
|
fi
|
|
|
|
|
2001-05-21 17:33:35 +04:00
|
|
|
|
2002-05-02 16:54:53 +04:00
|
|
|
AC_OUTPUT(Source/InitialConfigureFlags.cmake Makefile Source/Makefile)
|
2001-07-06 22:11:59 +04:00
|
|
|
# build cmake
|
2002-05-02 16:54:53 +04:00
|
|
|
$RUNMAKE
|
2002-09-13 17:51:57 +04:00
|
|
|
|
|
|
|
else
|
|
|
|
PRGNAME=configure # Should be `basename $0`
|
2003-04-17 16:02:44 +04:00
|
|
|
DIRNAME=Bootstrap.cmk
|
2002-09-13 17:51:57 +04:00
|
|
|
|
|
|
|
# Check if the bootstrap directory already exists.
|
2003-04-17 16:02:44 +04:00
|
|
|
if test -d ${DIRNAME}; then
|
2002-09-13 17:51:57 +04:00
|
|
|
:
|
|
|
|
else
|
|
|
|
# if it does not create one
|
2003-04-17 16:02:44 +04:00
|
|
|
mkdir ${DIRNAME}
|
2002-09-13 17:51:57 +04:00
|
|
|
fi
|
|
|
|
if (
|
|
|
|
# Build bootstrap cmake
|
2003-04-17 16:02:44 +04:00
|
|
|
cd ${DIRNAME}
|
2002-09-13 17:51:57 +04:00
|
|
|
echo "Bootstrapping to directory `pwd`"
|
|
|
|
BUILD_CMAKE_IN_SUBDIR=true $CMAKE_ROOT_DIR/$PRGNAME $ac_configure_args
|
|
|
|
); then
|
|
|
|
# run cmake
|
2003-04-17 16:02:44 +04:00
|
|
|
${DIRNAME}/Source/cmake $fullSrcDir
|
2002-09-13 17:51:57 +04:00
|
|
|
|
|
|
|
# run cmake depends
|
|
|
|
$RUNMAKE depend
|
|
|
|
else
|
|
|
|
echo "Problem bootstrapping CMake"
|
|
|
|
exit 1
|
|
|
|
fi
|
2003-04-17 16:02:44 +04:00
|
|
|
fi
|