diff --git a/configure.ac b/configure.ac index ad5d186b..0456c273 100644 --- a/configure.ac +++ b/configure.ac @@ -42,7 +42,6 @@ AC_CHECK_HEADERS(libpq-fe.h postgresql/libpq-fe.h grp.h) PTHREAD_LIBS="-lpthread" MATH_LIBS="-lm" RT_LIBS="-lrt" -PQ_LIBS="-lpq" AC_CONFIG_SUBDIRS([src/jansson-2.6]) JANSSON_LIBS="jansson-2.6/src/.libs/libjansson.a" @@ -50,9 +49,23 @@ JANSSON_LIBS="jansson-2.6/src/.libs/libjansson.a" AC_SUBST(PTHREAD_LIBS) AC_SUBST(MATH_LIBS) AC_SUBST(RT_LIBS) -AC_SUBST(PQ_LIBS) AC_SUBST(JANSSON_LIBS) +AC_ARG_WITH([ckdb], + [AC_HELP_STRING([--without-ckdb],[Compile ckpool without postgresql database support (default enabled)])], + [ckdb=$withval] + ) + +if test "x$ckdb" != "xno"; then + AC_CHECK_LIB([pq], [main],[PQ=-lpq],echo "Error: Required library libpq-dev + not found. Install it or disable postgresql support with --without-ckdb" && exit 1) + PQ_LIBS="-lpq" +else + PQ_LIBS="" +fi +AM_CONDITIONAL([WANT_CKDB], [test "x$ckdb" != "xno"]) +AC_SUBST(PQ_LIBS) + AC_OUTPUT([Makefile] [src/Makefile]) echo diff --git a/src/Makefile.am b/src/Makefile.am index 256e0556..7375fded 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,7 +7,7 @@ lib_LTLIBRARIES = libckpool.la libckpool_la_SOURCES = libckpool.c libckpool.h sha2.c sha2.h libckpool_la_LIBADD = @PTHREAD_LIBS@ @MATH_LIBS@ @RT_LIBS@ -bin_PROGRAMS = ckpool ckpmsg ckdb +bin_PROGRAMS = ckpool ckpmsg ckpool_SOURCES = ckpool.c ckpool.h generator.c generator.h bitcoin.c bitcoin.h \ stratifier.c stratifier.h connector.c connector.h uthash.h \ utlist.h @@ -16,5 +16,8 @@ ckpool_LDADD = libckpool.la @JANSSON_LIBS@ ckpmsg_SOURCES = ckpmsg.c ckpmsg_LDADD = libckpool.la @JANSSON_LIBS@ +if WANT_CKDB +bin_PROGRAMS += ckdb ckdb_SOURCES = ckdb.c klist.c ktree.c klist.h ktree.h ckdb_LDADD = libckpool.la @JANSSON_LIBS@ @PQ_LIBS@ +endif