acinclude.m4

来自「Windows NT声卡驱动VXD」· M4 代码 · 共 709 行 · 第 1/2 页

M4
709
字号
  ac_sympat='_\([_A-Za-z][_A-Za-z0-9]*\)'  ac_symxfrm='_\1 \1'  ;;irix*)  # Cannot use undefined symbols on IRIX because inlined functions mess us up.  ac_symcode='[BCDEGRST]'  ;;solaris*)  ac_symcode='[BDTU]'  ;;esac# If we're using GNU nm, then use its standard symbol codes.if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then  ac_symcode='[ABCDGISTUW]'ficase "$host_os" incygwin32* | mingw32*)  # We do not want undefined symbols on cygwin32.  The user must  # arrange to define them via -l arguments.  ac_symcode='[ABCDGISTW]'  ;;esacchangequote([,])dnl# Write the raw and C identifiers.ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* $ac_symcode $ac_sympat$/$ac_symxfrm/p'"# Check to see that the pipe works correctly.ac_pipe_works=nocat > conftest.$ac_ext <<EOF#ifdef __cplusplusextern "C" {#endifchar nm_test_var;void nm_test_func(){}#ifdef __cplusplus}#endifint main(){nm_test_var='a';nm_test_func;return 0;}EOFif AC_TRY_EVAL(ac_compile); then  # Now try to grab the symbols.  ac_nlist=conftest.nm  if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then    # Try sorting and uniquifying the output.    if sort "$ac_nlist" | uniq > "$ac_nlist"T; then      mv -f "$ac_nlist"T "$ac_nlist"      ac_wcout=`wc "$ac_nlist" 2>/dev/null`changequote(,)dnl      ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ 	]*\([0-9][0-9]*\).*$/\1/'`changequote([,])dnl      (test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1    else      rm -f "$ac_nlist"T      ac_count=-1    fi    # Make sure that we snagged all the symbols we need.    if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then      if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then	cat <<EOF > conftest.c#ifdef __cplusplusextern "C" {#endifEOF        # Now generate the symbol file.        sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c	cat <<EOF >> conftest.c#if defined (__STDC__) && __STDC__# define __ptr_t void *#else# define __ptr_t char *#endif/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */int dld_preloaded_symbol_count = $ac_count;/* The mapping between symbol names and symbols. */struct {  char *name;  __ptr_t address;}changequote(,)dnldld_preloaded_symbols[] =changequote([,])dnl{EOF        sed 's/^\(.*\) \(.*\)$/  {"\1", (__ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c        cat <<\EOF >> conftest.c  {0, (__ptr_t) 0}};#ifdef __cplusplus}#endifEOF        # Now try linking the two files.        mv conftest.$ac_objext conftestm.$ac_objext	ac_save_LIBS="$LIBS"	ac_save_CFLAGS="$CFLAGS"        LIBS="conftestm.$ac_objext"	CFLAGS="$CFLAGS$no_builtin_flag"        if AC_TRY_EVAL(ac_link) && test -s conftest; then          ac_pipe_works=yes        else          echo "configure: failed program was:" >&AC_FD_CC          cat conftest.c >&AC_FD_CC        fi        LIBS="$ac_save_LIBS"	CFLAGS="$ac_save_CFLAGS"      else        echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC      fi    else      echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC    fi  else    echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC  fielse  echo "$progname: failed program was:" >&AC_FD_CC  cat conftest.c >&AC_FD_CCfirm -rf conftest*# Do not use the global_symbol_pipe unless it works.test "$ac_pipe_works" = yes || ac_cv_sys_global_symbol_pipe=])ac_result=yesif test -z "$ac_cv_sys_global_symbol_pipe"; then   ac_result=nofiAC_MSG_RESULT($ac_result)])# AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32,[AC_CHECK_TOOL(DLLTOOL, dlltool, false)AC_CHECK_TOOL(AS, as, false)])# AM_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols#                            with an underscore?AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE,[AC_REQUIRE([AM_PROG_NM])dnlAC_REQUIRE([AM_SYS_NM_PARSE])dnlAC_MSG_CHECKING([for _ prefix in compiled symbols])AC_CACHE_VAL(ac_cv_sys_symbol_underscore,[ac_cv_sys_symbol_underscore=nocat > conftest.$ac_ext <<EOFvoid nm_test_func(){}int main(){nm_test_func;return 0;}EOFif AC_TRY_EVAL(ac_compile); then  # Now try to grab the symbols.  ac_nlist=conftest.nm  if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then    # See whether the symbols have a leading underscore.    if egrep '^_nm_test_func' "$ac_nlist" >/dev/null; then      ac_cv_sys_symbol_underscore=yes    else      if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then        :      else        echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC      fi    fi  else    echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC  fielse  echo "configure: failed program was:" >&AC_FD_CC  cat conftest.c >&AC_FD_CCfirm -rf conftest*])AC_MSG_RESULT($ac_cv_sys_symbol_underscore)if test x$ac_cv_sys_symbol_underscore = xyes; then  AC_DEFINE(WITH_SYMBOL_UNDERSCORE,1,  [define if compiled symbols have a leading underscore])fi])# 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,[dnl dnl Get the cflags and libraries from the audiofile-config scriptdnlAC_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 where AUDIOFILE is installed (optional)],            audiofile_exec_prefix="$withval", audiofile_exec_prefix="")AC_ARG_ENABLE(audiofiletest, [  --disable-audiofiletest       Do not 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;}int main (){  int major, minor, micro;  char *tmp_version;  system ("touch conf.audiofiletest");  /* HP/UX 9 (%@#!) writes to sscanf strings */  tmp_version = my_strdup("$min_audiofile_version");  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {     printf("%s, bad version string\n", "$min_audiofile_version");     exit(1);   }   if (($audiofile_major_version > major) ||      (($audiofile_major_version == major) && ($audiofile_minor_version > minor)) ||      (($audiofile_major_version == major) && ($audiofile_minor_version == minor) && ($audiofile_micro_version >= micro)))    {      return 0;    }  else    {      printf("\n*** 'audiofile-config --version' returned %d.%d.%d, but the minimum version\n", $audiofile_major_version, $audiofile_minor_version, $audiofile_micro_version);      printf("*** of AUDIOFILE required is %d.%d.%d. If audiofile-config is correct, then it is\n", major, minor, micro);      printf("*** best to upgrade to the required version.\n");      printf("*** If audiofile-config was wrong, set the environment variable AUDIOFILE_CONFIG\n");      printf("*** to point to the correct copy of audiofile-config, and remove the file\n");      printf("*** config.cache before re-running configure\n");      return 1;    }}],, no_audiofile=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])       CFLAGS="$ac_save_CFLAGS"       LIBS="$ac_save_LIBS"     fi  fi  if test "x$no_audiofile" = x ; then     AC_MSG_RESULT(yes)     ifelse([$2], , :, [$2])       else     AC_MSG_RESULT(no)     if test "$AUDIOFILE_CONFIG" = "no" ; then       echo "*** The audiofile-config script installed by AUDIOFILE could not be found"       echo "*** If AUDIOFILE was installed in PREFIX, make sure PREFIX/bin is in"       echo "*** your path, or set the AUDIOFILE_CONFIG environment variable to the"       echo "*** full path to audiofile-config."     else       if test -f conf.audiofiletest ; then        :       else          echo "*** Could not run AUDIOFILE test program, checking why..."          CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"          LIBS="$LIBS $AUDIOFILE_LIBS"          AC_TRY_LINK([#include <stdio.h>#include <audiofile.h>],      [ return 0; ],        [ echo "*** The test program compiled, but did not run. This usually means"          echo "*** that the run-time linker is not finding AUDIOFILE or finding the wrong"          echo "*** version of AUDIOFILE. If it is not finding AUDIOFILE, you'll need to set your"          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"          echo "*** to the installed location  Also, make sure you have run ldconfig if that"          echo "*** is required on your system"	  echo "***"          echo "*** If you have an old version installed, it is best to remove it, although"          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],        [ echo "*** The test program failed to compile or link. See the file config.log for the"          echo "*** exact error that occured. This usually means AUDIOFILE was incorrectly installed"          echo "*** or that you have moved AUDIOFILE since it was installed. In the latter case, you"          echo "*** may want to edit the audiofile-config script: $AUDIOFILE_CONFIG" ])          CFLAGS="$ac_save_CFLAGS"          LIBS="$ac_save_LIBS"       fi     fi     AUDIOFILE_CFLAGS=""     AUDIOFILE_LIBS=""     ifelse([$3], , :, [$3])  fi  AC_SUBST(AUDIOFILE_CFLAGS)  AC_SUBST(AUDIOFILE_LIBS)  rm -f conf.audiofiletest])

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?