$OpenBSD: patch-aclocal_m4,v 1.2 2010/04/26 02:56:30 jakemsr Exp $
--- aclocal.m4.orig	Sun Sep 27 21:57:48 2009
+++ aclocal.m4	Wed Jan 13 01:27:22 2010
@@ -438,19 +438,19 @@ allegro_enable_ossdigi=yes)
 
 if test -n "$allegro_enable_ossdigi"; then
   AC_CHECK_HEADER(soundcard.h, [
-    AC_DEFINE(ALLEGRO_HAVE_SOUNDCARD_H, 1)
+    AC_DEFINE(ALLEGRO_HAVE_SOUNDCARD_H, 1, [soundcard.h])
     allegro_support_ossdigi=yes
   ])
   AC_CHECK_HEADER(sys/soundcard.h, [
-    AC_DEFINE(ALLEGRO_HAVE_SYS_SOUNDCARD_H, 1)
+    AC_DEFINE(ALLEGRO_HAVE_SYS_SOUNDCARD_H, 1, [sys/soundcard.h])
     allegro_support_ossdigi=yes
   ])
   AC_CHECK_HEADER(machine/soundcard.h, [
-    AC_DEFINE(ALLEGRO_HAVE_MACHINE_SOUNDCARD_H, 1)
+    AC_DEFINE(ALLEGRO_HAVE_MACHINE_SOUNDCARD_H, 1, [machine/soundcard.h])
     allegro_support_ossdigi=yes
   ])
   AC_CHECK_HEADER(linux/soundcard.h, [
-    AC_DEFINE(ALLEGRO_HAVE_LINUX_SOUNDCARD_H, 1)
+    AC_DEFINE(ALLEGRO_HAVE_LINUX_SOUNDCARD_H, 1, [linux/soundcard.h])
     allegro_support_ossdigi=yes
   ])
 
@@ -473,15 +473,15 @@ allegro_enable_ossmidi=yes)
 
 if test -n "$allegro_enable_ossmidi"; then
   AC_CHECK_HEADER(soundcard.h,
-    AC_DEFINE(ALLEGRO_HAVE_SOUNDCARD_H, 1))
+    AC_DEFINE(ALLEGRO_HAVE_SOUNDCARD_H, 1, [soundcard.h]))
   AC_CHECK_HEADER(sys/soundcard.h,
-    AC_DEFINE(ALLEGRO_HAVE_SYS_SOUNDCARD_H, 1))
+    AC_DEFINE(ALLEGRO_HAVE_SYS_SOUNDCARD_H, 1, [sys/soundcard.h]))
   AC_CHECK_HEADER(machine/soundcard.h,
-    AC_DEFINE(ALLEGRO_HAVE_MACHINE_SOUNDCARD_H, 1))
+    AC_DEFINE(ALLEGRO_HAVE_MACHINE_SOUNDCARD_H, 1, [machine/soundcard.h]))
   AC_CHECK_HEADER(linux/soundcard.h,
-    AC_DEFINE(ALLEGRO_HAVE_LINUX_SOUNDCARD_H, 1))
+    AC_DEFINE(ALLEGRO_HAVE_LINUX_SOUNDCARD_H, 1, [linux/soundcard.h]))
   AC_CHECK_HEADER(linux/awe_voice.h,
-    AC_DEFINE(ALLEGRO_HAVE_LINUX_AWE_VOICE_H, 1))
+    AC_DEFINE(ALLEGRO_HAVE_LINUX_AWE_VOICE_H, 1, [linux/awe_voice.h]))
 
   dnl Link with libossaudio if necessary, used by some BSD systems.
   AC_CHECK_LIB(ossaudio, _oss_ioctl)
@@ -683,6 +683,27 @@ if test -n "$allegro_enable_sgialdigi"; then
 fi])
 
 dnl
+dnl Test for sndio driver.
+dnl
+dnl Variables:
+dnl  allegro_enable_sndiodigi=(yes|)
+dnl  allegro_cv_support_sndiodigi=(yes|)
+dnl
+AC_DEFUN(ALLEGRO_ACTEST_SNDIODIGI,
+[AC_ARG_ENABLE(sndiodigi,
+[  --enable-sndiodigi[=x]  enable building sndio driver [default=yes]],
+test "X$enableval" != "Xno" && allegro_enable_sndiodigi=yes,
+allegro_enable_sndiodigi=yes)
+ 
+if test "X$allegro_enable_sndiodigi" = "Xyes"; then
+  AC_CHECK_LIB(sndio, sio_open,
+  allegro_cv_support_sndiodigi=yes)
+  if test "X$allegro_cv_support_sndiodigi" = "Xyes" ; then
+    LIBS="-lsndio $LIBS"
+  fi
+fi])
+
+dnl
 dnl Test for JACK driver.
 dnl
 dnl Variables:
@@ -744,10 +765,22 @@ dnl
 dnl LIBS can be modified.
 dnl
 AC_DEFUN(ALLEGRO_ACTEST_PTHREADS,
-[AC_CHECK_HEADER(pthread.h,
-AC_CHECK_LIB(pthread, pthread_create,
-LIBS="-lpthread $LIBS"
-allegro_cv_support_pthreads=yes))])
+[AC_CHECK_HEADER(pthread.h, have_pthread_h=yes)
+if test "X$have_pthread_h" = "Xyes" ; then
+    save_LDFLAGS="$LDFLAGS";
+    LDFLAGS="$LDFLAGS -pthread"
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+        [[#include <pthread.h>
+        pthread_t thr;]],
+        [pthread_create(&thr, NULL, NULL, NULL);])],
+      [allegro_cv_support_pthreads=yes],
+      [LDFLAGS="$save_LDFLAGS"])
+    if test "X$allegro_cv_support_pthreads" != "Xyes" ; then
+      AC_CHECK_LIB(pthread, pthread_create,
+        LIBS="-lpthread $LIBS" allegro_cv_support_pthreads=yes)
+    fi
+fi])
 
 dnl
 dnl Test for sched_yield (SunOS).
