[xiph-cvs] cvs commit: vorbis-tools acinclude.m4 configure.in
Kenneth C. Arnold
kcarnold at xiph.org
Tue Jun 19 09:34:05 PDT 2001
kcarnold 01/06/19 09:34:05
Modified: . acinclude.m4 configure.in
Log:
Hmmm... somehow these didn't get in the last commit.
Revision Changes Path
1.9 +62 -0 vorbis-tools/acinclude.m4
Index: acinclude.m4
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/acinclude.m4,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- acinclude.m4 2001/03/26 22:35:47 1.8
+++ acinclude.m4 2001/06/19 16:34:05 1.9
@@ -300,3 +300,65 @@
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])
1.21 +1 -1 vorbis-tools/configure.in
Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/configure.in,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- configure.in 2001/06/18 02:24:25 1.20
+++ configure.in 2001/06/19 16:34:05 1.21
@@ -67,7 +67,7 @@
dnl Check for library functions
dnl --------------------------------------------------
-dnl none
+AC_FUNC_SMMAP
dnl --------------------------------------------------
dnl Work around FHS stupidity
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list