configure.ac
上传用户:wstnjxml
上传日期:2014-04-03
资源大小:7248k
文件大小:4k
源码类别:

Windows CE

开发平台:

C/C++

  1. # Run "autoconf" to generate "configure" from this file.
  2. # Run "autoheader" to generate "config.h.in" from this file.
  3. AC_PREREQ(2.56)
  4. AC_INIT(asap, 0.2.1, fox@scene.pl)
  5. AC_CONFIG_SRCDIR(asap.c)
  6. AC_CONFIG_HEADER(config.h)
  7. AC_CANONICAL_HOST
  8. if [[ "X_$CFLAGS" = "X_" ]]; then
  9.     CFLAGS="-O2 -Wall"
  10. fi
  11. if [[ "X_$LDFLAGS" = "X_" ]]; then
  12.     LDFLAGS="-s"
  13. fi
  14. AC_PROG_CC
  15. AC_C_BIGENDIAN
  16. AC_C_CONST
  17. AC_CHECK_LIB(m,cos,[LIBS="-lm $LIBS"])
  18. AC_ARG_ENABLE(unalignedwords,AC_HELP_STRING(--enable-unalignedwords,[Override usage of unaligned words]))
  19. if [[ "$enable_unalignedwords" != "yes" -a "$enable_unalignedwords" != "no" ]]; then
  20.     case $host_cpu in
  21.         alpha* | arm* | hppa* | ia64 | mips* | sparc*)
  22.             enable_unalignedwords=no
  23.             ;;
  24.         i*86 | m68* | powerpc* | x86_64)
  25.             enable_unalignedwords=yes
  26.             ;;
  27.         *)
  28.             AC_MSG_WARN([$host_cpu architecture is unknown to this script.])
  29.             AC_MSG_WARN([Performance may be sub-optimal.])
  30.             AC_MSG_WARN([Please contact ASAP developers.])
  31.             enable_unalignedwords=no
  32.             ;;
  33.     esac
  34. fi
  35. if [[ "$enable_unalignedwords" = "yes" ]]; then
  36.     dnl Make sure it is allowed
  37.     AC_MSG_CHECKING([for unaligned word access validity])
  38.     AC_RUN_IFELSE(
  39.         [AC_LANG_PROGRAM([[#include <stdio.h>]],[[
  40.             unsigned char test_data[] = "Hello, I test unaligned word access validity.";
  41.             unsigned char *p;
  42.             /* step through test_data as far as 4 bytes are available via p */
  43.             for (p = test_data; p[2] != ''; p++) {
  44.                 unsigned int word_read = *(unsigned short *) p;
  45.                 if (word_read != (p[0] + (p[1] << 8))
  46.                  && word_read != (p[1] + (p[0] << 8))) {
  47.                     printf("16-bit access at address %p yields bad data!n"
  48.                            "Bytes: %02X %02X; Value read: %04Xn",
  49.                            p, p[0], p[1], word_read);
  50.                     return 1;
  51.                 }
  52.                 word_read = *(unsigned int *) p;
  53.                 if (word_read != (p[0] + (p[1] << 8) + (p[2] << 16) + (p[3] << 24))
  54.                  && word_read != (p[3] + (p[2] << 8) + (p[1] << 16) + (p[0] << 24))) {
  55.                     printf("32-bit access at address %p yields bad data!n"
  56.                            "Bytes: %02X %02X %02X %02X; Value read: %08Xn",
  57.                            p, p[0], p[1], p[2], p[3], word_read);
  58.                     return 1;
  59.                 }
  60.             }
  61.         ]])],
  62.         AC_MSG_RESULT([yes]),
  63.         [enable_unalignedwords=no; AC_MSG_RESULT([failed! disabling unaligned word access])],
  64.         AC_MSG_RESULT([skipped because cross-compiling])
  65.     )
  66.     if [[ "$enable_unalignedwords" = "yes" ]]; then
  67.         AC_DEFINE(WORDS_UNALIGNED_OK,1,[Define if unaligned word access is ok.])
  68.     fi
  69. fi
  70. dnl The A8_OPTION macro automates the calling of AC_ARG_ENABLE, AC_HELP_STRING and AC_DEFINE.
  71. dnl         $1    = the name of the feature, what follows "--enable-".
  72. dnl         $2    = "yes" or "no", determines if feature defaults to being active or not.
  73. dnl         $3    = The right side of the help line.
  74. dnl                 The left side is always "--enable-$1".
  75. dnl         $4    = The symbol name which goes to config.h, the C #define symbol.
  76. dnl                 A symbol called "WANT_$4" is defined for use in this configure.ac.
  77. dnl         $5    = The help string which shows up in config.h for the $4 symbol.
  78. AC_DEFUN([A8_OPTION],[
  79.     AC_ARG_ENABLE($1,AC_HELP_STRING(--enable-$1,$3),WANT_$4=$enableval,WANT_$4=$2)
  80.     if [[ "$WANT_$4" = "yes" ]]; then
  81.         AC_DEFINE($4,1,$5)
  82.     fi
  83. ])
  84. A8_OPTION(stereo,yes,[Support stereo tunes (default=ON)],STEREO_SOUND,[Define to support stereo tunes.])
  85. AC_CHECK_PROG(HAVE_XMMS_CONFIG, xmms-config, yes, no)
  86. if [[ "$HAVE_XMMS_CONFIG" = "yes" ]]; then
  87.     XMMS_CFLAGS=`xmms-config --cflags`
  88.     XMMS_LIBS=`xmms-config --libs`
  89.     XMMS_INPUT_PLUGIN_DIR=`xmms-config --input-plugin-dir`
  90. else
  91.     AC_MSG_WARN([xmms-config program not found!])
  92.     AC_MSG_WARN([If you want to compile the XMMS plugin,])
  93.     AC_MSG_WARN([install xmms-devel package,])
  94.     AC_MSG_WARN([then re-run this configure script.])
  95.     XMMS_CFLAGS="NOT_CONFIGURED"
  96.     XMMS_LIBS="NOT_CONFIGURED"
  97.     XMMS_INPUT_PLUGIN_DIR="NOT_CONFIGURED"
  98. fi
  99. AC_SUBST(XMMS_CFLAGS)
  100. AC_SUBST(XMMS_LIBS)
  101. AC_SUBST(XMMS_INPUT_PLUGIN_DIR)
  102. AC_CONFIG_FILES(Makefile)
  103. AC_OUTPUT