📄 acinclude.m4
字号:
dnl - Macros for configure scriptdnl - AC_SOUND - Determine sound compilabilitydnl - Josh Green 08/08/99AC_DEFUN(AC_SOUND,[ AC_ARG_ENABLE(alsa-support, [ --disable-alsa-support Do not compile ALSA support], enable_alsa_support=no) AC_ARG_ENABLE(oss-support, [ --disable-oss-support Do not compile OSS support], enable_oss_support=no) AC_ARG_ENABLE(awe-support, [ --disable-awe-support Do not compile OSS AWE32/64 support], enable_awe_support=no) ALSA_SUPPORT=0 OSS_SUPPORT=0 AWE_SUPPORT=0 AM_PATH_ALSA(0.5.9, [ if test "x$enable_alsa_support" != "xno"; then ALSA_SUPPORT=1 AC_DEFINE(ALSA_SUPPORT, 1, [Define to enable ALSA driver]) LIBS="${LIBS} ${ALSA_LIBS}" CFLAGS="${CFLAGS} ${ALSA_CFLAGS}" COMPOPSTR="ALSA ${COMPOPSTR}" fi ]) if test "x$enable_oss_support" != "xno"; then AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/soundcard.h machine/soundcard.h) if test "${ac_cv_header_fcntl_h}" = "yes" && \ test "${ac_cv_header_sys_ioctl_h}" = "yes"; then if test "${ac_cv_header_sys_soundcard_h}" = "yes" || \ test "${ac_cv_header_machine_soundcard_h}" = "yes"; then OSS_SUPPORT=1 AC_DEFINE(OSS_SUPPORT, 1, [Define to enable OSS driver]) COMPOPSTR="OSS ${COMPOPSTR}" if test "x$enable_awe_support" != "xno"; then AC_CHECK_HEADERS(awe_voice.h sys/awe_voice.h linux/awe_voice.h) if test "${ac_cv_header_awe_voice_h}" = "yes" || \ test "${ac_cv_header_sys_awe_voice_h}" = "yes" || \ test "${ac_cv_header_linux_awe_voice_h}" = "yes"; then AWE_SUPPORT=1 AC_DEFINE(AWE_SUPPORT, 1, [Define to enable AWE32/64 driver]) COMPOPSTR="AWE ${COMPOPSTR}" else AC_MSG_WARN([ *** Could not find awe_voice.h, disabling AWE32/64 support]) fi dnl awe_voice header test fi dnl enable_awe_support != no? else AC_MSG_WARN([ *** Could not find soundcard.h, disabling OSS driver]) fi dnl soundcard.h header test else AC_MSG_WARN([ *** Could not find fcntl.h and/or ioctl.h which are required for sound and midi support]) fi dnl fcntl.h & ioctl.h header test fi dnl enable_oss_support != no?])dnl Josh Green ripped and modified from alsa-utils-0.9beta1 Feb 25 2001dnldnl Configure Paths for Alsadnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>dnl Christopher Lansdown <lansdoct@cs.alfred.edu>dnl Jaroslav Kysela <perex@suse.cz>dnl Last modification: 07/01/2001dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.dnl enables arguments --with-alsa-prefix=dnl --with-alsa-enc-prefix=dnl --disable-alsatest (this has no effect, as yet)dnlAC_DEFUN(AM_PATH_ALSA,[dnl Save the original CFLAGS, LDFLAGS, and LIBSalsa_save_CFLAGS="$CFLAGS"alsa_save_LDFLAGS="$LDFLAGS"alsa_save_LIBS="$LIBS"alsa_found=yesdnldnl Get the cflags and libraries for alsadnlAC_ARG_WITH(alsa-prefix,[ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)],[alsa_prefix="$withval"], [alsa_prefix=""])AC_ARG_WITH(alsa-inc-prefix,[ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)],[alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])dnl FIXME: this is not yet implementedAC_ARG_ENABLE(alsatest,[ --disable-alsatest Do not try to compile and run a test Alsa program],[enable_alsatest=no],[enable_alsatest=yes])dnl Add any special include directoriesAC_MSG_CHECKING(for ALSA CFLAGS)if test "$alsa_inc_prefix" != "" ; then ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" CFLAGS="$CFLAGS -I$alsa_inc_prefix"fiAC_MSG_RESULT($ALSA_CFLAGS)dnl add any special lib dirsAC_MSG_CHECKING(for ALSA LDFLAGS)if test "$alsa_prefix" != "" ; then ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" LDFLAGS="$LDFLAGS $ALSA_LIBS"fidnl add the alsa libraryALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl"LIBS="$ALSA_LIBS $LIBS"AC_MSG_RESULT($ALSA_LIBS)dnl Check for a working version of libasound that is of the right version.min_alsa_version=ifelse([$1], ,0.1.1,$1)AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)no_alsa="" alsa_min_major_version=`echo $min_alsa_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` alsa_min_minor_version=`echo $min_alsa_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` alsa_min_micro_version=`echo $min_alsa_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`AC_LANG_SAVEAC_LANG_CAC_TRY_COMPILE([#include <sys/asoundlib.h>], [void main(void){/* ensure backward compatibility */#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR#endif#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR#endif#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR#endif# if(SND_LIB_MAJOR > $alsa_min_major_version) exit(0);# else# if(SND_LIB_MAJOR < $alsa_min_major_version)# error not present# endif# if(SND_LIB_MINOR > $alsa_min_minor_version) exit(0);# else# if(SND_LIB_MINOR < $alsa_min_minor_version)# error not present# endif# if(SND_LIB_SUBMINOR < $alsa_min_micro_version)# error not present# endif# endif# endifexit(0);}], [AC_MSG_RESULT(found.)], [AC_MSG_RESULT(not present.) alsa_found=no])AC_LANG_RESTOREdnl Now that we know that we have the right version, let's see if we have the library and not just the headers.AC_CHECK_LIB([asound], [snd_seq_open],, [alsa_found=no])dnl Restore variablesCFLAGS="$alsa_save_CFLAGS"LDFLAGS="$alsa_save_LDFLAGS"LIBS="$alsa_save_LIBS"if test "x$alsa_found" = "xyes" ; then ifelse([$2], , :, [$2])fiif test "x$alsa_found" = "xno" ; then ifelse([$3], , :, [$3]) ALSA_CFLAGS="" ALSA_LIBS=""fidnl That should be it. Now just export out symbols:AC_SUBST(ALSA_CFLAGS)AC_SUBST(ALSA_LIBS)])dnl - libsndfile checkdnl - Josh Green 00-05-16 (ripped stuff from GTK check below, by Owen Taylor)dnl AC_SNDFILE_CHECK([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])dnl Test for libsndfile, and define SNDFILE_CFLAGS and SNDFILE_LIBSAC_DEFUN(AC_SNDFILE_CHECK, [ AC_ARG_WITH(sndfile-prefix, [ --with-sndfile-prefix=PFX Path where libsndfile is installed (optional)], sndfile_prefix="$withval", sndfile_prefix="") AC_ARG_ENABLE(sndfilecheck, [ --disable-sndfilecheck Do not check for libsndfile], enable_sndfilecheck=no) SNDFILE_CFLAGS="" SNDFILE_LIBS="-lsndfile" if test "x$sndfile_prefix" != "x" ; then SNDFILE_CFLAGS="-I${sndfile_prefix}/include" SNDFILE_LIBS="${SNDFILE_LIBS} -L${sndfile_prefix}/lib" fi AC_MSG_CHECKING(for libsndfile) no_sndfile="" if test "x$enable_sndfilecheck" != "xno" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$SNDFILE_CFLAGS $CFLAGS" LIBS="$SNDFILE_LIBS $LIBS" AC_TRY_RUN([#include <stdio.h>#include <sndfile.h>int main(void) { SF_INFO *sfh; /* some sanity checks SF_INFO structure should exist */ /* this is a dummy check, should never get to "sfh = NULL" */ if (!sf_open_read) sfh = NULL; exit(0);}], , no_sndfile=yes, [echo "assuming cross compile; will this work?"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_sndfile" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) SNDFILE_CFLAGS="" SNDFILE_LIBS="" ifelse([$2], , :, [$2]) fi])# Clipped from esound-0.2.13 aclocal.m4 Oct 24 1999# --------------------------------------------------------# Configure paths for AUDIOFILE# Bertrand Guiheneuf 98-10-21# stolen from esd.m4 in esound :# Manish Singh 98-9-30# stolen back from Frank Belew# stolen from Manish Singh# Shamelessly stolen from Owen Taylordnl AM_PATH_AUDIOFILE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])dnl Test for AUDIOFILE, and define AUDIOFILE_CFLAGS and AUDIOFILE_LIBSdnlAC_DEFUN(AM_PATH_AUDIOFILE, [ AC_ARG_WITH(audiofile-prefix, [ --with-audiofile-prefix=PFX Prefix where AUDIOFILE is installed (optional)], audiofile_prefix="$withval", audiofile_prefix="") AC_ARG_WITH(audiofile-exec-prefix, [ --with-audiofile-exec-prefix=PFX Exec prefix of AUDIOFILE (optional)], audiofile_exec_prefix="$withval", audiofile_exec_prefix="") AC_ARG_ENABLE(audiofiletest, [ --disable-audiofiletest Don't try to compile and run a test AUDIOFILE program], , enable_audiofiletest=yes) if test x$audiofile_exec_prefix != x ; then audiofile_args="$audiofile_args --exec-prefix=$audiofile_exec_prefix" if test x${AUDIOFILE_CONFIG+set} != xset ; then AUDIOFILE_CONFIG=$audiofile_exec_prefix/bin/audiofile-config fi fi if test x$audiofile_prefix != x ; then audiofile_args="$audiofile_args --prefix=$audiofile_prefix" if test x${AUDIOFILE_CONFIG+set} != xset ; then AUDIOFILE_CONFIG=$audiofile_prefix/bin/audiofile-config fi fi AC_PATH_PROG(AUDIOFILE_CONFIG, audiofile-config, no) min_audiofile_version=ifelse([$1], ,0.2.5,$1) AC_MSG_CHECKING(for AUDIOFILE - version >= $min_audiofile_version) no_audiofile="" if test "$AUDIOFILE_CONFIG" = "no" ; then no_audiofile=yes else AUDIOFILE_LIBS=`$AUDIOFILE_CONFIG $audiofileconf_args --libs` AUDIOFILE_CFLAGS=`$AUDIOFILE_CONFIG $audiofileconf_args --cflags` audiofile_major_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` audiofile_minor_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` audiofile_micro_version=`$AUDIOFILE_CONFIG $audiofile_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_audiofiletest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS" LIBS="$LIBS $AUDIOFILE_LIBS"dnldnl Now check if the installed AUDIOFILE is sufficiently new. (Also sanitydnl checks the results of audiofile-config to some extentdnl rm -f conf.audiofiletest AC_TRY_RUN([#include <stdio.h>#include <stdlib.h>#include <string.h>#include <audiofile.h>char*my_strdup (char *str){ char *new_str; if (str) { new_str = malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -