-case "$with_sound" in both | nas )
- AC_DEFINE(HAVE_NAS_SOUND)
- XE_ADD_OBJS(nas.o)
- XE_PREPEND(-laudio, libs_x)
- dnl If the nas library does not contain the error jump point,
- dnl then we force safer behavior.
- AC_EGREP_HEADER(AuXtErrorJump,audio/Xtutil.h,,[AC_DEFINE(NAS_NO_ERROR_JUMP)])
-esac
+dnl NAS Sound support
+if test "$with_nas_sound" != "no"; then
+ AC_CHECK_HEADER(audio/audiolib.h, [
+ AC_CHECK_LIB(audio, AuOpenServer, have_nas_sound=yes)])
+ if test "$have_nas_sound" = "yes"; then
+ with_nas_sound=yes
+ AC_DEFINE(HAVE_NAS_SOUND)
+ XE_ADD_OBJS(nas.o)
+ XE_PREPEND(-laudio, libs_x)
+ dnl If the nas library does not contain the error jump point,
+ dnl then we force safer behavior.
+ AC_EGREP_HEADER(AuXtErrorJump,audio/Xtutil.h,,[old_nas=yes; AC_DEFINE(NAS_NO_ERROR_JUMP)])
+ else
+ test "$with_nas_sound" = "yes" && \
+ XE_DIE("Required NAS sound support cannot be provided.")
+ with_nas_sound=no
+ fi
+fi
+
+dnl ESD Sound support
+if test "$with_esd_sound" != "no"; then
+ AC_CHECK_PROG(have_esd_config, esd-config, yes, no)
+ if test "$have_esd_config" = "yes"; then
+ save_c_switch_site="$c_switch_site" save_LIBS="$LIBS"
+ XE_APPEND(`esd-config --cflags`, c_switch_site)
+ XE_PREPEND(`esd-config --libs`, LIBS)
+ AC_CHECK_FUNC(esd_play_stream,
+ have_esd_sound=yes,
+ c_switch_site="$save_c_switch_site" LIBS="$save_LIBS")
+ fi
+
+ if test "$have_esd_sound" = "yes"; then
+ with_esd_sound=yes
+ need_miscplay=yes
+ XE_ADD_OBJS(esd.o)
+ AC_DEFINE(HAVE_ESD_SOUND)
+ else
+ test "$with_esd_sound" = "yes" && \
+ XE_DIE("Required ESD sound support cannot be provided.")
+ with_esd_sound=no
+ fi
+fi
+
+test "$need_miscplay" = "yes" && XE_ADD_OBJS(miscplay.o)