configure.in 3.39 KB
Newer Older
Ken Martin's avatar
Ken Martin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
# Process this file with autoconf to produce a configure script.
AC_INIT()

AC_CONFIG_HEADER(Source/cmConfigure.h)

CMAKE_CONFIG_DIR=`pwd`
AC_SUBST(CMAKE_CONFIG_DIR)

#
# check for some programs we use
#
AC_PROG_CC
AC_PROG_CXX

fullSrcDir=`cd $srcdir; pwd`
CMAKE_ROOT_DIR=$fullSrcDir
AC_SUBST(CMAKE_ROOT_DIR)

CMAKE_ANSI_CFLAGS=""
# 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.*)
        echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6
        echo 'void f(){}' > conftest.c
        if test -z "`${CC} -Aa -c conftest.c 2>&1`"; then
          echo "$ac_t""yes" 1>&6
          CMAKE_ANSI_CFLAGS="-Aa"
        else
          echo "$ac_t""no" 1>&6
        fi
        rm -f conftest*
33
	;;  
Bill Hoffman's avatar
Bill Hoffman committed
34
    IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
35 36 37 38 39 40 41 42 43 44
        echo $ac_n "checking whether ${CC} accepts -LANG:std""... $ac_c" 1>&6
        echo 'void f(){}' > conftest.c
        if test -z "`${CC} -LANG:std -c conftest.c 2>&1`"; then
          echo "$ac_t""yes" 1>&6
          CMAKE_ANSI_CFLAGS="-LANG:std"
        else
          echo "$ac_t""no" 1>&6
        fi
        rm -f conftest*
	;;  
Ken Martin's avatar
Ken Martin committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
esac
fi
AC_SUBST(CMAKE_ANSI_CFLAGS)

# if we are not running g++ then we might need some other flags
# to get the templates compiled correctly
CMAKE_TEMPLATE_FLAGS=""
if test $ac_cv_prog_gxx = no; then
    echo $ac_n "checking whether ${CXX} accepts -ptused -no_prelink""... $ac_c" 1>&6
  echo 'void f(){}' > conftest.cc
  if test -z "`${CXX} -ptused -no_prelink -c conftest.cc 2>&1`"; then
    echo "$ac_t""yes" 1>&6
    CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink"
  else
    echo "$ac_t""no" 1>&6
  fi
  rm -f conftest*
  echo $ac_n "checking whether ${CXX} accepts -instances=semiexplicit""... $ac_c" 1>&6
  echo 'void f(){}' > conftest.cc
  if test -z "`${CXX} -instances=static -c conftest.cc 2>&1`"; then
    echo "$ac_t""yes" 1>&6
    CMAKE_TEMPLATE_FLAGS="-instances=static"
  else
    echo "$ac_t""no" 1>&6
  fi
fi
AC_SUBST(CMAKE_TEMPLATE_FLAGS)

# check no g++ compilers to see if they have the standard 
# ansi stream files (without the .h)
if test $ac_cv_prog_gxx = no; then
  AC_MSG_CHECKING( ansi standard C++ stream headers ) 
  rm -rf conftest.*
  cat > conftest.cc <<!
#include <iostream>
!
Bill Hoffman's avatar
Bill Hoffman committed
81
  if test -z "`${CXX} $CXXFLAGS $CPPFLAGS  -c conftest.cc 2>&1`"; then
Ken Martin's avatar
Ken Martin committed
82 83
    echo "$ac_t""yes" 1>&6
  else
Bill Hoffman's avatar
Bill Hoffman committed
84
    AC_DEFINE(CMAKE_NO_ANSI_STREAM_HEADERS)
Ken Martin's avatar
Ken Martin committed
85 86 87 88 89 90 91 92 93 94 95 96
    echo "$ac_t""no" 1>&6
  fi
fi

# check to see if stl is in the std namespace
if test $ac_cv_prog_gxx = no; then
  AC_MSG_CHECKING( ansi standard namespace support ) 
  rm -rf conftest.*
  cat > conftest.cc <<!
#include <list>
void foo() { std::list<int> l; }
!
Bill Hoffman's avatar
Bill Hoffman committed
97
  if test -z "`${CXX} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
Ken Martin's avatar
Ken Martin committed
98 99
    echo "$ac_t""yes" 1>&6
  else
Bill Hoffman's avatar
Bill Hoffman committed
100
    AC_DEFINE(CMAKE_NO_STD_NAMESPACE)
Ken Martin's avatar
Ken Martin committed
101 102 103 104
    echo "$ac_t""no" 1>&6
  fi
fi

105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
# check to see if for scoping is supported
if test $ac_cv_prog_gxx = no; then
  AC_MSG_CHECKING( ansi for scope support ) 
  rm -rf conftest.*
  cat > conftest.cc <<!
void foo() { for(int i;;); for(int i;;); }
!
  if test -z "`${CXX} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
    echo "$ac_t""yes" 1>&6
  else
    AC_DEFINE(CMAKE_NO_ANSI_FOR_SCOPE)
    echo "$ac_t""no" 1>&6
  fi
fi

120 121
# find make to use to build cmake, prefer gmake
AC_PATH_PROGS(RUNMAKE, gmake make)
Ken Martin's avatar
Ken Martin committed
122 123

AC_OUTPUT(Makefile Source/Makefile)
Bill Hoffman's avatar
Bill Hoffman committed
124
# build cmake
125
$RUNMAKE 
Bill Hoffman's avatar
Bill Hoffman committed
126
# run cmake 
127
./Source/cmake $fullSrcDir
Bill Hoffman's avatar
Bill Hoffman committed
128 129
# run cmake depends
$RUNMAKE depend