From 01353cb7cb6c93ef2c172eb5009622a015ac0c7d Mon Sep 17 00:00:00 2001 From: Jason Petersen Date: Thu, 12 Oct 2017 16:38:25 -0600 Subject: [PATCH] Use header define rather than -D flag Eclipse apparently doesn't scan build output looking for -D flags, so having the value actually appear in a header is nicer for those of us using IDEs. --- configure | 7 +++++-- configure.in | 4 ++-- src/backend/distributed/utils/statistics_collection.c | 2 +- src/include/citus_version.h.in | 3 +++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 817f8d37e..9d89f4bc9 100755 --- a/configure +++ b/configure @@ -3349,7 +3349,9 @@ if test "${with_libcurl+set}" = set; then : withval=$with_libcurl; case $withval in yes) - : + +$as_echo "#define HAVE_LIBCURL 1" >>confdefs.h + ;; no) : @@ -3362,6 +3364,8 @@ if test "${with_libcurl+set}" = set; then : else with_libcurl=yes +$as_echo "#define HAVE_LIBCURL 1" >>confdefs.h + fi @@ -3826,7 +3830,6 @@ Use --without-libcurl to disable libcurl support." "$LINENO" 5 fi - CITUS_CFLAGS="$CITUS_CFLAGS -DHAVE_LIBCURL" fi CITUS_CFLAGS="$CITUS_CFLAGS" diff --git a/configure.in b/configure.in index dc911c3a6..baee5bd9c 100644 --- a/configure.in +++ b/configure.in @@ -144,7 +144,8 @@ fi # libcurl # PGAC_ARG_BOOL(with, libcurl, yes, - [do not use libcurl for anonymous statistics collection]) + [do not use libcurl for anonymous statistics collection], + [AC_DEFINE([HAVE_LIBCURL], 1, [Define to 1 to build with libcurl support. (--with-libcurl)])]) if test "$with_libcurl" = yes; then AC_CHECK_LIB(curl, curl_global_init, [], @@ -156,7 +157,6 @@ Use --without-libcurl to disable anonymous statistics collection.])]) If you have libcurl already installed, see config.log for details on the failure. It is possible the compiler isn't looking in the proper directory. Use --without-libcurl to disable libcurl support.])]) - CITUS_CFLAGS="$CITUS_CFLAGS -DHAVE_LIBCURL" fi AC_SUBST(CITUS_CFLAGS, "$CITUS_CFLAGS") diff --git a/src/backend/distributed/utils/statistics_collection.c b/src/backend/distributed/utils/statistics_collection.c index 1f73771cb..47fb0b1bc 100644 --- a/src/backend/distributed/utils/statistics_collection.c +++ b/src/backend/distributed/utils/statistics_collection.c @@ -12,7 +12,7 @@ bool EnableStatisticsCollection = true; /* send basic usage statistics to Citus */ -#if HAVE_LIBCURL +#ifdef HAVE_LIBCURL #include #include diff --git a/src/include/citus_version.h.in b/src/include/citus_version.h.in index 2367b86fa..6af53f264 100644 --- a/src/include/citus_version.h.in +++ b/src/include/citus_version.h.in @@ -11,3 +11,6 @@ /* Citus version as a number */ #undef CITUS_VERSION_NUM + +/* Define to 1 if you have the `curl' library (-lcurl). */ +#undef HAVE_LIBCURL