From d89aeb10fa95ff026e548b7e9c9420d2c503369e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Droz?= Date: Wed, 12 Dec 2012 01:15:53 +0100 Subject: [PATCH] vformat: fixed a build failure when libvformat is not enabled. (what is the default) vcard.[ch] files shouldn't be included if they are unwanted. Makefile.am and configure.in have been fixed and auto'files regenerated. Reported-by: Raniere --- Makefile.am | 12 ++++++++++-- Makefile.in | 21 ++++++++++++++++----- config.h.in | 3 +++ configure | 22 +++++++++++++++++----- configure.in | 8 +++----- filter.c | 4 ++-- 6 files changed, 51 insertions(+), 19 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1097d20..912ad97 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,15 +1,23 @@ bin_PROGRAMS = abook +if ENABLE_VFORMAT_SUPPORT +vformat_SOURCE = vcard.c vcard.h +AM_LDFLAGS = -lvformat +else +vformat_SOURCE = +endif + abook_SOURCES = abook.c abook_rl.c database.c edit.c \ filter.c getname.c getopt.c getopt1.c gettext.c \ ldif.c list.c mbswidth.c misc.c options.c \ - ui.c vcard.c views.c xmalloc.c \ + ui.c views.c xmalloc.c \ \ abook.h abook_curses.h abook_rl.h database.h edit.h \ filter.h getname.h getopt.h gettext.h \ help.h list.h ldif.h mbswidth.h misc.h options.h \ - ui.h vcard.h views.h xmalloc.h + ui.h views.h xmalloc.h \ + $(vformat_SOURCE) EXTRA_DIST = config.rpath ANNOUNCE BUGS FAQ abook.1 abookrc.5 sample.abookrc \ abook.spec contrib doc/HOWTO.translating_abook RELEASE_NOTES diff --git a/Makefile.in b/Makefile.in index e8a876f..830e245 100644 --- a/Makefile.in +++ b/Makefile.in @@ -87,12 +87,20 @@ CONFIG_CLEAN_FILES = abook.spec intl/Makefile CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) +am__abook_SOURCES_DIST = abook.c abook_rl.c database.c edit.c filter.c \ + getname.c getopt.c getopt1.c gettext.c ldif.c list.c \ + mbswidth.c misc.c options.c ui.c views.c xmalloc.c abook.h \ + abook_curses.h abook_rl.h database.h edit.h filter.h getname.h \ + getopt.h gettext.h help.h list.h ldif.h mbswidth.h misc.h \ + options.h ui.h views.h xmalloc.h vcard.c vcard.h +@ENABLE_VFORMAT_SUPPORT_TRUE@am__objects_1 = vcard.$(OBJEXT) am_abook_OBJECTS = abook.$(OBJEXT) abook_rl.$(OBJEXT) \ database.$(OBJEXT) edit.$(OBJEXT) filter.$(OBJEXT) \ getname.$(OBJEXT) getopt.$(OBJEXT) getopt1.$(OBJEXT) \ gettext.$(OBJEXT) ldif.$(OBJEXT) list.$(OBJEXT) \ mbswidth.$(OBJEXT) misc.$(OBJEXT) options.$(OBJEXT) \ - ui.$(OBJEXT) vcard.$(OBJEXT) views.$(OBJEXT) xmalloc.$(OBJEXT) + ui.$(OBJEXT) views.$(OBJEXT) xmalloc.$(OBJEXT) \ + $(am__objects_1) abook_OBJECTS = $(am_abook_OBJECTS) abook_DEPENDENCIES = DEFAULT_INCLUDES = -I.@am__isrc@ @@ -104,7 +112,7 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(abook_SOURCES) -DIST_SOURCES = $(abook_SOURCES) +DIST_SOURCES = $(am__abook_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -254,7 +262,6 @@ U = @U@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ -VFORMAT = @VFORMAT@ WINDRES = @WINDRES@ WOE32 = @WOE32@ WOE32DLL = @WOE32DLL@ @@ -311,15 +318,19 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +@ENABLE_VFORMAT_SUPPORT_FALSE@vformat_SOURCE = +@ENABLE_VFORMAT_SUPPORT_TRUE@vformat_SOURCE = vcard.c vcard.h +@ENABLE_VFORMAT_SUPPORT_TRUE@AM_LDFLAGS = -lvformat abook_SOURCES = abook.c abook_rl.c database.c edit.c \ filter.c getname.c getopt.c getopt1.c gettext.c \ ldif.c list.c mbswidth.c misc.c options.c \ - ui.c vcard.c views.c xmalloc.c \ + ui.c views.c xmalloc.c \ \ abook.h abook_curses.h abook_rl.h database.h edit.h \ filter.h getname.h getopt.h gettext.h \ help.h list.h ldif.h mbswidth.h misc.h options.h \ - ui.h vcard.h views.h xmalloc.h + ui.h views.h xmalloc.h \ + $(vformat_SOURCE) EXTRA_DIST = config.rpath ANNOUNCE BUGS FAQ abook.1 abookrc.5 sample.abookrc \ abook.spec contrib doc/HOWTO.translating_abook RELEASE_NOTES diff --git a/config.h.in b/config.h.in index 6f1adf9..390c101 100644 --- a/config.h.in +++ b/config.h.in @@ -271,6 +271,9 @@ /* Define to 1 if you have the `uselocale' function. */ #undef HAVE_USELOCALE +/* Defined if the vformat library is available */ +#undef HAVE_VFORMAT + /* Define to 1 or 0, depending whether the compiler supports simple visibility declarations. */ #undef HAVE_VISIBILITY diff --git a/configure b/configure index 1556069..390c72f 100755 --- a/configure +++ b/configure @@ -606,7 +606,8 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS -VFORMAT +ENABLE_VFORMAT_SUPPORT_FALSE +ENABLE_VFORMAT_SUPPORT_TRUE ANSI2KNR U USE_INCLUDED_INTL_H_FALSE @@ -11487,7 +11488,6 @@ else vformat=false fi -VFORMAT="no" if test x$vformat = xtrue; then ac_fn_c_check_header_mongrel "$LINENO" "vf_iface.h" "ac_cv_header_vf_iface_h" "$ac_includes_default" if test "x$ac_cv_header_vf_iface_h" = xyes; then : @@ -11531,9 +11531,10 @@ $as_echo "$ac_cv_lib_vformat_vf_read_file" >&6; } if test "x$ac_cv_lib_vformat_vf_read_file" = xyes; then : MODULES="$MODULES m_vcf" - VFORMAT="yes" - LDFLAGS="-lvformat $LDFLAGS" - CFLAGS="-DVFORMAT=1 $CFLAGS" + +$as_echo "#define HAVE_VFORMAT 1" >>confdefs.h + + have_vformat=yes fi @@ -11542,6 +11543,13 @@ fi fi + if test x"$have_vformat" = "xyes"; then + ENABLE_VFORMAT_SUPPORT_TRUE= + ENABLE_VFORMAT_SUPPORT_FALSE='#' +else + ENABLE_VFORMAT_SUPPORT_TRUE='#' + ENABLE_VFORMAT_SUPPORT_FALSE= +fi @@ -11745,6 +11753,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_VFORMAT_SUPPORT_TRUE}" && test -z "${ENABLE_VFORMAT_SUPPORT_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_VFORMAT_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git a/configure.in b/configure.in index 5f2325d..7ac1006 100644 --- a/configure.in +++ b/configure.in @@ -137,18 +137,16 @@ AC_ARG_ENABLE(vformat, [ --enable-vformat Use libvformat is available no) vformat=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-vformat) ;; esac], [vformat=false]) -VFORMAT="no" if test x$vformat = xtrue; then AC_CHECK_HEADER([vf_iface.h], [ AC_CHECK_LIB([vformat], [vf_read_file], [ MODULES="$MODULES m_vcf" - VFORMAT="yes" - LDFLAGS="-lvformat $LDFLAGS" - CFLAGS="-DVFORMAT=1 $CFLAGS" + AC_DEFINE(HAVE_VFORMAT,1,[Defined if the vformat library is available]) + have_vformat=yes ]) ]) fi -AC_SUBST(VFORMAT) +AM_CONDITIONAL(ENABLE_VFORMAT_SUPPORT,test x"$have_vformat" = "xyes") dnl ------------------------- dnl end of vformat detection diff --git a/filter.c b/filter.c index fd81174..13a0234 100644 --- a/filter.c +++ b/filter.c @@ -29,7 +29,7 @@ #include "xmalloc.h" #include -#ifdef VFORMAT +#ifdef HAVE_VFORMAT #include "vcard.h" #endif @@ -297,7 +297,7 @@ import_file(char filtname[FILTNAME_LEN], char *filename) if(i < 0) return -1; -#ifdef VFORMAT +#ifdef HAVE_VFORMAT // this is a special case for // libvformat whose API expects a filename if(!strcmp(filtname, "vcard")) { -- 2.39.2