[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
AC_SUBST(EXPAT_LIBS)
-RPM_LIB=""
-AC_ARG_WITH(rpm, [ --with-rpm=<dir> Use rpm from here],
- [
- rpm=$withval
- CPPFLAGS="$CPPFLAGS -I$withval/include"
- LDFLAGS="$LDFLAGS -L$withval/lib"
- ]
- )
-AC_CHECK_HEADERS(rpm/rpmlib.h, [],
- [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel.])])
-AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-lrpm"],
- [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel.])])
+RPM_LIBS=""
+AC_ARG_WITH(rpm, [ --with-rpm=<dir> Use rpm from here])
+
+AS_IF([test "$with_rpm" != no],
+ [if test "$with_rpm" != yes; then
+ CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
+ LDFLAGS="$LDFLAGS -L$with_rpm/lib"
+ fi
+ AC_CHECK_HEADERS(rpm/rpmlib.h, [],
+ [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
+ AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-lrpm"],
+ [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
+ AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
AC_SUBST(RPM_LIBS)
+AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
if test "x$GCC" = "xyes"; then
LDFLAGS="-Wl,--as-needed $LDFLAGS"
noinst_PROGRAMS = rpm
check_PROGRAMS = test-driver
-razor_SOURCES = main.c import-rpmdb.c import-yum.c
+razor_SOURCES = main.c import-yum.c
+if HAVE_RPMLIB
+razor_SOURCES += import-rpmdb.c
+endif
razor_LDADD = $(RPM_LIBS) $(EXPAT_LIBS) $(CURL_LIBS) $(top_builddir)/librazor/librazor.la
rpm_SOURCES = rpm.c
return 0;
}
+#if HAVE_RPMLIB
static int
command_import_rpmdb(int argc, const char *argv[])
{
return razor_root_commit(root);
}
+#endif
static int
mark_packages_for_update(struct razor_transaction *trans,
{ "what-requires", "list the packages that have the given requires", command_what_requires },
{ "what-provides", "list the packages that have the given provides", command_what_provides },
{ "import-yum", "import yum metadata files", command_import_yum },
+#if HAVE_RPMLIB
{ "import-rpmdb", "import the system rpm database", command_import_rpmdb },
+#endif
{ "import-rpms", "import rpms from the given directory", command_import_rpms },
{ "update", "update all or specified packages", command_update },
{ "remove", "remove specified packages", command_remove },