google_hash 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/README +21 -0
  2. data/Rakefile +11 -0
  3. data/VERSION +1 -0
  4. data/ext/extconf.rb +15 -0
  5. data/ext/go.cpp +109 -0
  6. data/ext/sparsehash-1.5.2/AUTHORS +2 -0
  7. data/ext/sparsehash-1.5.2/COPYING +28 -0
  8. data/ext/sparsehash-1.5.2/ChangeLog +167 -0
  9. data/ext/sparsehash-1.5.2/INSTALL +236 -0
  10. data/ext/sparsehash-1.5.2/Makefile.am +157 -0
  11. data/ext/sparsehash-1.5.2/Makefile.in +1019 -0
  12. data/ext/sparsehash-1.5.2/NEWS +0 -0
  13. data/ext/sparsehash-1.5.2/README +149 -0
  14. data/ext/sparsehash-1.5.2/README.windows +25 -0
  15. data/ext/sparsehash-1.5.2/TODO +28 -0
  16. data/ext/sparsehash-1.5.2/aclocal.m4 +868 -0
  17. data/ext/sparsehash-1.5.2/compile +99 -0
  18. data/ext/sparsehash-1.5.2/config.guess +1516 -0
  19. data/ext/sparsehash-1.5.2/config.sub +1626 -0
  20. data/ext/sparsehash-1.5.2/configure +8054 -0
  21. data/ext/sparsehash-1.5.2/configure.ac +74 -0
  22. data/ext/sparsehash-1.5.2/depcomp +530 -0
  23. data/ext/sparsehash-1.5.2/doc/dense_hash_map.html +1591 -0
  24. data/ext/sparsehash-1.5.2/doc/dense_hash_set.html +1445 -0
  25. data/ext/sparsehash-1.5.2/doc/designstyle.css +115 -0
  26. data/ext/sparsehash-1.5.2/doc/implementation.html +365 -0
  27. data/ext/sparsehash-1.5.2/doc/index.html +69 -0
  28. data/ext/sparsehash-1.5.2/doc/performance.html +96 -0
  29. data/ext/sparsehash-1.5.2/doc/sparse_hash_map.html +1527 -0
  30. data/ext/sparsehash-1.5.2/doc/sparse_hash_set.html +1376 -0
  31. data/ext/sparsehash-1.5.2/doc/sparsetable.html +1393 -0
  32. data/ext/sparsehash-1.5.2/experimental/Makefile +9 -0
  33. data/ext/sparsehash-1.5.2/experimental/README +14 -0
  34. data/ext/sparsehash-1.5.2/experimental/example.c +54 -0
  35. data/ext/sparsehash-1.5.2/experimental/libchash.c +1537 -0
  36. data/ext/sparsehash-1.5.2/experimental/libchash.h +252 -0
  37. data/ext/sparsehash-1.5.2/google-sparsehash.sln +47 -0
  38. data/ext/sparsehash-1.5.2/install-sh +323 -0
  39. data/ext/sparsehash-1.5.2/m4/acx_pthread.m4 +363 -0
  40. data/ext/sparsehash-1.5.2/m4/google_namespace.m4 +42 -0
  41. data/ext/sparsehash-1.5.2/m4/namespaces.m4 +15 -0
  42. data/ext/sparsehash-1.5.2/m4/stl_hash.m4 +70 -0
  43. data/ext/sparsehash-1.5.2/m4/stl_hash_fun.m4 +36 -0
  44. data/ext/sparsehash-1.5.2/m4/stl_namespace.m4 +25 -0
  45. data/ext/sparsehash-1.5.2/missing +360 -0
  46. data/ext/sparsehash-1.5.2/mkinstalldirs +158 -0
  47. data/ext/sparsehash-1.5.2/packages/deb.sh +74 -0
  48. data/ext/sparsehash-1.5.2/packages/deb/README +7 -0
  49. data/ext/sparsehash-1.5.2/packages/deb/changelog +107 -0
  50. data/ext/sparsehash-1.5.2/packages/deb/compat +1 -0
  51. data/ext/sparsehash-1.5.2/packages/deb/control +17 -0
  52. data/ext/sparsehash-1.5.2/packages/deb/copyright +35 -0
  53. data/ext/sparsehash-1.5.2/packages/deb/docs +16 -0
  54. data/ext/sparsehash-1.5.2/packages/deb/rules +117 -0
  55. data/ext/sparsehash-1.5.2/packages/deb/sparsehash.dirs +2 -0
  56. data/ext/sparsehash-1.5.2/packages/deb/sparsehash.install +2 -0
  57. data/ext/sparsehash-1.5.2/packages/rpm.sh +86 -0
  58. data/ext/sparsehash-1.5.2/packages/rpm/rpm.spec +61 -0
  59. data/ext/sparsehash-1.5.2/src/config.h.in +131 -0
  60. data/ext/sparsehash-1.5.2/src/config.h.include +23 -0
  61. data/ext/sparsehash-1.5.2/src/google/dense_hash_map +310 -0
  62. data/ext/sparsehash-1.5.2/src/google/dense_hash_set +287 -0
  63. data/ext/sparsehash-1.5.2/src/google/sparse_hash_map +294 -0
  64. data/ext/sparsehash-1.5.2/src/google/sparse_hash_set +275 -0
  65. data/ext/sparsehash-1.5.2/src/google/sparsehash/densehashtable.h +1062 -0
  66. data/ext/sparsehash-1.5.2/src/google/sparsehash/sparsehashtable.h +1015 -0
  67. data/ext/sparsehash-1.5.2/src/google/sparsetable +1468 -0
  68. data/ext/sparsehash-1.5.2/src/google/type_traits.h +250 -0
  69. data/ext/sparsehash-1.5.2/src/hashtable_unittest.cc +1375 -0
  70. data/ext/sparsehash-1.5.2/src/simple_test.cc +103 -0
  71. data/ext/sparsehash-1.5.2/src/sparsetable_unittest.cc +696 -0
  72. data/ext/sparsehash-1.5.2/src/time_hash_map.cc +488 -0
  73. data/ext/sparsehash-1.5.2/src/type_traits_unittest.cc +492 -0
  74. data/ext/sparsehash-1.5.2/src/windows/config.h +149 -0
  75. data/ext/sparsehash-1.5.2/src/windows/google/sparsehash/sparseconfig.h +32 -0
  76. data/ext/sparsehash-1.5.2/src/windows/port.cc +63 -0
  77. data/ext/sparsehash-1.5.2/src/windows/port.h +81 -0
  78. data/ext/sparsehash-1.5.2/src/words +8944 -0
  79. data/ext/sparsehash-1.5.2/vsprojects/hashtable_unittest/hashtable_unittest.vcproj +187 -0
  80. data/ext/sparsehash-1.5.2/vsprojects/sparsetable_unittest/sparsetable_unittest.vcproj +172 -0
  81. data/ext/sparsehash-1.5.2/vsprojects/time_hash_map/time_hash_map.vcproj +187 -0
  82. data/ext/sparsehash-1.5.2/vsprojects/type_traits_unittest/type_traits_unittest.vcproj +169 -0
  83. data/ext/test.rb +10 -0
  84. data/test/spec.go +70 -0
  85. metadata +147 -0
