# HG changeset patch # User J. Ali Harlow # Date 1231250760 0 # Node ID 53e1185e2366fa44ed4c9103269ef3b529fdadf7 # Parent ed8155380e45de4945a2d6b9892fa3181e375a7c Make rpmlib an optional dependency Use configure --without-rpm to avoid the dependency (default is unchanged). diff -r ed8155380e45 -r 53e1185e2366 configure.ac --- a/configure.ac Mon Jan 05 17:39:05 2009 +0000 +++ b/configure.ac Tue Jan 06 14:06:00 2009 +0000 @@ -154,19 +154,21 @@ [AC_MSG_ERROR([Can't find expat library. Please install expat.])]) AC_SUBST(EXPAT_LIBS) -RPM_LIB="" -AC_ARG_WITH(rpm, [ --with-rpm= 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= 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" diff -r ed8155380e45 -r 53e1185e2366 src/Makefile.am --- a/src/Makefile.am Mon Jan 05 17:39:05 2009 +0000 +++ b/src/Makefile.am Tue Jan 06 14:06:00 2009 +0000 @@ -17,7 +17,10 @@ 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 diff -r ed8155380e45 -r 53e1185e2366 src/main.c --- a/src/main.c Mon Jan 05 17:39:05 2009 +0000 +++ b/src/main.c Tue Jan 06 14:06:00 2009 +0000 @@ -431,6 +431,7 @@ return 0; } +#if HAVE_RPMLIB static int command_import_rpmdb(int argc, const char *argv[]) { @@ -449,6 +450,7 @@ return razor_root_commit(root); } +#endif static int mark_packages_for_update(struct razor_transaction *trans, @@ -1001,7 +1003,9 @@ { "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 },