1AC_PREREQ(2.60) 2AC_INIT(mpdscribble, 0.22, mpdscribble) 3AC_CONFIG_MACRO_DIR([m4]) 4AC_CONFIG_SRCDIR([src/mpdscribble.c]) 5AC_CONFIG_AUX_DIR(build) 6AM_INIT_AUTOMAKE([foreign 1.10 dist-bzip2 subdir-objects]) 7AM_CONFIG_HEADER([config.h]) 8 9AC_PROG_CC_C99 10 11 12dnl 13dnl OS specific defaults 14dnl 15 16AC_CANONICAL_HOST 17 18case "$host_os" in 19mingw32* | windows*) 20 LIBS="$LIBS -lws2_32" 21 ;; 22esac 23 24 25dnl 26dnl libc features 27dnl 28 29AC_CHECK_FUNCS(syslog) 30if test $ac_cv_func_syslog = no; then 31 # syslog is not in the default libraries. See if it's in some other. 32 for lib in bsd socket inet; do 33 AC_CHECK_LIB($lib, syslog, 34 [AC_DEFINE(HAVE_SYSLOG) 35 LIBS="$LIBS -l$lib"; break]) 36 done 37fi 38 39 40dnl 41dnl libraries 42dnl 43 44PKG_CHECK_MODULES([LIBMPDCLIENT], [libmpdclient >= 2.2],, 45 [AC_MSG_ERROR([libmpdclient2 is required])]) 46 47PKG_CHECK_MODULES([libglib], 48 [glib-2.0 >= 2.16], 49 [glib216=yes], [glib216=no]) 50if test "x$glib216" != "xyes"; then 51 PKG_CHECK_MODULES([libglib], 52 [glib-2.0 >= 2.6],, 53 [AC_MSG_ERROR([glib 2.6 is required])]) 54 55 # use libgcrypt's MD5 routines with GLib < 2.16 56 AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, 57 [AC_MSG_ERROR([libgcrypt-config required])]) 58fi 59 60dnl 61dnl HTTP client library 62dnl 63 64AC_ARG_WITH(http-client, 65 AS_HELP_STRING([--with-http-client=@<:@auto|soup|curl@:>@], 66 [choose the HTTP client library (default=auto)]),, 67 with_http_client=auto) 68 69if test x$with_http_client = xcurl || test x$with_http_client = xauto; then 70 PKG_CHECK_MODULES([libcurl], [libcurl], found_curl=yes, found_curl=no) 71 if test x$found_curl = xyes; then 72 with_http_client=curl 73 elif test x$with_http_client = xcurl; then 74 AC_MSG_ERROR([libcurl not found]) 75 fi 76elif test x$with_http_client != xsoup; then 77 AC_MSG_ERROR([unknown HTTP client specified]) 78fi 79 80AM_CONDITIONAL(HAVE_CURL, test x$with_http_client = xcurl) 81 82if test x$with_http_client = xsoup || test x$with_http_client = xauto; then 83 PKG_CHECK_MODULES([libsoup], [libsoup-2.4], 84 found_soup_24=yes, found_soup_24=no) 85 if test x$found_soup_24 = xyes; then 86 with_http_client=soup 87 AC_DEFINE([HAVE_SOUP_24], [1], [Defined if libsoup-2.4 instead of libsoup-2.2 is used]) 88 else 89 PKG_CHECK_MODULES([libsoup], [libsoup-2.2], 90 found_soup_22=yes, found_soup_22=no) 91 if test x$found_soup_22 = xyes; then 92 with_http_client=soup 93 elif test x$with_http_client = xsoup; then 94 AC_MSG_ERROR([libsoup (2.4 or 2.2) not found]) 95 fi 96 fi 97fi 98 99if test x$with_http_client = xsoup; then 100 PKG_CHECK_MODULES([libgthread], [gthread-2.0],, 101 [AC_MSG_ERROR(gthread-2.0 not found)]) 102fi 103 104AM_CONDITIONAL(HAVE_SOUP, test x$with_http_client = xsoup) 105 106if test x$with_http_client = xauto; then 107 AC_MSG_ERROR([No HTTP client library was found]) 108fi 109 110 111dnl 112dnl build options 113dnl 114 115AC_ARG_ENABLE(werror, 116 AS_HELP_STRING([--enable-werror], 117 [treat warnings as errors (default: disabled)]),, 118 enable_werror=no) 119 120if test "x$enable_werror" = xyes; then 121 AM_CFLAGS="$AM_CFLAGS -Werror -pedantic-errors" 122fi 123 124AC_ARG_ENABLE(debug, 125 AS_HELP_STRING([--enable-debug], 126 [enable debugging (default: disabled)]),, 127 enable_debug=no) 128 129if test "x$enable_debug" = xno; then 130 AM_CFLAGS="$AM_CFLAGS -DNDEBUG" 131fi 132 133AC_ARG_ENABLE(test, 134 AS_HELP_STRING([--enable-test], 135 [build the test programs (default: disabled)]),, 136 enable_test=no) 137AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes) 138 139 140dnl 141dnl CFLAGS 142dnl 143 144AC_SUBST(AM_CFLAGS) 145 146CHECK_CFLAG([-Wall]) 147CHECK_CFLAG([-Wextra]) 148CHECK_CFLAG([-Wno-deprecated-declarations]) 149CHECK_CFLAG([-Wmissing-prototypes]) 150CHECK_CFLAG([-Wshadow]) 151CHECK_CFLAG([-Wpointer-arith]) 152CHECK_CFLAG([-Wstrict-prototypes]) 153CHECK_CFLAG([-Wcast-qual]) 154CHECK_CFLAG([-Wwrite-strings]) 155 156 157dnl 158dnl Generate output files 159dnl 160 161AC_OUTPUT(Makefile) 162