@@ -0,0 +1,363 @@
1
+ # This was retrieved from
2
+ # http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?revision=1277&root=avahi
3
+ # See also (perhaps for new versions?)
4
+ # http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?root=avahi
5
+ #
6
+ # We've rewritten the inconsistency check code (from avahi), to work
7
+ # more broadly. In particular, it no longer assumes ld accepts -zdefs.
8
+ # This caused a restructing of the code, but the functionality has only
9
+ # changed a little.
10
+
11
+ dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
12
+ dnl
13
+ dnl @summary figure out how to build C programs using POSIX threads
14
+ dnl
15
+ dnl This macro figures out how to build C programs using POSIX threads.
16
+ dnl It sets the PTHREAD_LIBS output variable to the threads library and
17
+ dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
18
+ dnl C compiler flags that are needed. (The user can also force certain
19
+ dnl compiler flags/libs to be tested by setting these environment
20
+ dnl variables.)
21
+ dnl
22
+ dnl Also sets PTHREAD_CC to any special C compiler that is needed for
23
+ dnl multi-threaded programs (defaults to the value of CC otherwise).
24
+ dnl (This is necessary on AIX to use the special cc_r compiler alias.)
25
+ dnl
26
+ dnl NOTE: You are assumed to not only compile your program with these
27
+ dnl flags, but also link it with them as well. e.g. you should link
28
+ dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
29
+ dnl $LIBS
30
+ dnl
31
+ dnl If you are only building threads programs, you may wish to use
32
+ dnl these variables in your default LIBS, CFLAGS, and CC:
33
+ dnl
34
+ dnl LIBS="$PTHREAD_LIBS $LIBS"
35
+ dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
36
+ dnl CC="$PTHREAD_CC"
37
+ dnl
38
+ dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
39
+ dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
40
+ dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
41
+ dnl
42
+ dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
43
+ dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
44
+ dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
45
+ dnl default action will define HAVE_PTHREAD.
46
+ dnl
47
+ dnl Please let the authors know if this macro fails on any platform, or
48
+ dnl if you have any other suggestions or comments. This macro was based
49
+ dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
50
+ dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
51
+ dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
52
+ dnl We are also grateful for the helpful feedback of numerous users.
53
+ dnl
54
+ dnl @category InstalledPackages
55
+ dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
56
+ dnl @version 2006-05-29
57
+ dnl @license GPLWithACException
58
+ dnl
59
+ dnl Checks for GCC shared/pthread inconsistency based on work by
60
+ dnl Marcin Owsiany <marcin@owsiany.pl>
61
+
62
+
63
+ AC_DEFUN([ACX_PTHREAD], [
64
+ AC_REQUIRE([AC_CANONICAL_HOST])
65
+ AC_LANG_SAVE
66
+ AC_LANG_C
67
+ acx_pthread_ok=no
68
+
69
+ # We used to check for pthread.h first, but this fails if pthread.h
70
+ # requires special compiler flags (e.g. on True64 or Sequent).
71
+ # It gets checked for in the link test anyway.
72
+
73
+ # First of all, check if the user has set any of the PTHREAD_LIBS,
74
+ # etcetera environment variables, and if threads linking works using
75
+ # them:
76
+ if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
77
+ save_CFLAGS="$CFLAGS"
78
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
79
+ save_LIBS="$LIBS"
80
+ LIBS="$PTHREAD_LIBS $LIBS"
81
+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
82
+ AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
83
+ AC_MSG_RESULT($acx_pthread_ok)
84
+ if test x"$acx_pthread_ok" = xno; then
85
+ PTHREAD_LIBS=""
86
+ PTHREAD_CFLAGS=""
87
+ fi
88
+ LIBS="$save_LIBS"
89
+ CFLAGS="$save_CFLAGS"
90
+ fi
91
+
92
+ # We must check for the threads library under a number of different
93
+ # names; the ordering is very important because some systems
94
+ # (e.g. DEC) have both -lpthread and -lpthreads, where one of the
95
+ # libraries is broken (non-POSIX).
96
+
97
+ # Create a list of thread flags to try. Items starting with a "-" are
98
+ # C compiler flags, and other items are library names, except for "none"
99
+ # which indicates that we try without any flags at all, and "pthread-config"
100
+ # which is a program returning the flags for the Pth emulation library.
101
+
102
+ acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
103
+
104
+ # The ordering *is* (sometimes) important. Some notes on the
105
+ # individual items follow:
106
+
107
+ # pthreads: AIX (must check this before -lpthread)
108
+ # none: in case threads are in libc; should be tried before -Kthread and
109
+ # other compiler flags to prevent continual compiler warnings
110
+ # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
111
+ # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
112
+ # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
113
+ # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
114
+ # -pthreads: Solaris/gcc
115
+ # -mthreads: Mingw32/gcc, Lynx/gcc
116
+ # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
117
+ # doesn't hurt to check since this sometimes defines pthreads too;
118
+ # also defines -D_REENTRANT)
119
+ # ... -mt is also the pthreads flag for HP/aCC
120
+ # pthread: Linux, etcetera
121
+ # --thread-safe: KAI C++
122
+ # pthread-config: use pthread-config program (for GNU Pth library)
123
+
124
+ case "${host_cpu}-${host_os}" in
125
+ *solaris*)
126
+
127
+ # On Solaris (at least, for some versions), libc contains stubbed
128
+ # (non-functional) versions of the pthreads routines, so link-based
129
+ # tests will erroneously succeed. (We need to link with -pthreads/-mt/
130
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
131
+ # a function called by this macro, so we could check for that, but
132
+ # who knows whether they'll stub that too in a future libc.) So,
133
+ # we'll just look for -pthreads and -lpthread first:
134
+
135
+ acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
136
+ ;;
137
+ esac
138
+
139
+ if test x"$acx_pthread_ok" = xno; then
140
+ for flag in $acx_pthread_flags; do
141
+
142
+ case $flag in
143
+ none)
144
+ AC_MSG_CHECKING([whether pthreads work without any flags])
145
+ ;;
146
+
147
+ -*)
148
+ AC_MSG_CHECKING([whether pthreads work with $flag])
149
+ PTHREAD_CFLAGS="$flag"
150
+ ;;
151
+
152
+ pthread-config)
153
+ AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
154
+ if test x"$acx_pthread_config" = xno; then continue; fi
155
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
156
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
157
+ ;;
158
+
159
+ *)
160
+ AC_MSG_CHECKING([for the pthreads library -l$flag])
161
+ PTHREAD_LIBS="-l$flag"
162
+ ;;
163
+ esac
164
+
165
+ save_LIBS="$LIBS"
166
+ save_CFLAGS="$CFLAGS"
167
+ LIBS="$PTHREAD_LIBS $LIBS"
168
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
169
+
170
+ # Check for various functions. We must include pthread.h,
171
+ # since some functions may be macros. (On the Sequent, we
172
+ # need a special flag -Kthread to make this header compile.)
173
+ # We check for pthread_join because it is in -lpthread on IRIX
174
+ # while pthread_create is in libc. We check for pthread_attr_init
175
+ # due to DEC craziness with -lpthreads. We check for
176
+ # pthread_cleanup_push because it is one of the few pthread
177
+ # functions on Solaris that doesn't have a non-functional libc stub.
178
+ # We try pthread_create on general principles.
179
+ AC_TRY_LINK([#include <pthread.h>],
180
+ [pthread_t th; pthread_join(th, 0);
181
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
182
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
183
+ [acx_pthread_ok=yes])
184
+
185
+ LIBS="$save_LIBS"
186
+ CFLAGS="$save_CFLAGS"
187
+
188
+ AC_MSG_RESULT($acx_pthread_ok)
189
+ if test "x$acx_pthread_ok" = xyes; then
190
+ break;
191
+ fi
192
+
193
+ PTHREAD_LIBS=""
194
+ PTHREAD_CFLAGS=""
195
+ done
196
+ fi
197
+
198
+ # Various other checks:
199
+ if test "x$acx_pthread_ok" = xyes; then
200
+ save_LIBS="$LIBS"
201
+ LIBS="$PTHREAD_LIBS $LIBS"
202
+ save_CFLAGS="$CFLAGS"
203
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
204
+
205
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
206
+ AC_MSG_CHECKING([for joinable pthread attribute])
207
+ attr_name=unknown
208
+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
209
+ AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
210
+ [attr_name=$attr; break])
211
+ done
212
+ AC_MSG_RESULT($attr_name)
213
+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
214
+ AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
215
+ [Define to necessary symbol if this constant
216
+ uses a non-standard name on your system.])
217
+ fi
218
+
219
+ AC_MSG_CHECKING([if more special flags are required for pthreads])
220
+ flag=no
221
+ case "${host_cpu}-${host_os}" in
222
+ *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
223
+ *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
224
+ esac
225
+ AC_MSG_RESULT(${flag})
226
+ if test "x$flag" != xno; then
227
+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
228
+ fi
229
+
230
+ LIBS="$save_LIBS"
231
+ CFLAGS="$save_CFLAGS"
232
+ # More AIX lossage: must compile with xlc_r or cc_r
233
+ if test x"$GCC" != xyes; then
234
+ AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
235
+ else
236
+ PTHREAD_CC=$CC
237
+ fi
238
+
239
+ # The next part tries to detect GCC inconsistency with -shared on some
240
+ # architectures and systems. The problem is that in certain
241
+ # configurations, when -shared is specified, GCC "forgets" to
242
+ # internally use various flags which are still necessary.
243
+
244
+ #
245
+ # Prepare the flags
246
+ #
247
+ save_CFLAGS="$CFLAGS"
248
+ save_LIBS="$LIBS"
249
+ save_CC="$CC"
250
+
251
+ # Try with the flags determined by the earlier checks.
252
+ #
253
+ # -Wl,-z,defs forces link-time symbol resolution, so that the
254
+ # linking checks with -shared actually have any value
255
+ #
256
+ # FIXME: -fPIC is required for -shared on many architectures,
257
+ # so we specify it here, but the right way would probably be to
258
+ # properly detect whether it is actually required.
259
+ CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS"
260
+ LIBS="$PTHREAD_LIBS $LIBS"
261
+ CC="$PTHREAD_CC"
262
+
263
+ # In order not to create several levels of indentation, we test
264
+ # the value of "$done" until we find the cure or run out of ideas.
265
+ done="no"
266
+
267
+ # First, make sure the CFLAGS we added are actually accepted by our
268
+ # compiler. If not (and OS X's ld, for instance, does not accept -z),
269
+ # then we can't do this test.
270
+ if test x"$done" = xno; then
271
+ AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])
272
+ AC_TRY_LINK(,, , [done=yes])
273
+
274
+ if test "x$done" = xyes ; then
275
+ AC_MSG_RESULT([no])
276
+ else
277
+ AC_MSG_RESULT([yes])
278
+ fi
279
+ fi
280
+
281
+ if test x"$done" = xno; then
282
+ AC_MSG_CHECKING([whether -pthread is sufficient with -shared])
283
+ AC_TRY_LINK([#include <pthread.h>],
284
+ [pthread_t th; pthread_join(th, 0);
285
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
286
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
287
+ [done=yes])
288
+
289
+ if test "x$done" = xyes; then
290
+ AC_MSG_RESULT([yes])
291
+ else
292
+ AC_MSG_RESULT([no])
293
+ fi
294
+ fi
295
+
296
+ #
297
+ # Linux gcc on some architectures such as mips/mipsel forgets
298
+ # about -lpthread
299
+ #
300
+ if test x"$done" = xno; then
301
+ AC_MSG_CHECKING([whether -lpthread fixes that])
302
+ LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
303
+ AC_TRY_LINK([#include <pthread.h>],
304
+ [pthread_t th; pthread_join(th, 0);
305
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
306
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
307
+ [done=yes])
308
+
309
+ if test "x$done" = xyes; then
310
+ AC_MSG_RESULT([yes])
311
+ PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
312
+ else
313
+ AC_MSG_RESULT([no])
314
+ fi
315
+ fi
316
+ #
317
+ # FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc
318
+ #
319
+ if test x"$done" = xno; then
320
+ AC_MSG_CHECKING([whether -lc_r fixes that])
321
+ LIBS="-lc_r $PTHREAD_LIBS $save_LIBS"
322
+ AC_TRY_LINK([#include <pthread.h>],
323
+ [pthread_t th; pthread_join(th, 0);
324
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
325
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
326
+ [done=yes])
327
+
328
+ if test "x$done" = xyes; then
329
+ AC_MSG_RESULT([yes])
330
+ PTHREAD_LIBS="-lc_r $PTHREAD_LIBS"
331
+ else
332
+ AC_MSG_RESULT([no])
333
+ fi
334
+ fi
335
+ if test x"$done" = xno; then
336
+ # OK, we have run out of ideas
337
+ AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries])
338
+
339
+ # so it's not safe to assume that we may use pthreads
340
+ acx_pthread_ok=no
341
+ fi
342
+
343
+ CFLAGS="$save_CFLAGS"
344
+ LIBS="$save_LIBS"
345
+ CC="$save_CC"
346
+ else
347
+ PTHREAD_CC="$CC"
348
+ fi
349
+
350
+ AC_SUBST(PTHREAD_LIBS)
351
+ AC_SUBST(PTHREAD_CFLAGS)
352
+ AC_SUBST(PTHREAD_CC)
353
+
354
+ # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
355
+ if test x"$acx_pthread_ok" = xyes; then
356
+ ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
357
+ :
358
+ else
359
+ acx_pthread_ok=no
360
+ $2
361
+ fi
362
+ AC_LANG_RESTORE
363
+ ])dnl ACX_PTHREAD
@@ -0,0 +1,42 @@
1
+ # Allow users to override the namespace we define our application's classes in
2
+ # Arg $1 is the default namespace to use if --enable-namespace isn't present.
3
+
4
+ # In general, $1 should be 'google', so we put all our exported symbols in a
5
+ # unique namespace that is not likely to conflict with anyone else. However,
6
+ # when it makes sense -- for instance, when publishing stl-like code -- you
7
+ # may want to go with a different default, like 'std'.
8
+
9
+ # We guarantee the invariant that GOOGLE_NAMESPACE starts with ::,
10
+ # unless it's the empty string. Thus, it's always safe to do
11
+ # GOOGLE_NAMESPACE::foo and be sure you're getting the foo that's
12
+ # actually in the google namespace, and not some other namespace that
13
+ # the namespace rules might kick in.
14
+
15
+ AC_DEFUN([AC_DEFINE_GOOGLE_NAMESPACE],
16
+ [google_namespace_default=[$1]
17
+ AC_ARG_ENABLE(namespace, [ --enable-namespace=FOO to define these Google
18
+ classes in the FOO namespace. --disable-namespace
19
+ to define them in the global namespace. Default
20
+ is to define them in namespace $1.],
21
+ [case "$enableval" in
22
+ yes) google_namespace="$google_namespace_default" ;;
23
+ no) google_namespace="" ;;
24
+ *) google_namespace="$enableval" ;;
25
+ esac],
26
+ [google_namespace="$google_namespace_default"])
27
+ if test -n "$google_namespace"; then
28
+ ac_google_namespace="::$google_namespace"
29
+ ac_google_start_namespace="namespace $google_namespace {"
30
+ ac_google_end_namespace="}"
31
+ else
32
+ ac_google_namespace=""
33
+ ac_google_start_namespace=""
34
+ ac_google_end_namespace=""
35
+ fi
36
+ AC_DEFINE_UNQUOTED(GOOGLE_NAMESPACE, $ac_google_namespace,
37
+ Namespace for Google classes)
38
+ AC_DEFINE_UNQUOTED(_START_GOOGLE_NAMESPACE_, $ac_google_start_namespace,
39
+ Puts following code inside the Google namespace)
40
+ AC_DEFINE_UNQUOTED(_END_GOOGLE_NAMESPACE_, $ac_google_end_namespace,
41
+ Stops putting the code inside the Google namespace)
42
+ ])
@@ -0,0 +1,15 @@
1
+ # Checks whether the compiler implements namespaces
2
+ AC_DEFUN([AC_CXX_NAMESPACES],
3
+ [AC_CACHE_CHECK(whether the compiler implements namespaces,
4
+ ac_cv_cxx_namespaces,
5
+ [AC_LANG_SAVE
6
+ AC_LANG_CPLUSPLUS
7
+ AC_TRY_COMPILE([namespace Outer {
8
+ namespace Inner { int i = 0; }}],
9
+ [using namespace Outer::Inner; return i;],
10
+ ac_cv_cxx_namespaces=yes,
11
+ ac_cv_cxx_namespaces=no)
12
+ AC_LANG_RESTORE])
13
+ if test "$ac_cv_cxx_namespaces" = yes; then
14
+ AC_DEFINE(HAVE_NAMESPACES, 1, [define if the compiler implements namespaces])
15
+ fi])
@@ -0,0 +1,70 @@
1
+ # We check two things: where the include file is for
2
+ # unordered_map/hash_map (we prefer the first form), and what
3
+ # namespace unordered/hash_map lives in within that include file. We
4
+ # include AC_TRY_COMPILE for all the combinations we've seen in the
5
+ # wild. We define HASH_MAP_H to the location of the header file, and
6
+ # HASH_NAMESPACE to the namespace the class (unordered_map or
7
+ # hash_map) is in. We define HAVE_UNORDERED_MAP if the class we found
8
+ # is named unordered_map, or leave it undefined if not.
9
+
10
+ # This also checks if unordered map exists.
11
+ AC_DEFUN([AC_CXX_STL_HASH],
12
+ [AC_REQUIRE([AC_CXX_NAMESPACES])
13
+ AC_MSG_CHECKING(the location of hash_map)
14
+ AC_LANG_SAVE
15
+ AC_LANG_CPLUSPLUS
16
+ ac_cv_cxx_hash_map=""
17
+ # First try unordered_map, but not on gcc's before 4.2 -- I've
18
+ # seen unexplainable unordered_map bugs with -O2 on older gcc's.
19
+ AC_TRY_COMPILE([#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))
20
+ # error GCC too old for unordered_map
21
+ #endif
22
+ ],
23
+ [/* no program body necessary */],
24
+ [stl_hash_old_gcc=no],
25
+ [stl_hash_old_gcc=yes])
26
+ for location in unordered_map tr1/unordered_map; do
27
+ for namespace in std std::tr1; do
28
+ if test -z "$ac_cv_cxx_hash_map" -a "$stl_hash_old_gcc" != yes; then
29
+ # Some older gcc's have a buggy tr1, so test a bit of code.
30
+ AC_TRY_COMPILE([#include <$location>],
31
+ [const ${namespace}::unordered_map<int, int> t;
32
+ return t.find(5) == t.end();],
33
+ [ac_cv_cxx_hash_map="<$location>";
34
+ ac_cv_cxx_hash_namespace="$namespace";
35
+ ac_cv_cxx_have_unordered_map="yes";])
36
+ fi
37
+ done
38
+ done
39
+ # Now try hash_map
40
+ for location in ext/hash_map hash_map; do
41
+ for namespace in __gnu_cxx "" std stdext; do
42
+ if test -z "$ac_cv_cxx_hash_map"; then
43
+ AC_TRY_COMPILE([#include <$location>],
44
+ [${namespace}::hash_map<int, int> t],
45
+ [ac_cv_cxx_hash_map="<$location>";
46
+ ac_cv_cxx_hash_namespace="$namespace";
47
+ ac_cv_cxx_have_unordered_map="no";])
48
+ fi
49
+ done
50
+ done
51
+ ac_cv_cxx_hash_set=`echo "$ac_cv_cxx_hash_map" | sed s/map/set/`;
52
+ if test -n "$ac_cv_cxx_hash_map"; then
53
+ AC_DEFINE(HAVE_HASH_MAP, 1, [define if the compiler has hash_map])
54
+ AC_DEFINE(HAVE_HASH_SET, 1, [define if the compiler has hash_set])
55
+ AC_DEFINE_UNQUOTED(HASH_MAP_H,$ac_cv_cxx_hash_map,
56
+ [the location of <unordered_map> or <hash_map>])
57
+ AC_DEFINE_UNQUOTED(HASH_SET_H,$ac_cv_cxx_hash_set,
58
+ [the location of <unordered_set> or <hash_set>])
59
+ AC_DEFINE_UNQUOTED(HASH_NAMESPACE,$ac_cv_cxx_hash_namespace,
60
+ [the namespace of hash_map/hash_set])
61
+ if test "$ac_cv_cxx_have_unordered_map" = yes; then
62
+ AC_DEFINE(HAVE_UNORDERED_MAP,1,
63
+ [define if the compiler supports unordered_{map,set}])
64
+ fi
65
+ AC_MSG_RESULT([$ac_cv_cxx_hash_map])
66
+ else
67
+ AC_MSG_RESULT()
68
+ AC_MSG_WARN([could not find an STL hash_map])
69
+ fi
70
+ ])