378732a
--- allegro-4.2.0/tools/grabber.c.mprotect	2005-09-04 18:00:18.000000000 +0200
378732a
+++ allegro-4.2.0/tools/grabber.c	2006-03-08 23:13:39.000000000 +0100
378732a
@@ -3121,6 +3121,7 @@
378732a
       case OSTYPE_SUNOS:      s = "SunOS/Solaris";              break;
378732a
       case OSTYPE_FREEBSD:    s = "FreeBSD";                    break;
378732a
       case OSTYPE_NETBSD:     s = "NetBSD";                     break;
378732a
+      case OSTYPE_OPENBSD:    s = "OpenBSD";                    break;
378732a
       case OSTYPE_IRIX:       s = "IRIX";                       break;
378732a
       case OSTYPE_DARWIN:     s = "Darwin";                     break;
378732a
       case OSTYPE_QNX:        s = "QNX";                        break;
378732a
--- allegro-4.2.0/include/allegro/platform/alunixac.hin.mprotect	2005-10-30 21:23:33.000000000 +0100
378732a
+++ allegro-4.2.0/include/allegro/platform/alunixac.hin	2006-03-08 23:13:39.000000000 +0100
378732a
@@ -169,6 +169,9 @@
378732a
 /* Define to 1 if you have the `mmap' function. */
378732a
 #undef HAVE_MMAP
378732a
 
378732a
+/* Define to 1 if you have the `mprotect' function. */
378732a
+#undef HAVE_MPROTECT
378732a
+
378732a
 /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
378732a
 #undef HAVE_NDIR_H
378732a
 
378732a
--- allegro-4.2.0/include/allegro/system.h.mprotect	2005-03-15 21:32:43.000000000 +0100
378732a
+++ allegro-4.2.0/include/allegro/system.h	2006-03-08 23:13:39.000000000 +0100
378732a
@@ -53,6 +53,7 @@
378732a
 #define OSTYPE_SUNOS       AL_ID('S','U','N',' ')
378732a
 #define OSTYPE_FREEBSD     AL_ID('F','B','S','D')
378732a
 #define OSTYPE_NETBSD      AL_ID('N','B','S','D')
378732a
+#define OSTYPE_OPENBSD     AL_ID('O','B','S','D')
378732a
 #define OSTYPE_IRIX        AL_ID('I','R','I','X')
378732a
 #define OSTYPE_DARWIN      AL_ID('D','A','R','W')
378732a
 #define OSTYPE_QNX         AL_ID('Q','N','X',' ')
378732a
--- allegro-4.2.0/configure.mprotect	2005-11-06 10:54:00.000000000 +0100
378732a
+++ allegro-4.2.0/configure	2006-03-08 23:13:39.000000000 +0100
378732a
@@ -11225,7 +11225,7 @@
378732a
 
378732a
 
378732a
 
378732a
-for ac_func in mmap memcmp mkstemp stricmp strlwr strupr vprintf
378732a
+for ac_func in mmap mprotect memcmp mkstemp stricmp strlwr strupr vprintf
378732a
 do
378732a
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
378732a
 echo "$as_me:$LINENO: checking for $ac_func" >&5
378732a
--- allegro-4.2.0/configure.in.mprotect	2005-08-07 23:50:49.000000000 +0200
378732a
+++ allegro-4.2.0/configure.in	2006-03-08 23:13:39.000000000 +0100
378732a
@@ -713,7 +713,7 @@
378732a
 AC_STRUCT_TM
378732a
 AC_TYPE_SIGNAL
378732a
 
378732a
-AC_CHECK_FUNCS(mmap memcmp mkstemp stricmp strlwr strupr vprintf)
378732a
+AC_CHECK_FUNCS(mmap mprotect memcmp mkstemp stricmp strlwr strupr vprintf)
378732a
 
378732a
 dnl Tweak header files for library build
378732a
 CFLAGS="$CFLAGS -DALLEGRO_LIB_BUILD"
378732a
--- allegro-4.2.0/src/unix/usystem.c.mprotect	2005-09-04 18:00:17.000000000 +0200
378732a
+++ allegro-4.2.0/src/unix/usystem.c	2006-03-08 23:13:39.000000000 +0100
378732a
@@ -196,6 +196,9 @@
378732a
       else if (!strcmp(utsn.sysname, "NetBSD")) {
378732a
 	 os_type = OSTYPE_NETBSD;
378732a
       }
378732a
+      else if (!strcmp(utsn.sysname, "OpenBSD")) {
378732a
+	 os_type = OSTYPE_OPENBSD;
378732a
+      }
378732a
       else if ((!strcmp(utsn.sysname, "IRIX"))
378732a
 	       || (!strcmp(utsn.sysname, "IRIX64"))) {
378732a
 	 os_type = OSTYPE_IRIX;
378732a
--- allegro-4.2.0/src/unix/uesd.c.mprotect	2005-03-12 08:54:27.000000000 +0100
378732a
+++ allegro-4.2.0/src/unix/uesd.c	2006-03-08 23:13:39.000000000 +0100
378732a
@@ -27,6 +27,7 @@
378732a
 
378732a
 #include <sys/time.h>
378732a
 #include <sys/types.h>
378732a
+#include <string.h> /* FD_ZERO() needs this */
378732a
 #include <unistd.h>
378732a
 #include <esd.h>
378732a
 
378732a
--- allegro-4.2.0/src/i386/istretch.c.mprotect	2005-03-15 19:02:22.000000000 +0100
378732a
+++ allegro-4.2.0/src/i386/istretch.c	2006-03-08 23:14:52.000000000 +0100
378732a
@@ -30,6 +30,10 @@
378732a
    #include "winalleg.h"   /* For VirtualProtect */
378732a
 #endif     /* ifdef ALLEGRO_WINDOWS */
378732a
 
378732a
+#ifdef HAVE_MPROTECT
378732a
+   #include <sys/types.h>
378732a
+   #include <sys/mman.h>
378732a
+#endif
378732a
 
378732a
 
378732a
 /* helper macro for generating stretchers in each color depth */
378732a
@@ -435,7 +439,9 @@
378732a
  #ifdef ALLEGRO_WINDOWS
378732a
    /* Play nice with Windows executable memory protection */
378732a
    VirtualProtect(_scratch_mem, _scratch_mem_size, PAGE_EXECUTE_READWRITE, &old_protect);
378732a
- #endif     /* ifdef ALLEGRO_WINDOWS */
378732a
+ #elif defined(HAVE_MPROTECT)
378732a
+   mprotect(_scratch_mem, _scratch_mem_size, PROT_EXEC|PROT_READ|PROT_WRITE);
378732a
+ #endif
378732a
 
378732a
    /* call the stretcher */
378732a
    _do_stretch(source, dest, _scratch_mem, sx>>16, sy, syd,