From f92b7c06c2b7bf4e4f57cb2f4fb187b191332a5e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 28 Jun 2002 18:31:01 +0000 Subject: [PATCH] Added some ALSA configure checks. --- configure | 185 ++++++++++++++++++++++++++++++++ configure.ac | 10 ++ dlls/winmm/winealsa/Makefile.in | 3 +- dlls/winmm/winealsa/alsa.h | 2 + include/config.h.in | 6 ++ 5 files changed, 204 insertions(+), 2 deletions(-) diff --git a/configure b/configure index bd355b3651f..2b9eedb2ce3 100755 --- a/configure +++ b/configure @@ -9088,6 +9088,190 @@ _ACEOF fi +ALSALIBS="" + + +for ac_header in sys/asoundlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +if test "$ac_cv_header_sys_asoundlib_h" = "yes" +then + echo "$as_me:$LINENO: checking for snd_pcm_open in -lasound" >&5 +echo $ECHO_N "checking for snd_pcm_open in -lasound... $ECHO_C" >&6 +if test "${ac_cv_lib_asound_snd_pcm_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lasound $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char snd_pcm_open (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +snd_pcm_open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_asound_snd_pcm_open=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_asound_snd_pcm_open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_open" >&5 +echo "${ECHO_T}$ac_cv_lib_asound_snd_pcm_open" >&6 +if test $ac_cv_lib_asound_snd_pcm_open = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ALSA 1 +_ACEOF + + ALSALIBS="-lasound" +fi + +fi + echo "$as_me:$LINENO: checking whether mmap64 works defined as mmap" >&5 echo $ECHO_N "checking whether mmap64 works defined as mmap... $ECHO_C" >&6 @@ -13933,6 +14117,7 @@ s,@FREETYPEINCL@,$FREETYPEINCL,;t t s,@ARTSCCONFIG@,$ARTSCCONFIG,;t t s,@ARTSLIBS@,$ARTSLIBS,;t t s,@ARTSINCL@,$ARTSINCL,;t t +s,@ALSALIBS@,$ALSALIBS,;t t s,@DLLWRAP@,$DLLWRAP,;t t s,@ac_ct_DLLWRAP@,$ac_ct_DLLWRAP,;t t s,@DLLIBS@,$DLLIBS,;t t diff --git a/configure.ac b/configure.ac index ba55747610f..21a93835edd 100644 --- a/configure.ac +++ b/configure.ac @@ -551,6 +551,16 @@ then AC_DEFINE(HAVE_ARTS, 1, [Define if you have ARTS sound server]) fi +dnl **** Check for ALSA **** +AC_SUBST(ALSALIBS,"") +AC_CHECK_HEADERS(sys/asoundlib.h) +if test "$ac_cv_header_sys_asoundlib_h" = "yes" +then + AC_CHECK_LIB(asound,snd_pcm_open, + AC_DEFINE(HAVE_ALSA,1,[Define if you have ALSA including devel headers]) + ALSALIBS="-lasound") +fi + dnl **** Check for broken glibc mmap64 **** AC_CACHE_CHECK( [whether mmap64 works defined as mmap], ac_cv_mmap64_works, diff --git a/dlls/winmm/winealsa/Makefile.in b/dlls/winmm/winealsa/Makefile.in index 3aa3207bbcd..2142c063f85 100644 --- a/dlls/winmm/winealsa/Makefile.in +++ b/dlls/winmm/winealsa/Makefile.in @@ -4,12 +4,11 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = winealsa.drv IMPORTS = winmm user32 kernel32 ntdll +EXTRALIBS = @ALSALIBS@ LDDLLFLAGS = @LDDLLFLAGS@ SYMBOLFILE = $(MODULE).tmp.o -EXTRALIBS = -lasound - C_SRCS = \ audio.c \ audio_05.c \ diff --git a/dlls/winmm/winealsa/alsa.h b/dlls/winmm/winealsa/alsa.h index 6153a1db0f0..bcf68f2176e 100644 --- a/dlls/winmm/winealsa/alsa.h +++ b/dlls/winmm/winealsa/alsa.h @@ -19,7 +19,9 @@ # error You must include config.h to use this header #endif +#ifdef HAVE_SYS_ASOUNDLIB_H #include +#endif #ifdef HAVE_SYS_ERRNO_H #include #endif diff --git a/include/config.h.in b/include/config.h.in index 7bd5d05e426..a5e5627daf7 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -20,6 +20,9 @@ */ #undef HAVE_ALLOCA_H +/* Define if you have ALSA including devel headers */ +#undef HAVE_ALSA + /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H @@ -428,6 +431,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYSCALL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_ASOUNDLIB_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CDIO_H