You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

177 lines
3.5 KiB

  1. AC_PREREQ(2.60)
  2. AC_INIT(mpc, 0.30, musicpd-dev-team@lists.sourceforge.net)
  3. AC_CONFIG_MACRO_DIR([m4])
  4. AC_CONFIG_SRCDIR(src/main.c)
  5. AM_INIT_AUTOMAKE([foreign 1.11 dist-xz subdir-objects])
  6. AM_SILENT_RULES
  7. AC_CONFIG_HEADERS(config.h)
  8. dnl
  9. dnl programs
  10. dnl
  11. AC_PROG_CC_C99
  12. AC_PROG_INSTALL
  13. AC_PROG_MAKE_SET
  14. PKG_PROG_PKG_CONFIG
  15. dnl
  16. dnl declare variables
  17. dnl
  18. AC_SUBST(AM_CFLAGS)
  19. AC_SUBST(AM_CPPFLAGS)
  20. dnl
  21. dnl OS specific defaults
  22. dnl
  23. case "$host" in
  24. *-mingw32* | *-windows* | *-cygwin*)
  25. AM_CFLAGS="$AM_CFLAGS -mms-bitfields -fno-strict-aliasing"
  26. ;;
  27. esac
  28. if test -z "$prefix" || test "x$prefix" = xNONE; then
  29. local_lib=
  30. local_include=
  31. # aren't autotools supposed to be smart enough to figure this out?
  32. # oh well, the git-core Makefile managed to do some of the work for us :)
  33. case "`uname -s | tr A-Z a-z`" in
  34. darwin*)
  35. local_lib='/sw/lib /opt/local/lib'
  36. local_include='/sw/include /opt/local/include'
  37. ;;
  38. freebsd* | openbsd*)
  39. local_lib=/usr/local/lib
  40. local_include=/usr/local/include
  41. ;;
  42. netbsd*)
  43. local_lib=/usr/pkg/lib
  44. local_include=/usr/pkg/include
  45. LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/pkg/lib"
  46. ;;
  47. esac
  48. for d in $local_lib; do
  49. if test -d "$d"; then
  50. LDFLAGS="$LDFLAGS -L$d"
  51. break
  52. fi
  53. done
  54. for d in $local_include; do
  55. if test -d "$d"; then
  56. CFLAGS="$CFLAGS -I$d"
  57. break
  58. fi
  59. done
  60. fi
  61. dnl
  62. dnl libc features
  63. dnl
  64. PKG_CHECK_MODULES([LIBMPDCLIENT], [libmpdclient >= 2.9],,
  65. [AC_MSG_ERROR([libmpdclient 2.9 is required])])
  66. dnl
  67. dnl i18n / l10n (iconv)
  68. dnl
  69. AC_ARG_ENABLE(iconv,
  70. AS_HELP_STRING([--disable-iconv],
  71. [disable iconv support (default: enable)]),,
  72. [enable_iconv=yes])
  73. if test x$enable_iconv = xyes; then
  74. AC_CHECK_FUNC(iconv,
  75. [ICONV_CFLAGS="" ICONV_LIBS=""],
  76. [AC_CHECK_LIB(intl, iconv,
  77. [ICONV_CFLAGS="" ICONV_LIBS="-lintl"],
  78. [enable_iconv=no])])
  79. fi
  80. if test x$enable_iconv = xyes; then
  81. AC_CHECK_HEADER([locale.h],, [enable_iconv=no])
  82. if test x$enable_iconv != xyes; then
  83. AC_MSG_WARN(locale.h not available - disabling iconv)
  84. fi
  85. fi
  86. if test x$enable_iconv = xyes; then
  87. AC_DEFINE(HAVE_ICONV, 1, [Define if iconv() support is enabled])
  88. else
  89. ICONV_CPPFLAGS=""
  90. ICONV_LIBS=""
  91. fi
  92. AC_SUBST(ICONV_CPPFLAGS)
  93. AC_SUBST(ICONV_LIBS)
  94. AM_CONDITIONAL(HAVE_ICONV, test x$enable_iconv = xyes)
  95. dnl
  96. dnl CFLAGS
  97. dnl
  98. AX_APPEND_COMPILE_FLAGS([-Wall])
  99. AX_APPEND_COMPILE_FLAGS([-Wextra])
  100. AX_APPEND_COMPILE_FLAGS([-Wno-deprecated-declarations])
  101. AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes])
  102. AX_APPEND_COMPILE_FLAGS([-Wshadow])
  103. AX_APPEND_COMPILE_FLAGS([-Wpointer-arith])
  104. AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes])
  105. AX_APPEND_COMPILE_FLAGS([-Wcast-qual])
  106. AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
  107. dnl
  108. dnl build options
  109. dnl
  110. AC_ARG_ENABLE(werror,
  111. AS_HELP_STRING([--enable-werror],
  112. [Treat warnings as errors @<:@default=disabled@:>@]),,
  113. enable_werror=no)
  114. if test "x$enable_werror" = xyes; then
  115. AM_CFLAGS="$AM_CFLAGS -Werror -pedantic-errors"
  116. fi
  117. AC_ARG_ENABLE(debug,
  118. AS_HELP_STRING([--enable-debug],
  119. [Enable debugging @<:@default=disabled@:>@]),,
  120. enable_debug=no)
  121. if test "x$enable_debug" = xno; then
  122. AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG"
  123. AX_APPEND_COMPILE_FLAGS([-ffunction-sections])
  124. AX_APPEND_COMPILE_FLAGS([-fdata-sections])
  125. AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden])
  126. AX_APPEND_LINK_FLAGS([-Wl,--gc-sections])
  127. fi
  128. AC_ARG_ENABLE(test,
  129. AS_HELP_STRING([--enable-test],
  130. [build the test programs (default: disabled)]),,
  131. enable_test=no)
  132. if test "x$enable_test" = xyes; then
  133. AM_PATH_CHECK(,, [AC_MSG_ERROR([check not found])])
  134. fi
  135. AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
  136. dnl
  137. AC_OUTPUT(Makefile)