1 # Process this file with autoconf to produce a configure script.
6 # check for some programs we use
9 # save the CXXFLAGS specified by the user
10 save_CXXFLAGS=$CXXFLAGS
14 # Step 1: set the variable "system" to hold the name and version number
15 # for the system. This can usually be done via the "uname" command, but
16 # there are a few systems, like Next, where this doesn't work.
18 AC_MSG_CHECKING([system version (for dynamic loading)])
19 if test -f /usr/lib/NextStep/software_version; then
20 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
22 system=`uname -s`-`uname -r`
23 if test "$?" -ne 0 ; then
24 AC_MSG_RESULT([unknown (can't find uname command)])
27 # Special check for weird MP-RAS system (uname returns weird
28 # results, and the version is kept in special file).
30 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
31 system=MP-RAS-`awk '{print $3}' /etc/.relid'`
33 AC_MSG_RESULT($system)
37 # restore the flags specified by the user and get rid of any flags
38 # found by autoconf (we do not want -02 -g by default)
39 CXXFLAGS=$save_CXXFLAGS
42 CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION=""
43 if test $ac_cv_prog_gxx = no; then
44 CXXFLAGS_ORIG="$CXXFLAGS"
45 CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
46 AC_MSG_CHECKING([whether ${CXX} supports explicit instantiation])
50 template<class T>class x{};template class x<int>;
54 CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION=1
58 CXXFLAGS="$CXXFLAGS_ORIG"
61 # if running on darwin no explicit template instantiations even though
62 # syntax is supported.
65 CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION="1"
68 AC_SUBST(CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
70 CMAKE_ANSI_CXXFLAGS=""
71 # on hp use -Aa for ansi
72 if test $ac_cv_prog_gxx = no; then
74 IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
75 CXXFLAGS_ORIG="$CXXFLAGS"
76 CXXFLAGS="-LANG:std $CXXFLAGS"
77 AC_MSG_CHECKING([whether ${CXX} accepts -LANG:std])
84 CMAKE_ANSI_CXXFLAGS="-LANG:std"
89 CXXFLAGS="$CXXFLAGS_ORIG"
93 CXXFLAGS_ORIG="$CXXFLAGS"
94 CXXFLAGS="-std strict_ansi -nopure_cname $CXXFLAGS"
95 AC_MSG_CHECKING([whether ${CXX} accepts -std strict_ansi -nopure_cname])
102 CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
107 CXXFLAGS="$CXXFLAGS_ORIG"
111 AC_SUBST(CMAKE_ANSI_CXXFLAGS)
113 # if we are not running g++ then we might need some other flags
114 # to get the templates compiled correctly
115 CMAKE_TEMPLATE_FLAGS=""
116 if test $ac_cv_prog_gxx = no; then
117 CXXFLAGS_ORIG="$CXXFLAGS"
118 CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS -ptused -no_prelink"
119 AC_MSG_CHECKING([whether ${CXX} accepts -ptused -no_prelink])
126 CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink"
131 CXXFLAGS="$CXXFLAGS_ORIG"
133 AC_SUBST(CMAKE_TEMPLATE_FLAGS)
135 # check compilers to see if they have std::stringstream
136 CXXFLAGS_ORIG="$CXXFLAGS"
137 CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
138 AC_MSG_CHECKING([for ansi standard C++ stringstream])
146 CMAKE_NO_ANSI_STRING_STREAM=1
150 CXXFLAGS="$CXXFLAGS_ORIG"
151 AC_SUBST(CMAKE_NO_ANSI_STRING_STREAM)
153 # check to see if stl is in the std namespace
154 if test $ac_cv_prog_gxx = no; then
155 CXXFLAGS_ORIG="$CXXFLAGS"
156 CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
157 AC_MSG_CHECKING([whether the std namespace is supported])
162 void foo() { std::list<int>(); }
166 CMAKE_NO_STD_NAMESPACE=1
170 CXXFLAGS="$CXXFLAGS_ORIG"
172 AC_SUBST(CMAKE_NO_STD_NAMESPACE)
174 # check to see if for scoping is supported
175 if test $ac_cv_prog_gxx = no; then
176 CXXFLAGS_ORIG="$CXXFLAGS"
177 CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
178 AC_MSG_CHECKING([ansi for scope support])
182 void foo() { for(int i;;); for(int i;;); }
186 CMAKE_NO_ANSI_FOR_SCOPE=1
190 CXXFLAGS="$CXXFLAGS_ORIG"
192 AC_SUBST(CMAKE_NO_ANSI_FOR_SCOPE)
195 # find make to use to build cmake, prefer gmake
196 AC_PATH_PROGS(CMAKE_AR_TMP, ar)
197 CMAKE_CXX_AR="$CMAKE_AR_TMP"
198 CMAKE_CXX_AR_ARGS="cr"
199 # if on SunOS and not using gXX then use the compiler to make .a libs
202 if test $ac_cv_prog_gxx = yes; then
205 echo "Using $CXX -xar -o for creating .a libraries"
207 CMAKE_CXX_AR_ARGS="-xar -o"
211 if test $ac_cv_prog_gxx = yes; then
214 echo "Using $CXX -xar -o for creating .a libraries"
216 CMAKE_CXX_AR_ARGS="-ar -o"
220 AC_SUBST(CMAKE_CXX_AR)
221 AC_SUBST(CMAKE_CXX_AR_ARGS)
223 CMAKE_COMPILER_IS_GNUGXX=0
224 if test $ac_cv_prog_gxx = yes; then
225 CMAKE_COMPILER_IS_GNUCXX=1
229 CMAKE_CXX_LINK_SHARED=${CXX}
232 CMAKE_CXX_SHLIB_CFLAGS="+Z"
233 CMAKE_CXX_SHLIB_SUFFIX=".sl"
234 CMAKE_CXX_MODULE_SUFFIX=".sl"
235 CMAKE_CXX_SHLIB_BUILD_FLAGS='+Z -Wl,-E -b -L/usr/lib'
236 CMAKE_CXX_SHLIB_LINK_FLAGS='-Wl,+s'
237 CMAKE_CXX_MODULE_BUILD_FLAGS='+Z -Wl,-E -b -L/usr/lib'
238 CMAKE_CXX_MODULE_LINK_FLAGS='-Wl,+s'
239 CMAKE_CXX_SHLIB_RUNTIME_FLAG='-Wl,+b,'
240 CMAKE_CXX_SHLIB_RUNTIME_SEP=':'
242 # CXX versions of shared flags
243 AC_SUBST(CMAKE_CXX_LINK_SHARED)
244 AC_SUBST(CMAKE_CXX_SHLIB_CFLAGS)
245 AC_SUBST(CMAKE_CXX_SHLIB_BUILD_FLAGS)
246 AC_SUBST(CMAKE_CXX_SHLIB_LINK_FLAGS)
247 AC_SUBST(CMAKE_CXX_MODULE_BUILD_FLAGS)
248 AC_SUBST(CMAKE_CXX_MODULE_LINK_FLAGS)
249 AC_SUBST(CMAKE_CXX_SHLIB_RUNTIME_FLAG)
250 AC_SUBST(CMAKE_CXX_SHLIB_RUNTIME_SEP)
253 AC_SUBST(CMAKE_COMPILER_IS_GNUCXX)
254 # generate output files.
255 # create mkdir files just to make some of the directories
257 AC_OUTPUT( CXXCMakeSystemConfig.cmake )