| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | AC_DEFUN([PAC_PROG_CXX_TEMPLATE_DIR],[ |
|---|
| 14 | AC_CACHE_CHECK([for C++ template repository directory name], |
|---|
| 15 | pac_cv_cxx_template_dir,[ |
|---|
| 16 | mkdir conftest_dir |
|---|
| 17 | cd conftest_dir |
|---|
| 18 | AC_LANG_SAVE |
|---|
| 19 | AC_LANG_CPLUSPLUS |
|---|
| 20 | cat > conftest_1.h <<EOF |
|---|
| 21 | template <class T> |
|---|
| 22 | class foo { |
|---|
| 23 | public: |
|---|
| 24 | foo( T in ) : data( in ) { in.member(1); }; |
|---|
| 25 | void member( int i ); |
|---|
| 26 | private: |
|---|
| 27 | T data; |
|---|
| 28 | }; |
|---|
| 29 | class bar { |
|---|
| 30 | public: |
|---|
| 31 | bar( int i ) { data = i; }; |
|---|
| 32 | void member( int i ) { data = data + i; }; |
|---|
| 33 | private: |
|---|
| 34 | int data; |
|---|
| 35 | }; |
|---|
| 36 | EOF |
|---|
| 37 | cat > conftest_1.${ac_ext} <<EOF |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | void my_function( void ) |
|---|
| 41 | { |
|---|
| 42 | foo<bar> v1(6); |
|---|
| 43 | foo< foo<bar> > v2(v1); |
|---|
| 44 | } |
|---|
| 45 | EOF |
|---|
| 46 | cat > conftest.${ac_ext} <<EOF |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | void my_function( void ); |
|---|
| 50 | |
|---|
| 51 | template <class T> |
|---|
| 52 | void foo<T>::member(int i) |
|---|
| 53 | { |
|---|
| 54 | i++; |
|---|
| 55 | } |
|---|
| 56 | int main( int argc, char *argv[] ) |
|---|
| 57 | { |
|---|
| 58 | foo<bar> v1(6); |
|---|
| 59 | foo< foo<bar> > v2(v1); |
|---|
| 60 | my_function(); |
|---|
| 61 | return 0; |
|---|
| 62 | } |
|---|
| 63 | EOF |
|---|
| 64 | |
|---|
| 65 | ac_compile_special='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest_1.$ac_ext 1>&AC_FD_CC' |
|---|
| 66 | if AC_TRY_EVAL(ac_compile_special) ; then |
|---|
| 67 | if AC_TRY_EVAL(ac_compile) ; then |
|---|
| 68 | |
|---|
| 69 | for file in `ls` ; do |
|---|
| 70 | if test -d "$file" -a "$file" != "." -a "$file" != ".." ; then |
|---|
| 71 | pac_cv_cxx_template_dir="$pac_cv_cxx_template_dir $file" |
|---|
| 72 | fi |
|---|
| 73 | done |
|---|
| 74 | pac_cv_cxx_template_dir_name="$pac_cv_cxx_template_dir" |
|---|
| 75 | if test -z "$pac_cv_cxx_template_dir" ; then |
|---|
| 76 | pac_cv_cxx_template_dir="could not determine" |
|---|
| 77 | fi |
|---|
| 78 | else |
|---|
| 79 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 80 | cat conftest.$ac_ext >&AC_FD_CC |
|---|
| 81 | pac_cv_cxx_template_dir="could not determine" |
|---|
| 82 | fi |
|---|
| 83 | else |
|---|
| 84 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 85 | cat conftest_1.$ac_ext >&AC_FD_CC |
|---|
| 86 | pac_cv_cxx_template_dir="templates not supported" |
|---|
| 87 | fi |
|---|
| 88 | cd .. |
|---|
| 89 | |
|---|
| 90 | AC_LANG_RESTORE |
|---|
| 91 | ]) |
|---|
| 92 | $1="$pac_cv_cxx_template_dir_name" |
|---|
| 93 | ]) |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | AC_DEFUN([PAC_PROG_CXX_WORKS], |
|---|
| 100 | [AC_PROG_CXX_WORKS |
|---|
| 101 | AC_MSG_CHECKING([whether the C++ compiler sets its return status correctly]) |
|---|
| 102 | AC_LANG_SAVE |
|---|
| 103 | AC_LANG_CXX |
|---|
| 104 | AC_TRY_COMPILE(,[int a = bzzzt;],notbroken=no,notbroken=yes) |
|---|
| 105 | AC_MSG_RESULT($notbroken) |
|---|
| 106 | if test "$notbroken" = "no" ; then |
|---|
| 107 | AC_MSG_ERROR([installation or configuration problem: C++ compiler does not |
|---|
| 108 | correctly set error code when a fatal error occurs]) |
|---|
| 109 | fi |
|---|
| 110 | ]) |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | AC_DEFUN([AC_CXX_BOOL], |
|---|
| 116 | [AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type, |
|---|
| 117 | ac_cv_cxx_bool, |
|---|
| 118 | [AC_LANG_SAVE |
|---|
| 119 | AC_LANG_CPLUSPLUS |
|---|
| 120 | AC_TRY_COMPILE([ |
|---|
| 121 | int f(int x){return 1;} |
|---|
| 122 | int f(char x){return 1;} |
|---|
| 123 | int f(bool x){return 1;} |
|---|
| 124 | ],[bool b = true; return f(b);], |
|---|
| 125 | ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no) |
|---|
| 126 | AC_LANG_RESTORE |
|---|
| 127 | ]) |
|---|
| 128 | if test "$ac_cv_cxx_bool" != yes; then |
|---|
| 129 | AC_DEFINE(bool,int,[define if bool is a built-in type]) |
|---|
| 130 | fi |
|---|
| 131 | ]) |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | AC_DEFUN([AC_CXX_EXCEPTIONS], |
|---|
| 137 | [AC_CACHE_CHECK(whether the compiler supports exceptions, |
|---|
| 138 | ac_cv_cxx_exceptions, |
|---|
| 139 | [AC_LANG_SAVE |
|---|
| 140 | AC_LANG_CPLUSPLUS |
|---|
| 141 | AC_TRY_COMPILE(,[try { throw 1; } catch (int i) { return i; }], |
|---|
| 142 | ac_cv_cxx_exceptions=yes, ac_cv_cxx_exceptions=no) |
|---|
| 143 | AC_LANG_RESTORE |
|---|
| 144 | ]) |
|---|
| 145 | if test "$ac_cv_cxx_exceptions" = yes; then |
|---|
| 146 | AC_DEFINE(HAVE_CXX_EXCEPTIONS,,[define if the compiler supports exceptions]) |
|---|
| 147 | fi |
|---|
| 148 | ]) |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | |
|---|
| 153 | AC_DEFUN([AC_CXX_HAVE_COMPLEX], |
|---|
| 154 | [AC_CACHE_CHECK(whether the C++ compiler has complex<T>, |
|---|
| 155 | ac_cv_cxx_have_complex, |
|---|
| 156 | [AC_REQUIRE([AC_CXX_NAMESPACES]) |
|---|
| 157 | AC_LANG_SAVE |
|---|
| 158 | AC_LANG_CPLUSPLUS |
|---|
| 159 | AC_TRY_COMPILE([ |
|---|
| 160 | |
|---|
| 161 | using namespace std; |
|---|
| 162 | |
|---|
| 163 | ac_cv_cxx_have_complex=yes, ac_cv_cxx_have_complex=no) |
|---|
| 164 | AC_LANG_RESTORE |
|---|
| 165 | ]) |
|---|
| 166 | if test "$ac_cv_cxx_have_complex" = yes; then |
|---|
| 167 | AC_DEFINE(HAVE_CXX_COMPLEX,,[define if the C++ compiler has complex<T>]) |
|---|
| 168 | fi |
|---|
| 169 | ]) |
|---|
| 170 | |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | AC_DEFUN([AC_CXX_NAMESPACES], |
|---|
| 174 | [AC_CACHE_CHECK(whether the compiler implements namespaces, |
|---|
| 175 | ac_cv_cxx_namespaces, |
|---|
| 176 | [AC_LANG_SAVE |
|---|
| 177 | AC_LANG_CPLUSPLUS |
|---|
| 178 | AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], |
|---|
| 179 | [using namespace Outer::Inner; return i;], |
|---|
| 180 | ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) |
|---|
| 181 | AC_LANG_RESTORE |
|---|
| 182 | ]) |
|---|
| 183 | if test "$ac_cv_cxx_namespaces" = yes; then |
|---|
| 184 | AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) |
|---|
| 185 | fi |
|---|
| 186 | ]) |
|---|
| 187 | |
|---|
| 188 | |
|---|
| 189 | |
|---|
| 190 | AC_DEFUN([AC_CXX_NAMESPACE_STD], |
|---|
| 191 | [AC_REQUIRE([AC_CXX_NAMESPACES]) |
|---|
| 192 | AC_CACHE_CHECK(whether the compiler implements the namespace std, |
|---|
| 193 | ac_cv_cxx_namespace_std, |
|---|
| 194 | [ac_cv_cxx_namespace_std=no |
|---|
| 195 | if test "$ac_cv_cxx_namespaces" = yes ; then |
|---|
| 196 | AC_LANG_SAVE |
|---|
| 197 | AC_LANG_CPLUSPLUS |
|---|
| 198 | AC_TRY_COMPILE([ |
|---|
| 199 | |
|---|
| 200 | using namespace std;], |
|---|
| 201 | [cout << "message\n";], |
|---|
| 202 | ac_cv_cxx_namespace_std=yes, ac_cv_cxx_namespace_std=no) |
|---|
| 203 | AC_LANG_RESTORE |
|---|
| 204 | fi |
|---|
| 205 | ]) |
|---|
| 206 | if test "$ac_cv_cxx_namespace_std" = yes; then |
|---|
| 207 | AC_DEFINE(HAVE_NAMESPACE_STD,,[define if the compiler implements namespace std]) |
|---|
| 208 | fi |
|---|
| 209 | ]) |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | |
|---|
| 213 | |
|---|
| 214 | |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | |
|---|
| 221 | |
|---|
| 222 | |
|---|
| 223 | |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | AC_DEFUN([PAC_CXX_CHECK_COMPILER_OPTION],[ |
|---|
| 235 | AC_MSG_CHECKING([whether C++ compiler accepts option $1]) |
|---|
| 236 | save_CXXFLAGS="$CXXFLAGS" |
|---|
| 237 | CXXFLAGS="$1 $CXXFLAGS" |
|---|
| 238 | rm -f conftest.out |
|---|
| 239 | echo 'int foo(void);int foo(void){return 0;}' > conftest2.cpp |
|---|
| 240 | echo 'int main(void);int main(void){return 0;}' > conftest.cpp |
|---|
| 241 | if ${CXX-g++} $save_CXXFLAGS $CPPFLAGS -o conftest conftest.cpp $LDFLAGS >conftest.bas 2>&1 ; then |
|---|
| 242 | if ${CXX-g++} $CXXFLAGS $CPPFLAGS -o conftest conftest.cpp $LDFLAGS >conftest.out 2>&1 ; then |
|---|
| 243 | if diff -b conftest.out conftest.bas >/dev/null 2>&1 ; then |
|---|
| 244 | AC_MSG_RESULT(yes) |
|---|
| 245 | AC_MSG_CHECKING([whether routines compiled with $1 can be linked with ones compiled without $1]) |
|---|
| 246 | rm -f conftest.out |
|---|
| 247 | rm -f conftest.bas |
|---|
| 248 | if ${CXX-g++} -c $save_CXXFLAGS $CPPFLAGS conftest2.cpp >conftest2.out 2>&1 ; then |
|---|
| 249 | if ${CXX-g++} $CXXFLAGS $CPPFLAGS -o conftest conftest2.o conftest.cpp $LDFLAGS >conftest.bas 2>&1 ; then |
|---|
| 250 | if ${CXX-g++} $CXXFLAGS $CPPFLAGS -o conftest conftest2.o conftest.cpp $LDFLAGS >conftest.out 2>&1 ; then |
|---|
| 251 | if diff -b conftest.out conftest.bas >/dev/null 2>&1 ; then |
|---|
| 252 | AC_MSG_RESULT(yes) |
|---|
| 253 | CXXFLAGS="$save_CXXFLAGS" |
|---|
| 254 | ifelse($2,,CXXOPTIONS="$CXXOPTIONS $1",$2) |
|---|
| 255 | elif test -s conftest.out ; then |
|---|
| 256 | cat conftest.out >&AC_FD_CC |
|---|
| 257 | AC_MSG_RESULT(no) |
|---|
| 258 | CXXFLAGS="$save_CXXFLAGS" |
|---|
| 259 | $3 |
|---|
| 260 | else |
|---|
| 261 | AC_MSG_RESULT(no) |
|---|
| 262 | CXXFLAGS="$save_CXXFLAGS" |
|---|
| 263 | $3 |
|---|
| 264 | fi |
|---|
| 265 | else |
|---|
| 266 | if test -s conftest.out ; then |
|---|
| 267 | cat conftest.out >&AC_FD_CC |
|---|
| 268 | fi |
|---|
| 269 | AC_MSG_RESULT(no) |
|---|
| 270 | CXXFLAGS="$save_CXXFLAGS" |
|---|
| 271 | $3 |
|---|
| 272 | fi |
|---|
| 273 | else |
|---|
| 274 | |
|---|
| 275 | AC_MSG_RESULT(no) |
|---|
| 276 | fi |
|---|
| 277 | else |
|---|
| 278 | if test -s conftest2.out ; then |
|---|
| 279 | cat conftest2.out >&AC_FD_CC |
|---|
| 280 | fi |
|---|
| 281 | AC_MSG_RESULT(no) |
|---|
| 282 | CXXFLAGS="$save_CXXFLAGS" |
|---|
| 283 | $3 |
|---|
| 284 | fi |
|---|
| 285 | else |
|---|
| 286 | cat conftest.out >&AC_FD_CC |
|---|
| 287 | AC_MSG_RESULT(no) |
|---|
| 288 | $3 |
|---|
| 289 | CXXFLAGS="$save_CXXFLAGS" |
|---|
| 290 | fi |
|---|
| 291 | else |
|---|
| 292 | AC_MSG_RESULT(no) |
|---|
| 293 | $3 |
|---|
| 294 | if test -s conftest.out ; then cat conftest.out >&AC_FD_CC ; fi |
|---|
| 295 | CXXFLAGS="$save_CXXFLAGS" |
|---|
| 296 | fi |
|---|
| 297 | else |
|---|
| 298 | |
|---|
| 299 | AC_MSG_RESULT(no) |
|---|
| 300 | fi |
|---|
| 301 | rm -f conftest* |
|---|
| 302 | ]) |
|---|