2002-04-03 00:43:23 +04:00
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
AC_INIT()
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# check for some programs we use
|
|
|
|
#
|
|
|
|
|
|
|
|
# save the CXXFLAGS specified by the user
|
|
|
|
save_CXXFLAGS=$CXXFLAGS
|
|
|
|
|
|
|
|
AC_PROG_CXX
|
|
|
|
|
2002-04-04 18:04:07 +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-03 00:43:23 +04: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)
|
|
|
|
CXXFLAGS=$save_CXXFLAGS
|
|
|
|
|
|
|
|
|
|
|
|
CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION=""
|
|
|
|
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 ${CXX} supports explicit instantiation])
|
|
|
|
AC_LANG_SAVE
|
|
|
|
AC_LANG_CPLUSPLUS
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
template<class T>class x{};template class x<int>;
|
|
|
|
],,[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
],[
|
|
|
|
CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION=1
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
2002-04-03 00:43:23 +04:00
|
|
|
fi
|
2002-09-07 01:19:18 +04:00
|
|
|
|
2002-04-03 00:43:23 +04:00
|
|
|
# if running on darwin no explicit template instantiations even though
|
|
|
|
# syntax is supported.
|
|
|
|
case $system in
|
|
|
|
Darwin*)
|
|
|
|
CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION="1"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_SUBST(CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
|
|
|
|
|
|
|
|
CMAKE_ANSI_CXXFLAGS=""
|
|
|
|
# on hp use -Aa for ansi
|
|
|
|
if test $ac_cv_prog_gxx = no; then
|
|
|
|
case $system in
|
|
|
|
IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
|
2002-09-07 01:19:18 +04:00
|
|
|
CXXFLAGS_ORIG="$CXXFLAGS"
|
|
|
|
CXXFLAGS="-LANG:std $CXXFLAGS"
|
|
|
|
AC_MSG_CHECKING([whether ${CXX} accepts -LANG:std])
|
|
|
|
AC_LANG_SAVE
|
|
|
|
AC_LANG_CPLUSPLUS
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
void foo() {}
|
|
|
|
],,[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
CMAKE_ANSI_CXXFLAGS="-LANG:std"
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
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"
|
|
|
|
;;
|
2002-04-03 00:43:23 +04:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
AC_SUBST(CMAKE_ANSI_CXXFLAGS)
|
|
|
|
|
|
|
|
# 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
|
2002-09-07 01:19:18 +04:00
|
|
|
CXXFLAGS_ORIG="$CXXFLAGS"
|
|
|
|
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS -ptused -no_prelink"
|
|
|
|
AC_MSG_CHECKING([whether ${CXX} accepts -ptused -no_prelink])
|
|
|
|
AC_LANG_SAVE
|
|
|
|
AC_LANG_CPLUSPLUS
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
void foo() {}
|
|
|
|
],,[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink"
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
2002-04-03 00:43:23 +04:00
|
|
|
fi
|
|
|
|
AC_SUBST(CMAKE_TEMPLATE_FLAGS)
|
|
|
|
|
|
|
|
|
2002-06-19 23:05:14 +04:00
|
|
|
# check non-g++ compilers to see if they have the standard
|
2002-04-03 00:43:23 +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"
|
2002-04-03 00:43:23 +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)
|
|
|
|
],[
|
|
|
|
CMAKE_NO_ANSI_STREAM_HEADERS=1
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
2002-04-03 00:43:23 +04:00
|
|
|
fi
|
|
|
|
AC_SUBST(CMAKE_NO_ANSI_STREAM_HEADERS)
|
|
|
|
|
2002-06-21 16:39:01 +04:00
|
|
|
# check 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)
|
|
|
|
],[
|
|
|
|
CMAKE_NO_ANSI_STRING_STREAM=1
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
2002-06-19 23:05:14 +04:00
|
|
|
AC_SUBST(CMAKE_NO_ANSI_STRING_STREAM)
|
|
|
|
|
2002-04-03 00:43:23 +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)
|
|
|
|
],[
|
|
|
|
CMAKE_NO_STD_NAMESPACE=1
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
2002-04-03 00:43:23 +04:00
|
|
|
fi
|
|
|
|
AC_SUBST(CMAKE_NO_STD_NAMESPACE)
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
],[
|
|
|
|
CMAKE_NO_ANSI_FOR_SCOPE=1
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
])
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
CXXFLAGS="$CXXFLAGS_ORIG"
|
2002-04-03 00:43:23 +04:00
|
|
|
fi
|
|
|
|
AC_SUBST(CMAKE_NO_ANSI_FOR_SCOPE)
|
|
|
|
|
|
|
|
|
|
|
|
# find make to use to build cmake, prefer gmake
|
|
|
|
AC_PATH_PROGS(CMAKE_AR_TMP, ar)
|
2002-04-04 20:01:41 +04:00
|
|
|
CMAKE_CXX_AR="$CMAKE_AR_TMP"
|
|
|
|
CMAKE_CXX_AR_ARGS="cr"
|
2002-04-03 00:43:23 +04:00
|
|
|
# if on SunOS and not using gXX then use the compiler to make .a libs
|
|
|
|
case $system in
|
|
|
|
SunOS-5*)
|
|
|
|
if test $ac_cv_prog_gxx = yes; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "Using $CXX -xar -o for creating .a libraries"
|
2002-04-04 20:01:41 +04:00
|
|
|
CMAKE_CXX_AR="$CXX"
|
|
|
|
CMAKE_CXX_AR_ARGS="-xar -o"
|
2002-04-03 00:43:23 +04:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
IRIX*)
|
|
|
|
if test $ac_cv_prog_gxx = yes; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "Using $CXX -xar -o for creating .a libraries"
|
2002-04-04 20:01:41 +04:00
|
|
|
CMAKE_CXX_AR="$CXX"
|
|
|
|
CMAKE_CXX_AR_ARGS="-ar -o"
|
2002-04-03 00:43:23 +04:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2002-04-04 20:01:41 +04:00
|
|
|
AC_SUBST(CMAKE_CXX_AR)
|
|
|
|
AC_SUBST(CMAKE_CXX_AR_ARGS)
|
2002-04-03 00:43:23 +04:00
|
|
|
|
|
|
|
CMAKE_COMPILER_IS_GNUGXX=0
|
|
|
|
if test $ac_cv_prog_gxx = yes; then
|
|
|
|
CMAKE_COMPILER_IS_GNUCXX=1
|
|
|
|
fi
|
|
|
|
|
2002-04-08 21:36:18 +04:00
|
|
|
|
|
|
|
CMAKE_CXX_LINK_SHARED=${CXX}
|
|
|
|
case $system in
|
|
|
|
HP-UX-*)
|
|
|
|
CMAKE_CXX_SHLIB_CFLAGS="+Z"
|
|
|
|
CMAKE_CXX_SHLIB_SUFFIX=".sl"
|
|
|
|
CMAKE_CXX_MODULE_SUFFIX=".sl"
|
|
|
|
CMAKE_CXX_SHLIB_BUILD_FLAGS='+Z -Wl,-E -b -L/usr/lib'
|
|
|
|
CMAKE_CXX_SHLIB_LINK_FLAGS='-Wl,+s'
|
|
|
|
CMAKE_CXX_MODULE_BUILD_FLAGS='+Z -Wl,-E -b -L/usr/lib'
|
|
|
|
CMAKE_CXX_MODULE_LINK_FLAGS='-Wl,+s'
|
|
|
|
CMAKE_CXX_SHLIB_RUNTIME_FLAG='-Wl,+b,'
|
|
|
|
CMAKE_CXX_SHLIB_RUNTIME_SEP=':'
|
|
|
|
esac
|
|
|
|
# CXX versions of shared flags
|
|
|
|
AC_SUBST(CMAKE_CXX_LINK_SHARED)
|
|
|
|
AC_SUBST(CMAKE_CXX_SHLIB_CFLAGS)
|
|
|
|
AC_SUBST(CMAKE_CXX_SHLIB_BUILD_FLAGS)
|
|
|
|
AC_SUBST(CMAKE_CXX_SHLIB_LINK_FLAGS)
|
|
|
|
AC_SUBST(CMAKE_CXX_MODULE_BUILD_FLAGS)
|
|
|
|
AC_SUBST(CMAKE_CXX_MODULE_LINK_FLAGS)
|
|
|
|
AC_SUBST(CMAKE_CXX_SHLIB_RUNTIME_FLAG)
|
|
|
|
AC_SUBST(CMAKE_CXX_SHLIB_RUNTIME_SEP)
|
|
|
|
|
|
|
|
|
2002-04-03 00:43:23 +04:00
|
|
|
AC_SUBST(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
# generate output files.
|
|
|
|
# create mkdir files just to make some of the directories
|
|
|
|
|
|
|
|
AC_OUTPUT( CXXCMakeSystemConfig.cmake )
|