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
 
 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@
 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 \
 USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
 USE_NLS = @USE_NLS@
 VERSION = @VERSION@
-VFORMAT = @VFORMAT@
 WINDRES = @WINDRES@
 WOE32 = @WOE32@
 WOE32DLL = @WOE32DLL@
 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
 
 /* 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
 
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
-VFORMAT
+ENABLE_VFORMAT_SUPPORT_FALSE
+ENABLE_VFORMAT_SUPPORT_TRUE
 ANSI2KNR
 U
 USE_INCLUDED_INTL_H_FALSE
   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 :
 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
 
 
 
 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
 
 
 
   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
 
        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
 
 #include "xmalloc.h"
 #include <assert.h>
 
-#ifdef VFORMAT
+#ifdef HAVE_VFORMAT
 #include "vcard.h"
 #endif
 
        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")) {