$OpenBSD: patch-aclocal_m4,v 1.3 2017/09/28 22:06:15 naddy Exp $
Index: aclocal.m4
--- aclocal.m4.orig
+++ aclocal.m4
@@ -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:
@@ -730,7 +751,7 @@ AC_DEFUN(ALLEGRO_ACTEST_MAP_FAILED,
 AC_CACHE_VAL(allegro_cv_have_map_failed,
 [AC_TRY_COMPILE([#include <unistd.h>
 #include <sys/mman.h>],
-[int test_mmap_failed (void *addr) { return (addr == MAP_FAILED); }],
+[void *addr; return (addr == MAP_FAILED);],
 allegro_cv_have_map_failed=yes,
 allegro_cv_have_map_failed=no)])
 AC_MSG_RESULT($allegro_cv_have_map_failed)])
@@ -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).
@@ -879,7 +912,7 @@ allegro_save_CFLAGS="$CFLAGS"
 CFLAGS="-mtune=i386"
 AC_CACHE_VAL(allegro_cv_support_i386_mtune,
 [if test "$GCC" = yes; then
-   AC_TRY_COMPILE(,int foo(){return 0;}, allegro_cv_support_i386_mtune=yes, allegro_cv_support_i386_mtune=no)
+   AC_TRY_COMPILE(,, allegro_cv_support_i386_mtune=yes, allegro_cv_support_i386_mtune=no)
 else
    allegro_cv_support_i386_mtune=no
 fi
@@ -899,7 +932,7 @@ allegro_save_CFLAGS="$CFLAGS"
 CFLAGS="-mtune=k8"
 AC_CACHE_VAL(allegro_cv_support_amd64_mtune,
 [if test "$GCC" = yes; then
-   AC_TRY_COMPILE(,int foo(){return 0;}, allegro_cv_support_amd64_mtune=yes, allegro_cv_support_amd64_mtune=no)
+   AC_TRY_COMPILE(,, allegro_cv_support_amd64_mtune=yes, allegro_cv_support_amd64_mtune=no)
 else
    allegro_cv_support_amd64_mtune=no
 fi
