1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
--- aclocal.m4.orig Mon Feb 26 06:51:03 2001
+++ aclocal.m4 Sat Mar 17 17:06:03 2001
@@ -222,7 +222,7 @@ AC_ARG_ENABLE(aotest, [ --disable-aotes
AO_LIBS="-L$ao_prefix/lib"
fi
- AO_LIBS="$AO_LIBS -lao -ldl"
+ AO_LIBS="$AO_LIBS -lao"
AC_MSG_CHECKING(for ao)
no_ao=""
@@ -292,6 +292,68 @@ int main ()
AC_SUBST(AO_LIBS)
rm -f conf.aotest
])
+
+dnl Shamelessly stolen from Joerg Schilling's star.
+dnl Copyright 1998 J. Schilling
+
+dnl Checks if mmap() works to get shared memory
+dnl Defines HAVE_SMMAP on success.
+AC_DEFUN(AC_FUNC_SMMAP,
+[AC_CACHE_CHECK([if mmap works to get shared memory], ac_cv_func_smmap,
+ [AC_TRY_RUN([
+#include <sys/types.h>
+#include <sys/mman.h>
+
+char *
+mkshare()
+{
+ int size = 8192;
+ int f;
+ char *addr;
+
+ if ((f = open("/dev/zero", 2)) < 0)
+ exit(1);
+ addr = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, f, 0);
+ if (addr == (char *)-1)
+ exit(1);
+ close(f);
+
+ return (addr);
+}
+
+main()
+{
+ char *addr;
+
+ addr = mkshare(8192);
+ *addr = 'I';
+
+ switch (fork()) {
+
+ case -1:
+ printf("help\n"); exit(1);
+
+ case 0: /* child */
+ *addr = 'N';
+ _exit(0);
+ break;
+ default: /* parent */
+ wait(0);
+ sleep(1);
+ break;
+ }
+
+ if (*addr != 'N')
+ exit(1);
+ exit(0);
+}
+],
+ [ac_cv_func_smmap=yes],
+ [ac_cv_func_smmap=no],
+ [ac_cv_func_smmap=no])])
+if test $ac_cv_func_smmap = yes; then
+ AC_DEFINE(HAVE_SMMAP)
+fi])
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
|