diff --git a/Makefile.am b/Makefile.am index 41ec9345..68c30150 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,4 @@ +ACLOCAL_AMFLAGS = -I m4 sysconf_DATA = forked-daapd.conf diff --git a/configure.in b/configure.in index d4810e82..706cebd6 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(config.h.in) +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE(forked-daapd, 0.11) @@ -96,6 +97,12 @@ AC_ARG_WITH(oss4, AC_HELP_STRING([--with-oss4=includedir], [Use OSS4 with soundc esac ]) dnl Checks for libraries. +gl_LIBUNISTRING + +if test x$HAVE_LIBUNISTRING != xyes; then + AC_MSG_ERROR([GNU libunistring is required]) +fi + PKG_CHECK_MODULES(ZLIB, [ zlib ]) PKG_CHECK_MODULES(CONFUSE, [ libconfuse ]) PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6.24 ]) diff --git a/m4/.gitignore b/m4/.gitignore new file mode 100644 index 00000000..8f0005bc --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1,3 @@ +libtool.m4 +lt*.m4 + diff --git a/m4/libunistring.m4 b/m4/libunistring.m4 new file mode 100644 index 00000000..ac9d11ac --- /dev/null +++ b/m4/libunistring.m4 @@ -0,0 +1,41 @@ +# libunistring.m4 serial 4 +dnl Copyright (C) 2009-2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl gl_LIBUNISTRING +dnl Searches for an installed libunistring. +dnl If found, it sets and AC_SUBSTs HAVE_LIBUNISTRING=yes and the LIBUNISTRING +dnl and LTLIBUNISTRING variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIBUNISTRING to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIBUNISTRING=no and LIBUNISTRING and LTLIBUNISTRING to empty. + +AC_DEFUN([gl_LIBUNISTRING], +[ + dnl First, try to link without -liconv. libunistring often depends on + dnl libiconv, but we don't know (and often don't need to know) where + dnl libiconv is installed. + AC_LIB_HAVE_LINKFLAGS([unistring], [], + [#include ], [u8_strconv_from_locale((char*)0);], + [no, consider installing GNU libunistring]) + if test "$ac_cv_libunistring" != yes; then + dnl Second try, with -liconv. + AC_REQUIRE([AM_ICONV]) + if test -n "$LIBICONV"; then + dnl We have to erase the cached result of the first AC_LIB_HAVE_LINKFLAGS + dnl invocation, otherwise the second one will not be run. + unset ac_cv_libunistring + glus_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_LIB_HAVE_LINKFLAGS([unistring], [], + [#include ], [u8_strconv_from_locale((char*)0);], + [no, consider installing GNU libunistring]) + if test -n "$LIBUNISTRING"; then + LIBUNISTRING="$LIBUNISTRING $LIBICONV" + LTLIBUNISTRING="$LTLIBUNISTRING $LTLIBICONV" + fi + LIBS="$glus_save_LIBS" + fi + fi +]) diff --git a/src/Makefile.am b/src/Makefile.am index d8737483..23b316ee 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,7 +36,7 @@ ANTLR_PRODUCTS = forked_daapd_CPPFLAGS = -D_GNU_SOURCE @ZLIB_CFLAGS@ @AVAHI_CFLAGS@ @SQLITE3_CFLAGS@ @FFMPEG_CFLAGS@ @CONFUSE_CFLAGS@ @TAGLIB_CFLAGS@ @MINIXML_CFLAGS@ @LIBPLIST_CFLAGS@ @LIBGCRYPT_CFLAGS@ @ALSA_CFLAGS@ @OSS4CPPFLAGS@ \ -DDATADIR="\"$(pkgdatadir)\"" -DCONFDIR="\"$(sysconfdir)\"" -DSTATEDIR="\"$(localstatedir)\"" -forked_daapd_LDADD = @ZLIB_LIBS@ @AVAHI_LIBS@ @SQLITE3_LIBS@ @FFMPEG_LIBS@ @CONFUSE_LIBS@ @FLAC_LIBS@ @TAGLIB_LIBS@ @LIBEVENT_LIBS@ @LIBAVL_LIBS@ @MINIXML_LIBS@ @ANTLR3C_LIBS@ @LIBPLIST_LIBS@ @LIBGCRYPT_LIBS@ @ALSA_LIBS@ +forked_daapd_LDADD = @ZLIB_LIBS@ @AVAHI_LIBS@ @SQLITE3_LIBS@ @FFMPEG_LIBS@ @CONFUSE_LIBS@ @FLAC_LIBS@ @TAGLIB_LIBS@ @LIBEVENT_LIBS@ @LIBAVL_LIBS@ @MINIXML_LIBS@ @ANTLR3C_LIBS@ @LIBPLIST_LIBS@ @LIBGCRYPT_LIBS@ @ALSA_LIBS@ @LIBUNISTRING@ forked_daapd_SOURCES = main.c \ db.c db.h \ logger.c logger.h \