comparison m4/acinclude.m4 @ 17965:1d58abc740c0

acinclude.m4: Place new macro CHECK_BROKEN_STL_ALGO_H in alphabetical ordering. * acinclude.m4: Place new macro CHECK_BROKEN_STL_ALGO_H in alphabetical ordering.
author Rik <rik@octave.org>
date Wed, 20 Nov 2013 09:15:56 -0800
parents 11a6c7445a71
children 303157af491f
comparison
equal deleted inserted replaced
17964:abe592ef40b5 17965:1d58abc740c0
88 [CFLAGS="$CFLAGS $1" 88 [CFLAGS="$CFLAGS $1"
89 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2]) 89 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2])
90 else 90 else
91 AC_MSG_RESULT([no]) 91 AC_MSG_RESULT([no])
92 ifelse([$3], , , [$3]) 92 ifelse([$3], , , [$3])
93 fi
94 ])
95 dnl
96 dnl Check for broken stl_algo.h header file in gcc versions 4.8.0, 4.8.1, 4.8.2
97 dnl which leads to failures in nth_element.
98 dnl
99 AC_DEFUN([OCTAVE_CHECK_BROKEN_STL_ALGO_H], [
100 AC_CACHE_CHECK([whether stl_algo.h is broken],
101 [octave_cv_broken_stl_algo_h],
102 [AC_LANG_PUSH(C++)
103 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
104 // Based on code from a GCC test program.
105
106 // Copyright (C) 2013 Free Software Foundation, Inc.
107 //
108 // This file is part of the GNU ISO C++ Library. This library is free
109 // software; you can redistribute it and/or modify it under the
110 // terms of the GNU General Public License as published by the
111 // Free Software Foundation; either version 3, or (at your option)
112 // any later version.
113
114 // This library is distributed in the hope that it will be useful,
115 // but WITHOUT ANY WARRANTY; without even the implied warranty of
116 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117 // GNU General Public License for more details.
118
119 // You should have received a copy of the GNU General Public License along
120 // with this library; see the file COPYING3. If not see
121 // <http://www.gnu.org/licenses/>.
122
123 // 25.3.2 [lib.alg.nth.element]
124
125 // { dg-options "-std=gnu++11" }
126
127 #include <algorithm>
128 #include <vector>
129 ]], [[
130 std::vector<int> v (7);
131
132 v[0] = 207089;
133 v[1] = 202585;
134 v[2] = 180067;
135 v[3] = 157549;
136 v[4] = 211592;
137 v[5] = 216096;
138 v[6] = 207089;
139
140 std::nth_element (v.begin (), v.begin () + 3, v.end ());
141
142 return v[3] == 207089 ? 0 : 1;
143 ]])],
144 octave_cv_broken_stl_algo_h=no,
145 octave_cv_broken_stl_algo_h=yes,
146 [case "$GXX_VERSION" in
147 *4.8.2*)
148 octave_cv_broken_stl_algo_h=yes,
149 ;;
150 esac
151 ])
152 AC_LANG_POP(C++)
153 ])
154 if test "$GXX" = yes; then
155 if test $octave_cv_broken_stl_algo_h = yes; then
156 case "$GXX_VERSION" in
157 4.8.[[012]])
158 ;;
159 *)
160 octave_cv_broken_stl_algo_h=no
161 warn_stl_algo_h="UNEXPECTED: found nth_element broken in g++ $GXX_VERSION. Refusing to fix except for g++ 4.8.0, 4.8.1, or 4.8.2. You appear to have g++ $GXX_VERSION."
162 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
163 ;;
164 esac
165 else
166 case "$GXX_VERSION" in
167 4.8.2)
168 warn_stl_algo_h="UNEXPECTED: found nth_element working in g++ 4.8.2. Has it been patched on your system?"
169 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
170 ;;
171 esac
172 fi
173 else
174 octave_cv_broken_stl_algo_h=no
175 warn_stl_algo_h="UNEXPECTED: nth_element test failed. Refusing to fix except for g++ 4.8.2."
176 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
93 fi 177 fi
94 ]) 178 ])
95 dnl 179 dnl
96 dnl Check whether the FFTW library supports multi-threading. This macro 180 dnl Check whether the FFTW library supports multi-threading. This macro
97 dnl should be called once per FFTW precision passing in the library 181 dnl should be called once per FFTW precision passing in the library
2055 AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, 2139 AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1,
2056 [Define to 1 if unordered_map requires the use of tr1 namespace.]) 2140 [Define to 1 if unordered_map requires the use of tr1 namespace.])
2057 fi 2141 fi
2058 ]) 2142 ])
2059 2143
2060 AC_DEFUN([OCTAVE_CHECK_BROKEN_STL_ALGO_H], [
2061 AC_CACHE_CHECK([whether stl_algo.h is broken],
2062 [octave_cv_broken_stl_algo_h],
2063 [AC_LANG_PUSH(C++)
2064 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2065 // Based on code from a GCC test program.
2066
2067 // Copyright (C) 2013 Free Software Foundation, Inc.
2068 //
2069 // This file is part of the GNU ISO C++ Library. This library is free
2070 // software; you can redistribute it and/or modify it under the
2071 // terms of the GNU General Public License as published by the
2072 // Free Software Foundation; either version 3, or (at your option)
2073 // any later version.
2074
2075 // This library is distributed in the hope that it will be useful,
2076 // but WITHOUT ANY WARRANTY; without even the implied warranty of
2077 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2078 // GNU General Public License for more details.
2079
2080 // You should have received a copy of the GNU General Public License along
2081 // with this library; see the file COPYING3. If not see
2082 // <http://www.gnu.org/licenses/>.
2083
2084 // 25.3.2 [lib.alg.nth.element]
2085
2086 // { dg-options "-std=gnu++11" }
2087
2088 #include <algorithm>
2089 #include <vector>
2090 ]], [[
2091 std::vector<int> v (7);
2092
2093 v[0] = 207089;
2094 v[1] = 202585;
2095 v[2] = 180067;
2096 v[3] = 157549;
2097 v[4] = 211592;
2098 v[5] = 216096;
2099 v[6] = 207089;
2100
2101 std::nth_element (v.begin (), v.begin () + 3, v.end ());
2102
2103 return v[3] == 207089 ? 0 : 1;
2104 ]])],
2105 octave_cv_broken_stl_algo_h=no,
2106 octave_cv_broken_stl_algo_h=yes,
2107 [case "$GXX_VERSION" in
2108 *4.8.2*)
2109 octave_cv_broken_stl_algo_h=yes,
2110 ;;
2111 esac
2112 ])
2113 AC_LANG_POP(C++)
2114 ])
2115 if test "$GXX" = yes; then
2116 if test $octave_cv_broken_stl_algo_h = yes; then
2117 case "$GXX_VERSION" in
2118 4.8.[[012]])
2119 ;;
2120 *)
2121 octave_cv_broken_stl_algo_h=no
2122 warn_stl_algo_h="UNEXPECTED: found nth_element broken in g++ $GXX_VERSION. Refusing to fix except for g++ 4.8.0, 4.8.1, or 4.8.2. You appear to have g++ $GXX_VERSION."
2123 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
2124 ;;
2125 esac
2126 else
2127 case "$GXX_VERSION" in
2128 4.8.2)
2129 warn_stl_algo_h="UNEXPECTED: found nth_element working in g++ 4.8.2. Has it been patched on your system?"
2130 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
2131 ;;
2132 esac
2133 fi
2134 else
2135 octave_cv_broken_stl_algo_h=no
2136 warn_stl_algo_h="UNEXPECTED: nth_element test failed. Refusing to fix except for g++ 4.8.2."
2137 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
2138 fi
2139 ])
2140
2141 dnl End of macros written by Octave developers 2144 dnl End of macros written by Octave developers
2142 dnl ------------------------------------------------------------ 2145 dnl ------------------------------------------------------------
2143 dnl 2146 dnl
2144 2147
2145 ##############################################################################