Skip to content

Commit

Permalink
Check for GNU libunistring and use it
Browse files Browse the repository at this point in the history
  • Loading branch information
jblache committed Jun 21, 2010
1 parent 7d858d6 commit b7aac26
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile.am
@@ -1,3 +1,4 @@
ACLOCAL_AMFLAGS = -I m4

sysconf_DATA = forked-daapd.conf

Expand Down
7 changes: 7 additions & 0 deletions 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)

Expand Down Expand Up @@ -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 ])
Expand Down
3 changes: 3 additions & 0 deletions m4/.gitignore
@@ -0,0 +1,3 @@
libtool.m4
lt*.m4

41 changes: 41 additions & 0 deletions 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 <uniconv.h>], [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 <uniconv.h>], [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
])
2 changes: 1 addition & 1 deletion src/Makefile.am
Expand Up @@ -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 \
Expand Down

0 comments on commit b7aac26

Please sign in to comment.