>From b5f66b866b3365f62236668638c093be426c89a3 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 6 Nov 2018 08:46:27 +0000 Subject: [PATCH] build: add a simple test for iconv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's used by one plugin. There is a proper iconv.m4 available but it makes autoconf fail if we don't bring in more of gettext, which wants to add 50 files around. Original Author: François Revol RWMJ: I modified this to make the iconv dependency optional. If unavailable, the floppy plugin is disabled. --- README | 5 +++++ configure.ac | 24 ++++++++++++++++++++++++ plugins/floppy/Makefile.am | 7 ++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/README b/README index e0c95cd..0b266f2 100644 --- a/README +++ b/README @@ -77,6 +77,11 @@ For the iso plugin: - genisoimage or mkisofs +For the floppy plugin: + + - iconv (on Linux this is built into glibc, on other systems + it may be a separate library) + For the libvirt plugin: - libvirt diff --git a/configure.ac b/configure.ac index a64ae31..11a3fd2 100644 --- a/configure.ac +++ b/configure.ac @@ -144,6 +144,7 @@ AC_CHECK_HEADERS([\ alloca.h \ byteswap.h \ endian.h \ + iconv.h \ selinux/selinux.h \ sys/endian.h \ sys/prctl.h \ @@ -164,6 +165,29 @@ AC_SEARCH_LIBS([dlopen], [dl dld], [ ]) LIBS="$old_LIBS" +old_LIBS="$LIBS" +AC_SEARCH_LIBS([iconv], [iconv], [ + AS_IF([test "x$ac_cv_search_iconv" != "xnone required"], + [ICONV_LIBS="$ac_cv_search_iconv" + have_iconv=yes + ], + [ICONV_LIBS= + have_iconv=yes]) + ], [ + AC_SEARCH_LIBS([libiconv], [iconv], [ + AS_IF([test "x$ac_cv_search_libiconv" != "xnone required"], + [ICONV_LIBS="$ac_cv_search_libiconv" + have_iconv=yes + ], + [ICONV_LIBS= + have_iconv=yes]) + ], [AC_MSG_WARN([unable to find a library containing iconv]) + ]) +]) +AC_SUBST([ICONV_LIBS]) +AM_CONDITIONAL([HAVE_ICONV],[test "x$have_iconv" = "xyes"]) +LIBS="$old_LIBS" + dnl Check if -rdynamic linker flag works. acx_nbdkit_save_LDFLAGS="${LDFLAGS}" LDFLAGS="${LDFLAGS} -rdynamic" diff --git a/plugins/floppy/Makefile.am b/plugins/floppy/Makefile.am index b6c2435..9723478 100644 --- a/plugins/floppy/Makefile.am +++ b/plugins/floppy/Makefile.am @@ -34,6 +34,8 @@ include $(top_srcdir)/common-rules.mk EXTRA_DIST = nbdkit-floppy-plugin.pod +if HAVE_ICONV + plugin_LTLIBRARIES = nbdkit-floppy-plugin.la nbdkit_floppy_plugin_la_SOURCES = \ @@ -51,7 +53,8 @@ nbdkit_floppy_plugin_la_CPPFLAGS = \ nbdkit_floppy_plugin_la_CFLAGS = \ $(WARNINGS_CFLAGS) nbdkit_floppy_plugin_la_LDFLAGS = \ - -module -avoid-version -shared + -module -avoid-version -shared \ + $(ICONV_LIBS) nbdkit_floppy_plugin_la_LIBADD = \ $(top_builddir)/common/regions/libregions.la @@ -66,3 +69,5 @@ nbdkit-floppy-plugin.1: nbdkit-floppy-plugin.pod $< endif HAVE_POD + +endif -- 2.19.0.rc0