openal.m4 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Configure headers/flags for OpenAL
  2. # Unavowed <unavowed@vexillium.org>
  3. dnl AM_PATH_OPENAL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  4. dnl
  5. dnl AC_DEFINE OPENAL_AL_H/OPENAL_ALC_H to the equivalent of
  6. dnl <AL/al.h>/<AL/alc.h> so you can do #include OPENAL_AL_H. Define
  7. dnl OPENAL_CFLAGS and OPENAL_LIBS.
  8. AC_DEFUN([AM_PATH_OPENAL], [
  9. OPENAL_CFLAGS=
  10. OPENAL_LIBS=
  11. # First check for headers
  12. for header in "AL/al.h" "OpenAL/al.h"; do
  13. AC_CHECK_HEADER([$header], [
  14. ac_cv_openal_al_h="$header"
  15. break
  16. ])
  17. done
  18. AS_IF([test -n "$ac_cv_openal_al_h"], [
  19. ac_cv_openal_alc_h=$(echo "$ac_cv_openal_al_h" | sed 's/al\.h$/alc.h/')
  20. AC_DEFINE_UNQUOTED([OPENAL_AL_H], [<$ac_cv_openal_al_h>],
  21. [Define to the equivalent of <AL/al.h> on your system])
  22. AC_DEFINE_UNQUOTED([OPENAL_ALC_H], [<$ac_cv_openal_alc_h>],
  23. [Define to the equivalent of <AL/alc.h> on your system])
  24. ])
  25. # Then check for libs
  26. ac_cv_openal_al_libs=
  27. AS_IF([test -n "$ac_cv_openal_al_h" && test -n "$ac_cv_openal_alc_h"], [
  28. OLD_LIBS="$LIBS"
  29. for lib in "-framework OpenAL" "-lopenal" "-lopenal32"; do
  30. LIBS="$OLD_LIBS $lib"
  31. AC_MSG_CHECKING([for alGenSources in $lib])
  32. AC_TRY_LINK([#include OPENAL_AL_H], [alGenSources (1, 0);], [
  33. ac_cv_openal_al_libs="$lib"
  34. AC_MSG_RESULT([yes])
  35. break
  36. ], [
  37. AC_MSG_RESULT([no])
  38. ])
  39. done
  40. LIBS="$OLD_LIBS"
  41. OPENAL_LIBS="$ac_cv_openal_al_libs"
  42. ])
  43. AC_SUBST([OPENAL_CFLAGS])
  44. AC_SUBST([OPENAL_LIBS])
  45. AS_IF([test -z "$OPENAL_CFLAGS" && test -z "$OPENAL_LIBS"], [$2], [$1])
  46. ])